C++ cast for void*

reviewable/pr24841/r1
Esun Kim 4 years ago
parent ec0b88a5d7
commit 2ff84ed8c2
  1. 2
      src/core/ext/filters/client_channel/client_channel_plugin.cc
  2. 10
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  3. 6
      src/core/ext/filters/deadline/deadline_filter.cc
  4. 12
      src/core/ext/filters/http/client_authority_filter.cc
  5. 9
      src/core/ext/filters/http/http_filters_plugin.cc
  6. 2
      src/core/ext/filters/workarounds/workaround_utils.cc
  7. 2
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  8. 4
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  9. 2
      src/core/ext/transport/inproc/inproc_transport.cc
  10. 2
      src/core/lib/gpr/alloc.cc
  11. 6
      src/core/lib/gpr/sync.cc
  12. 3
      src/core/lib/http/parser.cc
  13. 17
      src/core/lib/iomgr/error.cc
  14. 5
      src/core/lib/iomgr/ev_epoll1_linux.cc
  15. 8
      src/core/lib/iomgr/ev_epollex_linux.cc
  16. 2
      src/core/lib/iomgr/ev_poll_posix.cc
  17. 7
      src/core/lib/iomgr/lockfree_event.cc
  18. 3
      src/core/lib/iomgr/tcp_server_custom.cc
  19. 2
      src/core/lib/iomgr/timer_custom.cc
  20. 2
      src/core/lib/security/credentials/jwt/json_token.cc
  21. 4
      src/core/lib/security/credentials/jwt/jwt_verifier.cc
  22. 2
      src/core/lib/security/credentials/plugin/plugin_credentials.cc
  23. 8
      src/core/lib/security/credentials/ssl/ssl_credentials.cc
  24. 2
      src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc
  25. 6
      src/core/lib/security/security_connector/ssl/ssl_security_connector.cc
  26. 4
      src/core/lib/security/security_connector/ssl_utils.cc
  27. 8
      src/core/lib/security/security_connector/tls/tls_security_connector.cc
  28. 3
      src/core/lib/surface/call.cc
  29. 2
      src/core/lib/surface/channel_init.cc
  30. 11
      src/core/lib/surface/init.cc
  31. 4
      src/core/lib/transport/status_metadata.cc
  32. 9
      src/core/tsi/alts/crypt/gsec.cc
  33. 21
      src/core/tsi/ssl_transport_security.cc
  34. 2
      src/cpp/common/channel_filter.cc
  35. 4
      src/cpp/server/server_builder.cc
  36. 8
      test/core/bad_client/bad_client.cc
  37. 2
      test/core/bad_client/tests/duplicate_header.cc
  38. 2
      test/core/bad_client/tests/head_of_line_blocking.cc
  39. 2
      test/core/bad_client/tests/server_registered_method.cc
  40. 2
      test/core/bad_client/tests/simple_request.cc
  41. 2
      test/core/bad_connection/close_fd_test.cc
  42. 2
      test/core/bad_ssl/bad_ssl_test.cc
  43. 3
      test/core/bad_ssl/server_common.cc
  44. 12
      test/core/channel/channel_stack_builder_test.cc
  45. 4
      test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
  46. 2
      test/core/client_channel/resolvers/dns_resolver_cooldown_test.cc
  47. 2
      test/core/client_channel/resolvers/fake_resolver_test.cc
  48. 4
      test/core/end2end/bad_server_response_test.cc
  49. 2
      test/core/end2end/connection_refused_test.cc
  50. 2
      test/core/end2end/dualstack_socket_test.cc
  51. 2
      test/core/end2end/fuzzers/client_fuzzer.cc
  52. 12
      test/core/end2end/fuzzers/server_fuzzer.cc
  53. 2
      test/core/end2end/goaway_server_test.cc
  54. 2
      test/core/end2end/h2_ssl_session_reuse_test.cc
  55. 2
      test/core/end2end/invalid_call_argument_test.cc
  56. 2
      test/core/end2end/no_server_test.cc
  57. 2
      test/core/end2end/tests/authority_not_supported.cc
  58. 2
      test/core/end2end/tests/bad_hostname.cc
  59. 2
      test/core/end2end/tests/bad_ping.cc
  60. 2
      test/core/end2end/tests/binary_metadata.cc
  61. 2
      test/core/end2end/tests/call_creds.cc
  62. 2
      test/core/end2end/tests/call_host_override.cc
  63. 2
      test/core/end2end/tests/cancel_after_accept.cc
  64. 2
      test/core/end2end/tests/cancel_after_client_done.cc
  65. 2
      test/core/end2end/tests/cancel_after_invoke.cc
  66. 2
      test/core/end2end/tests/cancel_after_round_trip.cc
  67. 2
      test/core/end2end/tests/cancel_before_invoke.cc
  68. 2
      test/core/end2end/tests/cancel_in_a_vacuum.cc
  69. 2
      test/core/end2end/tests/cancel_with_status.cc
  70. 2
      test/core/end2end/tests/channelz.cc
  71. 2
      test/core/end2end/tests/client_streaming.cc
  72. 2
      test/core/end2end/tests/compressed_payload.cc
  73. 8
      test/core/end2end/tests/connectivity.cc
  74. 2
      test/core/end2end/tests/default_host.cc
  75. 2
      test/core/end2end/tests/disappearing_server.cc
  76. 2
      test/core/end2end/tests/empty_batch.cc
  77. 2
      test/core/end2end/tests/filter_causes_close.cc
  78. 22
      test/core/end2end/tests/filter_context.cc
  79. 2
      test/core/end2end/tests/filter_init_fails.cc
  80. 20
      test/core/end2end/tests/filter_latency.cc
  81. 20
      test/core/end2end/tests/filter_status_code.cc
  82. 2
      test/core/end2end/tests/graceful_server_shutdown.cc
  83. 2
      test/core/end2end/tests/high_initial_seqno.cc
  84. 2
      test/core/end2end/tests/hpack_size.cc
  85. 2
      test/core/end2end/tests/idempotent_request.cc
  86. 2
      test/core/end2end/tests/invoke_large_request.cc
  87. 2
      test/core/end2end/tests/keepalive_timeout.cc
  88. 2
      test/core/end2end/tests/large_metadata.cc
  89. 2
      test/core/end2end/tests/max_concurrent_streams.cc
  90. 2
      test/core/end2end/tests/max_connection_age.cc
  91. 2
      test/core/end2end/tests/max_connection_idle.cc
  92. 2
      test/core/end2end/tests/max_message_length.cc
  93. 2
      test/core/end2end/tests/negative_deadline.cc
  94. 2
      test/core/end2end/tests/no_error_on_hotpath.cc
  95. 2
      test/core/end2end/tests/no_logging.cc
  96. 2
      test/core/end2end/tests/no_op.cc
  97. 2
      test/core/end2end/tests/payload.cc
  98. 2
      test/core/end2end/tests/ping.cc
  99. 2
      test/core/end2end/tests/ping_pong_streaming.cc
  100. 2
      test/core/end2end/tests/proxy_auth.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -54,7 +54,7 @@ void grpc_client_channel_init(void) {
grpc_core::GlobalSubchannelPool::Init();
grpc_channel_init_register_stage(
GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter,
(void*)&grpc_client_channel_filter);
const_cast<grpc_channel_filter*>(&grpc_client_channel_filter));
grpc_http_connect_register_handshaker_factory();
grpc_client_channel_global_init_backup_polling();
}

