aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/transport/chttp2/frame_settings.c
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2015-09-15 15:20:26 -0700
committerGravatar Julien Boeuf <jboeuf@google.com>2015-09-15 15:20:26 -0700
commitfd2f7331fa97f735879a8759ac9fc8591969011b (patch)
treeda031f982ee5d1d21fd71e6c4bc9d80365c7d6e2 /src/core/transport/chttp2/frame_settings.c
parent1928d496a237c3850365e2557ae41ae73125fc80 (diff)
parent9ed4be48955e3b65b0540f70060b7191d8c1eef1 (diff)
Merge branch 'master' of github.com:grpc/grpc into core_creds_plugin
Diffstat (limited to 'src/core/transport/chttp2/frame_settings.c')
-rw-r--r--src/core/transport/chttp2/frame_settings.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/core/transport/chttp2/frame_settings.c b/src/core/transport/chttp2/frame_settings.c
index d42bc000ae..54d3694a5c 100644
--- a/src/core/transport/chttp2/frame_settings.c
+++ b/src/core/transport/chttp2/frame_settings.c
@@ -61,9 +61,9 @@ const grpc_chttp2_setting_parameters
static gpr_uint8 *fill_header(gpr_uint8 *out, gpr_uint32 length,
gpr_uint8 flags) {
- *out++ = length >> 16;
- *out++ = length >> 8;
- *out++ = length;
+ *out++ = (gpr_uint8)(length >> 16);
+ *out++ = (gpr_uint8)(length >> 8);
+ *out++ = (gpr_uint8)(length);
*out++ = GRPC_CHTTP2_FRAME_SETTINGS;
*out++ = flags;
*out++ = 0;
@@ -76,26 +76,26 @@ static gpr_uint8 *fill_header(gpr_uint8 *out, gpr_uint32 length,
gpr_slice grpc_chttp2_settings_create(gpr_uint32 *old, const gpr_uint32 *new,
gpr_uint32 force_mask, size_t count) {
size_t i;
- size_t n = 0;
+ gpr_uint32 n = 0;
gpr_slice output;
gpr_uint8 *p;
for (i = 0; i < count; i++) {
- n += (new[i] != old[i] || (force_mask & (1 << i)) != 0);
+ n += (new[i] != old[i] || (force_mask & (1u << i)) != 0);
}
output = gpr_slice_malloc(9 + 6 * n);
p = fill_header(GPR_SLICE_START_PTR(output), 6 * n, 0);
for (i = 0; i < count; i++) {
- if (new[i] != old[i] || (force_mask & (1 << i)) != 0) {
+ if (new[i] != old[i] || (force_mask & (1u << i)) != 0) {
GPR_ASSERT(i);
- *p++ = i >> 8;
- *p++ = i;
- *p++ = new[i] >> 24;
- *p++ = new[i] >> 16;
- *p++ = new[i] >> 8;
- *p++ = new[i];
+ *p++ = (gpr_uint8)(i >> 8);
+ *p++ = (gpr_uint8)(i);
+ *p++ = (gpr_uint8)(new[i] >> 24);
+ *p++ = (gpr_uint8)(new[i] >> 16);
+ *p++ = (gpr_uint8)(new[i] >> 8);
+ *p++ = (gpr_uint8)(new[i]);
old[i] = new[i];
}
}
@@ -162,7 +162,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
}
return GRPC_CHTTP2_PARSE_OK;
}
- parser->id = ((gpr_uint16)*cur) << 8;
+ parser->id = (gpr_uint16)(((gpr_uint16)*cur) << 8);
cur++;
/* fallthrough */
case GRPC_CHTTP2_SPS_ID1:
@@ -170,7 +170,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
parser->state = GRPC_CHTTP2_SPS_ID1;
return GRPC_CHTTP2_PARSE_OK;
}
- parser->id |= (*cur);
+ parser->id = (gpr_uint16)(parser->id | (*cur));
cur++;
/* fallthrough */
case GRPC_CHTTP2_SPS_VAL0: