diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c | 5 | ||||
-rw-r--r-- | src/core/ext/filters/client_channel/subchannel_index.c | 4 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/chttp2_transport.c | 66 | ||||
-rw-r--r-- | src/core/lib/channel/channel_args.c | 18 | ||||
-rw-r--r-- | src/core/lib/channel/channel_stack_builder.c | 6 | ||||
-rw-r--r-- | src/core/lib/channel/connected_channel.c | 25 | ||||
-rw-r--r-- | src/core/lib/channel/handshaker.c | 14 | ||||
-rw-r--r-- | src/core/lib/channel/handshaker_registry.c | 2 | ||||
-rw-r--r-- | src/core/lib/debug/stats.c | 2 | ||||
-rw-r--r-- | src/core/lib/http/format_request.c | 2 | ||||
-rw-r--r-- | src/core/lib/http/httpcli.c | 13 | ||||
-rw-r--r-- | src/core/lib/http/parser.c | 7 | ||||
-rw-r--r-- | src/core/lib/iomgr/closure.c | 4 | ||||
-rw-r--r-- | src/core/lib/iomgr/error.c | 14 | ||||
-rw-r--r-- | src/core/lib/iomgr/ev_epoll1_linux.c | 6 |
15 files changed, 104 insertions, 84 deletions
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c index 3ff081a514..c4676e0299 100644 --- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c +++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.c @@ -159,7 +159,7 @@ typedef struct set_response_closure_arg { static void set_response_closure_fn(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - set_response_closure_arg* closure_arg = arg; + set_response_closure_arg* closure_arg = (set_response_closure_arg*)arg; grpc_fake_resolver_response_generator* generator = closure_arg->generator; fake_resolver* r = generator->resolver; if (r->next_results != NULL) { @@ -178,7 +178,8 @@ void grpc_fake_resolver_response_generator_set_response( grpc_exec_ctx* exec_ctx, grpc_fake_resolver_response_generator* generator, grpc_channel_args* next_response) { GPR_ASSERT(generator->resolver != NULL); - set_response_closure_arg* closure_arg = gpr_zalloc(sizeof(*closure_arg)); + set_response_closure_arg* closure_arg = + (set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg)); closure_arg->generator = generator; closure_arg->next_response = grpc_channel_args_copy(next_response); GRPC_CLOSURE_SCHED(exec_ctx, diff --git a/src/core/ext/filters/client_channel/subchannel_index.c b/src/core/ext/filters/client_channel/subchannel_index.c index f319aff0df..f57b631c41 100644 --- a/src/core/ext/filters/client_channel/subchannel_index.c +++ b/src/core/ext/filters/client_channel/subchannel_index.c @@ -136,8 +136,8 @@ grpc_subchannel *grpc_subchannel_index_find(grpc_exec_ctx *exec_ctx, gpr_avl index = gpr_avl_ref(g_subchannel_index, exec_ctx); gpr_mu_unlock(&g_mu); - grpc_subchannel *c = (grpc_subchannel *)GRPC_SUBCHANNEL_REF_FROM_WEAK_REF( - gpr_avl_get(index, key, exec_ctx), "index_find"); + grpc_subchannel *c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF( + (grpc_subchannel *)gpr_avl_get(index, key, exec_ctx), "index_find"); gpr_avl_unref(index, exec_ctx); return c; diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 7ff77b7cd9..adf9846336 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -589,7 +589,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, static void destroy_transport_locked(grpc_exec_ctx *exec_ctx, void *tp, grpc_error *error) { - grpc_chttp2_transport *t = tp; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)tp; t->destroying = 1; close_transport_locked( exec_ctx, t, @@ -715,7 +715,7 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt, static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp, grpc_error *error) { - grpc_chttp2_stream *s = sp; + grpc_chttp2_stream *s = (grpc_chttp2_stream *)sp; grpc_chttp2_transport *t = s->t; GPR_TIMER_BEGIN("destroy_stream", 0); @@ -897,7 +897,7 @@ void grpc_chttp2_become_writable( static void write_action_begin_locked(grpc_exec_ctx *exec_ctx, void *gt, grpc_error *error_ignored) { GPR_TIMER_BEGIN("write_action_begin_locked", 0); - grpc_chttp2_transport *t = gt; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; GPR_ASSERT(t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE); switch (t->closed ? GRPC_CHTTP2_NOTHING_TO_WRITE : grpc_chttp2_begin_write(exec_ctx, t)) { @@ -921,7 +921,7 @@ static void write_action_begin_locked(grpc_exec_ctx *exec_ctx, void *gt, } static void write_action(grpc_exec_ctx *exec_ctx, void *gt, grpc_error *error) { - grpc_chttp2_transport *t = gt; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)gt; GPR_TIMER_BEGIN("write_action", 0); grpc_endpoint_write( exec_ctx, t->ep, &t->outbuf, @@ -933,7 +933,7 @@ static void write_action(grpc_exec_ctx *exec_ctx, void *gt, grpc_error *error) { static void write_action_end_locked(grpc_exec_ctx *exec_ctx, void *tp, grpc_error *error) { GPR_TIMER_BEGIN("terminate_writing_with_lock", 0); - grpc_chttp2_transport *t = tp; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)tp; if (error != GRPC_ERROR_NONE) { close_transport_locked(exec_ctx, t, GRPC_ERROR_REF(error)); @@ -1191,7 +1191,7 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx, } else { grpc_chttp2_write_cb *cb = t->write_cb_pool; if (cb == NULL) { - cb = gpr_malloc(sizeof(*cb)); + cb = (grpc_chttp2_write_cb *)gpr_malloc(sizeof(*cb)); } else { t->write_cb_pool = cb->next; } @@ -1219,7 +1219,7 @@ static void continue_fetching_send_locked(grpc_exec_ctx *exec_ctx, static void complete_fetch_locked(grpc_exec_ctx *exec_ctx, void *gs, grpc_error *error) { - grpc_chttp2_stream *s = gs; + grpc_chttp2_stream *s = (grpc_chttp2_stream *)gs; grpc_chttp2_transport *t = s->t; if (error == GRPC_ERROR_NONE) { error = grpc_byte_stream_pull(exec_ctx, s->fetching_send_message, @@ -1254,8 +1254,9 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, grpc_error *error_ignored) { GPR_TIMER_BEGIN("perform_stream_op_locked", 0); - grpc_transport_stream_op_batch *op = stream_op; - grpc_chttp2_stream *s = op->handler_private.extra_arg; + grpc_transport_stream_op_batch *op = + (grpc_transport_stream_op_batch *)stream_op; + grpc_chttp2_stream *s = (grpc_chttp2_stream *)op->handler_private.extra_arg; grpc_transport_stream_op_batch_payload *op_payload = op->payload; grpc_chttp2_transport *t = s->t; @@ -1308,7 +1309,8 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, if ((s->stream_compression_send_enabled = (op_payload->send_initial_metadata.send_initial_metadata->idx.named .content_encoding != NULL)) == true) { - s->compressed_data_buffer = gpr_malloc(sizeof(grpc_slice_buffer)); + s->compressed_data_buffer = + (grpc_slice_buffer *)gpr_malloc(sizeof(grpc_slice_buffer)); grpc_slice_buffer_init(s->compressed_data_buffer); } @@ -1599,7 +1601,7 @@ static void send_ping_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, static void retry_initiate_ping_locked(grpc_exec_ctx *exec_ctx, void *tp, grpc_error *error) { - grpc_chttp2_transport *t = tp; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)tp; t->ping_state.is_delayed_ping_timer_set = false; grpc_chttp2_initiate_write(exec_ctx, t, "retry_send_ping"); } @@ -1651,8 +1653,9 @@ void grpc_chttp2_add_ping_strike(grpc_exec_ctx *exec_ctx, static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op, grpc_error *error_ignored) { - grpc_transport_op *op = stream_op; - grpc_chttp2_transport *t = op->handler_private.extra_arg; + grpc_transport_op *op = (grpc_transport_op *)stream_op; + grpc_chttp2_transport *t = + (grpc_chttp2_transport *)op->handler_private.extra_arg; grpc_error *close_transport = op->disconnect_with_error; if (op->goaway_error) { @@ -1864,7 +1867,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx *exec_ctx, static void remove_stream(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t, uint32_t id, grpc_error *error) { - grpc_chttp2_stream *s = grpc_chttp2_stream_map_delete(&t->stream_map, id); + grpc_chttp2_stream *s = + (grpc_chttp2_stream *)grpc_chttp2_stream_map_delete(&t->stream_map, id); GPR_ASSERT(s); if (t->incoming_stream == s) { t->incoming_stream = NULL; @@ -2242,8 +2246,8 @@ typedef struct { } cancel_stream_cb_args; static void cancel_stream_cb(void *user_data, uint32_t key, void *stream) { - cancel_stream_cb_args *args = user_data; - grpc_chttp2_stream *s = stream; + cancel_stream_cb_args *args = (cancel_stream_cb_args *)user_data; + grpc_chttp2_stream *s = (grpc_chttp2_stream *)stream; grpc_chttp2_cancel_stream(args->exec_ctx, args->t, s, GRPC_ERROR_REF(args->error)); } @@ -2345,7 +2349,7 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp, grpc_error *error) { GPR_TIMER_BEGIN("reading_action_locked", 0); - grpc_chttp2_transport *t = tp; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)tp; GRPC_ERROR_REF(error); @@ -2430,7 +2434,7 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp, static void start_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp, grpc_error *error) { - grpc_chttp2_transport *t = tp; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)tp; if (GRPC_TRACER_ON(grpc_http_trace)) { gpr_log(GPR_DEBUG, "%s: Start BDP ping", t->peer_string); } @@ -2443,7 +2447,7 @@ static void start_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp, static void finish_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp, grpc_error *error) { - grpc_chttp2_transport *t = tp; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)tp; if (GRPC_TRACER_ON(grpc_http_trace)) { gpr_log(GPR_DEBUG, "%s: Complete BDP ping", t->peer_string); } @@ -2492,7 +2496,7 @@ void grpc_chttp2_config_default_keepalive_args(grpc_channel_args *args, static void init_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_chttp2_transport *t = arg; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)arg; GPR_ASSERT(t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING); if (t->destroying || t->closed) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; @@ -2524,7 +2528,7 @@ static void init_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void start_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_chttp2_transport *t = arg; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)arg; GRPC_CHTTP2_REF_TRANSPORT(t, "keepalive watchdog"); grpc_timer_init( exec_ctx, &t->keepalive_watchdog_timer, @@ -2534,7 +2538,7 @@ static void start_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_chttp2_transport *t = arg; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)arg; if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (error == GRPC_ERROR_NONE) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_WAITING; @@ -2551,7 +2555,7 @@ static void finish_keepalive_ping_locked(grpc_exec_ctx *exec_ctx, void *arg, static void keepalive_watchdog_fired_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_chttp2_transport *t = arg; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)arg; if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_PINGING) { if (error == GRPC_ERROR_NONE) { t->keepalive_state = GRPC_CHTTP2_KEEPALIVE_STATE_DYING; @@ -2632,7 +2636,8 @@ static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx, static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx, void *argp, grpc_error *error_ignored) { - grpc_chttp2_incoming_byte_stream *bs = argp; + grpc_chttp2_incoming_byte_stream *bs = + (grpc_chttp2_incoming_byte_stream *)argp; grpc_chttp2_transport *t = bs->transport; grpc_chttp2_stream *s = bs->stream; @@ -2842,7 +2847,8 @@ static const grpc_byte_stream_vtable grpc_chttp2_incoming_byte_stream_vtable = { static void incoming_byte_stream_destroy_locked(grpc_exec_ctx *exec_ctx, void *byte_stream, grpc_error *error_ignored) { - grpc_chttp2_incoming_byte_stream *bs = byte_stream; + grpc_chttp2_incoming_byte_stream *bs = + (grpc_chttp2_incoming_byte_stream *)byte_stream; grpc_chttp2_stream *s = bs->stream; grpc_chttp2_transport *t = s->t; @@ -2898,7 +2904,7 @@ static void post_destructive_reclaimer(grpc_exec_ctx *exec_ctx, static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_chttp2_transport *t = arg; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)arg; if (error == GRPC_ERROR_NONE && grpc_chttp2_stream_map_size(&t->stream_map) == 0) { /* Channel with no active streams: send a goaway to try and make it @@ -2928,11 +2934,12 @@ static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg, static void destructive_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_chttp2_transport *t = arg; + grpc_chttp2_transport *t = (grpc_chttp2_transport *)arg; size_t n = grpc_chttp2_stream_map_size(&t->stream_map); t->destructive_reclaimer_registered = false; if (error == GRPC_ERROR_NONE && n > 0) { - grpc_chttp2_stream *s = grpc_chttp2_stream_map_rand(&t->stream_map); + grpc_chttp2_stream *s = + (grpc_chttp2_stream *)grpc_chttp2_stream_map_rand(&t->stream_map); if (GRPC_TRACER_ON(grpc_resource_quota_trace)) { gpr_log(GPR_DEBUG, "HTTP2: %s - abandon stream id %d", t->peer_string, s->id); @@ -2979,7 +2986,8 @@ static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream), grpc_transport *grpc_create_chttp2_transport( grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args, grpc_endpoint *ep, int is_client) { - grpc_chttp2_transport *t = gpr_zalloc(sizeof(grpc_chttp2_transport)); + grpc_chttp2_transport *t = + (grpc_chttp2_transport *)gpr_zalloc(sizeof(grpc_chttp2_transport)); init_transport(exec_ctx, t, channel_args, ep, is_client != 0); return &t->base; } diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 02db798b5c..16d0737b40 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -86,13 +86,14 @@ grpc_channel_args *grpc_channel_args_copy_and_add_and_remove( } } // Create result. - grpc_channel_args *dst = gpr_malloc(sizeof(grpc_channel_args)); + grpc_channel_args *dst = + (grpc_channel_args *)gpr_malloc(sizeof(grpc_channel_args)); dst->num_args = num_args_to_copy + num_to_add; if (dst->num_args == 0) { dst->args = NULL; return dst; } - dst->args = gpr_malloc(sizeof(grpc_arg) * dst->num_args); + dst->args = (grpc_arg *)gpr_malloc(sizeof(grpc_arg) * dst->num_args); // Copy args from src that are not being removed. size_t dst_idx = 0; if (src != NULL) { @@ -117,7 +118,7 @@ grpc_channel_args *grpc_channel_args_copy(const grpc_channel_args *src) { grpc_channel_args *grpc_channel_args_union(const grpc_channel_args *a, const grpc_channel_args *b) { const size_t max_out = (a->num_args + b->num_args); - grpc_arg *uniques = gpr_malloc(sizeof(*uniques) * max_out); + grpc_arg *uniques = (grpc_arg *)gpr_malloc(sizeof(*uniques) * max_out); for (size_t i = 0; i < a->num_args; ++i) uniques[i] = a->args[i]; size_t uniques_idx = a->num_args; @@ -160,24 +161,25 @@ static int cmp_arg(const grpc_arg *a, const grpc_arg *b) { /* stabilizing comparison function: since channel_args ordering matters for * keys with the same name, we need to preserve that ordering */ static int cmp_key_stable(const void *ap, const void *bp) { - const grpc_arg *const *a = ap; - const grpc_arg *const *b = bp; + const grpc_arg *const *a = (const grpc_arg *const *)ap; + const grpc_arg *const *b = (const grpc_arg *const *)bp; int c = strcmp((*a)->key, (*b)->key); if (c == 0) c = GPR_ICMP(*a, *b); return c; } grpc_channel_args *grpc_channel_args_normalize(const grpc_channel_args *a) { - grpc_arg **args = gpr_malloc(sizeof(grpc_arg *) * a->num_args); + grpc_arg **args = (grpc_arg **)gpr_malloc(sizeof(grpc_arg *) * a->num_args); for (size_t i = 0; i < a->num_args; i++) { args[i] = &a->args[i]; } if (a->num_args > 1) qsort(args, a->num_args, sizeof(grpc_arg *), cmp_key_stable); - grpc_channel_args *b = gpr_malloc(sizeof(grpc_channel_args)); + grpc_channel_args *b = + (grpc_channel_args *)gpr_malloc(sizeof(grpc_channel_args)); b->num_args = a->num_args; - b->args = gpr_malloc(sizeof(grpc_arg) * b->num_args); + b->args = (grpc_arg *)gpr_malloc(sizeof(grpc_arg) * b->num_args); for (size_t i = 0; i < a->num_args; i++) { b->args[i] = copy_arg(args[i]); } diff --git a/src/core/lib/channel/channel_stack_builder.c b/src/core/lib/channel/channel_stack_builder.c index 2c991ea960..df45f13c81 100644 --- a/src/core/lib/channel/channel_stack_builder.c +++ b/src/core/lib/channel/channel_stack_builder.c @@ -51,7 +51,8 @@ struct grpc_channel_stack_builder_iterator { }; grpc_channel_stack_builder *grpc_channel_stack_builder_create(void) { - grpc_channel_stack_builder *b = gpr_zalloc(sizeof(*b)); + grpc_channel_stack_builder *b = + (grpc_channel_stack_builder *)gpr_zalloc(sizeof(*b)); b->begin.filter = NULL; b->end.filter = NULL; @@ -76,7 +77,8 @@ const char *grpc_channel_stack_builder_get_target( static grpc_channel_stack_builder_iterator *create_iterator_at_filter_node( grpc_channel_stack_builder *builder, filter_node *node) { - grpc_channel_stack_builder_iterator *it = gpr_malloc(sizeof(*it)); + grpc_channel_stack_builder_iterator *it = + (grpc_channel_stack_builder_iterator *)gpr_malloc(sizeof(*it)); it->builder = builder; it->node = node; return it; diff --git a/src/core/lib/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c index 8285226fc4..4f37908958 100644 --- a/src/core/lib/channel/connected_channel.c +++ b/src/core/lib/channel/connected_channel.c @@ -100,8 +100,8 @@ static callback_state *get_state_for_batch( static void con_start_transport_stream_op_batch( grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_transport_stream_op_batch *batch) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; if (batch->recv_initial_metadata) { callback_state *state = &calld->recv_initial_metadata_ready; intercept_callback( @@ -136,7 +136,7 @@ static void con_start_transport_stream_op_batch( static void con_start_transport_op(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_transport_op *op) { - channel_data *chand = elem->channel_data; + channel_data *chand = (channel_data *)elem->channel_data; grpc_transport_perform_op(exec_ctx, chand->transport, op); } @@ -144,8 +144,8 @@ static void con_start_transport_op(grpc_exec_ctx *exec_ctx, static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_element_args *args) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; calld->call_combiner = args->call_combiner; int r = grpc_transport_init_stream( exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), @@ -158,8 +158,8 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx, static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, grpc_polling_entity *pollent) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; grpc_transport_set_pops(exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), pollent); } @@ -168,8 +168,8 @@ static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx, static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, const grpc_call_final_info *final_info, grpc_closure *then_schedule_closure) { - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; + call_data *calld = (call_data *)elem->call_data; + channel_data *chand = (channel_data *)elem->channel_data; grpc_transport_destroy_stream(exec_ctx, chand->transport, TRANSPORT_STREAM_FROM_CALL_DATA(calld), then_schedule_closure); @@ -218,7 +218,7 @@ static void bind_transport(grpc_channel_stack *channel_stack, channel_data *cd = (channel_data *)elem->channel_data; GPR_ASSERT(elem->filter == &grpc_connected_filter); GPR_ASSERT(cd->transport == NULL); - cd->transport = t; + cd->transport = (grpc_transport *)t; /* HACK(ctiller): increase call stack size for the channel to make space for channel data. We need a cleaner (but performant) way to do this, @@ -226,7 +226,8 @@ static void bind_transport(grpc_channel_stack *channel_stack, This is only "safe" because call stacks place no additional data after the last call element, and the last call element MUST be the connected channel. */ - channel_stack->call_stack_size += grpc_transport_stream_size(t); + channel_stack->call_stack_size += + grpc_transport_stream_size((grpc_transport *)t); } bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx, @@ -240,6 +241,6 @@ bool grpc_add_connected_filter(grpc_exec_ctx *exec_ctx, } grpc_stream *grpc_connected_channel_get_stream(grpc_call_element *elem) { - call_data *calld = elem->call_data; + call_data *calld = (call_data *)elem->call_data; return TRANSPORT_STREAM_FROM_CALL_DATA(calld); } diff --git a/src/core/lib/channel/handshaker.c b/src/core/lib/channel/handshaker.c index 2cb83f4114..1753da5721 100644 --- a/src/core/lib/channel/handshaker.c +++ b/src/core/lib/channel/handshaker.c @@ -84,7 +84,8 @@ struct grpc_handshake_manager { }; grpc_handshake_manager* grpc_handshake_manager_create() { - grpc_handshake_manager* mgr = gpr_zalloc(sizeof(grpc_handshake_manager)); + grpc_handshake_manager* mgr = + (grpc_handshake_manager*)gpr_zalloc(sizeof(grpc_handshake_manager)); gpr_mu_init(&mgr->mu); gpr_ref_init(&mgr->refs, 1); return mgr; @@ -137,8 +138,8 @@ void grpc_handshake_manager_add(grpc_handshake_manager* mgr, realloc_count = mgr->count * 2; } if (realloc_count > 0) { - mgr->handshakers = - gpr_realloc(mgr->handshakers, realloc_count * sizeof(grpc_handshaker*)); + mgr->handshakers = (grpc_handshaker**)gpr_realloc( + mgr->handshakers, realloc_count * sizeof(grpc_handshaker*)); } mgr->handshakers[mgr->count++] = handshaker; gpr_mu_unlock(&mgr->mu); @@ -205,7 +206,7 @@ static bool call_next_handshaker_locked(grpc_exec_ctx* exec_ctx, // handshakers together. static void call_next_handshaker(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - grpc_handshake_manager* mgr = arg; + grpc_handshake_manager* mgr = (grpc_handshake_manager*)arg; gpr_mu_lock(&mgr->mu); bool done = call_next_handshaker_locked(exec_ctx, mgr, GRPC_ERROR_REF(error)); gpr_mu_unlock(&mgr->mu); @@ -219,7 +220,7 @@ static void call_next_handshaker(grpc_exec_ctx* exec_ctx, void* arg, // Callback invoked when deadline is exceeded. static void on_timeout(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - grpc_handshake_manager* mgr = arg; + grpc_handshake_manager* mgr = (grpc_handshake_manager*)arg; if (error == GRPC_ERROR_NONE) { // Timer fired, rather than being cancelled. grpc_handshake_manager_shutdown( exec_ctx, mgr, @@ -241,7 +242,8 @@ void grpc_handshake_manager_do_handshake( mgr->args.endpoint = endpoint; mgr->args.args = grpc_channel_args_copy(channel_args); mgr->args.user_data = user_data; - mgr->args.read_buffer = gpr_malloc(sizeof(*mgr->args.read_buffer)); + mgr->args.read_buffer = + (grpc_slice_buffer*)gpr_malloc(sizeof(*mgr->args.read_buffer)); grpc_slice_buffer_init(mgr->args.read_buffer); // Initialize state needed for calling handshakers. mgr->acceptor = acceptor; diff --git a/src/core/lib/channel/handshaker_registry.c b/src/core/lib/channel/handshaker_registry.c index 8c4bc3aa00..c6bc87d704 100644 --- a/src/core/lib/channel/handshaker_registry.c +++ b/src/core/lib/channel/handshaker_registry.c @@ -34,7 +34,7 @@ typedef struct { static void grpc_handshaker_factory_list_register( grpc_handshaker_factory_list* list, bool at_start, grpc_handshaker_factory* factory) { - list->list = gpr_realloc( + list->list = (grpc_handshaker_factory**)gpr_realloc( list->list, (list->num_factories + 1) * sizeof(grpc_handshaker_factory*)); if (at_start) { memmove(list->list + 1, list->list, diff --git a/src/core/lib/debug/stats.c b/src/core/lib/debug/stats.c index 91ca0aa76e..4096384dd9 100644 --- a/src/core/lib/debug/stats.c +++ b/src/core/lib/debug/stats.c @@ -33,7 +33,7 @@ static size_t g_num_cores; void grpc_stats_init(void) { g_num_cores = GPR_MAX(1, gpr_cpu_num_cores()); grpc_stats_per_cpu_storage = - gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores); + (grpc_stats_data *)gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores); } void grpc_stats_shutdown(void) { gpr_free(grpc_stats_per_cpu_storage); } diff --git a/src/core/lib/http/format_request.c b/src/core/lib/http/format_request.c index f887726eea..88fb0ab0b6 100644 --- a/src/core/lib/http/format_request.c +++ b/src/core/lib/http/format_request.c @@ -98,7 +98,7 @@ grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request, gpr_strvec_destroy(&out); if (body_bytes) { - tmp = gpr_realloc(tmp, out_len + body_size); + tmp = (char *)gpr_realloc(tmp, out_len + body_size); memcpy(tmp + out_len, body_bytes, body_size); out_len += body_size; } diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c index 77af7b7c08..84cc39604c 100644 --- a/src/core/lib/http/httpcli.c +++ b/src/core/lib/http/httpcli.c @@ -130,7 +130,7 @@ static void do_read(grpc_exec_ctx *exec_ctx, internal_request *req) { static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, grpc_error *error) { - internal_request *req = user_data; + internal_request *req = (internal_request *)user_data; size_t i; for (i = 0; i < req->incoming.count; i++) { @@ -159,7 +159,7 @@ static void on_written(grpc_exec_ctx *exec_ctx, internal_request *req) { } static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (error == GRPC_ERROR_NONE) { on_written(exec_ctx, req); } else { @@ -175,7 +175,7 @@ static void start_write(grpc_exec_ctx *exec_ctx, internal_request *req) { static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *ep) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (!ep) { next_address(exec_ctx, req, GRPC_ERROR_CREATE_FROM_STATIC_STRING( @@ -189,7 +189,7 @@ static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, static void on_connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (!req->ep) { next_address(exec_ctx, req, GRPC_ERROR_REF(error)); @@ -226,7 +226,7 @@ static void next_address(grpc_exec_ctx *exec_ctx, internal_request *req, } static void on_resolved(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - internal_request *req = arg; + internal_request *req = (internal_request *)arg; if (error != GRPC_ERROR_NONE) { finish(exec_ctx, req, GRPC_ERROR_REF(error)); return; @@ -243,7 +243,8 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx, gpr_timespec deadline, grpc_closure *on_done, grpc_httpcli_response *response, const char *name, grpc_slice request_text) { - internal_request *req = gpr_malloc(sizeof(internal_request)); + internal_request *req = + (internal_request *)gpr_malloc(sizeof(internal_request)); memset(req, 0, sizeof(*req)); req->request_text = request_text; grpc_http_parser_init(&req->parser, GRPC_HTTP_RESPONSE, response); diff --git a/src/core/lib/http/parser.c b/src/core/lib/http/parser.c index 9c5e93f4e5..0950bd655e 100644 --- a/src/core/lib/http/parser.c +++ b/src/core/lib/http/parser.c @@ -28,7 +28,7 @@ grpc_tracer_flag grpc_http1_trace = GRPC_TRACER_INITIALIZER(false, "http1"); static char *buf2str(void *buffer, size_t length) { - char *out = gpr_malloc(length + 1); + char *out = (char *)gpr_malloc(length + 1); memcpy(out, buffer, length); out[length] = 0; return out; @@ -197,7 +197,8 @@ static grpc_error *add_header(grpc_http_parser *parser) { if (*hdr_count == parser->hdr_capacity) { parser->hdr_capacity = GPR_MAX(parser->hdr_capacity + 1, parser->hdr_capacity * 3 / 2); - *hdrs = gpr_realloc(*hdrs, parser->hdr_capacity * sizeof(**hdrs)); + *hdrs = (grpc_http_header *)gpr_realloc( + *hdrs, parser->hdr_capacity * sizeof(**hdrs)); } (*hdrs)[(*hdr_count)++] = hdr; @@ -255,7 +256,7 @@ static grpc_error *addbyte_body(grpc_http_parser *parser, uint8_t byte) { if (*body_length == parser->body_capacity) { parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2); - *body = gpr_realloc((void *)*body, parser->body_capacity); + *body = (char *)gpr_realloc((void *)*body, parser->body_capacity); } (*body)[*body_length] = (char)byte; (*body_length)++; diff --git a/src/core/lib/iomgr/closure.c b/src/core/lib/iomgr/closure.c index 26f9cbe0fa..7236e23cf7 100644 --- a/src/core/lib/iomgr/closure.c +++ b/src/core/lib/iomgr/closure.c @@ -109,7 +109,7 @@ typedef struct { static void closure_wrapper(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - wrapped_closure *wc = arg; + wrapped_closure *wc = (wrapped_closure *)arg; grpc_iomgr_cb_func cb = wc->cb; void *cb_arg = wc->cb_arg; gpr_free(wc); @@ -124,7 +124,7 @@ grpc_closure *grpc_closure_create(const char *file, int line, grpc_closure *grpc_closure_create(grpc_iomgr_cb_func cb, void *cb_arg, grpc_closure_scheduler *scheduler) { #endif - wrapped_closure *wc = gpr_malloc(sizeof(*wc)); + wrapped_closure *wc = (wrapped_closure *)gpr_malloc(sizeof(*wc)); wc->cb = cb; wc->cb_arg = cb_arg; #ifndef NDEBUG diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c index 3759dda992..dcd175a2e1 100644 --- a/src/core/lib/iomgr/error.c +++ b/src/core/lib/iomgr/error.c @@ -211,7 +211,7 @@ static uint8_t get_placement(grpc_error **err, size_t size) { #ifndef NDEBUG grpc_error *orig = *err; #endif - *err = gpr_realloc( + *err = (grpc_error *)gpr_realloc( *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)); #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { @@ -406,7 +406,8 @@ static grpc_error *copy_error_and_unref(grpc_error *in) { if (in->arena_capacity - in->arena_size < (uint8_t)SLOTS_PER_STR) { new_arena_capacity = (uint8_t)(3 * new_arena_capacity / 2); } - out = gpr_malloc(sizeof(*in) + new_arena_capacity * sizeof(intptr_t)); + out = (grpc_error *)gpr_malloc(sizeof(*in) + + new_arena_capacity * sizeof(intptr_t)); #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { gpr_log(GPR_DEBUG, "%p create copying %p", out, in); @@ -530,7 +531,7 @@ typedef struct { static void append_chr(char c, char **s, size_t *sz, size_t *cap) { if (*sz == *cap) { *cap = GPR_MAX(8, 3 * *cap / 2); - *s = gpr_realloc(*s, *cap); + *s = (char *)gpr_realloc(*s, *cap); } (*s)[(*sz)++] = c; } @@ -582,7 +583,8 @@ static void append_esc_str(const uint8_t *str, size_t len, char **s, size_t *sz, static void append_kv(kv_pairs *kvs, char *key, char *value) { if (kvs->num_kvs == kvs->cap_kvs) { kvs->cap_kvs = GPR_MAX(3 * kvs->cap_kvs / 2, 4); - kvs->kvs = gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs); + kvs->kvs = + (kv_pair *)gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs); } kvs->kvs[kvs->num_kvs].key = key; kvs->kvs[kvs->num_kvs].value = value; @@ -695,8 +697,8 @@ static char *errs_string(grpc_error *err) { } static int cmp_kvs(const void *a, const void *b) { - const kv_pair *ka = a; - const kv_pair *kb = b; + const kv_pair *ka = (const kv_pair *)a; + const kv_pair *kb = (const kv_pair *)b; return strcmp(ka->key, kb->key); } diff --git a/src/core/lib/iomgr/ev_epoll1_linux.c b/src/core/lib/iomgr/ev_epoll1_linux.c index b76eb9e1c9..5bc7e878de 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.c +++ b/src/core/lib/iomgr/ev_epoll1_linux.c @@ -260,7 +260,7 @@ static grpc_fd *fd_create(int fd, const char *name) { gpr_mu_unlock(&fd_freelist_mu); if (new_fd == NULL) { - new_fd = gpr_malloc(sizeof(grpc_fd)); + new_fd = (grpc_fd *)gpr_malloc(sizeof(grpc_fd)); } new_fd->fd = fd; @@ -442,8 +442,8 @@ static grpc_error *pollset_global_init(void) { return GRPC_OS_ERROR(errno, "epoll_ctl"); } g_num_neighbourhoods = GPR_CLAMP(gpr_cpu_num_cores(), 1, MAX_NEIGHBOURHOODS); - g_neighbourhoods = - gpr_zalloc(sizeof(*g_neighbourhoods) * g_num_neighbourhoods); + g_neighbourhoods = (pollset_neighbourhood *)gpr_zalloc( + sizeof(*g_neighbourhoods) * g_num_neighbourhoods); for (size_t i = 0; i < g_num_neighbourhoods; i++) { gpr_mu_init(&g_neighbourhoods[i].mu); } |