@ -1358,7 +1358,7 @@ GrpcLb::GrpcLb(Args args)
}
GrpcLb::~GrpcLb() {
gpr_free((void*)server_name_);
gpr_free(const_cast<char*>(server_name_));
grpc_channel_args_destroy(args_);
}
@ -1782,10 +1782,10 @@ void grpc_lb_policy_grpclb_init() {
grpc_core::LoadBalancingPolicyRegistry::Builder::
RegisterLoadBalancingPolicyFactory(
absl::make_unique<grpc_core::GrpcLbFactory>());
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_client_load_reporting_filter,
(void*)&grpc_client_load_reporting_filter);
grpc_channel_init_register_stage(
GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_client_load_reporting_filter,
const_cast<grpc_channel_filter*>(&grpc_client_load_reporting_filter));
}
void grpc_lb_policy_grpclb_shutdown() {}

@ -383,10 +383,12 @@ static bool maybe_add_deadline_filter(grpc_channel_stack_builder* builder,
void grpc_deadline_filter_init(void) {
grpc_channel_init_register_stage(
GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_deadline_filter, (void*)&grpc_client_deadline_filter);
maybe_add_deadline_filter,
const_cast<grpc_channel_filter*>(&grpc_client_deadline_filter));
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_deadline_filter, (void*)&grpc_server_deadline_filter);
maybe_add_deadline_filter,
const_cast<grpc_channel_filter*>(&grpc_server_deadline_filter));
}
void grpc_deadline_filter_shutdown(void) {}

@ -148,12 +148,12 @@ static bool add_client_authority_filter(grpc_channel_stack_builder* builder,
}
void grpc_client_authority_filter_init(void) {
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX,
add_client_authority_filter,
(void*)&grpc_client_authority_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX,
add_client_authority_filter,
(void*)&grpc_client_authority_filter);
grpc_channel_init_register_stage(
GRPC_CLIENT_SUBCHANNEL, INT_MAX, add_client_authority_filter,
const_cast<grpc_channel_filter*>(&grpc_client_authority_filter));
grpc_channel_init_register_stage(
GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, add_client_authority_filter,
const_cast<grpc_channel_filter*>(&grpc_client_authority_filter));
}
void grpc_client_authority_filter_shutdown(void) {}

@ -93,13 +93,16 @@ void grpc_http_filters_init(void) {
maybe_add_optional_filter<true>, &decompress_filter);
grpc_channel_init_register_stage(
GRPC_CLIENT_SUBCHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_required_filter, (void*)&grpc_http_client_filter);
maybe_add_required_filter,
const_cast<grpc_channel_filter*>(&grpc_http_client_filter));
grpc_channel_init_register_stage(
GRPC_CLIENT_DIRECT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_required_filter, (void*)&grpc_http_client_filter);
maybe_add_required_filter,
const_cast<grpc_channel_filter*>(&grpc_http_client_filter));
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
maybe_add_required_filter, (void*)&grpc_http_server_filter);
maybe_add_required_filter,
const_cast<grpc_channel_filter*>(&grpc_http_server_filter));
}
void grpc_http_filters_shutdown(void) {}

@ -42,7 +42,7 @@ grpc_workaround_user_agent_md* grpc_parse_user_agent(grpc_mdelem md) {
user_agent_md->workaround_active[i] = ua_parser[i](md);
}
}
grpc_mdelem_set_user_data(md, destroy_user_agent_md, (void*)user_agent_md);
grpc_mdelem_set_user_data(md, destroy_user_agent_md, user_agent_md);
return user_agent_md;
}

@ -749,7 +749,7 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
GPR_ASSERT(t->accepting_stream == nullptr);
t->accepting_stream = &accepting;
t->accept_stream_cb(t->accept_stream_cb_user_data, &t->base,
(void*)static_cast<uintptr_t>(id));
reinterpret_cast<void*>(id));
t->accepting_stream = nullptr;
return accepting;
}

