aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/util/passthru_endpoint.cc
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:16:55 -0800
committerGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:16:55 -0800
commitbe82e64b3debcdb1d9ec6a149fc85af0d46bfb7e (patch)
treecc5e1234073eb250a2c319b5a4db2919fce060ea /test/core/util/passthru_endpoint.cc
parent194436342137924b4fb7429bede037a4b5ec7edb (diff)
Autofix c casts to c++ casts
Diffstat (limited to 'test/core/util/passthru_endpoint.cc')
-rw-r--r--test/core/util/passthru_endpoint.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/core/util/passthru_endpoint.cc b/test/core/util/passthru_endpoint.cc
index 0da0765979..38c23aa978 100644
--- a/test/core/util/passthru_endpoint.cc
+++ b/test/core/util/passthru_endpoint.cc
@@ -55,7 +55,7 @@ struct passthru_endpoint {
static void me_read(grpc_endpoint* ep, grpc_slice_buffer* slices,
grpc_closure* cb) {
- half* m = (half*)ep;
+ half* m = reinterpret_cast<half*>(ep);
gpr_mu_lock(&m->parent->mu);
if (m->parent->shutdown) {
GRPC_CLOSURE_SCHED(
@@ -77,7 +77,7 @@ static half* other_half(half* h) {
static void me_write(grpc_endpoint* ep, grpc_slice_buffer* slices,
grpc_closure* cb) {
- half* m = other_half((half*)ep);
+ half* m = other_half(reinterpret_cast<half*>(ep));
gpr_mu_lock(&m->parent->mu);
grpc_error* error = GRPC_ERROR_NONE;
gpr_atm_no_barrier_fetch_add(&m->parent->stats->num_writes, (gpr_atm)1);
@@ -108,7 +108,7 @@ static void me_delete_from_pollset_set(grpc_endpoint* ep,
grpc_pollset_set* pollset) {}
static void me_shutdown(grpc_endpoint* ep, grpc_error* why) {
- half* m = (half*)ep;
+ half* m = reinterpret_cast<half*>(ep);
gpr_mu_lock(&m->parent->mu);
m->parent->shutdown = true;
if (m->on_read) {
@@ -130,7 +130,7 @@ static void me_shutdown(grpc_endpoint* ep, grpc_error* why) {
}
static void me_destroy(grpc_endpoint* ep) {
- passthru_endpoint* p = ((half*)ep)->parent;
+ passthru_endpoint* p = (reinterpret_cast<half*>(ep))->parent;
gpr_mu_lock(&p->mu);
if (0 == --p->halves) {
gpr_mu_unlock(&p->mu);
@@ -147,15 +147,15 @@ static void me_destroy(grpc_endpoint* ep) {
}
static char* me_get_peer(grpc_endpoint* ep) {
- passthru_endpoint* p = ((half*)ep)->parent;
- return ((half*)ep) == &p->client ? gpr_strdup("fake:mock_client_endpoint")
+ passthru_endpoint* p = (reinterpret_cast<half*>(ep))->parent;
+ return (reinterpret_cast<half*>(ep)) == &p->client ? gpr_strdup("fake:mock_client_endpoint")
: gpr_strdup("fake:mock_server_endpoint");
}
static int me_get_fd(grpc_endpoint* ep) { return -1; }
static grpc_resource_user* me_get_resource_user(grpc_endpoint* ep) {
- half* m = (half*)ep;
+ half* m = reinterpret_cast<half*>(ep);
return m->resource_user;
}
@@ -190,7 +190,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 = (passthru_endpoint*)gpr_malloc(sizeof(*m));
+ passthru_endpoint* m = static_cast<passthru_endpoint*>(gpr_malloc(sizeof(*m)));
m->halves = 2;
m->shutdown = 0;
if (stats == nullptr) {
@@ -208,8 +208,8 @@ void grpc_passthru_endpoint_create(grpc_endpoint** client,
grpc_passthru_endpoint_stats* grpc_passthru_endpoint_stats_create() {
grpc_passthru_endpoint_stats* stats =
- (grpc_passthru_endpoint_stats*)gpr_malloc(
- sizeof(grpc_passthru_endpoint_stats));
+ static_cast<grpc_passthru_endpoint_stats*>(gpr_malloc(
+ sizeof(grpc_passthru_endpoint_stats)));
memset(stats, 0, sizeof(*stats));
gpr_ref_init(&stats->refs, 1);
return stats;