I'm not sure if I did everything right, but I increase the buffers and replace sprintf with snprintf
Earlier, when assembling, I just cleaned -Wall :smile:
P.S.
im rebuild physics demo for test,but not delete executable file because you also did not delete it and did not object to the fact that I left it there earlier )))
Version gccgcc version 8.3.0 (Debian 8.3.0-2)
Build log
In file included from ./include/casset.h:24,
from src/casset.c:1:
src/casset.c: In function ‘asset_hndl_ptr’:
src/casset.c:182:13: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2027 [-Werror=format-overflow=]
error("Failed to get Asset '%s', is it loaded yet?", ah->path.ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/cengine.h:79:22: note: in definition of macro ‘error’
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~
./include/cengine.h:79:3: note: ‘sprintf’ output between 42 and 4137 bytes into a destination of size 2048
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:182:7: note: in expansion of macro ‘error’
error("Failed to get Asset '%s', is it loaded yet?", ah->path.ptr);
^~~~~
src/casset.c: In function ‘file_load’:
src/casset.c:272:11: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2041 [-Werror=format-overflow=]
error("Asset '%s' already loaded", filename.ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
./include/cengine.h:79:22: note: in definition of macro ‘error’
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~
./include/cengine.h:79:3: note: ‘sprintf’ output between 24 and 4119 bytes into a destination of size 2048
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:272:5: note: in expansion of macro ‘error’
error("Asset '%s' already loaded", filename.ptr);
^~~~~
src/casset.c:282:13: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2038 [-Werror=format-overflow=]
debug("Loading: '%s'", filename.ptr);
^~~~~~~~~~~~~~~ ~~~~~~~~~~~~
./include/cengine.h:89:22: note: in definition of macro ‘debug’
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~
./include/cengine.h:89:3: note: ‘sprintf’ output between 12 and 4107 bytes into a destination of size 2048
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:282:7: note: in expansion of macro ‘debug’
debug("Loading: '%s'", filename.ptr);
^~~~~
src/casset.c: In function ‘file_unload’:
src/casset.c:402:13: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2036 [-Werror=format-overflow=]
debug("Unloading: '%s'", filename.ptr);
^~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
./include/cengine.h:89:22: note: in definition of macro ‘debug’
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~
./include/cengine.h:89:3: note: ‘sprintf’ output between 14 and 4109 bytes into a destination of size 2048
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:402:7: note: in expansion of macro ‘debug’
debug("Unloading: '%s'", filename.ptr);
^~~~~
src/casset.c: In function ‘folder_unload’:
src/casset.c:414:9: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2029 [-Werror=format-overflow=]
debug("Unloading Folder: '%s'", folder.ptr);
^~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
./include/cengine.h:89:22: note: in definition of macro ‘debug’
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~
./include/cengine.h:89:3: note: ‘sprintf’ output between 21 and 4116 bytes into a destination of size 2048
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:414:3: note: in expansion of macro ‘debug’
debug("Unloading Folder: '%s'", folder.ptr);
^~~~~
src/casset.c:418:11: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2022 [-Werror=format-overflow=]
error("Could not open directory '%s' to unload.\n", folder.ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
./include/cengine.h:79:22: note: in definition of macro ‘error’
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~
./include/cengine.h:79:3: note: ‘sprintf’ output between 40 and 4135 bytes into a destination of size 2048
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:418:5: note: in expansion of macro ‘error’
error("Could not open directory '%s' to unload.\n", folder.ptr);
^~~~~
src/casset.c: In function ‘folder_load’:
src/casset.c:308:9: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2031 [-Werror=format-overflow=]
debug("Loading Folder: '%s'", folder.ptr);
^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
./include/cengine.h:89:22: note: in definition of macro ‘debug’
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~
./include/cengine.h:89:3: note: ‘sprintf’ output between 19 and 4114 bytes into a destination of size 2048
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:308:3: note: in expansion of macro ‘debug’
debug("Loading Folder: '%s'", folder.ptr);
^~~~~
src/casset.c:312:11: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2022 [-Werror=format-overflow=]
error("Could not open directory '%s' to load.", folder.ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
./include/cengine.h:79:22: note: in definition of macro ‘error’
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~
./include/cengine.h:79:3: note: ‘sprintf’ output between 37 and 4132 bytes into a destination of size 2048
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:312:5: note: in expansion of macro ‘error’
error("Could not open directory '%s' to load.", folder.ptr);
^~~~~
src/casset.c: In function ‘folder_load_recursive’:
src/casset.c:342:9: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2031 [-Werror=format-overflow=]
debug("Loading Folder: '%s'", folder.ptr);
^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
./include/cengine.h:89:22: note: in definition of macro ‘debug’
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~
./include/cengine.h:89:3: note: ‘sprintf’ output between 19 and 4114 bytes into a destination of size 2048
sprintf(debug_buf, MSG, ##__VA_ARGS__); strcat(debug_str, debug_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:342:3: note: in expansion of macro ‘debug’
debug("Loading Folder: '%s'", folder.ptr);
^~~~~
src/casset.c:346:11: error: ‘%s’ directive writing up to 4095 bytes into a region of size 2022 [-Werror=format-overflow=]
error("Could not open directory '%s' to load.", folder.ptr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~
./include/cengine.h:79:22: note: in definition of macro ‘error’
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~
./include/cengine.h:79:3: note: ‘sprintf’ output between 37 and 4132 bytes into a destination of size 2048
sprintf(error_buf, MSG, ##__VA_ARGS__); strcat(error_str, error_buf); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/casset.c:346:5: note: in expansion of macro ‘error’
error("Could not open directory '%s' to load.", folder.ptr);
^~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:43: obj/casset.o] Ошибка 1
build
gcc -Wall
in Makefile I`m have errors,I'm not sure if I did everything right, but I increase the buffers and replace sprintf with snprintf Earlier, when assembling, I just cleaned
-Wall
:smile:P.S. im rebuild physics demo for test,but not delete executable file because you also did not delete it and did not object to the fact that I left it there earlier )))
Version gcc
gcc version 8.3.0 (Debian 8.3.0-2)
Build log