diff options
Diffstat (limited to 'test/core/util')
-rw-r--r-- | test/core/util/memory_counters.c | 8 | ||||
-rw-r--r-- | test/core/util/mock_endpoint.c | 2 | ||||
-rw-r--r-- | test/core/util/passthru_endpoint.c | 2 | ||||
-rw-r--r-- | test/core/util/port.c | 3 | ||||
-rw-r--r-- | test/core/util/port_server_client.c | 10 | ||||
-rw-r--r-- | test/core/util/slice_splitter.c | 9 | ||||
-rw-r--r-- | test/core/util/trickle_endpoint.c | 4 |
7 files changed, 20 insertions, 18 deletions
diff --git a/test/core/util/memory_counters.c b/test/core/util/memory_counters.c index b898057034..9fb3ffe095 100644 --- a/test/core/util/memory_counters.c +++ b/test/core/util/memory_counters.c @@ -48,13 +48,13 @@ static void *guard_malloc(size_t size) { NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, (gpr_atm)size); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_allocs_absolute, (gpr_atm)1); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_allocs_relative, (gpr_atm)1); - ptr = g_old_allocs.malloc_fn(size + sizeof(size)); + ptr = (size_t *)g_old_allocs.malloc_fn(size + sizeof(size)); *ptr++ = size; return ptr; } static void *guard_realloc(void *vptr, size_t size) { - size_t *ptr = vptr; + size_t *ptr = (size_t *)vptr; if (vptr == NULL) { return guard_malloc(size); } @@ -67,13 +67,13 @@ static void *guard_realloc(void *vptr, size_t size) { NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, -(gpr_atm)*ptr); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, (gpr_atm)size); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_allocs_absolute, (gpr_atm)1); - ptr = g_old_allocs.realloc_fn(ptr, size + sizeof(size)); + ptr = (size_t *)g_old_allocs.realloc_fn(ptr, size + sizeof(size)); *ptr++ = size; return ptr; } static void guard_free(void *vptr) { - size_t *ptr = vptr; + size_t *ptr = (size_t *)vptr; if (!vptr) return; --ptr; NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, -(gpr_atm)*ptr); diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.c index 40cf0a2652..bd386b2148 100644 --- a/test/core/util/mock_endpoint.c +++ b/test/core/util/mock_endpoint.c @@ -110,7 +110,7 @@ static const grpc_endpoint_vtable vtable = { grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice), grpc_resource_quota *resource_quota) { - grpc_mock_endpoint *m = gpr_malloc(sizeof(*m)); + grpc_mock_endpoint *m = (grpc_mock_endpoint *)gpr_malloc(sizeof(*m)); m->base.vtable = &vtable; char *name; gpr_asprintf(&name, "mock_endpoint_%" PRIxPTR, (intptr_t)m); diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c index eef1f163f0..38a47584d5 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.c @@ -183,7 +183,7 @@ void grpc_passthru_endpoint_create(grpc_endpoint **client, grpc_endpoint **server, grpc_resource_quota *resource_quota, grpc_passthru_endpoint_stats *stats) { - passthru_endpoint *m = gpr_malloc(sizeof(*m)); + passthru_endpoint *m = (passthru_endpoint *)gpr_malloc(sizeof(*m)); m->halves = 2; m->shutdown = 0; m->stats = stats == NULL ? &m->dummy_stats : stats; diff --git a/test/core/util/port.c b/test/core/util/port.c index b1fc722858..61f2e5018f 100644 --- a/test/core/util/port.c +++ b/test/core/util/port.c @@ -75,7 +75,8 @@ static void chose_port(int port) { atexit(free_chosen_ports); } num_chosen_ports++; - chosen_ports = gpr_realloc(chosen_ports, sizeof(int) * num_chosen_ports); + chosen_ports = + (int *)gpr_realloc(chosen_ports, sizeof(int) * num_chosen_ports); chosen_ports[num_chosen_ports - 1] = port; } diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.c index 1b015c95e9..ba4028dbee 100644 --- a/test/core/util/port_server_client.c +++ b/test/core/util/port_server_client.c @@ -42,14 +42,14 @@ typedef struct freereq { static void destroy_pops_and_shutdown(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset *pollset = grpc_polling_entity_pollset(p); + grpc_pollset *pollset = grpc_polling_entity_pollset((grpc_polling_entity *)p); grpc_pollset_destroy(exec_ctx, pollset); gpr_free(pollset); } static void freed_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - freereq *pr = arg; + freereq *pr = (freereq *)arg; gpr_mu_lock(pr->mu); pr->done = 1; GRPC_LOG_IF_ERROR( @@ -74,7 +74,7 @@ void grpc_free_port_using_server(int port) { memset(&req, 0, sizeof(req)); memset(&rsp, 0, sizeof(rsp)); - grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); + grpc_pollset *pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &pr.mu); pr.pops = grpc_polling_entity_create_from_pollset(pollset); shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops, @@ -131,7 +131,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { size_t i; int port = 0; - portreq *pr = arg; + portreq *pr = (portreq *)arg; int failed = 0; grpc_httpcli_response *response = &pr->response; @@ -207,7 +207,7 @@ int grpc_pick_port_using_server(void) { memset(&pr, 0, sizeof(pr)); memset(&req, 0, sizeof(req)); - grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); + grpc_pollset *pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &pr.mu); pr.pops = grpc_polling_entity_create_from_pollset(pollset); shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops, diff --git a/test/core/util/slice_splitter.c b/test/core/util/slice_splitter.c index f6d892f166..6fcef9acce 100644 --- a/test/core/util/slice_splitter.c +++ b/test/core/util/slice_splitter.c @@ -44,7 +44,8 @@ void grpc_split_slices(grpc_slice_split_mode mode, grpc_slice *src_slices, switch (mode) { case GRPC_SLICE_SPLIT_IDENTITY: *dst_slice_count = src_slice_count; - *dst_slices = gpr_malloc(sizeof(grpc_slice) * src_slice_count); + *dst_slices = + (grpc_slice *)gpr_malloc(sizeof(grpc_slice) * src_slice_count); for (i = 0; i < src_slice_count; i++) { (*dst_slices)[i] = src_slices[i]; grpc_slice_ref((*dst_slices)[i]); @@ -56,7 +57,7 @@ void grpc_split_slices(grpc_slice_split_mode mode, grpc_slice *src_slices, for (i = 0; i < src_slice_count; i++) { length += GRPC_SLICE_LENGTH(src_slices[i]); } - *dst_slices = gpr_malloc(sizeof(grpc_slice)); + *dst_slices = (grpc_slice *)gpr_malloc(sizeof(grpc_slice)); **dst_slices = grpc_slice_malloc(length); length = 0; for (i = 0; i < src_slice_count; i++) { @@ -72,7 +73,7 @@ void grpc_split_slices(grpc_slice_split_mode mode, grpc_slice *src_slices, length += GRPC_SLICE_LENGTH(src_slices[i]); } *dst_slice_count = length; - *dst_slices = gpr_malloc(sizeof(grpc_slice) * length); + *dst_slices = (grpc_slice *)gpr_malloc(sizeof(grpc_slice) * length); length = 0; for (i = 0; i < src_slice_count; i++) { for (j = 0; j < GRPC_SLICE_LENGTH(src_slices[i]); j++) { @@ -112,7 +113,7 @@ grpc_slice grpc_slice_merge(grpc_slice *slices, size_t nslices) { for (i = 0; i < nslices; i++) { if (GRPC_SLICE_LENGTH(slices[i]) + length > capacity) { capacity = GPR_MAX(capacity * 2, GRPC_SLICE_LENGTH(slices[i]) + length); - out = gpr_realloc(out, capacity); + out = (uint8_t *)gpr_realloc(out, capacity); } memcpy(out + length, GRPC_SLICE_START_PTR(slices[i]), GRPC_SLICE_LENGTH(slices[i])); diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.c index 4f3c30dcf6..fc066f9d80 100644 --- a/test/core/util/trickle_endpoint.c +++ b/test/core/util/trickle_endpoint.c @@ -128,7 +128,7 @@ static int te_get_fd(grpc_endpoint *ep) { static void te_finish_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - trickle_endpoint *te = arg; + trickle_endpoint *te = (trickle_endpoint *)arg; gpr_mu_lock(&te->mu); te->writing = false; grpc_slice_buffer_reset_and_unref(&te->writing_buffer); @@ -142,7 +142,7 @@ static const grpc_endpoint_vtable vtable = { grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap, double bytes_per_second) { - trickle_endpoint *te = gpr_malloc(sizeof(*te)); + trickle_endpoint *te = (trickle_endpoint *)gpr_malloc(sizeof(*te)); te->base.vtable = &vtable; te->wrapped = wrap; te->bytes_per_second = bytes_per_second; |