aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/json
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-09-10 11:47:15 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-09-10 11:47:15 -0700
commit32ca48ce0b963949ff29d2dcd526b174679779aa (patch)
treee1203e29dbc0827fe4e9eed5737b3f1589d44f34 /test/core/json
parentbe947697d7c5edb1f67c9df5ef024e3eaf98e9e6 (diff)
Core compiles with -Wsign-conversion
Diffstat (limited to 'test/core/json')
-rw-r--r--test/core/json/json_rewrite.c26
-rw-r--r--test/core/json/json_rewrite_test.c28
2 files changed, 27 insertions, 27 deletions
diff --git a/test/core/json/json_rewrite.c b/test/core/json/json_rewrite.c
index 02f60a3163..561bf487b9 100644
--- a/test/core/json/json_rewrite.c
+++ b/test/core/json/json_rewrite.c
@@ -81,7 +81,7 @@ grpc_json_writer_vtable writer_vtable = {json_writer_output_char,
static void check_string(json_reader_userdata* state, size_t needed) {
if (state->free_space >= needed) return;
needed -= state->free_space;
- needed = (needed + 0xff) & ~0xff;
+ needed = (needed + 0xffu) & ~0xffu;
state->scratchpad = gpr_realloc(state->scratchpad, state->allocated + needed);
state->free_space += needed;
state->allocated += needed;
@@ -103,22 +103,22 @@ static void json_reader_string_add_utf32(void* userdata, gpr_uint32 c) {
if (c <= 0x7f) {
json_reader_string_add_char(userdata, c);
} else if (c <= 0x7ff) {
- int b1 = 0xc0 | ((c >> 6) & 0x1f);
- int b2 = 0x80 | (c & 0x3f);
+ gpr_uint32 b1 = 0xc0u | ((c >> 6u) & 0x1fu);
+ gpr_uint32 b2 = 0x80u | (c & 0x3fu);
json_reader_string_add_char(userdata, b1);
json_reader_string_add_char(userdata, b2);
- } else if (c <= 0xffff) {
- int b1 = 0xe0 | ((c >> 12) & 0x0f);
- int b2 = 0x80 | ((c >> 6) & 0x3f);
- int b3 = 0x80 | (c & 0x3f);
+ } else if (c <= 0xffffu) {
+ gpr_uint32 b1 = 0xe0u | ((c >> 12u) & 0x0fu);
+ gpr_uint32 b2 = 0x80u | ((c >> 6u) & 0x3fu);
+ gpr_uint32 b3 = 0x80u | (c & 0x3fu);
json_reader_string_add_char(userdata, b1);
json_reader_string_add_char(userdata, b2);
json_reader_string_add_char(userdata, b3);
- } else if (c <= 0x1fffff) {
- int b1 = 0xf0 | ((c >> 18) & 0x07);
- int b2 = 0x80 | ((c >> 12) & 0x3f);
- int b3 = 0x80 | ((c >> 6) & 0x3f);
- int b4 = 0x80 | (c & 0x3f);
+ } else if (c <= 0x1fffffu) {
+ gpr_uint32 b1 = 0xf0u | ((c >> 18u) & 0x07u);
+ gpr_uint32 b2 = 0x80u | ((c >> 12u) & 0x3fu);
+ gpr_uint32 b3 = 0x80u | ((c >> 6u) & 0x3fu);
+ gpr_uint32 b4 = 0x80u | (c & 0x3fu);
json_reader_string_add_char(userdata, b1);
json_reader_string_add_char(userdata, b2);
json_reader_string_add_char(userdata, b3);
@@ -132,7 +132,7 @@ static gpr_uint32 json_reader_read_char(void* userdata) {
r = fgetc(state->in);
if (r == EOF) r = GRPC_JSON_READ_CHAR_EOF;
- return r;
+ return (gpr_uint32)r;
}
static void json_reader_container_begins(void* userdata, grpc_json_type type) {
diff --git a/test/core/json/json_rewrite_test.c b/test/core/json/json_rewrite_test.c
index f5859322ea..7cf184950e 100644
--- a/test/core/json/json_rewrite_test.c
+++ b/test/core/json/json_rewrite_test.c
@@ -93,7 +93,7 @@ grpc_json_writer_vtable writer_vtable = {json_writer_output_char,
static void check_string(json_reader_userdata* state, size_t needed) {
if (state->free_space >= needed) return;
needed -= state->free_space;
- needed = (needed + 0xff) & ~0xff;
+ needed = (needed + 0xffu) & ~0xffu;
state->scratchpad = gpr_realloc(state->scratchpad, state->allocated + needed);
state->free_space += needed;
state->allocated += needed;
@@ -114,23 +114,23 @@ static void json_reader_string_add_char(void* userdata, gpr_uint32 c) {
static void json_reader_string_add_utf32(void* userdata, gpr_uint32 c) {
if (c <= 0x7f) {
json_reader_string_add_char(userdata, c);
- } else if (c <= 0x7ff) {
- int b1 = 0xc0 | ((c >> 6) & 0x1f);
- int b2 = 0x80 | (c & 0x3f);
+ } else if (c <= 0x7ffu) {
+ gpr_uint32 b1 = 0xc0u | ((c >> 6u) & 0x1fu);
+ gpr_uint32 b2 = 0x80u | (c & 0x3fu);
json_reader_string_add_char(userdata, b1);
json_reader_string_add_char(userdata, b2);
- } else if (c <= 0xffff) {
- int b1 = 0xe0 | ((c >> 12) & 0x0f);
- int b2 = 0x80 | ((c >> 6) & 0x3f);
- int b3 = 0x80 | (c & 0x3f);
+ } else if (c <= 0xffffu) {
+ gpr_uint32 b1 = 0xe0u | ((c >> 12u) & 0x0fu);
+ gpr_uint32 b2 = 0x80u | ((c >> 6u) & 0x3fu);
+ gpr_uint32 b3 = 0x80u | (c & 0x3fu);
json_reader_string_add_char(userdata, b1);
json_reader_string_add_char(userdata, b2);
json_reader_string_add_char(userdata, b3);
- } else if (c <= 0x1fffff) {
- int b1 = 0xf0 | ((c >> 18) & 0x07);
- int b2 = 0x80 | ((c >> 12) & 0x3f);
- int b3 = 0x80 | ((c >> 6) & 0x3f);
- int b4 = 0x80 | (c & 0x3f);
+ } else if (c <= 0x1fffffu) {
+ gpr_uint32 b1 = 0xf0u | ((c >> 18u) & 0x07u);
+ gpr_uint32 b2 = 0x80u | ((c >> 12u) & 0x3fu);
+ gpr_uint32 b3 = 0x80u | ((c >> 6u) & 0x3fu);
+ gpr_uint32 b4 = 0x80u | (c & 0x3fu);
json_reader_string_add_char(userdata, b1);
json_reader_string_add_char(userdata, b2);
json_reader_string_add_char(userdata, b3);
@@ -151,7 +151,7 @@ static gpr_uint32 json_reader_read_char(void* userdata) {
r = fgetc(state->in);
if (r == EOF) r = GRPC_JSON_READ_CHAR_EOF;
- return r;
+ return (gpr_uint32)r;
}
static void json_reader_container_begins(void* userdata, grpc_json_type type) {