@ -1059,8 +1059,8 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) {
unsigned int header_index;
for (header_index = 0; header_index < s->header_array.count;
header_index++) {
gpr_free((void*)s->header_array.headers[header_index].key);
gpr_free((void*)s->header_array.headers[header_index].value);
gpr_free(s->header_array.headers[header_index].key);
gpr_free(s->header_array.headers[header_index].value);
}
stream_state->state_op_done[OP_SEND_INITIAL_METADATA] = true;
if (t->use_packet_coalescing) {

@ -153,7 +153,7 @@ struct inproc_stream {
// side to avoid destruction
INPROC_LOG(GPR_INFO, "calling accept stream cb %p %p",
st->accept_stream_cb, st->accept_stream_data);
(*st->accept_stream_cb)(st->accept_stream_data, &st->base, (void*)this);
(*st->accept_stream_cb)(st->accept_stream_data, &st->base, this);
} else {
// This is the server-side and is being called through accept_stream_cb
inproc_stream* cs = (inproc_stream*)server_data;

@ -68,7 +68,7 @@ void* gpr_malloc_aligned(size_t size, size_t alignment) {
void* p = gpr_malloc(size + extra);
void** ret = (void**)(((uintptr_t)p + extra) & ~(alignment - 1));
ret[-1] = p;
return (void*)ret;
return ret;
}
void gpr_free_aligned(void* ptr) { gpr_free((static_cast<void**>(ptr))[-1]); }

@ -67,16 +67,16 @@ void gpr_event_set(gpr_event* ev, void* value) {
}
void* gpr_event_get(gpr_event* ev) {
return (void*)gpr_atm_acq_load(&ev->state);
return reinterpret_cast<void*>(gpr_atm_acq_load(&ev->state));
}
void* gpr_event_wait(gpr_event* ev, gpr_timespec abs_deadline) {
void* result = (void*)gpr_atm_acq_load(&ev->state);
void* result = reinterpret_cast<void*>(gpr_atm_acq_load(&ev->state));
if (result == nullptr) {
struct sync_array_s* s = hash(ev);
gpr_mu_lock(&s->mu);
do {
result = (void*)gpr_atm_acq_load(&ev->state);
result = reinterpret_cast<void*>(gpr_atm_acq_load(&ev->state));
} while (result == nullptr && !gpr_cv_wait(&s->cv, &s->mu, abs_deadline));
gpr_mu_unlock(&s->mu);
}

@ -281,8 +281,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 =
static_cast<char*>(gpr_realloc((void*)*body, parser->body_capacity));
*body = static_cast<char*>(gpr_realloc(*body, parser->body_capacity));
}
(*body)[*body_length] = static_cast<char>(byte);
(*body_length)++;

@ -166,7 +166,8 @@ static void error_destroy(grpc_error* err) {
GPR_ASSERT(!grpc_error_is_special(err));
unref_errs(err);
unref_strs(err);
gpr_free((void*)gpr_atm_acq_load(&err->atomics.error_string));
gpr_free(
reinterpret_cast<void*>(gpr_atm_acq_load(&err->atomics.error_string)));
gpr_free(err);
}
@ -237,10 +238,10 @@ static void internal_set_str(grpc_error** err, grpc_error_strs which,
if (slot == UINT8_MAX) {
slot = get_placement(err, sizeof(value));
if (slot == UINT8_MAX) {
const char* str = grpc_slice_to_c_string(value);
char* str = grpc_slice_to_c_string(value);
gpr_log(GPR_ERROR, "Error %p is full, dropping string {\"%s\":\"%s\"}",
*err, error_str_name(which), str);
gpr_free((void*)str);
gpr_free(str);
return;
}
} else {
@ -258,10 +259,10 @@ static void internal_set_time(grpc_error** err, grpc_error_times which,
if (slot == UINT8_MAX) {
slot = get_placement(err, sizeof(value));
if (slot == UINT8_MAX) {
const char* time_str = fmt_time(value);
char* time_str = fmt_time(value);
gpr_log(GPR_ERROR, "Error %p is full, dropping \"%s\":\"%s\"}", *err,
error_time_name(which), time_str);
gpr_free((void*)time_str);
gpr_free(time_str);
return;
}
}
@ -426,7 +427,8 @@ static grpc_error* copy_error_and_unref(grpc_error* in) {
// bulk memcpy of the rest of the struct.
// NOLINTNEXTLINE(bugprone-sizeof-expression)
size_t skip = sizeof(&out->atomics);
memcpy((void*)((uintptr_t)out + skip), (void*)((uintptr_t)in + skip),
memcpy(reinterpret_cast<void*>((uintptr_t)out + skip),
(void*)((uintptr_t)in + skip),
sizeof(*in) + (in->arena_size * sizeof(intptr_t)) - skip);
// manually set the atomics and the new capacity
gpr_atm_no_barrier_store(&out->atomics.error_string, 0);
@ -744,7 +746,8 @@ const char* grpc_error_string(grpc_error* err) {
if (err == GRPC_ERROR_OOM) return oom_error_string;
if (err == GRPC_ERROR_CANCELLED) return cancelled_error_string;
void* p = (void*)gpr_atm_acq_load(&err->atomics.error_string);
void* p =
reinterpret_cast<void*>(gpr_atm_acq_load(&err->atomics.error_string));
if (p != nullptr) {
return static_cast<const char*>(p);
}

@ -1071,8 +1071,9 @@ static grpc_error* pollset_kick(grpc_pollset* pollset,
std::vector<std::string> log;
log.push_back(absl::StrFormat(
"PS:%p KICK:%p curps=%p curworker=%p root=%p", pollset, specific_worker,
(void*)gpr_tls_get(&g_current_thread_pollset),
(void*)gpr_tls_get(&g_current_thread_worker), pollset->root_worker));
reinterpret_cast<void*>(gpr_tls_get(&g_current_thread_pollset)),
reinterpret_cast<void*>(gpr_tls_get(&g_current_thread_worker)),
pollset->root_worker));
if (pollset->root_worker != nullptr) {
log.push_back(absl::StrFormat(
" {kick_state=%s next=%p {kick_state=%s}}",

@ -577,7 +577,7 @@ static grpc_error* pollable_create(pollable_type type, pollable** p) {
}
struct epoll_event ev;
ev.events = static_cast<uint32_t>(EPOLLIN | EPOLLET);
ev.data.ptr = (void*)(1 | (intptr_t) & (*p)->wakeup);
ev.data.ptr = reinterpret_cast<void*>(1 | (intptr_t) & (*p)->wakeup);
if (epoll_ctl(epfd, EPOLL_CTL_ADD, (*p)->wakeup.read_fd, &ev) != 0) {
err = GRPC_OS_ERROR(errno, "epoll_ctl");
GRPC_FD_TRACE(
@ -730,9 +730,9 @@ static grpc_error* pollset_kick(grpc_pollset* pollset,
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_INFO,
"PS:%p kick %p tls_pollset=%p tls_worker=%p pollset.root_worker=%p",
pollset, specific_worker,
(void*)gpr_tls_get(&g_current_thread_pollset),
(void*)gpr_tls_get(&g_current_thread_worker), pollset->root_worker);
static_cast<void*>(pollset), specific_worker,
gpr_tls_get(&g_current_thread_pollset),
gpr_tls_get(&g_current_thread_worker), pollset->root_worker);
}
if (specific_worker == nullptr) {
if (gpr_tls_get(&g_current_thread_pollset) != (intptr_t)pollset) {

@ -987,7 +987,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
void* buf = gpr_malloc(pfd_size + watch_size);
pfds = static_cast<struct pollfd*>(buf);
watchers = static_cast<grpc_fd_watcher*>(
(void*)(static_cast<char*>(buf) + pfd_size));
static_cast<void*>((static_cast<char*>(buf) + pfd_size)));
}
fd_count = 0;

@ -97,7 +97,7 @@ void LockfreeEvent::NotifyOn(grpc_closure* closure) {
gpr_atm curr = gpr_atm_acq_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_DEBUG, "LockfreeEvent::NotifyOn: %p curr=%p closure=%p", this,
(void*)curr, closure);
reinterpret_cast<void*>(curr), closure);
}
switch (curr) {
case kClosureNotReady: {
@ -163,7 +163,8 @@ bool LockfreeEvent::SetShutdown(grpc_error* shutdown_error) {
gpr_atm curr = gpr_atm_no_barrier_load(&state_);
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_DEBUG, "LockfreeEvent::SetShutdown: %p curr=%p err=%s",
&state_, (void*)curr, grpc_error_string(shutdown_error));
&state_, reinterpret_cast<void*>(curr),
grpc_error_string(shutdown_err));
}
switch (curr) {
case kClosureReady:
@ -212,7 +213,7 @@ void LockfreeEvent::SetReady() {
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_DEBUG, "LockfreeEvent::SetReady: %p curr=%p", &state_,
(void*)curr);
reinterpret_cast<void*>(curr));
}
switch (curr) {

@ -293,7 +293,8 @@ static grpc_error* add_socket_to_server(grpc_tcp_server* s,
}
error = grpc_custom_socket_vtable->bind(
socket, reinterpret_cast<grpc_sockaddr*>(addr->addr), addr->len, flags);
socket, reinterpret_cast<grpc_sockaddr*>(const_cast<char*>(addr->addr)),
addr->len, flags);
if (error != GRPC_ERROR_NONE) {
return error;
}

@ -59,7 +59,7 @@ static void timer_init(grpc_timer* timer, grpc_millis deadline,
grpc_custom_timer* timer_wrapper =
static_cast<grpc_custom_timer*>(gpr_malloc(sizeof(grpc_custom_timer)));
timer_wrapper->timeout_ms = timeout;
timer->custom_timer = (void*)timer_wrapper;
timer->custom_timer = timer_wrapper;
timer_wrapper->original = timer;
custom_timer_impl->start(timer_wrapper);
}

@ -112,7 +112,7 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const Json& json) {
goto end;
}
result.private_key =
PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, (void*)"");
PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, const_cast<char*>(""));
if (result.private_key == nullptr) {
gpr_log(GPR_ERROR, "Could not deserialize private key.");
goto end;

@ -757,8 +757,8 @@ const char* grpc_jwt_issuer_email_domain(const char* issuer) {
if (dot == nullptr || dot == email_domain) return email_domain;
GPR_ASSERT(dot > email_domain);
/* There may be a subdomain, we just want the domain. */
dot = static_cast<const char*>(gpr_memrchr(
(void*)email_domain, '.', static_cast<size_t>(dot - email_domain)));
dot = static_cast<const char*>(
gpr_memrchr(email_domain, '.', static_cast<size_t>(dot - email_domain)));
if (dot == nullptr) return email_domain;
return dot + 1;
}

@ -224,7 +224,7 @@ bool grpc_plugin_credentials::get_request_metadata(
grpc_slice_unref_internal(creds_md[i].key);
grpc_slice_unref_internal(creds_md[i].value);
}
gpr_free((void*)error_details);
gpr_free(const_cast<char*>(error_details));
gpr_free(request);
}
return retval;

@ -38,8 +38,8 @@ void grpc_tsi_ssl_pem_key_cert_pairs_destroy(tsi_ssl_pem_key_cert_pair* kp,
size_t num_key_cert_pairs) {
if (kp == nullptr) return;
for (size_t i = 0; i < num_key_cert_pairs; i++) {
gpr_free((void*)kp[i].private_key);
gpr_free((void*)kp[i].cert_chain);
gpr_free(const_cast<char*>(kp[i].private_key));
gpr_free(const_cast<char*>(kp[i].cert_chain));
}
gpr_free(kp);
}
@ -262,8 +262,8 @@ void grpc_ssl_server_certificate_config_destroy(
grpc_ssl_server_certificate_config* config) {
if (config == nullptr) return;
for (size_t i = 0; i < config->num_key_cert_pairs; i++) {
gpr_free((void*)config->pem_key_cert_pairs[i].private_key);
gpr_free((void*)config->pem_key_cert_pairs[i].cert_chain);
gpr_free(const_cast<char*>(config->pem_key_cert_pairs[i].private_key));
gpr_free(const_cast<char*>(config->pem_key_cert_pairs[i].cert_chain));
}
gpr_free(config->pem_key_cert_pairs);
gpr_free(config->pem_root_certs);

@ -172,7 +172,7 @@ FileWatcherCertificateProvider::~FileWatcherCertificateProvider() {
// Reset distributor's callback to make sure the callback won't be invoked
// again after this object(provider) is destroyed.
distributor_->SetWatchStatusCallback(nullptr);
gpr_event_set(&shutdown_event_, (void*)(1));
gpr_event_set(&shutdown_event_, reinterpret_cast<void*>(1));
refresh_thread_.Join();
}

@ -111,7 +111,7 @@ class grpc_ssl_channel_security_connector final
const tsi_result result =
tsi_create_ssl_client_handshaker_factory_with_options(
&options, &client_handshaker_factory_);
gpr_free((void*)options.alpn_protocols);
gpr_free(options.alpn_protocols);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));
@ -258,7 +258,7 @@ class grpc_ssl_server_security_connector
const tsi_result result =
tsi_create_ssl_server_handshaker_factory_with_options(
&options, &server_handshaker_factory_);
gpr_free((void*)alpn_protocol_strings);
gpr_free(alpn_protocol_strings);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));
@ -368,7 +368,7 @@ class grpc_ssl_server_security_connector
grpc_tsi_ssl_pem_key_cert_pairs_destroy(
const_cast<tsi_ssl_pem_key_cert_pair*>(options.pem_key_cert_pairs),
options.num_key_cert_pairs);
gpr_free((void*)alpn_protocol_strings);
gpr_free(alpn_protocol_strings);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",

@ -427,7 +427,7 @@ grpc_security_status grpc_ssl_tsi_client_handshaker_factory_init(
const tsi_result result =
tsi_create_ssl_client_handshaker_factory_with_options(&options,
handshaker_factory);
gpr_free((void*)options.alpn_protocols);
gpr_free(options.alpn_protocols);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));
@ -459,7 +459,7 @@ grpc_security_status grpc_ssl_tsi_server_handshaker_factory_init(
const tsi_result result =
tsi_create_ssl_server_handshaker_factory_with_options(&options,
handshaker_factory);
gpr_free((void*)alpn_protocol_strings);
gpr_free(alpn_protocol_strings);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));

