Skip to content

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

@chrisemsen

Description

@chrisemsen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions