Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tinydir_readfile(): avoid GCC 8+ warning and simplify (#64)
The code was correct, but GCC 8 and 9 warned: $ g++-8 -O2 -Wall -I.. file_open_sample.c In file included from /usr/include/string.h:494, from ../tinydir.h:46, from file_open_sample.c:2: In function ‘char* strcat(char*, const char*)’, inlined from ‘int tinydir_readfile(const tinydir_dir*, tinydir_file*)’ at ../tinydir.h:550:17, inlined from ‘int tinydir_file_open(tinydir_file*, const char*)’ at ../tinydir.h:727:23, inlined from ‘int main(int, char**)’ at file_open_sample.c:12:23: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:128:33: warning: ‘char* __builtin___strcat_chk(char*, const char*, long unsigned int)’ accessing 4097 or more bytes at offsets 0 and 4096 may overlap 1 byte at offset 4096 [-Wrestrict] return __builtin___strcat_chk (__dest, __src, __bos (__dest)); ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Loading branch information