@ -419,9 +419,11 @@ void TlsChannelSecurityConnector::ServerAuthorizationCheckArgDestroy(
if (arg == nullptr) {
return;
}
gpr_free((void*)arg->target_name);
gpr_free((void*)arg->peer_cert);
if (arg->peer_cert_full_chain) gpr_free((void*)arg->peer_cert_full_chain);
gpr_free(const_cast<char*>(arg->target_name));
gpr_free(const_cast<char*>(arg->peer_cert));
if (arg->peer_cert_full_chain) {
gpr_free(const_cast<char*>(arg->peer_cert_full_chain));
}
delete arg->error_details;
if (arg->destroy_context != nullptr) {
arg->destroy_context(arg->context);

@ -869,7 +869,8 @@ static void set_encodings_accepted_by_peer(grpc_call* /*call*/,
grpc_mdelem_set_user_data(
mdel, destroy_encodings_accepted_by_peer,
(void*)((static_cast<uintptr_t>(*encodings_accepted_by_peer)) + 1));
reinterpret_cast<void*>(
(static_cast<uintptr_t>(*encodings_accepted_by_peer)) + 1));
}
uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call* call) {

@ -87,7 +87,7 @@ void grpc_channel_init_shutdown(void) {
for (int i = 0; i < GRPC_NUM_CHANNEL_STACK_TYPES; i++) {
gpr_free(g_slots[i].slots);
g_slots[i].slots =
static_cast<stage_slot*>((void*)static_cast<uintptr_t>(0xdeadbeef));
static_cast<stage_slot*>(reinterpret_cast<void*>(0xdeadbeef));
}
}

@ -101,11 +101,12 @@ static void register_builtin_channel_init() {
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
grpc_add_connected_filter, nullptr);
grpc_channel_init_register_stage(GRPC_CLIENT_LAME_CHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
append_filter, (void*)&grpc_lame_filter);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, prepend_filter,
(void*)&grpc_core::Server::kServerTopFilter);
grpc_channel_init_register_stage(
GRPC_CLIENT_LAME_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
append_filter, const_cast<grpc_channel_filter*>(&grpc_lame_filter));
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, INT_MAX, prepend_filter,
const_cast<grpc_channel_filter*>(&grpc_core::Server::kServerTopFilter));
}
typedef struct grpc_plugin {

@ -48,8 +48,8 @@ grpc_status_code grpc_get_status_code_from_metadata(grpc_mdelem md) {
if (!grpc_parse_slice_to_uint32(GRPC_MDVALUE(md), &status)) {
status = GRPC_STATUS_UNKNOWN; /* could not parse status code */
}
grpc_mdelem_set_user_data(
md, destroy_status, (void*)static_cast<intptr_t>(status + STATUS_OFFSET));
grpc_mdelem_set_user_data(md, destroy_status,
reinterpret_cast<void*>(status + STATUS_OFFSET));
return static_cast<grpc_status_code>(status);
}

@ -43,8 +43,9 @@ grpc_status_code gsec_aead_crypter_encrypt(
char** error_details) {
if (crypter != nullptr && crypter->vtable != nullptr &&
crypter->vtable->encrypt_iovec != nullptr) {
struct iovec aad_vec = {(void*)aad, aad_length};
struct iovec plaintext_vec = {(void*)plaintext, plaintext_length};
struct iovec aad_vec = {const_cast<uint8_t*>(aad), aad_length};
struct iovec plaintext_vec = {const_cast<uint8_t*>(plaintext),
plaintext_length};
struct iovec ciphertext_vec = {ciphertext_and_tag,
ciphertext_and_tag_length};
return crypter->vtable->encrypt_iovec(
@ -81,8 +82,8 @@ grpc_status_code gsec_aead_crypter_decrypt(
size_t plaintext_length, size_t* bytes_written, char** error_details) {
if (crypter != nullptr && crypter->vtable != nullptr &&
crypter->vtable->decrypt_iovec != nullptr) {
struct iovec aad_vec = {(void*)aad, aad_length};
struct iovec ciphertext_vec = {(void*)ciphertext_and_tag,
struct iovec aad_vec = {const_cast<uint8_t*>(aad), aad_length};
struct iovec ciphertext_vec = {const_cast<uint8_t*>(ciphertext_and_tag),
ciphertext_and_tag_length};
struct iovec plaintext_vec = {plaintext, plaintext_length};
return crypter->vtable->decrypt_iovec(

@ -554,12 +554,12 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX* context,
X509* certificate = nullptr;
BIO* pem;
GPR_ASSERT(pem_cert_chain_size <= INT_MAX);
pem = BIO_new_mem_buf((void*)pem_cert_chain,
static_cast<int>(pem_cert_chain_size));
pem = BIO_new_mem_buf(pem_cert_chain, static_cast<int>(pem_cert_chain_size));
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
do {
certificate = PEM_read_bio_X509_AUX(pem, nullptr, nullptr, (void*)"");
certificate =
PEM_read_bio_X509_AUX(pem, nullptr, nullptr, const_cast<char*>(""));
if (certificate == nullptr) {
result = TSI_INVALID_ARGUMENT;
break;
@ -570,7 +570,7 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX* context,
}
while (true) {
X509* certificate_authority =
PEM_read_bio_X509(pem, nullptr, nullptr, (void*)"");
PEM_read_bio_X509(pem, nullptr, nullptr, const_cast<char*>(""));
if (certificate_authority == nullptr) {
ERR_clear_error();
break; /* Done reading. */
@ -674,10 +674,11 @@ static tsi_result ssl_ctx_use_pem_private_key(SSL_CTX* context,
EVP_PKEY* private_key = nullptr;
BIO* pem;
GPR_ASSERT(pem_key_size <= INT_MAX);
pem = BIO_new_mem_buf((void*)pem_key, static_cast<int>(pem_key_size));
pem = BIO_new_mem_buf(pem_key, static_cast<int>(pem_key_size));
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
do {
private_key = PEM_read_bio_PrivateKey(pem, nullptr, nullptr, (void*)"");
private_key =
PEM_read_bio_PrivateKey(pem, nullptr, nullptr, const_cast<char*>(""));
if (private_key == nullptr) {
result = TSI_INVALID_ARGUMENT;
break;
@ -718,7 +719,7 @@ static tsi_result x509_store_load_certs(X509_STORE* cert_store,
X509_NAME* root_name = nullptr;
BIO* pem;
GPR_ASSERT(pem_roots_size <= INT_MAX);
pem = BIO_new_mem_buf((void*)pem_roots, static_cast<int>(pem_roots_size));
pem = BIO_new_mem_buf(pem_roots, static_cast<int>(pem_roots_size));
if (cert_store == nullptr) return TSI_INVALID_ARGUMENT;
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
if (root_names != nullptr) {
@ -727,7 +728,7 @@ static tsi_result x509_store_load_certs(X509_STORE* cert_store,
}
while (true) {
root = PEM_read_bio_X509_AUX(pem, nullptr, nullptr, (void*)"");
root = PEM_read_bio_X509_AUX(pem, nullptr, nullptr, const_cast<char*>(""));
if (root == nullptr) {
ERR_clear_error();
break; /* We're at the end of stream. */
@ -837,10 +838,10 @@ tsi_result tsi_ssl_extract_x509_subject_names_from_pem_cert(
tsi_result result = TSI_OK;
X509* cert = nullptr;
BIO* pem;
pem = BIO_new_mem_buf((void*)pem_cert, static_cast<int>(strlen(pem_cert)));
pem = BIO_new_mem_buf(pem_cert, static_cast<int>(strlen(pem_cert)));
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
cert = PEM_read_bio_X509(pem, nullptr, nullptr, (void*)"");
cert = PEM_read_bio_X509(pem, nullptr, nullptr, const_cast<char*>(""));
if (cert == nullptr) {
gpr_log(GPR_ERROR, "Invalid certificate");
result = TSI_INVALID_ARGUMENT;

@ -87,7 +87,7 @@ void ChannelFilterPluginInit() {
for (size_t i = 0; i < channel_filters->size(); ++i) {
FilterRecord& filter = (*channel_filters)[i];
grpc_channel_init_register_stage(filter.stack_type, filter.priority,
MaybeAddFilter, (void*)&filter);
MaybeAddFilter, &filter);
}
}

@ -95,7 +95,7 @@ ServerBuilder& ServerBuilder::RegisterAsyncGenericService(
gpr_log(GPR_ERROR,
"Adding multiple generic services is unsupported for now. "
"Dropping the service %p",
(void*)service);
service);
} else {
generic_service_ = service;
}
@ -122,7 +122,7 @@ ServerBuilder& ServerBuilder::experimental_type::RegisterCallbackGenericService(
gpr_log(GPR_ERROR,
"Adding multiple generic services is unsupported for now. "
"Dropping the service %p",
(void*)service);
service);
} else {
builder_->callback_generic_service_ = service;
}

@ -53,13 +53,13 @@ static void thd_func(void* arg) {
if (a->validator != nullptr) {
a->validator(a->server, a->cq, a->registered_method);
}
gpr_event_set(&a->done_thd, (void*)1);
gpr_event_set(&a->done_thd, reinterpret_cast<void*>(1));
}
/* Sets the done_write event */
static void set_done_write(void* arg, grpc_error* /*error*/) {
gpr_event* done_write = static_cast<gpr_event*>(arg);
gpr_event_set(done_write, (void*)1);
gpr_event_set(done_write, reinterpret_cast<void*>(1));
}
static void server_setup_transport(void* ts, grpc_transport* transport) {
@ -72,7 +72,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
/* Sets the read_done event */
static void set_read_done(void* arg, grpc_error* /*error*/) {
gpr_event* read_done = static_cast<gpr_event*>(arg);
gpr_event_set(read_done, (void*)1);
gpr_event_set(read_done, reinterpret_cast<void*>(1));
}
/* shutdown client */
@ -307,7 +307,7 @@ bool rst_stream_client_validator(grpc_slice_buffer* incoming, void* /*arg*/) {
return success;
}
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
void server_verifier_request_call(grpc_server* server,
grpc_completion_queue* cq,

@ -49,7 +49,7 @@
"\x00\x00\x20\x00\x00\x00\x00\x00\x01" \
"\x00\x00\x00\x00"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {

@ -66,7 +66,7 @@ static const char prefix[] =
"\x01\x00\x00\x27\x10"
"";
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {

@ -38,7 +38,7 @@
"\x10\x02te\x08trailers" \
"\x10\x0auser-agent\"bad-client grpc-c/0.12.0.0 (linux)"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {

@ -85,7 +85,7 @@
"\x10\x0cgrpc-timeout\x02" \
"5S"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* /*registered_method*/) {

@ -44,7 +44,7 @@
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/surface/server.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
typedef struct test_ctx test_ctx;

@ -34,7 +34,7 @@
#include "test/core/util/subprocess.h"
#include "test/core/util/test_config.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void run_test(const char* target, size_t nops) {
grpc_channel_credentials* ssl_creds =

@ -62,7 +62,8 @@ void bad_ssl_run(grpc_server* server) {
grpc_server_start(server);
error = grpc_server_request_call(server, &s, &call_details,
&request_metadata_recv, cq, cq, (void*)1);
&request_metadata_recv, cq, cq,
reinterpret_cast<void*>(1));
GPR_ASSERT(GRPC_CALL_OK == error);
signal(SIGINT, sigint_handler);

@ -111,12 +111,12 @@ static bool add_original_filter(grpc_channel_stack_builder* builder,
}
static void init_plugin(void) {
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
add_original_filter,
(void*)&original_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
add_replacement_filter,
(void*)&replacement_filter);
grpc_channel_init_register_stage(
GRPC_CLIENT_CHANNEL, INT_MAX, add_original_filter,
const_cast<grpc_channel_filter*>(&original_filter));
grpc_channel_init_register_stage(
GRPC_CLIENT_CHANNEL, INT_MAX, add_replacement_filter,
const_cast<grpc_channel_filter*>(&replacement_filter));
}
static void destroy_plugin(void) {}

@ -128,7 +128,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler {
GPR_ASSERT(output != nullptr);
output->result = std::move(result);
output->error = GRPC_ERROR_NONE;
gpr_event_set(&output->ev, (void*)1);
gpr_event_set(&output->ev, reinterpret_cast<void*>(1));
}
void ReturnError(grpc_error* error) override {
@ -136,7 +136,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler {
reinterpret_cast<ResolverOutput*>(gpr_atm_acq_load(&output_));
GPR_ASSERT(output != nullptr);
output->error = error;
gpr_event_set(&output->ev, (void*)1);
gpr_event_set(&output->ev, reinterpret_cast<void*>(1));
}
private:

@ -174,7 +174,7 @@ static void poll_pollset_until_request_done(iomgr_args* args) {
gpr_mu_unlock(args->mu);
grpc_core::ExecCtx::Get()->Flush();
}
gpr_event_set(&args->ev, (void*)1);
gpr_event_set(&args->ev, reinterpret_cast<void*>(1));
}
struct OnResolutionCallbackArg;

@ -54,7 +54,7 @@ class ResultHandler : public grpc_core::Resolver::ResultHandler {
for (size_t i = 0; i < expected_.addresses.size(); ++i) {
GPR_ASSERT(actual.addresses[i] == expected_.addresses[i]);
}
gpr_event_set(ev_, (void*)1);
gpr_event_set(ev_, reinterpret_cast<void*>(1));
ev_ = nullptr;
}

@ -93,7 +93,7 @@ static grpc_closure on_read;
static grpc_closure on_writing_settings_frame;
static grpc_closure on_write;
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void done_write(void* /*arg*/, grpc_error* error) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
@ -286,7 +286,7 @@ static void actually_poll_server(void* arg) {
}
test_tcp_server_poll(pa->server, 1000);
}
gpr_event_set(pa->signal_when_done, (void*)1);
gpr_event_set(pa->signal_when_done, reinterpret_cast<void*>(1));
gpr_free(pa);
}

@ -33,7 +33,7 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
static void* tag(intptr_t i) { return (void*)i; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void run_test(bool wait_for_ready, bool use_service_config) {
grpc_channel* chan;

@ -48,7 +48,7 @@
/* This test exercises IPv4, IPv6, and dualstack sockets in various ways. */
static void* tag(intptr_t i) { return (void*)i; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;

@ -33,7 +33,7 @@ bool leak_check = true;
static void discard_write(grpc_slice /*slice*/) {}
static void* tag(int n) { return (void*)static_cast<uintptr_t>(n); }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args* /*args*/) {}

@ -29,8 +29,7 @@ bool leak_check = true;
static void discard_write(grpc_slice /*slice*/) {}
static void* tag(int n) { return (void*)static_cast<uintptr_t>(n); }
static int detag(void* p) { return static_cast<int>((uintptr_t)p); }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void dont_log(gpr_log_func_args* /*args*/) {}
@ -84,12 +83,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
case GRPC_QUEUE_SHUTDOWN:
break;
case GRPC_OP_COMPLETE:
switch (detag(ev.tag)) {
case 1:
requested_calls--;
// TODO(ctiller): keep reading that call!
break;
if (ev.tag == tag(1)) {
requested_calls--;
// TODO(ctiller): keep reading that call!
}
break;
}
}

@ -44,7 +44,7 @@
extern grpc_address_resolver_vtable* grpc_resolve_address_impl;
static grpc_address_resolver_vtable* default_resolver;
static void* tag(intptr_t i) { return (void*)i; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static gpr_mu g_mu;
static int g_resolve_port = -1;

@ -44,7 +44,7 @@ namespace grpc {
namespace testing {
namespace {
void* tag(intptr_t t) { return (void*)t; }
void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
gpr_timespec five_seconds_time() { return grpc_timeout_seconds_to_deadline(5); }

@ -31,7 +31,7 @@
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
static void* tag(intptr_t i) { return (void*)i; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
struct test_state {
int is_client;

@ -27,7 +27,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/test_config.h"
static void* tag(intptr_t i) { return (void*)i; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
void run_test(bool wait_for_ready) {
gpr_log(GPR_INFO, "TEST: wait_for_ready=%d", wait_for_ready);

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -29,7 +29,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -32,7 +32,7 @@
#define MAX_PING_STRIKES 2
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -38,7 +38,7 @@ static const char overridden_iam_selector[] = "overridden_selector";
typedef enum { NONE, OVERRIDE, DESTROY, FAIL } override_mode;
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -31,7 +31,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -34,7 +34,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/tests/cancel_test_helpers.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -30,7 +30,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/tests/cancel_test_helpers.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -31,7 +31,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/tests/cancel_test_helpers.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -34,7 +34,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/tests/cancel_test_helpers.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -28,7 +28,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -30,7 +30,7 @@
#include "test/core/end2end/cq_verifier.h"
#include "test/core/end2end/tests/cancel_test_helpers.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -31,7 +31,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -33,7 +33,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -39,7 +39,7 @@
#include "src/core/lib/transport/static_metadata.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -25,7 +25,7 @@
#include "src/core/lib/gprpp/thd.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
typedef struct {
gpr_event started;
@ -47,7 +47,7 @@ struct CallbackContext {
static void child_thread(void* arg) {
child_events* ce = static_cast<child_events*>(arg);
grpc_event ev;
gpr_event_set(&ce->started, (void*)1);
gpr_event_set(&ce->started, reinterpret_cast<void*>(1));
gpr_log(GPR_DEBUG, "verifying");
ev = grpc_completion_queue_next(ce->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC),
nullptr);
@ -183,7 +183,7 @@ static void cb_watch_connectivity(
/* callback must not have errors */
GPR_ASSERT(success != 0);
gpr_event_set(&cb_ctx->finished, (void*)1);
gpr_event_set(&cb_ctx->finished, reinterpret_cast<void*>(1));
}
static void cb_shutdown(grpc_experimental_completion_queue_functor* functor,
@ -191,7 +191,7 @@ static void cb_shutdown(grpc_experimental_completion_queue_functor* functor,
CallbackContext* cb_ctx = reinterpret_cast<CallbackContext*>(functor);
gpr_log(GPR_DEBUG, "cb_shutdown called, nothing to do");
gpr_event_set(&cb_ctx->finished, (void*)1);
gpr_event_set(&cb_ctx->finished, reinterpret_cast<void*>(1));
}
static void test_watch_connectivity_cq_callback(

@ -29,7 +29,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static gpr_timespec n_seconds_from_now(int n) {
return grpc_timeout_seconds_to_deadline(n);

@ -29,7 +29,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -32,7 +32,7 @@
static bool g_enable_filter = false;
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -36,7 +36,7 @@ enum { TIMEOUT = 200000 };
static bool g_enable_filter = false;
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
@ -295,14 +295,18 @@ static bool maybe_add_filter(grpc_channel_stack_builder* builder, void* arg) {
}
static void init_plugin(void) {
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
maybe_add_filter, (void*)&test_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX,
maybe_add_filter, (void*)&test_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX,
maybe_add_filter, (void*)&test_filter);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
maybe_add_filter, (void*)&test_filter);
grpc_channel_init_register_stage(
GRPC_CLIENT_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_filter));
grpc_channel_init_register_stage(
GRPC_CLIENT_SUBCHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_filter));
grpc_channel_init_register_stage(
GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_filter));
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_filter));
}
static void destroy_plugin(void) {}

@ -38,7 +38,7 @@ static bool g_enable_client_channel_filter = false;
static bool g_enable_client_subchannel_filter = false;
static bool g_channel_filter_init_failure = false;
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -39,7 +39,7 @@ static gpr_mu g_mu;
static gpr_timespec g_client_latency;
static gpr_timespec g_server_latency;
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
@ -326,15 +326,15 @@ static bool maybe_add_filter(grpc_channel_stack_builder* builder, void* arg) {
static void init_plugin(void) {
gpr_mu_init(&g_mu);
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
maybe_add_filter,
(void*)&test_client_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX,
maybe_add_filter,
(void*)&test_client_filter);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
maybe_add_filter,
(void*)&test_server_filter);
grpc_channel_init_register_stage(
GRPC_CLIENT_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_client_filter));
grpc_channel_init_register_stage(
GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_client_filter));
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_server_filter));
}
static void destroy_plugin(void) { gpr_mu_destroy(&g_mu); }

@ -52,7 +52,7 @@ static gpr_cv g_server_code_cv;
static grpc_status_code g_client_status_code;
static grpc_status_code g_server_status_code;
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,
@ -376,15 +376,15 @@ static void init_plugin(void) {
g_client_code_recv = false;
g_server_code_recv = false;
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
maybe_add_filter,
(void*)&test_client_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX,
maybe_add_filter,
(void*)&test_client_filter);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
maybe_add_filter,
(void*)&test_server_filter);
grpc_channel_init_register_stage(
GRPC_CLIENT_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_client_filter));
grpc_channel_init_register_stage(
GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_client_filter));
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, INT_MAX, maybe_add_filter,
const_cast<grpc_channel_filter*>(&test_server_filter));
}
static void destroy_plugin(void) {

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -34,7 +34,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -35,7 +35,7 @@
#include "src/core/lib/gpr/useful.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
const char* hobbits[][2] = {
{"Adaldrida", "Brandybuck"}, {"Adamanta", "Took"},

@ -30,7 +30,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -33,7 +33,7 @@
#include "src/core/lib/gpr/useful.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -37,7 +37,7 @@
#include "src/core/lib/iomgr/ev_posix.h"
#endif // GRPC_POSIX_SOCKET
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -45,7 +45,7 @@
/* The grace period for the test to observe the channel shutdown process */
#define IMMEDIATE_SHUTDOWN_GRACE_TIME_MS 3000
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;

@ -32,7 +32,7 @@
#define MAX_CONNECTION_IDLE_MS 500
#define MAX_CONNECTION_AGE_MS 9999
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;

@ -34,7 +34,7 @@
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -30,7 +30,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -31,7 +31,7 @@
#include "src/core/lib/iomgr/error.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -36,7 +36,7 @@
enum { TIMEOUT = 200000 };
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
void gpr_default_log(gpr_log_func_args* args);

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -29,7 +29,7 @@
#define PING_NUM 5
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static void test_ping(grpc_end2end_test_config config,
int min_time_between_pings_ms) {

@ -27,7 +27,7 @@
#include <grpc/support/time.h>
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

@ -34,7 +34,7 @@
#include "src/core/lib/gpr/string.h"
#include "test/core/end2end/cq_verifier.h"
static void* tag(intptr_t t) { return (void*)t; }
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
const char* test_name,

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save