Update libbase64.
This commit is contained in:
parent
a337852d27
commit
7a5d038f5c
|
@ -1,5 +1,6 @@
|
||||||
VERSION := 1.0.0
|
VERSION := 1.0.0
|
||||||
TARGET := libbase64.a
|
TARGET := libbase64.a
|
||||||
|
MANPAGE := libbase64.3
|
||||||
OBJS := base64.o
|
OBJS := base64.o
|
||||||
HEADERS := kst
|
HEADERS := kst
|
||||||
LIBS :=
|
LIBS :=
|
||||||
|
@ -12,7 +13,8 @@ CFLAGS += -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align
|
||||||
CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
|
CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
|
||||||
CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable -g
|
CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable -g
|
||||||
CFLAGS += -Wstrict-prototypes -Werror -std=c99 -I. -I/usr/local/include
|
CFLAGS += -Wstrict-prototypes -Werror -std=c99 -I. -I/usr/local/include
|
||||||
CFLAGS += OS_CFLAGS
|
CFLAGS += OS_CFLAGS -DPACKAGE_VERSION="\"$(VERSION)\""
|
||||||
|
|
||||||
|
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
|
@ -25,13 +27,13 @@ $(TARGET): $(OBJS)
|
||||||
$(AR) -rcs $@ $(OBJS)
|
$(AR) -rcs $@ $(OBJS)
|
||||||
|
|
||||||
install: $(TARGET)
|
install: $(TARGET)
|
||||||
install -m 0755 $(TARGET) $(PREFIX)/lib/$(TARGET)
|
install -D -m 0755 $(TARGET) $(PREFIX)/lib/$(TARGET)
|
||||||
install -m 0755 -d $(MANDIR)/man1
|
install -m 0755 -d $(MANDIR)/man3
|
||||||
install -m 0444 $(TARGET).3 $(MANDIR)/man3/$(TARGET).3
|
install -m 0444 $(MANPAGE) $(MANDIR)/man3/$(MANPAGE)
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(PREFIX)/lib/$(TARGET)
|
-rm -f $(PREFIX)/lib/$(TARGET)
|
||||||
-rm -f $(MANDIR)/man3/$(TARGET).3
|
-rm -f $(MANDIR)/man3/$(MANPAGE)
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
-mkdir $(TARGET)-$(VERSION)
|
-mkdir $(TARGET)-$(VERSION)
|
||||||
|
@ -43,7 +45,7 @@ distclean: clean
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
|
|
||||||
htmldoc:
|
htmldoc:
|
||||||
-mandoc -Thtml $(TARGET).1 > $(TARGET).1.html
|
-mandoc -Thtml $(MANPAGE) > $(MANPAGE).html
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
ctags *.[ch]
|
ctags *.[ch]
|
||||||
|
|
|
@ -126,7 +126,7 @@ base64_encode(const uint8_t *src, size_t srclength, char *target,
|
||||||
size_t datalength = 0;
|
size_t datalength = 0;
|
||||||
unsigned char input[3];
|
unsigned char input[3];
|
||||||
unsigned char output[4];
|
unsigned char output[4];
|
||||||
int i;
|
unsigned long i;
|
||||||
|
|
||||||
while (2 < srclength) {
|
while (2 < srclength) {
|
||||||
input[0] = *src++;
|
input[0] = *src++;
|
||||||
|
@ -187,7 +187,8 @@ base64_encode(const uint8_t *src, size_t srclength, char *target,
|
||||||
int
|
int
|
||||||
base64_decode(const char *src, uint8_t *target, size_t targsize)
|
base64_decode(const char *src, uint8_t *target, size_t targsize)
|
||||||
{
|
{
|
||||||
int tarindex, state, ch;
|
unsigned long tarindex;
|
||||||
|
int state, ch;
|
||||||
char *pos;
|
char *pos;
|
||||||
|
|
||||||
state = 0;
|
state = 0;
|
||||||
|
@ -336,8 +337,7 @@ base64_declen(size_t orig_len)
|
||||||
* Return the package version.
|
* Return the package version.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
base64_lib_version()
|
base64_lib_version(void)
|
||||||
{
|
{
|
||||||
return libversion;
|
return libversion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ void test_base64_enclen(void);
|
||||||
void test_base64_declen(void);
|
void test_base64_declen(void);
|
||||||
void test_base64_encode(void);
|
void test_base64_encode(void);
|
||||||
void test_base64_decode(void);
|
void test_base64_decode(void);
|
||||||
|
void fireball(void);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -40,12 +41,14 @@ void test_base64_decode(void);
|
||||||
* required in this code. init_test is called each time a test is run,
|
* required in this code. init_test is called each time a test is run,
|
||||||
* and cleanup is run after every test.
|
* and cleanup is run after every test.
|
||||||
*/
|
*/
|
||||||
int init_test(void)
|
static int
|
||||||
|
init_test(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cleanup_test(void)
|
static int
|
||||||
|
cleanup_test(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +119,7 @@ void
|
||||||
test_base64_lib_version()
|
test_base64_lib_version()
|
||||||
{
|
{
|
||||||
char *version = NULL;
|
char *version = NULL;
|
||||||
|
|
||||||
version = (char *)base64_lib_version();
|
version = (char *)base64_lib_version();
|
||||||
CU_ASSERT(NULL != version);
|
CU_ASSERT(NULL != version);
|
||||||
CU_ASSERT(0 == strcmp(version, PACKAGE_VERSION));
|
CU_ASSERT(0 == strcmp(version, PACKAGE_VERSION));
|
||||||
|
|
|
@ -12,7 +12,7 @@ OPSYS=$(uname -s)
|
||||||
|
|
||||||
echo "Configuring for ${OPSYS}..."
|
echo "Configuring for ${OPSYS}..."
|
||||||
if [ "x${OPSYS}" = "xLinux" ]; then
|
if [ "x${OPSYS}" = "xLinux" ]; then
|
||||||
OS_CFLAGS="-D_BSD_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE"
|
OS_CFLAGS="-D_DEFAULT_SOURCE -D_POSIX_SOURCE -D_XOPEN_SOURCE"
|
||||||
else
|
else
|
||||||
OS_CFLAGS=""
|
OS_CFLAGS=""
|
||||||
fi
|
fi
|
||||||
|
@ -25,7 +25,7 @@ fi
|
||||||
|
|
||||||
if [ -z "${PREFIX}" ]; then
|
if [ -z "${PREFIX}" ]; then
|
||||||
PREFIX="/usr/local"
|
PREFIX="/usr/local"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${PREFIX}" = "/usr" ]; then
|
if [ "${PREFIX}" = "/usr" ]; then
|
||||||
MANDIR="$(PREFIX)/share/man"
|
MANDIR="$(PREFIX)/share/man"
|
||||||
|
|
Loading…
Reference in New Issue