fix warnings for gcc 10 and clang 10

This commit is contained in:
aurhat
2021-10-05 22:12:49 +02:00
parent 4aa520515c
commit fcd0fd8980
9 changed files with 27 additions and 11 deletions
+1
View File
@@ -119,6 +119,7 @@ typedef char string[MAXSTRLEN];
#define vformatstring(d,last,fmt) { va_list ap; va_start(ap, last); vformatstring_(d, fmt, ap); va_end(ap); }
inline void vformatstring_(char* d, const char* fmt, va_list v, int len = MAXSTRLEN) { _vsnprintf(d, len, fmt, v); d[len - 1] = 0; }
//#pragma GCC diagnostic ignored "-Wstringop-truncation" // moved to makefile, because it doesn't work from precompiled header
inline char *copystring(char *d, const char *s, size_t len = MAXSTRLEN) { strncpy(d, s, len); d[len-1] = 0; return d; }
inline char *concatstring(char *d, const char *s, size_t len = MAXSTRLEN) { size_t used = strlen(d); return used < len ? copystring(d+used, s, len-used) : d; }
extern char *concatformatstring(char *d, const char *s, ...) PRINTFARGS(2, 3);