sprinkle compiler attributes over code base

some arm fixes (char is unsigned on arm)
This commit is contained in:
leitner
2024-11-26 09:49:31 +00:00
parent a7080c590a
commit 02582cc1ab
4 changed files with 7 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
0.35:
add clamp.h (for easy integer overflow prevention)
sprinkle compiler attributes over code base
some arm fixes (char is unsigned on arm)
0.34:
be more C99 compliant (Florian Weimer)

View File

@@ -158,6 +158,7 @@
#define __builtin_constant_p(x) 0
#endif
#ifndef __dietlibc__
#if defined(__GNUC__)
#if __has_attribute(null_terminated_string_arg)
// Function arguments.
@@ -208,5 +209,6 @@
#endif
#endif // !defined(__GNUC__)
#endif // !defined(__dietlibc__
#endif

View File

@@ -1,3 +1,5 @@
#include <stddef.h>
#include "compiler.h"
#undef __dietlibc__
#include "str.h"

View File

@@ -29,7 +29,7 @@ size_t scan_jsonescape(const char *src,char *dest,size_t *destlen) {
size_t j;
unsigned int cur;
for (cur=j=0; j<4; ++j) {
char x=scan_fromhex(s[i+2+j]);
signed char x=scan_fromhex(s[i+2+j]);
if (x<0) goto abort; // not hex -> invalid input
cur=(cur<<4) | x;
}