aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/tsi/transport_security_adapter.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 /src/core/tsi/transport_security_adapter.cc
parent194436342137924b4fb7429bede037a4b5ec7edb (diff)
Autofix c casts to c++ casts
Diffstat (limited to 'src/core/tsi/transport_security_adapter.cc')
-rw-r--r--src/core/tsi/transport_security_adapter.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/tsi/transport_security_adapter.cc b/src/core/tsi/transport_security_adapter.cc
index 56dec55494..e57a42ad6c 100644
--- a/src/core/tsi/transport_security_adapter.cc
+++ b/src/core/tsi/transport_security_adapter.cc
@@ -59,7 +59,7 @@ static tsi_result adapter_result_get_unused_bytes(
}
static void adapter_result_destroy(tsi_handshaker_result* self) {
- tsi_adapter_handshaker_result* impl = (tsi_adapter_handshaker_result*)self;
+ tsi_adapter_handshaker_result* impl = reinterpret_cast<tsi_adapter_handshaker_result*>(self);
tsi_handshaker_destroy(impl->wrapped);
gpr_free(impl->unused_bytes);
gpr_free(self);
@@ -82,12 +82,12 @@ static tsi_result tsi_adapter_create_handshaker_result(
return TSI_INVALID_ARGUMENT;
}
tsi_adapter_handshaker_result* impl =
- (tsi_adapter_handshaker_result*)gpr_zalloc(sizeof(*impl));
+ static_cast<tsi_adapter_handshaker_result*>(gpr_zalloc(sizeof(*impl)));
impl->base.vtable = &result_vtable;
impl->wrapped = wrapped;
impl->unused_bytes_size = unused_bytes_size;
if (unused_bytes_size > 0) {
- impl->unused_bytes = (unsigned char*)gpr_malloc(unused_bytes_size);
+ impl->unused_bytes = static_cast<unsigned char*>(gpr_malloc(unused_bytes_size));
memcpy(impl->unused_bytes, unused_bytes, unused_bytes_size);
} else {
impl->unused_bytes = nullptr;
@@ -137,7 +137,7 @@ static tsi_result adapter_create_frame_protector(
}
static void adapter_destroy(tsi_handshaker* self) {
- tsi_adapter_handshaker* impl = (tsi_adapter_handshaker*)self;
+ tsi_adapter_handshaker* impl = reinterpret_cast<tsi_adapter_handshaker*>(self);
tsi_handshaker_destroy(impl->wrapped);
gpr_free(impl->adapter_buffer);
gpr_free(self);
@@ -156,7 +156,7 @@ static tsi_result adapter_next(
}
/* If there are received bytes, process them first. */
- tsi_adapter_handshaker* impl = (tsi_adapter_handshaker*)self;
+ tsi_adapter_handshaker* impl = reinterpret_cast<tsi_adapter_handshaker*>(self);
tsi_result status = TSI_OK;
size_t bytes_consumed = received_bytes_size;
if (received_bytes_size > 0) {
@@ -174,8 +174,8 @@ static tsi_result adapter_next(
offset += to_send_size;
if (status == TSI_INCOMPLETE_DATA) {
impl->adapter_buffer_size *= 2;
- impl->adapter_buffer = (unsigned char*)gpr_realloc(
- impl->adapter_buffer, impl->adapter_buffer_size);
+ impl->adapter_buffer = static_cast<unsigned char*>(gpr_realloc(
+ impl->adapter_buffer, impl->adapter_buffer_size));
}
} while (status == TSI_INCOMPLETE_DATA);
if (status != TSI_OK) return status;
@@ -212,16 +212,16 @@ static const tsi_handshaker_vtable handshaker_vtable = {
tsi_handshaker* tsi_create_adapter_handshaker(tsi_handshaker* wrapped) {
GPR_ASSERT(wrapped != nullptr);
tsi_adapter_handshaker* impl =
- (tsi_adapter_handshaker*)gpr_zalloc(sizeof(*impl));
+ static_cast<tsi_adapter_handshaker*>(gpr_zalloc(sizeof(*impl)));
impl->base.vtable = &handshaker_vtable;
impl->wrapped = wrapped;
impl->adapter_buffer_size = TSI_ADAPTER_INITIAL_BUFFER_SIZE;
- impl->adapter_buffer = (unsigned char*)gpr_malloc(impl->adapter_buffer_size);
+ impl->adapter_buffer = static_cast<unsigned char*>(gpr_malloc(impl->adapter_buffer_size));
return &impl->base;
}
tsi_handshaker* tsi_adapter_handshaker_get_wrapped(tsi_handshaker* adapter) {
if (adapter == nullptr) return nullptr;
- tsi_adapter_handshaker* impl = (tsi_adapter_handshaker*)adapter;
+ tsi_adapter_handshaker* impl = reinterpret_cast<tsi_adapter_handshaker*>(adapter);
return impl->wrapped;
}