akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.05k stars 809 forks source link

The #define for JSON flags should be unsigned constants. #694

Open chrisemsen opened 1 month ago

chrisemsen commented 1 month ago

The flags parameter passed to the json_dump functions is of the type size_t so the #defines's for those flags should be defined as unsigned too.

#define JSON_MAX_INDENT        0x1FU
#define JSON_INDENT(n)         ((n)&JSON_MAX_INDENT)
#define JSON_COMPACT           0x20U
#define JSON_ENSURE_ASCII      0x40U
#define JSON_SORT_KEYS         0x80U
#define JSON_PRESERVE_ORDER    0x100U
#define JSON_ENCODE_ANY        0x200U
#define JSON_ESCAPE_SLASH      0x400U
#define JSON_REAL_PRECISION(n) (((n)&0x1FU) << 11)
#define JSON_EMBED             0x10000U

Not normally a problem, but the inconsistency is detected by static analysis tools.