Skip to content

Commit

Permalink
encoding/json: Use unsigned type for bitfield
Browse files Browse the repository at this point in the history
Enabling -Wsingle-bit-bitfield-constant-conversion compains.
repos/apache-mynewt-core/encoding/json/src/json_encode.c:187:27: error:
    implicit truncation from 'int' to a one-bit wide bit-field changes
    value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
562
    encoder->je_wr_commas = 1;
563
                          ^ ~
564
repos/apache-mynewt-core/encoding/json/src/json_encode.c:199:27: error:
    implicit truncation from 'int' to a one-bit wide bit-field changes
    value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
565
    encoder->je_wr_commas = 1;
566
                          ^ ~
567
repos/apache-mynewt-core/encoding/json/src/json_encode.c:233:27: error:
    implicit truncation from 'int' to a one-bit wide bit-field changes
    value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
568
    encoder->je_wr_commas = 1;
569
                          ^ ~
570
repos/apache-mynewt-core/encoding/json/src/json_encode.c:244:27: error:
    implicit truncation from 'int' to a one-bit wide bit-field changes
    value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
571
    encoder->je_wr_commas = 1;
572
                          ^ ~
  • Loading branch information
sjanc committed Oct 30, 2024
1 parent cff00d2 commit 519ce54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion encoding/json/include/json/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ typedef int (*json_write_func_t)(void *buf, char *data,
struct json_encoder {
json_write_func_t je_write;
void *je_arg;
int je_wr_commas:1;
unsigned int je_wr_commas : 1;
char je_encode_buf[64];
};

Expand Down

0 comments on commit 519ce54

Please sign in to comment.