Update libbase64.

This commit is contained in:
Kyle Isom 2025-05-01 14:30:20 -07:00
parent a337852d27
commit 7a5d038f5c
4 changed files with 20 additions and 15 deletions

View File

@ -1,5 +1,6 @@
VERSION := 1.0.0
TARGET := libbase64.a
MANPAGE := libbase64.3
OBJS := base64.o
HEADERS := kst
LIBS :=
@ -12,7 +13,8 @@ CFLAGS += -Wall -Wextra -pedantic -Wshadow -Wpointer-arith -Wcast-align
CFLAGS += -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations
CFLAGS += -Wnested-externs -Winline -Wno-long-long -Wunused-variable -g
CFLAGS += -Wstrict-prototypes -Werror -std=c99 -I. -I/usr/local/include
CFLAGS += OS_CFLAGS
CFLAGS += OS_CFLAGS -DPACKAGE_VERSION="\"$(VERSION)\""
all: $(TARGET)
@ -25,13 +27,13 @@ $(TARGET): $(OBJS)
$(AR) -rcs $@ $(OBJS)
install: $(TARGET)
install -m 0755 $(TARGET) $(PREFIX)/lib/$(TARGET)
install -m 0755 -d $(MANDIR)/man1
install -m 0444 $(TARGET).3 $(MANDIR)/man3/$(TARGET).3
install -D -m 0755 $(TARGET) $(PREFIX)/lib/$(TARGET)
install -m 0755 -d $(MANDIR)/man3
install -m 0444 $(MANPAGE) $(MANDIR)/man3/$(MANPAGE)
uninstall:
-rm -f $(PREFIX)/lib/$(TARGET)
-rm -f $(MANDIR)/man3/$(TARGET).3
-rm -f $(MANDIR)/man3/$(MANPAGE)
dist: clean
-mkdir $(TARGET)-$(VERSION)
@ -43,7 +45,7 @@ distclean: clean
-rm -f Makefile
htmldoc:
-mandoc -Thtml $(TARGET).1 > $(TARGET).1.html
-mandoc -Thtml $(MANPAGE) > $(MANPAGE).html
tags:
ctags *.[ch]

View File

@ -126,7 +126,7 @@ base64_encode(const uint8_t *src, size_t srclength, char *target,
size_t datalength = 0;
unsigned char input[3];
unsigned char output[4];
int i;
unsigned long i;
while (2 < srclength) {
input[0] = *src++;
@ -187,7 +187,8 @@ base64_encode(const uint8_t *src, size_t srclength, char *target,
int
base64_decode(const char *src, uint8_t *target, size_t targsize)
{
int tarindex, state, ch;
unsigned long tarindex;
int state, ch;
char *pos;
state = 0;
@ -336,8 +337,7 @@ base64_declen(size_t orig_len)
* Return the package version.
*/
const char *
base64_lib_version()
base64_lib_version(void)
{
return libversion;
}

View File

@ -33,6 +33,7 @@ void test_base64_enclen(void);
void test_base64_declen(void);
void test_base64_encode(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,
* and cleanup is run after every test.
*/
int init_test(void)
static int
init_test(void)
{
return 0;
}
int cleanup_test(void)
static int
cleanup_test(void)
{
return 0;
}

View File

@ -12,7 +12,7 @@ OPSYS=$(uname -s)
echo "Configuring for ${OPSYS}..."
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
OS_CFLAGS=""
fi