diff options
author | Yash Tibrewal <yashkt@google.com> | 2017-10-23 15:33:21 -0700 |
---|---|---|
committer | Yash Tibrewal <yashkt@google.com> | 2017-10-25 16:23:01 -0700 |
commit | 34a57d0346afe95e11104462c30dc468b0cb0b89 (patch) | |
tree | 67db15f7b8b361e0618199dc55215f3b4d626201 /test/core/iomgr | |
parent | c563b583cb9b7fecc33971581368796d2df4759d (diff) |
rename all test core files to cc and a lot of C++ style conversions
Diffstat (limited to 'test/core/iomgr')
-rw-r--r-- | test/core/iomgr/combiner_test.cc (renamed from test/core/iomgr/combiner_test.c) | 17 | ||||
-rw-r--r-- | test/core/iomgr/endpoint_pair_test.cc (renamed from test/core/iomgr/endpoint_pair_test.c) | 13 | ||||
-rw-r--r-- | test/core/iomgr/endpoint_tests.cc (renamed from test/core/iomgr/endpoint_tests.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/error_test.cc (renamed from test/core/iomgr/error_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/ev_epollsig_linux_test.cc (renamed from test/core/iomgr/ev_epollsig_linux_test.c) | 11 | ||||
-rw-r--r-- | test/core/iomgr/fd_conservation_posix_test.cc (renamed from test/core/iomgr/fd_conservation_posix_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/fd_posix_test.cc (renamed from test/core/iomgr/fd_posix_test.c) | 22 | ||||
-rw-r--r-- | test/core/iomgr/load_file_test.cc (renamed from test/core/iomgr/load_file_test.c) | 2 | ||||
-rw-r--r-- | test/core/iomgr/pollset_set_test.cc (renamed from test/core/iomgr/pollset_set_test.c) | 5 | ||||
-rw-r--r-- | test/core/iomgr/resolve_address_posix_test.cc (renamed from test/core/iomgr/resolve_address_posix_test.c) | 11 | ||||
-rw-r--r-- | test/core/iomgr/resolve_address_test.cc (renamed from test/core/iomgr/resolve_address_test.c) | 6 | ||||
-rw-r--r-- | test/core/iomgr/resource_quota_test.cc (renamed from test/core/iomgr/resource_quota_test.c) | 6 | ||||
-rw-r--r-- | test/core/iomgr/sockaddr_utils_test.cc (renamed from test/core/iomgr/sockaddr_utils_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/socket_utils_test.cc (renamed from test/core/iomgr/socket_utils_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/tcp_client_posix_test.cc (renamed from test/core/iomgr/tcp_client_posix_test.c) | 4 | ||||
-rw-r--r-- | test/core/iomgr/tcp_client_uv_test.cc (renamed from test/core/iomgr/tcp_client_uv_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/tcp_posix_test.cc (renamed from test/core/iomgr/tcp_posix_test.c) | 43 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_posix_test.cc (renamed from test/core/iomgr/tcp_server_posix_test.c) | 15 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_uv_test.cc (renamed from test/core/iomgr/tcp_server_uv_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/time_averaged_stats_test.cc (renamed from test/core/iomgr/time_averaged_stats_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/timer_heap_test.cc (renamed from test/core/iomgr/timer_heap_test.c) | 11 | ||||
-rw-r--r-- | test/core/iomgr/timer_list_test.cc (renamed from test/core/iomgr/timer_list_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/udp_server_test.cc (renamed from test/core/iomgr/udp_server_test.c) | 7 | ||||
-rw-r--r-- | test/core/iomgr/wakeup_fd_cv_test.cc (renamed from test/core/iomgr/wakeup_fd_cv_test.c) | 0 |
24 files changed, 94 insertions, 79 deletions
diff --git a/test/core/iomgr/combiner_test.c b/test/core/iomgr/combiner_test.cc index 38f512de0e..7d2d098d2b 100644 --- a/test/core/iomgr/combiner_test.c +++ b/test/core/iomgr/combiner_test.cc @@ -35,7 +35,7 @@ static void test_no_op(void) { static void set_event_to_true(grpc_exec_ctx *exec_ctx, void *value, grpc_error *error) { - gpr_event_set(value, (void *)1); + gpr_event_set(static_cast<gpr_event *>(value), (void *)1); } static void test_execute_one(void) { @@ -68,19 +68,19 @@ typedef struct { } ex_args; static void check_one(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) { - ex_args *args = a; + ex_args *args = static_cast<ex_args *>(a); GPR_ASSERT(*args->ctr == args->value - 1); *args->ctr = args->value; gpr_free(a); } static void execute_many_loop(void *a) { - thd_args *args = a; + thd_args *args = static_cast<thd_args *>(a); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; size_t n = 1; for (size_t i = 0; i < 10; i++) { for (size_t j = 0; j < 10000; j++) { - ex_args *c = gpr_malloc(sizeof(*c)); + ex_args *c = static_cast<ex_args *>(gpr_malloc(sizeof(*c))); c->ctr = &args->ctr; c->value = n++; GRPC_CLOSURE_SCHED(&exec_ctx, @@ -131,10 +131,11 @@ static void in_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { } static void add_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - GRPC_CLOSURE_SCHED(exec_ctx, - GRPC_CLOSURE_CREATE(in_finally, arg, - grpc_combiner_finally_scheduler(arg)), - GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_CREATE(in_finally, arg, + grpc_combiner_finally_scheduler( + static_cast<grpc_combiner *>(arg))), + GRPC_ERROR_NONE); } static void test_execute_finally(void) { diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.cc index f2ce3d0d12..c7ce6c0419 100644 --- a/test/core/iomgr/endpoint_pair_test.c +++ b/test/core/iomgr/endpoint_pair_test.cc @@ -34,10 +34,11 @@ static grpc_endpoint_test_fixture create_fixture_endpoint_pair( size_t slice_size) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_endpoint_test_fixture f; - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; grpc_endpoint_pair p = grpc_iomgr_create_endpoint_pair("test", &args); f.client_ep = p.client; @@ -55,7 +56,7 @@ static grpc_endpoint_test_config configs[] = { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -63,7 +64,7 @@ int main(int argc, char **argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); grpc_endpoint_tests(configs[0], g_pollset, g_mu); GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.cc index 61e901f645..61e901f645 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.cc diff --git a/test/core/iomgr/error_test.c b/test/core/iomgr/error_test.cc index 51f8af1957..51f8af1957 100644 --- a/test/core/iomgr/error_test.c +++ b/test/core/iomgr/error_test.cc diff --git a/test/core/iomgr/ev_epollsig_linux_test.c b/test/core/iomgr/ev_epollsig_linux_test.cc index 37aadacd49..23079c12c6 100644 --- a/test/core/iomgr/ev_epollsig_linux_test.c +++ b/test/core/iomgr/ev_epollsig_linux_test.cc @@ -92,14 +92,15 @@ static void test_fd_cleanup(grpc_exec_ctx *exec_ctx, test_fd *tfds, static void test_pollset_init(test_pollset *pollsets, int num_pollsets) { int i; for (i = 0; i < num_pollsets; i++) { - pollsets[i].pollset = gpr_zalloc(grpc_pollset_size()); + pollsets[i].pollset = + static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(pollsets[i].pollset, &pollsets[i].mu); } } static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, (grpc_pollset *)p); } static void test_pollset_cleanup(grpc_exec_ctx *exec_ctx, @@ -232,7 +233,7 @@ typedef struct threading_shared { static __thread int thread_wakeups = 0; static void test_threading_loop(void *arg) { - threading_shared *shared = arg; + threading_shared *shared = static_cast<threading_shared *>(arg); while (thread_wakeups < 1000000) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_pollset_worker *worker; @@ -247,7 +248,7 @@ static void test_threading_loop(void *arg) { static void test_threading_wakeup(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - threading_shared *shared = arg; + threading_shared *shared = static_cast<threading_shared *>(arg); ++shared->wakeups; ++thread_wakeups; if (error == GRPC_ERROR_NONE) { @@ -261,7 +262,7 @@ static void test_threading_wakeup(grpc_exec_ctx *exec_ctx, void *arg, static void test_threading(void) { threading_shared shared; - shared.pollset = gpr_zalloc(grpc_pollset_size()); + shared.pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(shared.pollset, &shared.mu); gpr_thd_id thds[10]; diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.cc index d29b1e8e41..d29b1e8e41 100644 --- a/test/core/iomgr/fd_conservation_posix_test.c +++ b/test/core/iomgr/fd_conservation_posix_test.cc diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.cc index 1c62f34d3e..63363a43a5 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.cc @@ -113,7 +113,7 @@ typedef struct { Close session FD and start to shutdown listen FD. */ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ bool success) { - session *se = arg; + session *se = static_cast<session *>(arg); server *sv = se->sv; grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, false /* already_closed */, "a"); @@ -126,7 +126,7 @@ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ /* Called when data become readable in a session. */ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ grpc_error *error) { - session *se = arg; + session *se = static_cast<session *>(arg); int fd = grpc_fd_wrapped_fd(se->em_fd); ssize_t read_once = 0; @@ -171,7 +171,7 @@ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ Close listen FD and signal that server can be shutdown. */ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */, int success) { - server *sv = arg; + server *sv = static_cast<server *>(arg); grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, false /* already_closed */, "b"); @@ -186,7 +186,7 @@ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */, /* Called when a new TCP connection request arrives in the listening port. */ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/ grpc_error *error) { - server *sv = arg; + server *sv = static_cast<server *>(arg); int fd; int flags; session *se; @@ -204,7 +204,7 @@ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/ GPR_ASSERT(fd < FD_SETSIZE); flags = fcntl(fd, F_GETFL, 0); fcntl(fd, F_SETFL, flags | O_NONBLOCK); - se = gpr_malloc(sizeof(*se)); + se = static_cast<session *>(gpr_malloc(sizeof(*se))); se->sv = sv; se->em_fd = grpc_fd_create(fd, "listener"); grpc_pollset_add_fd(exec_ctx, g_pollset, se->em_fd); @@ -291,7 +291,7 @@ static void client_init(client *cl) { /* Called when a client upload session is ready to shutdown. */ static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*client */, int success) { - client *cl = arg; + client *cl = static_cast<client *>(arg); grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, false /* already_closed */, "c"); cl->done = 1; @@ -302,7 +302,7 @@ static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx, /* Write as much as possible, then register notify_on_write. */ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */ grpc_error *error) { - client *cl = arg; + client *cl = static_cast<client *>(arg); int fd = grpc_fd_wrapped_fd(cl->em_fd); ssize_t write_once = 0; @@ -409,7 +409,7 @@ void destroy_change_data(fd_change_data *fdc) {} static void first_read_callback(grpc_exec_ctx *exec_ctx, void *arg /* fd_change_data */, grpc_error *error) { - fd_change_data *fdc = arg; + fd_change_data *fdc = static_cast<fd_change_data *>(arg); gpr_mu_lock(g_mu); fdc->cb_that_ran = first_read_callback; @@ -421,7 +421,7 @@ static void first_read_callback(grpc_exec_ctx *exec_ctx, static void second_read_callback(grpc_exec_ctx *exec_ctx, void *arg /* fd_change_data */, grpc_error *error) { - fd_change_data *fdc = arg; + fd_change_data *fdc = static_cast<fd_change_data *>(arg); gpr_mu_lock(g_mu); fdc->cb_that_ran = second_read_callback; @@ -516,7 +516,7 @@ static void test_grpc_fd_change(void) { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -524,7 +524,7 @@ int main(int argc, char **argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); test_grpc_fd(); test_grpc_fd_change(); diff --git a/test/core/iomgr/load_file_test.c b/test/core/iomgr/load_file_test.cc index 537c3430b1..5fb8266b10 100644 --- a/test/core/iomgr/load_file_test.c +++ b/test/core/iomgr/load_file_test.cc @@ -122,7 +122,7 @@ static void test_load_big_file(void) { grpc_error *error; char *tmp_name; static const size_t buffer_size = 124631; - unsigned char *buffer = gpr_malloc(buffer_size); + unsigned char *buffer = static_cast<unsigned char *>(gpr_malloc(buffer_size)); unsigned char *current; size_t i; diff --git a/test/core/iomgr/pollset_set_test.c b/test/core/iomgr/pollset_set_test.cc index cddc146ce0..ae19c81d6d 100644 --- a/test/core/iomgr/pollset_set_test.c +++ b/test/core/iomgr/pollset_set_test.cc @@ -65,14 +65,15 @@ typedef struct test_pollset { static void init_test_pollsets(test_pollset *pollsets, const int num_pollsets) { for (int i = 0; i < num_pollsets; i++) { - pollsets[i].ps = gpr_zalloc(grpc_pollset_size()); + pollsets[i].ps = + static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(pollsets[i].ps, &pollsets[i].mu); } } static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } static void cleanup_test_pollsets(grpc_exec_ctx *exec_ctx, diff --git a/test/core/iomgr/resolve_address_posix_test.c b/test/core/iomgr/resolve_address_posix_test.cc index cb9d6080fb..572b4222b5 100644 --- a/test/core/iomgr/resolve_address_posix_test.c +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -50,7 +50,7 @@ static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} void args_init(grpc_exec_ctx *exec_ctx, args_struct *args) { gpr_event_init(&args->ev); - args->pollset = gpr_zalloc(grpc_pollset_size()); + args->pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(args->pollset, &args->mu); args->pollset_set = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset); @@ -78,7 +78,7 @@ static grpc_millis n_sec_deadline(int seconds) { } static void actually_poll(void *argsp) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_millis deadline = n_sec_deadline(10); while (true) { @@ -109,7 +109,7 @@ static void poll_pollset_until_request_done(args_struct *args) { static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err == GRPC_ERROR_NONE); GPR_ASSERT(args->addrs != NULL); GPR_ASSERT(args->addrs->naddrs > 0); @@ -117,7 +117,7 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, } static void must_fail(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err != GRPC_ERROR_NONE); gpr_atm_rel_store(&args->done_atm, 1); } @@ -142,7 +142,8 @@ static void test_unix_socket_path_name_too_long(void) { const char prefix[] = "unix:/path/name"; size_t path_name_length = GPR_ARRAY_SIZE(((struct sockaddr_un *)0)->sun_path) + 6; - char *path_name = gpr_malloc(sizeof(char) * path_name_length); + char *path_name = + static_cast<char *>(gpr_malloc(sizeof(char) * path_name_length)); memset(path_name, 'a', path_name_length); memcpy(path_name, prefix, strlen(prefix) - 1); path_name[path_name_length - 1] = '\0'; diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.cc index 178bbbb95f..da6aab3518 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.cc @@ -43,7 +43,7 @@ static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} void args_init(grpc_exec_ctx *exec_ctx, args_struct *args) { gpr_event_init(&args->ev); - args->pollset = gpr_zalloc(grpc_pollset_size()); + args->pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(args->pollset, &args->mu); args->pollset_set = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset); @@ -98,7 +98,7 @@ static void poll_pollset_until_request_done(args_struct *args) { static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err == GRPC_ERROR_NONE); GPR_ASSERT(args->addrs != NULL); GPR_ASSERT(args->addrs->naddrs > 0); @@ -110,7 +110,7 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, } static void must_fail(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err != GRPC_ERROR_NONE); gpr_atm_rel_store(&args->done_atm, 1); gpr_mu_lock(args->mu); diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.cc index b588f3d120..f0002e0947 100644 --- a/test/core/iomgr/resource_quota_test.c +++ b/test/core/iomgr/resource_quota_test.cc @@ -58,7 +58,7 @@ typedef struct { static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) { GPR_ASSERT(error == GRPC_ERROR_NONE); - reclaimer_args *a = args; + reclaimer_args *a = static_cast<reclaimer_args *>(args); grpc_resource_user_free(exec_ctx, a->resource_user, a->size); grpc_resource_user_finish_reclamation(exec_ctx, a->resource_user); GRPC_CLOSURE_RUN(exec_ctx, a->then, GRPC_ERROR_NONE); @@ -66,7 +66,7 @@ static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args, } grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size, grpc_closure *then) { - reclaimer_args *a = gpr_malloc(sizeof(*a)); + reclaimer_args *a = static_cast<reclaimer_args *>(gpr_malloc(sizeof(*a))); a->size = size; a->resource_user = resource_user; a->then = then; @@ -76,7 +76,7 @@ grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size, static void unused_reclaimer_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { GPR_ASSERT(error == GRPC_ERROR_CANCELLED); - GRPC_CLOSURE_RUN(exec_ctx, arg, GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, static_cast<grpc_closure *>(arg), GRPC_ERROR_NONE); } grpc_closure *make_unused_reclaimer(grpc_closure *then) { return GRPC_CLOSURE_CREATE(unused_reclaimer_cb, then, diff --git a/test/core/iomgr/sockaddr_utils_test.c b/test/core/iomgr/sockaddr_utils_test.cc index e4a4ddaa99..e4a4ddaa99 100644 --- a/test/core/iomgr/sockaddr_utils_test.c +++ b/test/core/iomgr/sockaddr_utils_test.cc diff --git a/test/core/iomgr/socket_utils_test.c b/test/core/iomgr/socket_utils_test.cc index 30f0c943dc..30f0c943dc 100644 --- a/test/core/iomgr/socket_utils_test.c +++ b/test/core/iomgr/socket_utils_test.cc diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.cc index b8b76d1c42..b2dcb1d04f 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.cc @@ -190,7 +190,7 @@ void test_fails(void) { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -199,7 +199,7 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); g_pollset_set = grpc_pollset_set_create(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); grpc_pollset_set_add_pollset(&exec_ctx, g_pollset_set, g_pollset); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/tcp_client_uv_test.c b/test/core/iomgr/tcp_client_uv_test.cc index edfccbe867..edfccbe867 100644 --- a/test/core/iomgr/tcp_client_uv_test.c +++ b/test/core/iomgr/tcp_client_uv_test.cc diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.cc index 6501160c6f..8a4433b55c 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.cc @@ -171,10 +171,10 @@ static void read_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER, a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args, "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); @@ -223,10 +223,11 @@ static void large_read_test(size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "large_read_test"), &args, "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); @@ -363,10 +364,10 @@ static void write_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER, a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "write_test"), &args, "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); @@ -433,10 +434,11 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args, "test"); GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0); @@ -525,10 +527,11 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair( create_sockets(sv); grpc_resource_quota *resource_quota = grpc_resource_quota_create("tcp_posix_test_socketpair"); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; f.client_ep = grpc_tcp_create( &exec_ctx, grpc_fd_create(sv[0], "fixture:client"), &args, "test"); f.server_ep = grpc_tcp_create( diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.cc index 782dfb413a..a44e3954f2 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -112,7 +112,7 @@ static void on_connect_result_set(on_connect_result *result, static void server_weak_ref_shutdown(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - server_weak_ref *weak_ref = arg; + server_weak_ref *weak_ref = static_cast<server_weak_ref *>(arg); weak_ref->server = NULL; } @@ -429,22 +429,25 @@ static void test_connect(size_t num_connects, static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { grpc_closure destroyed; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_arg chan_args[] = { - {GRPC_ARG_INTEGER, GRPC_ARG_EXPAND_WILDCARD_ADDRS, {.integer = 1}}}; + grpc_arg chan_args[1]; + chan_args[0].type = GRPC_ARG_INTEGER; + chan_args[0].key = const_cast<char *>(GRPC_ARG_EXPAND_WILDCARD_ADDRS); + chan_args[0].value.integer = 1; const grpc_channel_args channel_args = {1, chan_args}; struct ifaddrs *ifa = NULL; struct ifaddrs *ifa_it; // Zalloc dst_addrs to avoid oversized frames. - test_addrs *dst_addrs = gpr_zalloc(sizeof(*dst_addrs)); + test_addrs *dst_addrs = + static_cast<test_addrs *>(gpr_zalloc(sizeof(*dst_addrs))); grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); test_no_op(); diff --git a/test/core/iomgr/tcp_server_uv_test.c b/test/core/iomgr/tcp_server_uv_test.cc index 9fafd3177a..9fafd3177a 100644 --- a/test/core/iomgr/tcp_server_uv_test.c +++ b/test/core/iomgr/tcp_server_uv_test.cc diff --git a/test/core/iomgr/time_averaged_stats_test.c b/test/core/iomgr/time_averaged_stats_test.cc index 508e3c5bf8..508e3c5bf8 100644 --- a/test/core/iomgr/time_averaged_stats_test.c +++ b/test/core/iomgr/time_averaged_stats_test.cc diff --git a/test/core/iomgr/timer_heap_test.c b/test/core/iomgr/timer_heap_test.cc index ee5a474fd1..3eb25dd0be 100644 --- a/test/core/iomgr/timer_heap_test.c +++ b/test/core/iomgr/timer_heap_test.cc @@ -35,7 +35,8 @@ static gpr_atm random_deadline(void) { return rand(); } static grpc_timer *create_test_elements(size_t num_elements) { - grpc_timer *elems = gpr_malloc(num_elements * sizeof(grpc_timer)); + grpc_timer *elems = + static_cast<grpc_timer *>(gpr_malloc(num_elements * sizeof(grpc_timer))); size_t i; for (i = 0; i < num_elements; i++) { elems[i].deadline = random_deadline(); @@ -75,7 +76,7 @@ static void test1(void) { const size_t num_test_operations = 10000; size_t i; grpc_timer *test_elements = create_test_elements(num_test_elements); - uint8_t *inpq = gpr_malloc(num_test_elements); + uint8_t *inpq = static_cast<uint8_t *>(gpr_malloc(num_test_elements)); gpr_log(GPR_INFO, "test1"); @@ -135,7 +136,8 @@ typedef struct { static elem_struct *search_elems(elem_struct *elems, size_t count, bool inserted) { - size_t *search_order = gpr_malloc(count * sizeof(*search_order)); + size_t *search_order = + static_cast<size_t *>(gpr_malloc(count * sizeof(*search_order))); for (size_t i = 0; i < count; i++) { search_order[i] = i; } @@ -160,7 +162,8 @@ static void test2(void) { grpc_timer_heap pq; static const size_t elems_size = 1000; - elem_struct *elems = gpr_malloc(elems_size * sizeof(elem_struct)); + elem_struct *elems = + static_cast<elem_struct *>(gpr_malloc(elems_size * sizeof(elem_struct))); size_t num_inserted = 0; grpc_timer_heap_init(&pq); diff --git a/test/core/iomgr/timer_list_test.c b/test/core/iomgr/timer_list_test.cc index c3d9f9d88d..c3d9f9d88d 100644 --- a/test/core/iomgr/timer_list_test.c +++ b/test/core/iomgr/timer_list_test.cc diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.cc index 2e44d0abc8..51c7ab8c29 100644 --- a/test/core/iomgr/udp_server_test.c +++ b/test/core/iomgr/udp_server_test.cc @@ -118,7 +118,8 @@ static const grpc_socket_factory_vtable test_socket_factory_vtable = { test_socket_factory_compare, test_socket_factory_destroy}; static test_socket_factory *test_socket_factory_create(void) { - test_socket_factory *factory = gpr_malloc(sizeof(test_socket_factory)); + test_socket_factory *factory = static_cast<test_socket_factory *>( + gpr_malloc(sizeof(test_socket_factory))); grpc_socket_factory_init(&factory->base, &test_socket_factory_vtable); factory->number_of_socket_calls = 0; factory->number_of_bind_calls = 0; @@ -292,7 +293,7 @@ static void test_receive(int number_of_clients) { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -300,7 +301,7 @@ int main(int argc, char **argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); test_no_op(); diff --git a/test/core/iomgr/wakeup_fd_cv_test.c b/test/core/iomgr/wakeup_fd_cv_test.cc index 0b211274f2..0b211274f2 100644 --- a/test/core/iomgr/wakeup_fd_cv_test.c +++ b/test/core/iomgr/wakeup_fd_cv_test.cc |