fix compiler warnings
Test and Deploy / test (push) Failing after 14s Details
Test and Deploy / docs (push) Failing after 15s Details

This commit is contained in:
Evan Burkey 2024-08-13 12:57:36 -07:00
parent 34b21c494b
commit 4b59b4789c
5 changed files with 21 additions and 7 deletions

13
Makefile Normal file
View File

@ -0,0 +1,13 @@
CMAKE_OPTS=-DCMAKE_EXPORT_COMPILE_COMMANDS=1
all:
mkdir -p build
cd build && \
cmake ${CMAKE_OPTS} .. && \
$(MAKE) && \
cp compile_commands.json ..
clean:
rm -rf build
rm -f compile_commands.json

View File

@ -146,8 +146,8 @@ void print_node(char *prefix, BinTreeNode *node, int is_left, void (*pfunc)(void
pfunc(node->data);
char new_prefix[64];
memset(new_prefix, 0, 64);
strcat(new_prefix, prefix);
strcat(new_prefix, (is_left == 1 ? "" : " "));
strlcat(new_prefix, prefix, 64);
strlcat(new_prefix, (is_left == 1 ? "" : " "), 64 - strlen(prefix));
print_node(new_prefix, node->left, 1, pfunc);
print_node(new_prefix, node->right, 0, pfunc);
}

View File

@ -216,10 +216,10 @@ unsigned char *hex_decode(const char *orig, size_t *sz) {
char *buf = malloc(sizeof(char) * buf_sz);
if (strlen(sptr) % 2 != 0) {
strcpy(buf+ 1, sptr);
strlcpy(buf + 1, sptr, buf_sz - 1);
buf[0] = '0';
} else {
strcpy(buf, sptr);
strlcpy(buf, sptr, buf_sz);
}
buf[buf_sz - 1] = '\0';

View File

@ -116,10 +116,10 @@ int vec_shrink(Vector *vec) {
vec->capacity = vec_len(vec);
#if !defined(__OpenBSD__) || defined(__linux)
vec->elements = reallocarray(vec->elements, vec->capacity, sizeof(void *));
#else
#if !defined(__OpenBSD__)
vec->elements = reallocf(vec->elements, sizeof(void *) * vec->capacity);
#else
vec->elements = reallocarray(vec->elements, vec->capacity, sizeof(void *));
#endif
if (vec->elements == NULL) {

View File

@ -3,6 +3,7 @@
#include <assert.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <pthread.h>
#include "lflinkedlist.h"