diff options
Diffstat (limited to 'src/core')
44 files changed, 165 insertions, 121 deletions
diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc index 0538e00a6f..d3627a237f 100644 --- a/src/core/ext/filters/client_channel/channel_connectivity.cc +++ b/src/core/ext/filters/client_channel/channel_connectivity.cc @@ -115,8 +115,8 @@ static void partly_done(grpc_exec_ctx* exec_ctx, state_watcher* w, grpc_channel_get_channel_stack(w->channel)); grpc_client_channel_watch_connectivity_state( exec_ctx, client_channel_elem, - grpc_polling_entity_create_from_pollset(grpc_cq_pollset(w->cq)), nullptr, - &w->on_complete, nullptr); + grpc_polling_entity_create_from_pollset(grpc_cq_pollset(w->cq)), + nullptr, &w->on_complete, nullptr); } gpr_mu_lock(&w->mu); diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 075c569f61..8b8d512432 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -266,7 +266,8 @@ static void on_lb_policy_state_changed_locked(grpc_exec_ctx* exec_ctx, gpr_log(GPR_DEBUG, "chand=%p: lb_policy=%p state changed to %s", w->chand, w->lb_policy, grpc_connectivity_state_name(w->state)); } - if (publish_state == GRPC_CHANNEL_SHUTDOWN && w->chand->resolver != nullptr) { + if (publish_state == GRPC_CHANNEL_SHUTDOWN && + w->chand->resolver != nullptr) { publish_state = GRPC_CHANNEL_TRANSIENT_FAILURE; grpc_resolver_channel_saw_error_locked(exec_ctx, w->chand->resolver); GRPC_LB_POLICY_UNREF(exec_ctx, w->chand->lb_policy, "channel"); @@ -408,7 +409,8 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx, } } if (found_balancer_address) { - if (lb_policy_name != nullptr && strcmp(lb_policy_name, "grpclb") != 0) { + if (lb_policy_name != nullptr && + strcmp(lb_policy_name, "grpclb") != 0) { gpr_log(GPR_INFO, "resolver requested LB policy %s but provided at least one " "balancer address -- forcing use of grpclb LB policy", diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index 195d95aad0..e9bef8a921 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -1178,8 +1178,8 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol, bool pick_done = false; if (glb_policy->rr_policy != nullptr) { const grpc_connectivity_state rr_connectivity_state = - grpc_lb_policy_check_connectivity_locked(exec_ctx, - glb_policy->rr_policy, nullptr); + grpc_lb_policy_check_connectivity_locked( + exec_ctx, glb_policy->rr_policy, nullptr); // The glb_policy->rr_policy may have transitioned to SHUTDOWN but the // callback registered to capture this event // (glb_rr_connectivity_changed_locked) may not have been invoked yet. We @@ -1525,8 +1525,8 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx, op->flags = 0; op->reserved = nullptr; op++; - call_error = grpc_call_start_batch_and_execute(exec_ctx, glb_policy->lb_call, - ops, (size_t)(op - ops), nullptr); + call_error = grpc_call_start_batch_and_execute( + exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops), nullptr); GPR_ASSERT(GRPC_CALL_OK == call_error); op = ops; diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index 2287740b82..caa6aee9a6 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -155,7 +155,8 @@ static void pf_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol, static void start_picking_locked(grpc_exec_ctx* exec_ctx, pick_first_lb_policy* p) { p->started_picking = true; - if (p->subchannel_list != nullptr && p->subchannel_list->num_subchannels > 0) { + if (p->subchannel_list != nullptr && + p->subchannel_list->num_subchannels > 0) { p->subchannel_list->checking_subchannel = 0; grpc_lb_subchannel_list_ref_for_connectivity_watch( p->subchannel_list, "connectivity_watch+start_picking"); diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc index f53abb7d96..27d9598ac4 100644 --- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc +++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc @@ -240,7 +240,8 @@ static void subchannel_data_cancel_connectivity_watch( (size_t)(sd - sd->subchannel_list->subchannels), sd->subchannel_list->num_subchannels, sd->subchannel, reason); } - grpc_subchannel_notify_on_state_change(exec_ctx, sd->subchannel, nullptr, nullptr, + grpc_subchannel_notify_on_state_change(exec_ctx, sd->subchannel, nullptr, + nullptr, &sd->connectivity_changed_closure); } diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc index 5f91fe05af..07737b19d2 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc @@ -177,7 +177,8 @@ static char* choose_service_config(char* service_config_choice_json) { break; } grpc_json* service_config_json = nullptr; - for (grpc_json* field = choice->child; field != nullptr; field = field->next) { + for (grpc_json* field = choice->child; field != nullptr; + field = field->next) { // Check client language, if specified. if (strcmp(field->key, "clientLanguage") == 0) { if (field->type != GRPC_JSON_ARRAY || diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc index 82afd1d8b7..1da8ab9161 100644 --- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc @@ -157,8 +157,8 @@ static grpc_resolver* sockaddr_create(grpc_exec_ctx* exec_ctx, grpc_slice_buffer path_parts; grpc_slice_buffer_init(&path_parts); grpc_slice_split(path_slice, ",", &path_parts); - grpc_lb_addresses* addresses = - grpc_lb_addresses_create(path_parts.count, nullptr /* user_data_vtable */); + grpc_lb_addresses* addresses = grpc_lb_addresses_create( + path_parts.count, nullptr /* user_data_vtable */); bool errors_found = false; for (size_t i = 0; i < addresses->num_addresses; i++) { grpc_uri ith_uri = *args->uri; diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index f0d61e2893..2720e68040 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -756,7 +756,7 @@ grpc_error* grpc_connected_subchannel_create_call( (*call)->connection = GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call"); const grpc_call_element_args call_args = { callstk, /* call_stack */ - nullptr, /* server_transport_data */ + nullptr, /* server_transport_data */ args->context, /* context */ args->path, /* path */ args->start_time, /* start_time */ diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index a5cd5d5294..028b69e5ff 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -99,7 +99,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target, grpc_channel_args_destroy(&exec_ctx, new_args); grpc_exec_ctx_finish(&exec_ctx); return channel != nullptr ? channel - : grpc_lame_client_channel_create( - target, GRPC_STATUS_INTERNAL, - "Failed to create client channel"); + : grpc_lame_client_channel_create( + target, GRPC_STATUS_INTERNAL, + "Failed to create client channel"); } diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc index aa3d0d1404..e748d28964 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc @@ -63,9 +63,9 @@ grpc_channel* grpc_insecure_channel_create_from_fd( grpc_exec_ctx_finish(&exec_ctx); return channel != nullptr ? channel - : grpc_lame_client_channel_create( - target, GRPC_STATUS_INTERNAL, - "Failed to create client channel"); + : grpc_lame_client_channel_create( + target, GRPC_STATUS_INTERNAL, + "Failed to create client channel"); } #else // !GPR_SUPPORT_CHANNELS_FROM_FD diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc index 7e23c56643..dd2bc427a7 100644 --- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc @@ -218,7 +218,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds, grpc_exec_ctx_finish(&exec_ctx); } return channel != nullptr ? channel - : grpc_lame_client_channel_create( - target, GRPC_STATUS_INTERNAL, - "Failed to create secure client channel"); + : grpc_lame_client_channel_create( + target, GRPC_STATUS_INTERNAL, + "Failed to create secure client channel"); } diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc index 2206e4a4f6..007d1be50c 100644 --- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc @@ -60,7 +60,8 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server, grpc_endpoint_add_to_pollset(&exec_ctx, server_endpoint, pollsets[i]); } - grpc_server_setup_transport(&exec_ctx, server, transport, nullptr, server_args); + grpc_server_setup_transport(&exec_ctx, server, transport, nullptr, + server_args); grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index c92fdb7127..43788bfc5c 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -1761,8 +1761,8 @@ static void send_goaway(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t, t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED; grpc_http2_error_code http_error; grpc_slice slice; - grpc_error_get_status(exec_ctx, error, GRPC_MILLIS_INF_FUTURE, nullptr, &slice, - &http_error); + grpc_error_get_status(exec_ctx, error, GRPC_MILLIS_INF_FUTURE, nullptr, + &slice, &http_error); grpc_chttp2_goaway_append(t->last_new_stream_id, (uint32_t)http_error, grpc_slice_ref_internal(slice), &t->qbuf); grpc_chttp2_initiate_write(exec_ctx, t, @@ -1980,10 +1980,10 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx, s->stream_decompression_ctx = grpc_stream_compression_context_create( s->stream_decompression_method); } - if (!grpc_stream_decompress(s->stream_decompression_ctx, - &s->frame_storage, - &s->unprocessed_incoming_frames_buffer, nullptr, - GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) { + if (!grpc_stream_decompress( + s->stream_decompression_ctx, &s->frame_storage, + &s->unprocessed_incoming_frames_buffer, nullptr, + GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) { grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage); grpc_slice_buffer_reset_and_unref_internal( exec_ctx, &s->unprocessed_incoming_frames_buffer); @@ -2064,8 +2064,8 @@ void grpc_chttp2_cancel_stream(grpc_exec_ctx* exec_ctx, if (!s->read_closed || !s->write_closed) { if (s->id != 0) { grpc_http2_error_code http_error; - grpc_error_get_status(exec_ctx, due_to_error, s->deadline, nullptr, nullptr, - &http_error); + grpc_error_get_status(exec_ctx, due_to_error, s->deadline, nullptr, + nullptr, &http_error); grpc_slice_buffer_add( &t->qbuf, grpc_chttp2_rst_stream_create(s->id, (uint32_t)http_error, &s->stats.outgoing)); diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index 33e4fc415a..e6e4ff24a3 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -54,7 +54,7 @@ static grpc_slice_refcount terminal_slice_refcount = {nullptr, nullptr}; static const grpc_slice terminal_slice = { &terminal_slice_refcount, /* refcount */ - {{nullptr, 0}} /* data.refcounted */ + {{nullptr, 0}} /* data.refcounted */ }; extern "C" grpc_tracer_flag grpc_http_trace; diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc index db9fb21333..61a2598618 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -333,10 +333,10 @@ class DataSendContext { s_->fetching_send_message == nullptr); if (is_last_data_frame && s_->send_trailing_metadata != nullptr && s_->stream_compression_ctx != nullptr) { - if (!grpc_stream_compress(s_->stream_compression_ctx, - &s_->flow_controlled_buffer, - &s_->compressed_data_buffer, nullptr, MAX_SIZE_T, - GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) { + if (!grpc_stream_compress( + s_->stream_compression_ctx, &s_->flow_controlled_buffer, + &s_->compressed_data_buffer, nullptr, MAX_SIZE_T, + GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) { gpr_log(GPR_ERROR, "Stream compression failed."); } grpc_stream_compression_context_destroy(s_->stream_compression_ctx); @@ -347,7 +347,8 @@ class DataSendContext { * recalculated. */ return; } - is_last_frame_ = is_last_data_frame && s_->send_trailing_metadata != nullptr && + is_last_frame_ = is_last_data_frame && + s_->send_trailing_metadata != nullptr && grpc_metadata_batch_is_empty(s_->send_trailing_metadata); grpc_chttp2_encode_data(s_->id, &s_->compressed_data_buffer, send_bytes, is_last_frame_, &s_->stats.outgoing, &t_->outbuf); diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc index a629942c2d..7ea08b05bb 100644 --- a/src/core/ext/transport/inproc/inproc_transport.cc +++ b/src/core/ext/transport/inproc/inproc_transport.cc @@ -410,10 +410,11 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s, grpc_metadata_batch_init(&fake_md); inproc_stream* other = s->other_side; - grpc_metadata_batch* dest = (other == nullptr) ? &s->write_buffer_trailing_md - : &other->to_read_trailing_md; + grpc_metadata_batch* dest = (other == nullptr) + ? &s->write_buffer_trailing_md + : &other->to_read_trailing_md; bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled - : &other->to_read_trailing_md_filled; + : &other->to_read_trailing_md_filled; fill_in_metadata(exec_ctx, s, &fake_md, 0, dest, nullptr, destfilled); grpc_metadata_batch_destroy(exec_ctx, &fake_md); @@ -612,10 +613,11 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg, (!s->send_message_op || (s->t->is_client && (s->trailing_md_recvd || s->to_read_trailing_md_filled)))) { - grpc_metadata_batch* dest = (other == nullptr) ? &s->write_buffer_trailing_md - : &other->to_read_trailing_md; + grpc_metadata_batch* dest = (other == nullptr) + ? &s->write_buffer_trailing_md + : &other->to_read_trailing_md; bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled - : &other->to_read_trailing_md_filled; + : &other->to_read_trailing_md_filled; if (*destfilled || s->trailing_md_sent) { // The buffer is already in use; that's an error! INPROC_LOG(GPR_DEBUG, "Extra trailing metadata %p", s); @@ -827,10 +829,11 @@ static bool cancel_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s, grpc_metadata_batch_init(&cancel_md); inproc_stream* other = s->other_side; - grpc_metadata_batch* dest = (other == nullptr) ? &s->write_buffer_trailing_md - : &other->to_read_trailing_md; + grpc_metadata_batch* dest = (other == nullptr) + ? &s->write_buffer_trailing_md + : &other->to_read_trailing_md; bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled - : &other->to_read_trailing_md_filled; + : &other->to_read_trailing_md_filled; fill_in_metadata(exec_ctx, s, &cancel_md, 0, dest, nullptr, destfilled); grpc_metadata_batch_destroy(exec_ctx, &cancel_md); @@ -914,12 +917,14 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt, error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Endpoint already shutdown"); } if (error == GRPC_ERROR_NONE && op->send_initial_metadata) { - grpc_metadata_batch* dest = (other == nullptr) ? &s->write_buffer_initial_md - : &other->to_read_initial_md; - uint32_t* destflags = (other == nullptr) ? &s->write_buffer_initial_md_flags - : &other->to_read_initial_md_flags; + grpc_metadata_batch* dest = (other == nullptr) + ? &s->write_buffer_initial_md + : &other->to_read_initial_md; + uint32_t* destflags = (other == nullptr) + ? &s->write_buffer_initial_md_flags + : &other->to_read_initial_md_flags; bool* destfilled = (other == nullptr) ? &s->write_buffer_initial_md_filled - : &other->to_read_initial_md_filled; + : &other->to_read_initial_md_filled; if (*destfilled || s->initial_md_sent) { // The buffer is already in use; that's an error! INPROC_LOG(GPR_DEBUG, "Extra initial metadata %p", s); diff --git a/src/core/lib/http/httpcli.cc b/src/core/lib/http/httpcli.cc index 4b10a624da..73b484b06d 100644 --- a/src/core/lib/http/httpcli.cc +++ b/src/core/lib/http/httpcli.cc @@ -136,8 +136,8 @@ static void on_read(grpc_exec_ctx* exec_ctx, void* user_data, for (i = 0; i < req->incoming.count; i++) { if (GRPC_SLICE_LENGTH(req->incoming.slices[i])) { req->have_read_byte = 1; - grpc_error* err = - grpc_http_parser_parse(&req->parser, req->incoming.slices[i], nullptr); + grpc_error* err = grpc_http_parser_parse( + &req->parser, req->incoming.slices[i], nullptr); if (err != GRPC_ERROR_NONE) { finish(exec_ctx, req, err); return; diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index d4cc1ac52b..581b903f1a 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -767,8 +767,8 @@ grpc_error* grpc_os_error(const char* file, int line, int err, grpc_error_set_str( grpc_error_set_int( grpc_error_create(file, line, - grpc_slice_from_static_string("OS Error"), nullptr, - 0), + grpc_slice_from_static_string("OS Error"), + nullptr, 0), GRPC_ERROR_INT_ERRNO, err), GRPC_ERROR_STR_OS_ERROR, grpc_slice_from_static_string(strerror(err))), diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc index e01dc4e65c..3477fb52cd 100644 --- a/src/core/lib/iomgr/sockaddr_utils.cc +++ b/src/core/lib/iomgr/sockaddr_utils.cc @@ -167,8 +167,8 @@ int grpc_sockaddr_to_string(char** out, port = ntohs(addr6->sin6_port); sin6_scope_id = addr6->sin6_scope_id; } - if (ip != nullptr && - grpc_inet_ntop(addr->sa_family, ip, ntop_buf, sizeof(ntop_buf)) != nullptr) { + if (ip != nullptr && grpc_inet_ntop(addr->sa_family, ip, ntop_buf, + sizeof(ntop_buf)) != nullptr) { if (sin6_scope_id != 0) { char* host_with_scope; /* Enclose sin6_scope_id with the format defined in RFC 6784 section 2. */ diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc index d87aba3af2..2d4b8f0add 100644 --- a/src/core/lib/iomgr/socket_utils_common_posix.cc +++ b/src/core/lib/iomgr/socket_utils_common_posix.cc @@ -263,8 +263,8 @@ static grpc_error* error_for_fd(int fd, const grpc_resolved_address* addr) { grpc_error* grpc_create_dualstack_socket( const grpc_resolved_address* resolved_addr, int type, int protocol, grpc_dualstack_mode* dsmode, int* newfd) { - return grpc_create_dualstack_socket_using_factory(nullptr, resolved_addr, type, - protocol, dsmode, newfd); + return grpc_create_dualstack_socket_using_factory( + nullptr, resolved_addr, type, protocol, dsmode, newfd); } static int create_socket(grpc_socket_factory* factory, int domain, int type, diff --git a/src/core/lib/iomgr/tcp_client_posix.cc b/src/core/lib/iomgr/tcp_client_posix.cc index 85a4c29497..cb0f627c94 100644 --- a/src/core/lib/iomgr/tcp_client_posix.cc +++ b/src/core/lib/iomgr/tcp_client_posix.cc @@ -296,8 +296,8 @@ static void tcp_client_connect_impl(grpc_exec_ctx* exec_ctx, } if (errno != EWOULDBLOCK && errno != EINPROGRESS) { - grpc_fd_orphan(exec_ctx, fdobj, nullptr, nullptr, false /* already_closed */, - "tcp_client_connect_error"); + grpc_fd_orphan(exec_ctx, fdobj, nullptr, nullptr, + false /* already_closed */, "tcp_client_connect_error"); GRPC_CLOSURE_SCHED(exec_ctx, closure, GRPC_OS_ERROR(errno, "connect")); goto done; } diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 104d233c15..cb90933e31 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -198,7 +198,8 @@ static void cover_self(grpc_exec_ctx* exec_ctx, grpc_tcp* tcp) { grpc_executor_scheduler(GRPC_EXECUTOR_LONG)), GRPC_ERROR_NONE); } else { - while ((p = (backup_poller*)gpr_atm_acq_load(&g_backup_poller)) == nullptr) { + while ((p = (backup_poller*)gpr_atm_acq_load(&g_backup_poller)) == + nullptr) { // spin waiting for backup poller } } diff --git a/src/core/lib/security/credentials/composite/composite_credentials.cc b/src/core/lib/security/credentials/composite/composite_credentials.cc index 867b851dc1..93dd721240 100644 --- a/src/core/lib/security/credentials/composite/composite_credentials.cc +++ b/src/core/lib/security/credentials/composite/composite_credentials.cc @@ -224,7 +224,8 @@ static grpc_security_status composite_channel_create_security_connector( downstream. */ if (call_creds != nullptr) { grpc_call_credentials* composite_call_creds = - grpc_composite_call_credentials_create(c->call_creds, call_creds, nullptr); + grpc_composite_call_credentials_create(c->call_creds, call_creds, + nullptr); status = c->inner_creds->vtable->create_security_connector( exec_ctx, c->inner_creds, composite_call_creds, target, args, sc, new_args); @@ -253,7 +254,8 @@ grpc_channel_credentials* grpc_composite_channel_credentials_create( void* reserved) { grpc_composite_channel_credentials* c = (grpc_composite_channel_credentials*)gpr_zalloc(sizeof(*c)); - GPR_ASSERT(channel_creds != nullptr && call_creds != nullptr && reserved == nullptr); + GPR_ASSERT(channel_creds != nullptr && call_creds != nullptr && + reserved == nullptr); GRPC_API_TRACE( "grpc_composite_channel_credentials_create(channel_creds=%p, " "call_creds=%p, reserved=%p)", diff --git a/src/core/lib/security/credentials/credentials.cc b/src/core/lib/security/credentials/credentials.cc index b29abdc6aa..90576e69b9 100644 --- a/src/core/lib/security/credentials/credentials.cc +++ b/src/core/lib/security/credentials/credentials.cc @@ -117,7 +117,8 @@ bool grpc_call_credentials_get_request_metadata( void grpc_call_credentials_cancel_get_request_metadata( grpc_exec_ctx* exec_ctx, grpc_call_credentials* creds, grpc_credentials_mdelem_array* md_array, grpc_error* error) { - if (creds == nullptr || creds->vtable->cancel_get_request_metadata == nullptr) { + if (creds == nullptr || + creds->vtable->cancel_get_request_metadata == nullptr) { return; } creds->vtable->cancel_get_request_metadata(exec_ctx, creds, md_array, error); @@ -206,7 +207,8 @@ void grpc_server_credentials_unref(grpc_exec_ctx* exec_ctx, if (creds->vtable->destruct != nullptr) { creds->vtable->destruct(exec_ctx, creds); } - if (creds->processor.destroy != nullptr && creds->processor.state != nullptr) { + if (creds->processor.destroy != nullptr && + creds->processor.state != nullptr) { creds->processor.destroy(creds->processor.state); } gpr_free(creds); @@ -238,7 +240,8 @@ void grpc_server_credentials_set_auth_metadata_processor( "processor=grpc_auth_metadata_processor { process: %p, state: %p })", 3, (creds, (void*)(intptr_t)processor.process, processor.state)); if (creds == nullptr) return; - if (creds->processor.destroy != nullptr && creds->processor.state != nullptr) { + if (creds->processor.destroy != nullptr && + creds->processor.state != nullptr) { creds->processor.destroy(creds->processor.state); } creds->processor = processor; diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.cc b/src/core/lib/security/credentials/google_default/google_default_credentials.cc index b4df1dc116..f586c7b604 100644 --- a/src/core/lib/security/credentials/google_default/google_default_credentials.cc +++ b/src/core/lib/security/credentials/google_default/google_default_credentials.cc @@ -80,8 +80,8 @@ static void on_compute_engine_detection_http_response(grpc_exec_ctx* exec_ctx, detector->is_done = 1; GRPC_LOG_IF_ERROR( "Pollset kick", - grpc_pollset_kick(exec_ctx, - grpc_polling_entity_pollset(&detector->pollent), nullptr)); + grpc_pollset_kick( + exec_ctx, grpc_polling_entity_pollset(&detector->pollent), nullptr)); gpr_mu_unlock(g_polling_mu); } diff --git a/src/core/lib/security/credentials/jwt/json_token.cc b/src/core/lib/security/credentials/jwt/json_token.cc index 07807201ce..a152ddcaaf 100644 --- a/src/core/lib/security/credentials/jwt/json_token.cc +++ b/src/core/lib/security/credentials/jwt/json_token.cc @@ -52,7 +52,8 @@ gpr_timespec grpc_max_auth_token_lifetime() { /* --- Override for testing. --- */ -static grpc_jwt_encode_and_sign_override g_jwt_encode_and_sign_override = nullptr; +static grpc_jwt_encode_and_sign_override g_jwt_encode_and_sign_override = + nullptr; /* --- grpc_auth_json_key. --- */ @@ -99,7 +100,8 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const grpc_json* json) { gpr_log(GPR_ERROR, "Could not write into openssl BIO."); goto end; } - result.private_key = PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, (void*)""); + result.private_key = + PEM_read_bio_RSAPrivateKey(bio, nullptr, nullptr, (void*)""); if (result.private_key == nullptr) { gpr_log(GPR_ERROR, "Could not deserialize private key."); goto end; @@ -192,8 +194,8 @@ static char* encoded_jwt_claim(const grpc_auth_json_key* json_key, int64_ttoa(now.tv_sec, now_str); int64_ttoa(expiration.tv_sec, expiration_str); - child = - create_child(nullptr, json, "iss", json_key->client_email, GRPC_JSON_STRING); + child = create_child(nullptr, json, "iss", json_key->client_email, + GRPC_JSON_STRING); if (scope != nullptr) { child = create_child(child, json, "scope", scope, GRPC_JSON_STRING); } else { diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc index 105178ff4c..3709b83c4e 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc @@ -576,7 +576,8 @@ static EVP_PKEY* find_verification_key(grpc_exec_ctx* exec_ctx, const char* kty = nullptr; if (jkey->type != GRPC_JSON_OBJECT) continue; - for (key_prop = jkey->child; key_prop != nullptr; key_prop = key_prop->next) { + for (key_prop = jkey->child; key_prop != nullptr; + key_prop = key_prop->next) { if (strcmp(key_prop->key, "alg") == 0 && key_prop->type == GRPC_JSON_STRING) { alg = key_prop->value; @@ -783,7 +784,8 @@ static void retrieve_key_and_verify(grpc_exec_ctx* exec_ctx, req.handshaker = &grpc_httpcli_ssl; http_response_index rsp_idx; - GPR_ASSERT(ctx != nullptr && ctx->header != nullptr && ctx->claims != nullptr); + GPR_ASSERT(ctx != nullptr && ctx->header != nullptr && + ctx->claims != nullptr); iss = ctx->claims->iss; if (ctx->header->kid == nullptr) { gpr_log(GPR_ERROR, "Missing kid in jose header."); @@ -869,7 +871,8 @@ void grpc_jwt_verifier_verify(grpc_exec_ctx* exec_ctx, size_t signed_jwt_len; const char* cur = jwt; - GPR_ASSERT(verifier != nullptr && jwt != nullptr && audience != nullptr && cb != nullptr); + GPR_ASSERT(verifier != nullptr && jwt != nullptr && audience != nullptr && + cb != nullptr); dot = strchr(cur, '.'); if (dot == nullptr) goto error; json = parse_json_part_from_jwt(exec_ctx, cur, (size_t)(dot - cur), diff --git a/src/core/lib/security/transport/client_auth_filter.cc b/src/core/lib/security/transport/client_auth_filter.cc index 0ea33de6ca..326f4d7773 100644 --- a/src/core/lib/security/transport/client_auth_filter.cc +++ b/src/core/lib/security/transport/client_auth_filter.cc @@ -146,8 +146,8 @@ void grpc_auth_metadata_context_build( *port_delimiter = '\0'; } } - gpr_asprintf(&service_url, "%s://%s%s", url_scheme == nullptr ? "" : url_scheme, - host_and_port, service); + gpr_asprintf(&service_url, "%s://%s%s", + url_scheme == nullptr ? "" : url_scheme, host_and_port, service); auth_md_context->service_url = service_url; auth_md_context->method_name = method_name; auth_md_context->channel_auth_context = diff --git a/src/core/lib/security/transport/security_connector.cc b/src/core/lib/security/transport/security_connector.cc index 0e89d005a0..b996cc8cdb 100644 --- a/src/core/lib/security/transport/security_connector.cc +++ b/src/core/lib/security/transport/security_connector.cc @@ -600,7 +600,7 @@ static void ssl_channel_add_handshakers(grpc_exec_ctx* exec_ctx, tsi_result result = tsi_ssl_client_handshaker_factory_create_handshaker( c->client_handshaker_factory, c->overridden_target_name != nullptr ? c->overridden_target_name - : c->target_name, + : c->target_name, &tsi_hs); if (result != TSI_OK) { gpr_log(GPR_ERROR, "Handshaker creation failed with error %s.", @@ -911,7 +911,8 @@ static bool ssl_channel_check_call_host(grpc_exec_ctx* exec_ctx, /* If the target name was overridden, then the original target_name was 'checked' transitively during the previous peer check at the end of the handshake. */ - if (c->overridden_target_name != nullptr && strcmp(host, c->target_name) == 0) { + if (c->overridden_target_name != nullptr && + strcmp(host, c->target_name) == 0) { status = GRPC_SECURITY_OK; } if (status != GRPC_SECURITY_OK) { diff --git a/src/core/lib/slice/slice_intern.cc b/src/core/lib/slice/slice_intern.cc index 4ceb712904..e8949135c0 100644 --- a/src/core/lib/slice/slice_intern.cc +++ b/src/core/lib/slice/slice_intern.cc @@ -172,7 +172,7 @@ int grpc_static_slice_eq(grpc_slice a, grpc_slice b) { uint32_t grpc_slice_hash(grpc_slice s) { return s.refcount == nullptr ? grpc_slice_default_hash_impl(s) - : s.refcount->vtable->hash(s); + : s.refcount->vtable->hash(s); } grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, diff --git a/src/core/lib/support/avl.cc b/src/core/lib/support/avl.cc index ca0e4c6372..0b67a21f2f 100644 --- a/src/core/lib/support/avl.cc +++ b/src/core/lib/support/avl.cc @@ -60,8 +60,8 @@ static long node_height(gpr_avl_node* node) { #ifndef NDEBUG static long calculate_height(gpr_avl_node* node) { return node == nullptr ? 0 - : 1 + GPR_MAX(calculate_height(node->left), - calculate_height(node->right)); + : 1 + GPR_MAX(calculate_height(node->left), + calculate_height(node->right)); } static gpr_avl_node* assert_invariants(gpr_avl_node* n) { diff --git a/src/core/lib/support/sync_posix.cc b/src/core/lib/support/sync_posix.cc index d306d43cb4..dfdd233bf4 100644 --- a/src/core/lib/support/sync_posix.cc +++ b/src/core/lib/support/sync_posix.cc @@ -33,7 +33,9 @@ gpr_atm gpr_counter_atm_cas = 0; gpr_atm gpr_counter_atm_add = 0; #endif -void gpr_mu_init(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_init(mu, nullptr) == 0); } +void gpr_mu_init(gpr_mu* mu) { + GPR_ASSERT(pthread_mutex_init(mu, nullptr) == 0); +} void gpr_mu_destroy(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_destroy(mu) == 0); } @@ -63,7 +65,9 @@ int gpr_mu_trylock(gpr_mu* mu) { /*----------------------------------------*/ -void gpr_cv_init(gpr_cv* cv) { GPR_ASSERT(pthread_cond_init(cv, nullptr) == 0); } +void gpr_cv_init(gpr_cv* cv) { + GPR_ASSERT(pthread_cond_init(cv, nullptr) == 0); +} void gpr_cv_destroy(gpr_cv* cv) { GPR_ASSERT(pthread_cond_destroy(cv) == 0); } diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index 92e36284bd..3a06b0c4cf 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -601,7 +601,8 @@ void grpc_call_unref(grpc_call* c) { // effect of scheduling the previously set cancellation closure, if // any, so that it can release any internal references it may be // holding to the call stack. - grpc_call_combiner_set_notify_on_cancel(&exec_ctx, &c->call_combiner, nullptr); + grpc_call_combiner_set_notify_on_cancel(&exec_ctx, &c->call_combiner, + nullptr); } GRPC_CALL_INTERNAL_UNREF(&exec_ctx, c, "destroy"); grpc_exec_ctx_finish(&exec_ctx); @@ -1910,8 +1911,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx* exec_ctx, if (!prepare_application_metadata( exec_ctx, call, (int)op->data.send_status_from_server.trailing_metadata_count, - op->data.send_status_from_server.trailing_metadata, 1, 1, nullptr, - 0)) { + op->data.send_status_from_server.trailing_metadata, 1, 1, + nullptr, 0)) { for (int n = 0; n < call->send_extra_metadata_count; n++) { GRPC_MDELEM_UNREF(exec_ctx, call->send_extra_metadata[n].md); } diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 8987768a7e..1be734cdb7 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -306,8 +306,8 @@ grpc_call* grpc_channel_create_call(grpc_channel* channel, grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_PATH, grpc_slice_ref_internal(method)), host != nullptr ? grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_AUTHORITY, - grpc_slice_ref_internal(*host)) - : GRPC_MDNULL, + grpc_slice_ref_internal(*host)) + : GRPC_MDNULL, grpc_timespec_to_millis_round_up(deadline)); grpc_exec_ctx_finish(&exec_ctx); return call; @@ -323,8 +323,8 @@ grpc_call* grpc_channel_create_pollset_set_call( grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_PATH, grpc_slice_ref_internal(method)), host != nullptr ? grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_AUTHORITY, - grpc_slice_ref_internal(*host)) - : GRPC_MDNULL, + grpc_slice_ref_internal(*host)) + : GRPC_MDNULL, deadline); } @@ -372,8 +372,8 @@ grpc_call* grpc_channel_create_registered_call( GPR_ASSERT(!reserved); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_call* call = grpc_channel_create_call_internal( - &exec_ctx, channel, parent_call, propagation_mask, completion_queue, nullptr, - GRPC_MDELEM_REF(rc->path), GRPC_MDELEM_REF(rc->authority), + &exec_ctx, channel, parent_call, propagation_mask, completion_queue, + nullptr, GRPC_MDELEM_REF(rc->path), GRPC_MDELEM_REF(rc->authority), grpc_timespec_to_millis_round_up(deadline)); grpc_exec_ctx_finish(&exec_ctx); return call; diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc index e90bbfccc2..a171f90666 100644 --- a/src/core/lib/surface/completion_queue.cc +++ b/src/core/lib/surface/completion_queue.cc @@ -148,7 +148,8 @@ static grpc_error* non_polling_poller_kick( grpc_exec_ctx* exec_ctx, grpc_pollset* pollset, grpc_pollset_worker* specific_worker) { non_polling_poller* p = (non_polling_poller*)pollset; - if (specific_worker == nullptr) specific_worker = (grpc_pollset_worker*)p->root; + if (specific_worker == nullptr) + specific_worker = (grpc_pollset_worker*)p->root; if (specific_worker != nullptr) { non_polling_worker* w = (non_polling_worker*)specific_worker; if (!w->kicked) { @@ -327,7 +328,8 @@ static void cq_destroy_pluck(void* data); static const cq_vtable g_cq_vtable[] = { /* GRPC_CQ_NEXT */ {GRPC_CQ_NEXT, sizeof(cq_next_data), cq_init_next, cq_shutdown_next, - cq_destroy_next, cq_begin_op_for_next, cq_end_op_for_next, cq_next, nullptr}, + cq_destroy_next, cq_begin_op_for_next, cq_end_op_for_next, cq_next, + nullptr}, /* GRPC_CQ_PLUCK */ {GRPC_CQ_PLUCK, sizeof(cq_pluck_data), cq_init_pluck, cq_shutdown_pluck, cq_destroy_pluck, cq_begin_op_for_pluck, cq_end_op_for_pluck, nullptr, diff --git a/src/core/lib/surface/lame_client.cc b/src/core/lib/surface/lame_client.cc index b9e2b58262..7114a9f545 100644 --- a/src/core/lib/surface/lame_client.cc +++ b/src/core/lib/surface/lame_client.cc @@ -167,8 +167,8 @@ grpc_channel* grpc_lame_client_channel_create(const char* target, const char* error_message) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_element* elem; - grpc_channel* channel = grpc_channel_create(&exec_ctx, target, nullptr, - GRPC_CLIENT_LAME_CHANNEL, nullptr); + grpc_channel* channel = grpc_channel_create( + &exec_ctx, target, nullptr, GRPC_CLIENT_LAME_CHANNEL, nullptr); elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0); GRPC_API_TRACE( "grpc_lame_client_channel_create(target=%s, error_code=%d, " diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index bb48c8d900..b816439770 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -1110,8 +1110,8 @@ void grpc_server_setup_transport(grpc_exec_ctx* exec_ctx, grpc_server* s, uint32_t max_probes = 0; grpc_transport_op* op = nullptr; - channel = - grpc_channel_create(exec_ctx, nullptr, args, GRPC_SERVER_CHANNEL, transport); + channel = grpc_channel_create(exec_ctx, nullptr, args, GRPC_SERVER_CHANNEL, + transport); chand = (channel_data*)grpc_channel_stack_element( grpc_channel_get_channel_stack(channel), 0) ->channel_data; diff --git a/src/core/lib/transport/metadata_batch.cc b/src/core/lib/transport/metadata_batch.cc index 480544c8a8..5817765aa3 100644 --- a/src/core/lib/transport/metadata_batch.cc +++ b/src/core/lib/transport/metadata_batch.cc @@ -270,7 +270,8 @@ void grpc_metadata_batch_clear(grpc_exec_ctx* exec_ctx, } bool grpc_metadata_batch_is_empty(grpc_metadata_batch* batch) { - return batch->list.head == nullptr && batch->deadline == GRPC_MILLIS_INF_FUTURE; + return batch->list.head == nullptr && + batch->deadline == GRPC_MILLIS_INF_FUTURE; } size_t grpc_metadata_batch_size(grpc_metadata_batch* batch) { diff --git a/src/core/lib/transport/service_config.cc b/src/core/lib/transport/service_config.cc index 6faf5c272a..adcec8c444 100644 --- a/src/core/lib/transport/service_config.cc +++ b/src/core/lib/transport/service_config.cc @@ -233,8 +233,8 @@ grpc_slice_hash_table* grpc_service_config_create_method_config_table( // Instantiate method config table. grpc_slice_hash_table* method_config_table = nullptr; if (entries != nullptr) { - method_config_table = - grpc_slice_hash_table_create(num_entries, entries, unref_value, nullptr); + method_config_table = grpc_slice_hash_table_create(num_entries, entries, + unref_value, nullptr); gpr_free(entries); } return method_config_table; diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc index 9392c16db3..b39e6ebc30 100644 --- a/src/core/lib/transport/transport.cc +++ b/src/core/lib/transport/transport.cc @@ -186,7 +186,8 @@ void grpc_transport_set_pops(grpc_exec_ctx* exec_ctx, grpc_transport* transport, grpc_pollset_set* pollset_set; if ((pollset = grpc_polling_entity_pollset(pollent)) != nullptr) { transport->vtable->set_pollset(exec_ctx, transport, stream, pollset); - } else if ((pollset_set = grpc_polling_entity_pollset_set(pollent)) != nullptr) { + } else if ((pollset_set = grpc_polling_entity_pollset_set(pollent)) != + nullptr) { transport->vtable->set_pollset_set(exec_ctx, transport, stream, pollset_set); } else { diff --git a/src/core/tsi/fake_transport_security.cc b/src/core/tsi/fake_transport_security.cc index cce6ad29b5..e508d9b24a 100644 --- a/src/core/tsi/fake_transport_security.cc +++ b/src/core/tsi/fake_transport_security.cc @@ -402,7 +402,8 @@ static tsi_result fake_zero_copy_grpc_protector_protect( grpc_exec_ctx* exec_ctx, tsi_zero_copy_grpc_protector* self, grpc_slice_buffer* unprotected_slices, grpc_slice_buffer* protected_slices) { - if (self == nullptr || unprotected_slices == nullptr || protected_slices == nullptr) { + if (self == nullptr || unprotected_slices == nullptr || + protected_slices == nullptr) { return TSI_INVALID_ARGUMENT; } tsi_fake_zero_copy_grpc_protector* impl = @@ -426,7 +427,8 @@ static tsi_result fake_zero_copy_grpc_protector_unprotect( grpc_exec_ctx* exec_ctx, tsi_zero_copy_grpc_protector* self, grpc_slice_buffer* protected_slices, grpc_slice_buffer* unprotected_slices) { - if (self == nullptr || unprotected_slices == nullptr || protected_slices == nullptr) { + if (self == nullptr || unprotected_slices == nullptr || + protected_slices == nullptr) { return TSI_INVALID_ARGUMENT; } tsi_fake_zero_copy_grpc_protector* impl = diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index 2fe62f2f10..f1fff043bd 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -361,8 +361,8 @@ static tsi_result add_subject_alt_names_properties_to_peer( static tsi_result peer_from_x509(X509* cert, int include_certificate_type, tsi_peer* peer) { /* TODO(jboeuf): Maybe add more properties. */ - GENERAL_NAMES* subject_alt_names = - (GENERAL_NAMES*)X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr); + GENERAL_NAMES* subject_alt_names = (GENERAL_NAMES*)X509_get_ext_d2i( + cert, NID_subject_alt_name, nullptr, nullptr); int subject_alt_name_count = (subject_alt_names != nullptr) ? (int)sk_GENERAL_NAME_num(subject_alt_names) : 0; @@ -631,7 +631,8 @@ static tsi_result populate_ssl_context( } } } - if ((cipher_list != nullptr) && !SSL_CTX_set_cipher_list(context, cipher_list)) { + if ((cipher_list != nullptr) && + !SSL_CTX_set_cipher_list(context, cipher_list)) { gpr_log(GPR_ERROR, "Invalid cipher list: %s.", cipher_list); return TSI_INVALID_ARGUMENT; } @@ -679,7 +680,8 @@ static tsi_result build_alpn_protocol_name_list( *protocol_name_list_length = 0; if (num_alpn_protocols == 0) return TSI_INVALID_ARGUMENT; for (i = 0; i < num_alpn_protocols; i++) { - size_t length = alpn_protocols[i] == nullptr ? 0 : strlen(alpn_protocols[i]); + size_t length = + alpn_protocols[i] == nullptr ? 0 : strlen(alpn_protocols[i]); if (length == 0 || length > 255) { gpr_log(GPR_ERROR, "Invalid protocol name length: %d.", (int)length); return TSI_INVALID_ARGUMENT; @@ -1218,8 +1220,8 @@ tsi_result tsi_ssl_server_handshaker_factory_create_handshaker( if (self->ssl_context_count == 0) return TSI_INVALID_ARGUMENT; /* Create the handshaker with the first context. We will switch if needed because of SNI in ssl_server_handshaker_factory_servername_callback. */ - return create_tsi_ssl_handshaker(self->ssl_contexts[0], 0, nullptr, &self->base, - handshaker); + return create_tsi_ssl_handshaker(self->ssl_contexts[0], 0, nullptr, + &self->base, handshaker); } void tsi_ssl_server_handshaker_factory_unref( diff --git a/src/core/tsi/transport_security.cc b/src/core/tsi/transport_security.cc index 9f66492536..a2232bfab1 100644 --- a/src/core/tsi/transport_security.cc +++ b/src/core/tsi/transport_security.cc @@ -74,8 +74,9 @@ tsi_result tsi_frame_protector_protect(tsi_frame_protector* self, size_t* unprotected_bytes_size, unsigned char* protected_output_frames, size_t* protected_output_frames_size) { - if (self == nullptr || self->vtable == nullptr || unprotected_bytes == nullptr || - unprotected_bytes_size == nullptr || protected_output_frames == nullptr || + if (self == nullptr || self->vtable == nullptr || + unprotected_bytes == nullptr || unprotected_bytes_size == nullptr || + protected_output_frames == nullptr || protected_output_frames_size == nullptr) { return TSI_INVALID_ARGUMENT; } @@ -88,8 +89,10 @@ tsi_result tsi_frame_protector_protect(tsi_frame_protector* self, tsi_result tsi_frame_protector_protect_flush( tsi_frame_protector* self, unsigned char* protected_output_frames, size_t* protected_output_frames_size, size_t* still_pending_size) { - if (self == nullptr || self->vtable == nullptr || protected_output_frames == nullptr || - protected_output_frames_size == nullptr || still_pending_size == nullptr) { + if (self == nullptr || self->vtable == nullptr || + protected_output_frames == nullptr || + protected_output_frames_size == nullptr || + still_pending_size == nullptr) { return TSI_INVALID_ARGUMENT; } if (self->vtable->protect_flush == nullptr) return TSI_UNIMPLEMENTED; @@ -102,7 +105,8 @@ tsi_result tsi_frame_protector_unprotect( tsi_frame_protector* self, const unsigned char* protected_frames_bytes, size_t* protected_frames_bytes_size, unsigned char* unprotected_bytes, size_t* unprotected_bytes_size) { - if (self == nullptr || self->vtable == nullptr || protected_frames_bytes == nullptr || + if (self == nullptr || self->vtable == nullptr || + protected_frames_bytes == nullptr || protected_frames_bytes_size == nullptr || unprotected_bytes == nullptr || unprotected_bytes_size == nullptr) { return TSI_INVALID_ARGUMENT; @@ -130,7 +134,8 @@ tsi_result tsi_handshaker_get_bytes_to_send_to_peer(tsi_handshaker* self, return TSI_INVALID_ARGUMENT; } if (self->frame_protector_created) return TSI_FAILED_PRECONDITION; - if (self->vtable->get_bytes_to_send_to_peer == nullptr) return TSI_UNIMPLEMENTED; + if (self->vtable->get_bytes_to_send_to_peer == nullptr) + return TSI_UNIMPLEMENTED; return self->vtable->get_bytes_to_send_to_peer(self, bytes, bytes_size); } @@ -142,7 +147,8 @@ tsi_result tsi_handshaker_process_bytes_from_peer(tsi_handshaker* self, return TSI_INVALID_ARGUMENT; } if (self->frame_protector_created) return TSI_FAILED_PRECONDITION; - if (self->vtable->process_bytes_from_peer == nullptr) return TSI_UNIMPLEMENTED; + if (self->vtable->process_bytes_from_peer == nullptr) + return TSI_UNIMPLEMENTED; return self->vtable->process_bytes_from_peer(self, bytes, bytes_size); } diff --git a/src/core/tsi/transport_security_adapter.cc b/src/core/tsi/transport_security_adapter.cc index 137bf6bfdd..56dec55494 100644 --- a/src/core/tsi/transport_security_adapter.cc +++ b/src/core/tsi/transport_security_adapter.cc @@ -77,7 +77,8 @@ static const tsi_handshaker_result_vtable result_vtable = { static tsi_result tsi_adapter_create_handshaker_result( tsi_handshaker* wrapped, const unsigned char* unused_bytes, size_t unused_bytes_size, tsi_handshaker_result** handshaker_result) { - if (wrapped == nullptr || (unused_bytes_size > 0 && unused_bytes == nullptr)) { + if (wrapped == nullptr || + (unused_bytes_size > 0 && unused_bytes == nullptr)) { return TSI_INVALID_ARGUMENT; } tsi_adapter_handshaker_result* impl = |