Compare commits

..

2 Commits

Author SHA1 Message Date
076b1310e3 Fix warning and errors reported by gcc 2023-11-04 14:24:32 +00:00
6fb5418314 Switch to using gcc instead of clang 2023-11-04 14:24:22 +00:00
3 changed files with 6 additions and 4 deletions

0
build Normal file → Executable file
View File

2
compile Normal file → Executable file
View File

@ -1,6 +1,6 @@
#!/bin/bash
CC=clang
CC=gcc
AR=ar
CFLAGS="-c -fPIC -Wall -Werror -pedantic -O3 -Iinclude -Ic-cpp-aliases"
SRC="src/cpath.c"

View File

@ -7,7 +7,7 @@
#if defined(__unix__) || defined(__APPLE__) || defined(__ANDROID__)
INTERNAL char path_sep = '/';
#elif defined(_WIN32) || defined(_WIN64)
INTERNAL char path_sep = '\';
INTERNAL char path_sep = '\\';
#endif
void join_root_and_leaf(const char *root, const char *leaf, char *dst);
@ -70,7 +70,9 @@ void join_root_and_leaf(const char *root, const char *leaf, char *dst) {
++leaf_start;
}
strncpy(dst, root, ++root_end);
memcpy(dst, root, ++root_end);
dst[root_end] = path_sep;
strncpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start);
memcpy(&(dst[++root_end]), &(leaf[leaf_start]), leaf_length - leaf_start);
}