From c44972ac261fe476230e70c29f83a4460ebe1f03 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 22 Sep 2016 11:08:29 -0700 Subject: [PATCH] Fix type problems. --- src/core/lib/channel/message_size_filter.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/lib/channel/message_size_filter.c b/src/core/lib/channel/message_size_filter.c index 7528184d898..5a28479426a 100644 --- a/src/core/lib/channel/message_size_filter.c +++ b/src/core/lib/channel/message_size_filter.c @@ -56,8 +56,8 @@ typedef struct call_data { } call_data; typedef struct channel_data { - long max_send_size; - long max_recv_size; + int max_send_size; + int max_recv_size; } channel_data; // Callback invoked when we receive a message. Here we check the max @@ -68,11 +68,11 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data, call_data* calld = elem->call_data; channel_data* chand = elem->channel_data; if (*calld->recv_message != NULL && chand->max_recv_size >= 0 && - (*calld->recv_message)->length > chand->max_recv_size) { + (*calld->recv_message)->length > (size_t)chand->max_recv_size) { char* message_string; gpr_asprintf( - &message_string, "Received message larger than max (%u vs. %lu)", - (*calld->recv_message)->length, (unsigned long)chand->max_recv_size); + &message_string, "Received message larger than max (%u vs. %d)", + (*calld->recv_message)->length, chand->max_recv_size); gpr_slice message = gpr_slice_from_copied_string(message_string); gpr_free(message_string); grpc_call_element_send_cancel_with_message( @@ -90,10 +90,10 @@ static void start_transport_stream_op(grpc_exec_ctx* exec_ctx, channel_data* chand = elem->channel_data; // Check max send message size. if (op->send_message != NULL && chand->max_send_size >= 0 && - op->send_message->length > chand->max_send_size) { + op->send_message->length > (size_t)chand->max_send_size) { char* message_string; - gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %lu)", - op->send_message->length, (unsigned long)chand->max_send_size); + gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %d)", + op->send_message->length, chand->max_send_size); gpr_slice message = gpr_slice_from_copied_string(message_string); gpr_free(message_string); grpc_call_element_send_cancel_with_message( @@ -138,14 +138,14 @@ static void init_channel_elem(grpc_exec_ctx* exec_ctx, GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) == 0) { const grpc_integer_options options = {DEFAULT_MAX_SEND_MESSAGE_LENGTH, 0, INT_MAX}; - chand->max_send_size = (size_t)grpc_channel_arg_get_integer( + chand->max_send_size = grpc_channel_arg_get_integer( &args->channel_args->args[i], options); } if (strcmp(args->channel_args->args[i].key, GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH) == 0) { const grpc_integer_options options = {DEFAULT_MAX_RECV_MESSAGE_LENGTH, 0, INT_MAX}; - chand->max_recv_size = (size_t)grpc_channel_arg_get_integer( + chand->max_recv_size = grpc_channel_arg_get_integer( &args->channel_args->args[i], options); } }