File tree Expand file tree Collapse file tree 2 files changed +14
-9
lines changed
Expand file tree Collapse file tree 2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change 99 </ tr >
1010 < tr >
1111 < td > core_json.c</ td >
12- < td > < center > 2.7K </ center > </ td >
13- < td > < center > 2.2K </ center > </ td >
12+ < td > < center > 2.9K </ center > </ td >
13+ < td > < center > 2.3K </ center > </ td >
1414 </ tr >
1515 < tr >
1616 < td > < b > Total estimates</ b > </ td >
17- < td > < b > < center > 2.7K </ center > </ b > </ td >
18- < td > < b > < center > 2.2K </ center > </ b > </ td >
17+ < td > < b > < center > 2.9K </ center > </ b > </ td >
18+ < td > < b > < center > 2.3K </ center > </ b > </ td >
1919 </ tr >
2020</ table >
Original file line number Diff line number Diff line change 2626 */
2727
2828#include <assert.h>
29+ #include <limits.h>
2930#include <stddef.h>
3031#include <stdint.h>
3132#include "core_json.h"
@@ -39,8 +40,13 @@ typedef union
3940 uint8_t u ;
4041} char_ ;
4142
42- #define isdigit_ ( x ) ( ( ( x ) >= '0' ) && ( ( x ) <= '9' ) )
43- #define iscntrl_ ( x ) ( ( ( x ) >= '\0' ) && ( ( x ) < ' ' ) )
43+ #if ( CHAR_MIN == 0 )
44+ #define isascii_ ( x ) ( ( x ) <= '\x7F' )
45+ #else
46+ #define isascii_ ( x ) ( ( x ) >= '\0' )
47+ #endif
48+ #define iscntrl_ ( x ) ( isascii_( x ) && ( ( x ) < ' ' ) )
49+ #define isdigit_ ( x ) ( ( ( x ) >= '0' ) && ( ( x ) <= '9' ) )
4450/* NB. This is whitespace as defined by the JSON standard (ECMA-404). */
4551#define isspace_ ( x ) \
4652 ( ( ( x ) == ' ' ) || ( ( x ) == '\t' ) || \
@@ -190,7 +196,7 @@ static bool skipUTF8MultiByte( const char * buf,
190196
191197 i = * start ;
192198 assert ( i < max );
193- assert ( buf [ i ] < '\0' );
199+ assert ( ! isascii_ ( buf [ i ] ) );
194200
195201 c .c = buf [ i ];
196202
@@ -251,8 +257,7 @@ static bool skipUTF8( const char * buf,
251257
252258 if ( * start < max )
253259 {
254- /* an ASCII byte */
255- if ( buf [ * start ] >= '\0' )
260+ if ( isascii_ ( buf [ * start ] ) )
256261 {
257262 * start += 1U ;
258263 ret = true;
You can’t perform that action at this time.
0 commit comments