Autofix c casts to c++ casts
diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc
index c430f3d..a936d17 100644
--- a/src/core/ext/filters/deadline/deadline_filter.cc
+++ b/src/core/ext/filters/deadline/deadline_filter.cc
@@ -37,7 +37,7 @@
// The on_complete callback used when sending a cancel_error batch down the
// filter stack. Yields the call combiner when the batch returns.
static void yield_call_combiner(void* arg, grpc_error* ignored) {
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)arg;
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(arg);
GRPC_CALL_COMBINER_STOP(deadline_state->call_combiner,
"got on_complete from cancel_stream batch");
GRPC_CALL_STACK_UNREF(deadline_state->call_stack, "deadline_timer");
@@ -46,8 +46,8 @@
// This is called via the call combiner, so access to deadline_state is
// synchronized.
static void send_cancel_op_in_call_combiner(void* arg, grpc_error* error) {
- grpc_call_element* elem = (grpc_call_element*)arg;
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
+ grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
grpc_transport_stream_op_batch* batch = grpc_make_transport_stream_op(
GRPC_CLOSURE_INIT(&deadline_state->timer_callback, yield_call_combiner,
deadline_state, grpc_schedule_on_exec_ctx));
@@ -58,8 +58,8 @@
// Timer callback.
static void timer_callback(void* arg, grpc_error* error) {
- grpc_call_element* elem = (grpc_call_element*)arg;
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
+ grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
if (error != GRPC_ERROR_CANCELLED) {
error = grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Deadline Exceeded"),
@@ -85,7 +85,7 @@
if (deadline == GRPC_MILLIS_INF_FUTURE) {
return;
}
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
grpc_closure* closure = nullptr;
switch (deadline_state->timer_state) {
case GRPC_DEADLINE_STATE_PENDING:
@@ -126,7 +126,7 @@
// Callback run when the call is complete.
static void on_complete(void* arg, grpc_error* error) {
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)arg;
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(arg);
cancel_timer_if_needed(deadline_state);
// Invoke the next callback.
GRPC_CLOSURE_RUN(deadline_state->next_on_complete, GRPC_ERROR_REF(error));
@@ -151,9 +151,9 @@
};
static void start_timer_after_init(void* arg, grpc_error* error) {
struct start_timer_after_init_state* state =
- (struct start_timer_after_init_state*)arg;
+ static_cast<struct start_timer_after_init_state*>(arg);
grpc_deadline_state* deadline_state =
- (grpc_deadline_state*)state->elem->call_data;
+ static_cast<grpc_deadline_state*>(state->elem->call_data);
if (!state->in_call_combiner) {
// We are initially called without holding the call combiner, so we
// need to bounce ourselves into it.
@@ -173,7 +173,7 @@
grpc_call_stack* call_stack,
grpc_call_combiner* call_combiner,
grpc_millis deadline) {
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
deadline_state->call_stack = call_stack;
deadline_state->call_combiner = call_combiner;
// Deadline will always be infinite on servers, so the timer will only be
@@ -187,7 +187,7 @@
// create a closure to start the timer, and we schedule that closure
// to be run after call stack initialization is done.
struct start_timer_after_init_state* state =
- (struct start_timer_after_init_state*)gpr_zalloc(sizeof(*state));
+ static_cast<struct start_timer_after_init_state*>(gpr_zalloc(sizeof(*state)));
state->elem = elem;
state->deadline = deadline;
GRPC_CLOSURE_INIT(&state->closure, start_timer_after_init, state,
@@ -197,20 +197,20 @@
}
void grpc_deadline_state_destroy(grpc_call_element* elem) {
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
cancel_timer_if_needed(deadline_state);
}
void grpc_deadline_state_reset(grpc_call_element* elem,
grpc_millis new_deadline) {
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
cancel_timer_if_needed(deadline_state);
start_timer_if_needed(elem, new_deadline);
}
void grpc_deadline_state_client_start_transport_stream_op_batch(
grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
- grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
+ grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
if (op->cancel_stream) {
cancel_timer_if_needed(deadline_state);
} else {
@@ -278,8 +278,8 @@
// Callback for receiving initial metadata on the server.
static void recv_initial_metadata_ready(void* arg, grpc_error* error) {
- grpc_call_element* elem = (grpc_call_element*)arg;
- server_call_data* calld = (server_call_data*)elem->call_data;
+ grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
+ server_call_data* calld = static_cast<server_call_data*>(elem->call_data);
// Get deadline from metadata and start the timer if needed.
start_timer_if_needed(elem, calld->recv_initial_metadata->deadline);
// Invoke the next callback.
@@ -290,7 +290,7 @@
// Method for starting a call op for server filter.
static void server_start_transport_stream_op_batch(
grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
- server_call_data* calld = (server_call_data*)elem->call_data;
+ server_call_data* calld = static_cast<server_call_data*>(elem->call_data);
if (op->cancel_stream) {
cancel_timer_if_needed(&calld->base.deadline_state);
} else {
@@ -360,7 +360,7 @@
return grpc_deadline_checking_enabled(
grpc_channel_stack_builder_get_channel_arguments(builder))
? grpc_channel_stack_builder_prepend_filter(
- builder, (const grpc_channel_filter*)arg, nullptr, nullptr)
+ builder, static_cast<const grpc_channel_filter*>(arg), nullptr, nullptr)
: true;
}