Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
chrisemsen opened this issue Jul 24, 2024 · 0 comments
Open

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

chrisemsen opened this issue Jul 24, 2024 · 0 comments

Comments

@chrisemsen
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant