Enable clang-tidy as a sanity check, fix up all known failures

pull/13349/head
Craig Tiller 7 years ago
parent e77b3c36d1
commit 4ac2b8e585
  1. 5
      .clang_complete
  2. 6
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  3. 1
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
  4. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
  5. 4
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  6. 4
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  7. 2
      src/core/ext/transport/chttp2/transport/flow_control.h
  8. 1
      src/core/ext/transport/chttp2/transport/stream_map.cc
  9. 2
      src/core/ext/transport/chttp2/transport/writing.cc
  10. 9
      src/core/lib/iomgr/error.h
  11. 1
      src/core/lib/iomgr/error_internal.h
  12. 5
      src/core/lib/iomgr/iocp_windows.h
  13. 2
      src/core/lib/iomgr/lockfree_event.h
  14. 4
      src/core/lib/iomgr/pollset_windows.h
  15. 5
      src/core/lib/iomgr/sockaddr_windows.h
  16. 4
      src/core/lib/iomgr/socket_windows.h
  17. 6
      src/core/lib/iomgr/tcp_uv.h
  18. 4
      src/core/lib/iomgr/tcp_windows.h
  19. 1
      src/core/lib/iomgr/udp_server.cc
  20. 5
      src/core/lib/iomgr/unix_sockets_posix.cc
  21. 2
      src/core/lib/support/atomic_with_atm.h
  22. 2
      src/core/lib/support/memory.h
  23. 8
      src/core/lib/surface/channel.cc
  24. 2
      src/core/lib/transport/bdp_estimator.h
  25. 2
      src/core/lib/transport/error_utils.cc
  26. 2
      src/core/lib/transport/transport_op_string.cc
  27. 16
      src/cpp/client/channel_cc.cc
  28. 2
      src/cpp/client/client_context.cc
  29. 2
      src/cpp/client/create_channel.cc
  30. 2
      src/cpp/server/server_cc.cc
  31. 8
      src/cpp/server/server_context.cc
  32. 2
      src/cpp/server/server_posix.cc
  33. 30
      test/core/bad_client/bad_client.cc
  34. 12
      test/core/bad_client/tests/badreq.cc
  35. 50
      test/core/bad_client/tests/connection_prefix.cc
  36. 6
      test/core/bad_client/tests/head_of_line_blocking.cc
  37. 120
      test/core/bad_client/tests/headers.cc
  38. 54
      test/core/bad_client/tests/initial_settings_frame.cc
  39. 4
      test/core/bad_client/tests/large_metadata.cc
  40. 28
      test/core/bad_client/tests/server_registered_method.cc
  41. 26
      test/core/bad_client/tests/simple_request.cc
  42. 4
      test/core/bad_client/tests/unknown_frame.cc
  43. 4
      test/core/bad_client/tests/window_overflow.cc
  44. 20
      test/core/bad_ssl/bad_ssl_test.cc
  45. 20
      test/core/bad_ssl/server_common.cc
  46. 4
      test/core/bad_ssl/servers/alpn.cc
  47. 4
      test/core/bad_ssl/servers/cert.cc
  48. 10
      test/core/channel/channel_args_test.cc
  49. 4
      test/core/channel/channel_stack_builder_test.cc
  50. 6
      test/core/channel/channel_stack_test.cc
  51. 28
      test/core/channel/minimal_stack_is_minimal_test.cc
  52. 96
      test/core/client_channel/lb_policies_test.cc
  53. 4
      test/core/client_channel/parse_address_test.cc
  54. 12
      test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc
  55. 4
      test/core/client_channel/resolvers/dns_resolver_test.cc
  56. 20
      test/core/client_channel/resolvers/fake_resolver_test.cc
  57. 4
      test/core/client_channel/resolvers/sockaddr_resolver_test.cc
  58. 14
      test/core/client_channel/uri_parser_test.cc
  59. 4
      test/core/compression/algorithm_test.cc
  60. 14
      test/core/compression/stream_compression_test.cc
  61. 30
      test/core/end2end/bad_server_response_test.cc
  62. 20
      test/core/end2end/connection_refused_test.cc
  63. 26
      test/core/end2end/cq_verifier.cc
  64. 7
      test/core/end2end/cq_verifier_native.cc
  65. 36
      test/core/end2end/dualstack_socket_test.cc
  66. 6
      test/core/end2end/end2end_test_utils.cc
  67. 10
      test/core/end2end/fixtures/h2_census.cc
  68. 14
      test/core/end2end/fixtures/h2_compress.cc
  69. 20
      test/core/end2end/fixtures/h2_fakesec.cc
  70. 10
      test/core/end2end/fixtures/h2_fd.cc
  71. 10
      test/core/end2end/fixtures/h2_full+pipe.cc
  72. 10
      test/core/end2end/fixtures/h2_full+trace.cc
  73. 10
      test/core/end2end/fixtures/h2_full+workarounds.cc
  74. 10
      test/core/end2end/fixtures/h2_full.cc
  75. 12
      test/core/end2end/fixtures/h2_http_proxy.cc
  76. 10
      test/core/end2end/fixtures/h2_load_reporting.cc
  77. 34
      test/core/end2end/fixtures/h2_oauth2.cc
  78. 14
      test/core/end2end/fixtures/h2_proxy.cc
  79. 16
      test/core/end2end/fixtures/h2_sockpair+trace.cc
  80. 16
      test/core/end2end/fixtures/h2_sockpair.cc
  81. 14
      test/core/end2end/fixtures/h2_sockpair_1byte.cc
  82. 28
      test/core/end2end/fixtures/h2_ssl.cc
  83. 36
      test/core/end2end/fixtures/h2_ssl_proxy.cc
  84. 10
      test/core/end2end/fixtures/h2_uds.cc
  85. 20
      test/core/end2end/fixtures/http_proxy_fixture.cc
  86. 10
      test/core/end2end/fixtures/inproc.cc
  87. 58
      test/core/end2end/fixtures/proxy.cc
  88. 226
      test/core/end2end/fuzzers/api_fuzzer.cc
  89. 36
      test/core/end2end/fuzzers/client_fuzzer.cc
  90. 22
      test/core/end2end/fuzzers/server_fuzzer.cc
  91. 52
      test/core/end2end/goaway_server_test.cc
  92. 38
      test/core/end2end/h2_ssl_cert_test.cc
  93. 148
      test/core/end2end/invalid_call_argument_test.cc
  94. 24
      test/core/end2end/multiple_server_queues_test.cc
  95. 16
      test/core/end2end/no_server_test.cc
  96. 34
      test/core/end2end/tests/authority_not_supported.cc
  97. 24
      test/core/end2end/tests/bad_hostname.cc
  98. 34
      test/core/end2end/tests/bad_ping.cc
  99. 54
      test/core/end2end/tests/binary_metadata.cc
  100. 102
      test/core/end2end/tests/call_creds.cc
  101. Some files were not shown because too many files have changed in this diff Show More

@ -10,3 +10,8 @@
-Ithird_party/zlib
-Ithird_party/protobuf/src
-Ithird_party/abseil-cpp
-Ithird_party/cares/cares
-Ithird_party/cares
-Ithird_party/googletest/googletest/include
-Ithird_party/googletest/googlemock/include

@ -449,8 +449,8 @@ static bool is_server_valid(const grpc_grpclb_server* server, size_t idx,
/* vtable for LB tokens in grpc_lb_addresses. */
static void* lb_token_copy(void* token) {
return token == NULL
? NULL
return token == nullptr
? nullptr
: (void*)GRPC_MDELEM_REF(grpc_mdelem{(uintptr_t)token}).payload;
}
static void lb_token_destroy(grpc_exec_ctx* exec_ctx, void* token) {
@ -563,7 +563,7 @@ static grpc_lb_addresses* extract_backend_addresses_locked(
const grpc_resolved_address* addr = &addresses->addresses[i].address;
grpc_lb_addresses_set_address(backend_addresses, num_copied, &addr->addr,
addr->len, false /* is_balancer */,
NULL /* balancer_name */,
nullptr /* balancer_name */,
(void*)GRPC_MDELEM_LB_TOKEN_EMPTY.payload);
++num_copied;
}

@ -19,6 +19,7 @@
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H
#include <ares.h>
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/pollset_set.h"

@ -285,7 +285,7 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
ARES_GETSOCK_WRITABLE(socks_bitmask, i)) {
fd_node* fdn = pop_fd_node(&ev_driver->fds, socks[i]);
// Create a new fd_node if sock[i] is not in the fd_node list.
if (fdn == NULL) {
if (fdn == nullptr) {
char* fd_name;
gpr_asprintf(&fd_name, "ares_ev_driver-%" PRIuPTR, i);
fdn = (fd_node*)gpr_malloc(sizeof(fd_node));

@ -297,7 +297,7 @@ static void on_txt_done_cb(void* arg, int status, int timeouts,
*r->service_config_json_out = (char*)gpr_malloc(service_config_len + 1);
memcpy(*r->service_config_json_out, result->txt + prefix_len,
service_config_len);
for (result = result->next; result != NULL && !result->record_start;
for (result = result->next; result != nullptr && !result->record_start;
result = result->next) {
*r->service_config_json_out = (char*)gpr_realloc(
*r->service_config_json_out, service_config_len + result->length + 1);
@ -334,7 +334,7 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl(
grpc_error* error = GRPC_ERROR_NONE;
grpc_ares_hostbyname_request* hr = nullptr;
grpc_ares_request* r = nullptr;
ares_channel* channel = NULL;
ares_channel* channel = nullptr;
/* TODO(zyc): Enable tracing after #9603 is checked in */
/* if (grpc_dns_trace) {
gpr_log(GPR_DEBUG, "resolve_address (blocking): name=%s, default_port=%s",

@ -575,7 +575,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
schedule_bdp_ping_locked(exec_ctx, t);
grpc_chttp2_act_on_flowctl_action(
exec_ctx, t->flow_control->PeriodicUpdate(exec_ctx), t, NULL);
exec_ctx, t->flow_control->PeriodicUpdate(exec_ctx), t, nullptr);
}
grpc_chttp2_initiate_write(exec_ctx, t,
@ -2569,7 +2569,7 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer,
&t->read_action_locked);
grpc_chttp2_act_on_flowctl_action(exec_ctx, t->flow_control->MakeAction(),
t, NULL);
t, nullptr);
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keep_reading");
} else {
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "reading_action");

@ -41,7 +41,7 @@ class TrickledCHTTP2; // to make this a friend
namespace grpc_core {
namespace chttp2 {
static constexpr uint32_t;;;;;;;;;;;;; kDefaultWindow = 65535;
static constexpr uint32_t kDefaultWindow = 65535;
class TransportFlowControl;
class StreamFlowControl;

@ -145,6 +145,7 @@ void* grpc_chttp2_stream_map_rand(grpc_chttp2_stream_map* map) {
if (map->free != 0) {
map->count = compact(map->keys, map->values, map->count);
map->free = 0;
GPR_ASSERT(map->count > 0);
}
return map->values[((size_t)rand()) % map->count];
}

@ -397,7 +397,7 @@ class StreamWriteContext {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t_,
t_->is_client ? "CLIENT" : "SERVER", s->id,
s->sent_initial_metadata, s->send_initial_metadata != NULL,
s->sent_initial_metadata, s->send_initial_metadata != nullptr,
(int)(s->flow_control->local_window_delta() -
s->flow_control->announced_window_delta())));
}

@ -24,6 +24,7 @@
#include <grpc/slice.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include "src/core/lib/debug/trace.h"
@ -184,9 +185,15 @@ grpc_error* grpc_error_add_child(grpc_error* src,
grpc_error* child) GRPC_MUST_USE_RESULT;
grpc_error* grpc_os_error(const char* file, int line, int err,
const char* call_name) GRPC_MUST_USE_RESULT;
inline grpc_error* grpc_assert_never_ok(grpc_error* error) {
GPR_ASSERT(error != GRPC_ERROR_NONE);
return error;
}
/// create an error associated with errno!=0 (an 'operating system' error)
#define GRPC_OS_ERROR(err, call_name) \
grpc_os_error(__FILE__, __LINE__, err, call_name)
grpc_assert_never_ok(grpc_os_error(__FILE__, __LINE__, err, call_name))
grpc_error* grpc_wsa_error(const char* file, int line, int err,
const char* call_name) GRPC_MUST_USE_RESULT;
/// windows only: create an error associated with WSAGetLastError()!=0

@ -23,6 +23,7 @@
#include <stdbool.h> // TODO, do we need this?
#include <grpc/support/sync.h>
#include "src/core/lib/iomgr/error.h"
#ifdef __cplusplus
extern "C" {

@ -21,6 +21,10 @@
#include <grpc/support/sync.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include "src/core/lib/iomgr/socket_windows.h"
#ifdef __cplusplus
@ -45,4 +49,5 @@ void grpc_iocp_add_socket(grpc_winsocket*);
}
#endif
#endif /* GRPC_WINSOCK_SOCKET */
#endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */

@ -25,7 +25,7 @@
#include "src/core/lib/iomgr/exec_ctx.h"
namespace grpc_core; {
namespace grpc_core {
class LockfreeEvent {
public:

@ -21,6 +21,9 @@
#include <grpc/support/sync.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include "src/core/lib/iomgr/socket_windows.h"
#ifdef __cplusplus
@ -68,4 +71,5 @@ void grpc_pollset_global_shutdown(void);
}
#endif
#endif /* GRPC_WINSOCK_SOCKET */
#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */

@ -19,10 +19,15 @@
#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H
#define GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include <winsock2.h>
#include <ws2tcpip.h>
// must be included after the above
#include <mswsock.h>
#endif /* GRPC_WINSOCK_SOCKET */
#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H */

@ -20,6 +20,9 @@
#define GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include <winsock2.h>
#include <grpc/support/atm.h>
@ -115,4 +118,5 @@ void grpc_socket_become_ready(grpc_exec_ctx* exec_ctx,
}
#endif
#endif /* GRPC_WINSOCK_SOCKET */
#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */

@ -32,6 +32,10 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_UV
#include <uv.h>
extern grpc_tracer_flag grpc_tcp_trace;
@ -50,4 +54,6 @@ grpc_endpoint* grpc_tcp_create(uv_tcp_t* handle,
}
#endif
#endif /* GRPC_UV */
#endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */

@ -29,6 +29,9 @@
otherwise specified.
*/
#include "src/core/lib/iomgr/port.h"
#ifdef GRPC_WINSOCK_SOCKET
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/iomgr/socket_windows.h"
@ -49,4 +52,5 @@ grpc_error* grpc_tcp_prepare_socket(SOCKET sock);
}
#endif
#endif /* GRPC_WINSOCK_SOCKET */
#endif /* GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H */

@ -508,6 +508,7 @@ int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index) {
for (sp = s->head; sp && port_index != 0; sp = sp->next) {
--port_index;
}
GPR_ASSERT(sp); // if this fails, our check earlier was bogus
return sp->fd;
}

@ -39,7 +39,8 @@ void grpc_create_socketpair_if_unix(int sv[2]) {
grpc_error* grpc_resolve_unix_domain_address(const char* name,
grpc_resolved_addresses** addrs) {
struct sockaddr_un* un;
if (strlen(name) > GPR_ARRAY_SIZE(((struct sockaddr_un*)nullptr)->sun_path) - 1) {
if (strlen(name) >
GPR_ARRAY_SIZE(((struct sockaddr_un*)nullptr)->sun_path) - 1) {
char* err_msg;
grpc_error* err;
gpr_asprintf(&err_msg,
@ -56,7 +57,7 @@ grpc_error* grpc_resolve_unix_domain_address(const char* name,
(grpc_resolved_address*)gpr_malloc(sizeof(grpc_resolved_address));
un = (struct sockaddr_un*)(*addrs)->addrs->addr;
un->sun_family = AF_UNIX;
strcpy(un->sun_path, name);
strncpy(un->sun_path, name, sizeof(un->sun_path));
(*addrs)->addrs->len = strlen(un->sun_path) + sizeof(un->sun_family) + 1;
return GRPC_ERROR_NONE;
}

@ -21,7 +21,7 @@
#include <grpc/support/atm.h>
namespace grpc_core;; {
namespace grpc_core {
enum MemoryOrderRelaxed { memory_order_relaxed };

@ -76,7 +76,7 @@ class Allocator {
pointer address(reference x) const { return &x; }
const_pointer address(const_reference x) const { return &x; }
pointer allocate(std::size_t n,
std::allocator<void>::const_pointer hint = 0) {
std::allocator<void>::const_pointer hint = nullptr) {
return static_cast<pointer>(gpr_malloc(n * sizeof(T)));
}
void deallocate(T* p, std::size_t n) { gpr_free(p); }

@ -302,10 +302,10 @@ grpc_call* grpc_channel_create_call(grpc_channel* channel,
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, cq, NULL,
&exec_ctx, channel, parent_call, propagation_mask, cq, nullptr,
grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_PATH,
grpc_slice_ref_internal(method)),
host != NULL ? grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_AUTHORITY,
host != nullptr ? grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_AUTHORITY,
grpc_slice_ref_internal(*host))
: GRPC_MDNULL,
grpc_timespec_to_millis_round_up(deadline));
@ -319,10 +319,10 @@ grpc_call* grpc_channel_create_pollset_set_call(
const grpc_slice* host, grpc_millis deadline, void* reserved) {
GPR_ASSERT(!reserved);
return grpc_channel_create_call_internal(
exec_ctx, channel, parent_call, propagation_mask, NULL, pollset_set,
exec_ctx, channel, parent_call, propagation_mask, nullptr, pollset_set,
grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_PATH,
grpc_slice_ref_internal(method)),
host != NULL ? grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_AUTHORITY,
host != nullptr ? grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_AUTHORITY,
grpc_slice_ref_internal(*host))
: GRPC_MDNULL,
deadline);

@ -33,7 +33,7 @@
extern grpc_tracer_flag grpc_bdp_estimator_trace;
namespace grpc_core; {
namespace grpc_core {
class BdpEstimator {
public:

@ -90,8 +90,6 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error,
}
}
}
if (found_error == nullptr) found_error = error;
}
bool grpc_error_has_clear_grpc_status(grpc_error* error) {

@ -189,7 +189,7 @@ char* grpc_transport_op_string(grpc_transport_op* op) {
if (op->send_ping != nullptr) {
if (!first) gpr_strvec_add(&b, gpr_strdup(" "));
first = false;
// first = false;
gpr_strvec_add(&b, gpr_strdup("SEND_PING"));
}

@ -61,11 +61,11 @@ namespace {
grpc::string GetChannelInfoField(grpc_channel* channel,
grpc_channel_info* channel_info,
char*** channel_info_field) {
char* value = NULL;
char* value = nullptr;
memset(channel_info, 0, sizeof(*channel_info));
*channel_info_field = &value;
grpc_channel_get_info(channel, channel_info);
if (value == NULL) return "";
if (value == nullptr) return "";
grpc::string result = value;
gpr_free(value);
return result;
@ -89,14 +89,14 @@ internal::Call Channel::CreateCall(const internal::RpcMethod& method,
ClientContext* context,
CompletionQueue* cq) {
const bool kRegistered = method.channel_tag() && context->authority().empty();
grpc_call* c_call = NULL;
grpc_call* c_call = nullptr;
if (kRegistered) {
c_call = grpc_channel_create_registered_call(
c_channel_, context->propagate_from_call_,
context->propagation_options_.c_bitmask(), cq->cq(),
method.channel_tag(), context->raw_deadline(), nullptr);
} else {
const char* host_str = NULL;
const char* host_str = nullptr;
if (!context->authority().empty()) {
host_str = context->authority_.c_str();
} else if (!host_.empty()) {
@ -134,7 +134,7 @@ void Channel::PerformOpsOnCall(internal::CallOpSetInterface* ops,
void* Channel::RegisterMethod(const char* method) {
return grpc_channel_register_call(
c_channel_, method, host_.empty() ? NULL : host_.c_str(), nullptr);
c_channel_, method, host_.empty() ? nullptr : host_.c_str(), nullptr);
}
grpc_connectivity_state Channel::GetState(bool try_to_connect) {
@ -171,10 +171,10 @@ bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed,
gpr_timespec deadline) {
CompletionQueue cq;
bool ok = false;
void* tag = NULL;
NotifyOnStateChangeImpl(last_observed, deadline, &cq, NULL);
void* tag = nullptr;
NotifyOnStateChangeImpl(last_observed, deadline, &cq, nullptr);
cq.Next(&tag, &ok);
GPR_ASSERT(tag == NULL);
GPR_ASSERT(tag == nullptr);
return ok;
}

@ -127,7 +127,7 @@ grpc::string ClientContext::peer() const {
void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) {
GPR_ASSERT(g_client_callbacks == &g_default_client_callbacks);
GPR_ASSERT(client_callbacks != NULL);
GPR_ASSERT(client_callbacks != nullptr);
GPR_ASSERT(client_callbacks != &g_default_client_callbacks);
g_client_callbacks = client_callbacks;
}

@ -42,7 +42,7 @@ std::shared_ptr<Channel> CreateCustomChannel(
return creds
? creds->CreateChannel(target, args)
: CreateChannelInternal("", grpc_lame_client_channel_create(
NULL, GRPC_STATUS_INVALID_ARGUMENT,
nullptr, GRPC_STATUS_INVALID_ARGUMENT,
"Invalid credentials."));
}

@ -76,7 +76,7 @@ class Server::UnimplementedAsyncRequest final
public:
UnimplementedAsyncRequest(Server* server, ServerCompletionQueue* cq)
: GenericAsyncRequest(server, &server_context_, &generic_stream_, cq, cq,
NULL, false),
nullptr, false),
server_(server),
cq_(cq) {}

@ -90,7 +90,7 @@ void ServerContext::CompletionOp::FillOps(grpc_call* call, grpc_op* ops,
ops->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
ops->data.recv_close_on_server.cancelled = &cancelled_;
ops->flags = 0;
ops->reserved = NULL;
ops->reserved = nullptr;
*nops = 1;
}
@ -171,7 +171,7 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key,
void ServerContext::TryCancel() const {
grpc_call_error err = grpc_call_cancel_with_status(
call_, GRPC_STATUS_CANCELLED, "Cancelled on the server side", NULL);
call_, GRPC_STATUS_CANCELLED, "Cancelled on the server side", nullptr);
if (err != GRPC_CALL_OK) {
gpr_log(GPR_ERROR, "TryCancel failed with: %d", err);
}
@ -190,13 +190,13 @@ bool ServerContext::IsCancelled() const {
void ServerContext::set_compression_algorithm(
grpc_compression_algorithm algorithm) {
const char* algorithm_name = NULL;
const char* algorithm_name = nullptr;
if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
algorithm);
abort();
}
GPR_ASSERT(algorithm_name != NULL);
GPR_ASSERT(algorithm_name != nullptr);
AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name);
}

@ -25,7 +25,7 @@ namespace grpc {
#ifdef GPR_SUPPORT_CHANNELS_FROM_FD
void AddInsecureChannelFromFd(Server* server, int fd) {
grpc_server_add_insecure_channel_from_fd(server->c_server(), NULL, fd);
grpc_server_add_insecure_channel_from_fd(server->c_server(), nullptr, fd);
}
#endif // GPR_SUPPORT_CHANNELS_FROM_FD

@ -58,7 +58,7 @@ static void done_write(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
static void server_setup_transport(void* ts, grpc_transport* transport) {
thd_args* a = (thd_args*)ts;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_server_setup_transport(&exec_ctx, a->server, transport, NULL,
grpc_server_setup_transport(&exec_ctx, a->server, transport, nullptr,
grpc_server_get_channel_args(a->server));
grpc_exec_ctx_finish(&exec_ctx);
}
@ -101,23 +101,23 @@ void grpc_run_bad_client_test(
grpc_init();
/* Create endpoints */
sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL);
sfd = grpc_iomgr_create_endpoint_pair("fixture", nullptr);
/* Create server, completion events */
a.server = grpc_server_create(NULL, NULL);
a.cq = grpc_completion_queue_create_for_next(NULL);
a.server = grpc_server_create(nullptr, nullptr);
a.cq = grpc_completion_queue_create_for_next(nullptr);
gpr_event_init(&a.done_thd);
gpr_event_init(&a.done_write);
a.validator = server_validator;
grpc_server_register_completion_queue(a.server, a.cq, NULL);
grpc_server_register_completion_queue(a.server, a.cq, nullptr);
a.registered_method =
grpc_server_register_method(a.server, GRPC_BAD_CLIENT_REGISTERED_METHOD,
GRPC_BAD_CLIENT_REGISTERED_HOST,
GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER, 0);
grpc_server_start(a.server);
transport = grpc_create_chttp2_transport(&exec_ctx, NULL, sfd.server, 0);
transport = grpc_create_chttp2_transport(&exec_ctx, nullptr, sfd.server, 0);
server_setup_transport(&a, transport);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
/* Bind everything into the same pollset */
@ -128,7 +128,7 @@ void grpc_run_bad_client_test(
GPR_ASSERT(grpc_server_has_open_connections(a.server));
/* Start validator */
gpr_thd_new(&id, thd_func, &a, NULL);
gpr_thd_new(&id, thd_func, &a, nullptr);
grpc_slice_buffer_init(&outgoing);
grpc_slice_buffer_add(&outgoing, slice);
@ -152,14 +152,14 @@ void grpc_run_bad_client_test(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Disconnect"));
grpc_endpoint_destroy(&exec_ctx, sfd.client);
grpc_exec_ctx_finish(&exec_ctx);
sfd.client = NULL;
sfd.client = nullptr;
}
GPR_ASSERT(gpr_event_wait(&a.done_thd, grpc_timeout_seconds_to_deadline(5)));
if (sfd.client != NULL) {
if (sfd.client != nullptr) {
// Validate client stream, if requested.
if (client_validator != NULL) {
if (client_validator != nullptr) {
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5);
grpc_slice_buffer incoming;
grpc_slice_buffer_init(&incoming);
@ -176,7 +176,7 @@ void grpc_run_bad_client_test(
do {
GPR_ASSERT(gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0);
GPR_ASSERT(grpc_completion_queue_next(
a.cq, grpc_timeout_milliseconds_to_deadline(100), NULL)
a.cq, grpc_timeout_milliseconds_to_deadline(100), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
} while (!gpr_event_get(&read_done_event));
if (client_validator(&incoming)) break;
@ -196,10 +196,10 @@ void grpc_run_bad_client_test(
GPR_ASSERT(
gpr_event_wait(&a.done_write, grpc_timeout_seconds_to_deadline(1)));
shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
grpc_server_shutdown_and_notify(a.server, shutdown_cq, NULL);
shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
grpc_server_shutdown_and_notify(a.server, shutdown_cq, nullptr);
GPR_ASSERT(grpc_completion_queue_pluck(
shutdown_cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL)
shutdown_cq, nullptr, grpc_timeout_seconds_to_deadline(1), nullptr)
.type == GRPC_OP_COMPLETE);
grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(a.server);

@ -31,7 +31,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -41,7 +41,7 @@ int main(int argc, char** argv) {
/* invalid content type */
GRPC_RUN_BAD_CLIENT_TEST(
verifier, NULL,
verifier, nullptr,
PFX_STR
"\x00\x00\xc2\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
@ -57,7 +57,7 @@ int main(int argc, char** argv) {
/* invalid te */
GRPC_RUN_BAD_CLIENT_TEST(
verifier, NULL,
verifier, nullptr,
PFX_STR
"\x00\x00\xcb\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
@ -75,7 +75,7 @@ int main(int argc, char** argv) {
/* two path headers */
GRPC_RUN_BAD_CLIENT_TEST(
verifier, NULL,
verifier, nullptr,
PFX_STR
"\x00\x00\xd9\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
@ -93,7 +93,7 @@ int main(int argc, char** argv) {
/* bad accept-encoding algorithm */
GRPC_RUN_BAD_CLIENT_TEST(
verifier, NULL,
verifier, nullptr,
PFX_STR
"\x00\x00\xd2\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"
@ -110,7 +110,7 @@ int main(int argc, char** argv) {
/* bad grpc-encoding algorithm */
GRPC_RUN_BAD_CLIENT_TEST(
verifier, NULL,
verifier, nullptr,
PFX_STR
"\x00\x00\xf5\x01\x04\x00\x00\x00\x01"
"\x10\x05:path\x08/foo/bar"

@ -23,7 +23,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -31,30 +31,30 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
int main(int argc, char** argv) {
grpc_test_init(argc, argv);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRIX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI *X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTPX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\rX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\nX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\rX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSMX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSM\rX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSM\r\nX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSM\r\n\rX",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRIX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI *X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTPX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0X", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\rX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\nX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\rX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSMX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSM\rX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSM\r\nX", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSM\r\n\rX",
0);
return 0;
}

@ -74,7 +74,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
cq_verifier* cqv = cq_verifier_create(cq);
grpc_metadata_array request_metadata_recv;
gpr_timespec deadline;
grpc_byte_buffer* payload = NULL;
grpc_byte_buffer* payload = nullptr;
grpc_metadata_array_init(&request_metadata_recv);
@ -85,7 +85,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
cq_verify(cqv);
GPR_ASSERT(payload != NULL);
GPR_ASSERT(payload != nullptr);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_unref(s);
@ -129,7 +129,7 @@ int main(int argc, char** argv) {
addbuf(hdr, sizeof(hdr));
addbuf(msg, FRAME_SIZE);
}
grpc_run_bad_client_test(verifier, NULL, g_buffer, g_count, 0);
grpc_run_bad_client_test(verifier, nullptr, g_buffer, g_count, 0);
gpr_free(g_buffer);
return 0;

@ -27,7 +27,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -36,275 +36,275 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
/* partial http2 header prefixes */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x04",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x05",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x05",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x04\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x01\x04\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
/* test adding prioritization data */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x01\x01\x24\x00\x00\x00\x01"
"\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x02\x01\x24\x00\x00\x00\x01"
"\x00\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x03\x01\x24\x00\x00\x00\x01"
"\x00\x00\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x04\x01\x24\x00\x00\x00\x01"
"\x00\x00\x00\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x01\x24\x00\x00\x00\x01"
"",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x01\x24\x00\x00\x00\x01"
"\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x01\x24\x00\x00\x00\x01"
"\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x01\x24\x00\x00\x00\x01"
"\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x01\x24\x00\x00\x00\x01"
"\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x01\x24\x00\x00\x00\x01"
"\x00\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
/* test looking up an invalid index */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x01\x01\x04\x00\x00\x00\x01"
"\xfe",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\x7f\x7f\x01"
"a",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\x0f\x7f\x01"
"a",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\x1f\x7f\x01"
"a",
0);
/* test nvr, not indexed in static table */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x01\x01"
"a",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x11\x01"
"a",
GRPC_BAD_CLIENT_DISCONNECT);
/* illegal op code */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x01\x01\x04\x00\x00\x00\x01"
"\x80",
0);
/* parse some long indices */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x02\x01\x04\x00\x00\x00\x01"
"\xff\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\xff\x80\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x06\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x07\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80\x80\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80\x80",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80\x80\x80",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80\x80\x80\x00",
0);
/* overflow on byte 4 */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x06\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80\x7f",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x06\x01\x04\x00\x00\x00\x01"
"\xff\xff\xff\xff\xff\x0f",
GRPC_BAD_CLIENT_DISCONNECT);
/* overflow after byte 4 */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x08\x01\x04\x00\x00\x00\x01"
"\xff\x80\x80\x80\x80\x80\x80\x02",
0);
/* end of headers mid-opcode */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x01\x01\x04\x00\x00\x00\x01"
"\x01",
GRPC_BAD_CLIENT_DISCONNECT);
/* dynamic table size update: set to default */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x3f\xe1\x1f",
GRPC_BAD_CLIENT_DISCONNECT);
/* dynamic table size update: set too large */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x3f\xf1\x1f",
0);
/* dynamic table size update: set twice */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x04\x01\x04\x00\x00\x00\x01"
"\x20\x3f\xe1\x1f",
GRPC_BAD_CLIENT_DISCONNECT);
/* dynamic table size update: set thrice */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x03\x01\x04\x00\x00\x00\x01"
"\x20\x20\x20",
0);
/* non-ending header followed by continuation frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x00\x01\x00\x00\x00\x00\x01"
"\x00\x00\x00\x09\x04\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
/* non-ending header followed by non-continuation frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x00\x01\x00\x00\x00\x00\x01"
"\x00\x00\x00\x00\x04\x00\x00\x00\x01",
0);
/* non-ending header followed by a continuation frame for a different stream
*/
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x00\x00\x00\x00\x03"
"\x00\x00\x00\x09\x04\x00\x00\x00\x01",
0);
/* opening with a continuation frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x09\x04\x00\x00\x00\x01", 0);
/* three header frames */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
"\x00\x00\x00\x01\x04\x00\x00\x00\x01"
@ -312,19 +312,19 @@ int main(int argc, char** argv) {
GRPC_BAD_CLIENT_DISCONNECT);
/* an invalid header found with fuzzing */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x01\x39\x67\xed\x1d\x64",
GRPC_BAD_CLIENT_DISCONNECT);
/* a badly encoded timeout value */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x19\x01\x04\x00\x00\x00\x01"
"\x10\x0cgrpc-timeout\x0a"
"15 seconds",
GRPC_BAD_CLIENT_DISCONNECT);
/* a badly encoded timeout value: twice (catches caching) */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x19\x01\x04\x00\x00\x00\x01"
"\x10\x0cgrpc-timeout\x0a"

@ -26,7 +26,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -35,73 +35,73 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
/* various partial prefixes */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x06",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x06",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x06",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x06",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x06",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x06",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\x01",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x01",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\xff",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\xff",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\x00\x00",
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x04\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x04\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
/* must not send frames with stream id != 0 */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x04\x00\x00\x00\x00\x01", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x04\x00\x40\x00\x00\x00", 0);
/* settings frame must be a multiple of six bytes long */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x01\x04\x00\x00\x00\x00\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x02\x04\x00\x00\x00\x00\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x03\x04\x00\x00\x00\x00\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x04\x04\x00\x00\x00\x00\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x05\x04\x00\x00\x00\x00\x00", 0);
/* some settings values are illegal */
/* max frame size = 0 */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR ONE_SETTING_HDR "\x00\x05\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR ONE_SETTING_HDR "\x00\x06\xff\xff\xff\xff",
GRPC_BAD_CLIENT_DISCONNECT);
/* update intiial window size */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR ONE_SETTING_HDR "\x00\x04\x00\x01\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
/* ack with data */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x00\x04\x00\x00\x00\x00\x00"
"\x00\x00\x01\x04\x01\x00\x00\x00\x00",
0);
/* settings frame with invalid flags */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x04\x10\x00\x00\x00\x00", 0);
/* unknown settings should be ignored */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR ONE_SETTING_HDR "\x00\x99\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);

@ -154,8 +154,8 @@ static void server_verifier_sends_too_much_metadata(grpc_server* server,
op.data.send_initial_metadata.count = 1;
op.data.send_initial_metadata.metadata = &meta;
op.flags = 0;
op.reserved = NULL;
error = grpc_call_start_batch(s, &op, 1, tag(102), NULL);
op.reserved = nullptr;
error = grpc_call_start_batch(s, &op, 1, tag(102), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(102), 0); // Operation fails.
cq_verify(cqv);

@ -47,7 +47,7 @@ static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq,
cq_verifier* cqv = cq_verifier_create(cq);
grpc_metadata_array request_metadata_recv;
gpr_timespec deadline;
grpc_byte_buffer* payload = NULL;
grpc_byte_buffer* payload = nullptr;
grpc_metadata_array_init(&request_metadata_recv);
@ -58,7 +58,7 @@ static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq,
CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
cq_verify(cqv);
GPR_ASSERT(payload != NULL);
GPR_ASSERT(payload != nullptr);
grpc_metadata_array_destroy(&request_metadata_recv);
grpc_call_unref(s);
@ -70,7 +70,7 @@ static void verifier_fails(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -80,45 +80,45 @@ int main(int argc, char** argv) {
/* body generated with
* tools/codegen/core/gen_server_registered_method_bad_client_test_body.py */
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr,
PFX_STR "\x00\x00\x00\x00\x00\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr,
PFX_STR "\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr,
PFX_STR
"\x00\x00\x02\x00\x00\x00\x00\x00\x01\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr,
PFX_STR
"\x00\x00\x03\x00\x00\x00\x00\x00\x01\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails, NULL,
verifier_fails, nullptr,
PFX_STR "\x00\x00\x04\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_succeeds, NULL,
verifier_succeeds, nullptr,
PFX_STR "\x00\x00\x05\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00", 0);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails, NULL,
verifier_fails, nullptr,
PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_succeeds, NULL,
verifier_succeeds, nullptr,
PFX_STR "\x00\x00\x06\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x01\x00",
0);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails, NULL,
verifier_fails, nullptr,
PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_fails, NULL,
verifier_fails, nullptr,
PFX_STR "\x00\x00\x06\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00",
GRPC_BAD_CLIENT_DISCONNECT);
GRPC_RUN_BAD_CLIENT_TEST(
verifier_succeeds, NULL,
verifier_succeeds, nullptr,
PFX_STR
"\x00\x00\x07\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00",
0);

@ -115,7 +115,7 @@ static void failure_verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -124,44 +124,44 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
/* basic request: check that things are working */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR, 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR_UNUSUAL, 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR_UNUSUAL2, 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR, 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR_UNUSUAL, 0);
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR_UNUSUAL2, 0);
/* push an illegal data frame */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR
"\x00\x00\x05\x00\x00\x00\x00\x00\x01"
"\x34\x00\x00\x00\x00",
0);
/* push a data frame with bad flags */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x00\x02\x00\x00\x00\x01", 0);
/* push a window update with a bad length */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr,
PFX_STR "\x00\x00\x01\x08\x00\x00\x00\x00\x01", 0);
/* push a window update with bad flags */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr,
PFX_STR "\x00\x00\x00\x08\x10\x00\x00\x00\x01", 0);
/* push a window update with bad data */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr,
PFX_STR
"\x00\x00\x04\x08\x00\x00\x00\x00\x01"
"\xff\xff\xff\xff",
0);
/* push a short goaway */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr,
PFX_STR "\x00\x00\x04\x07\x00\x00\x00\x00\x00", 0);
/* disconnect before sending goaway */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr,
PFX_STR "\x00\x01\x12\x07\x00\x00\x00\x00\x00",
GRPC_BAD_CLIENT_DISCONNECT);
/* push a rst_stream with a bad length */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr,
PFX_STR "\x00\x00\x01\x03\x00\x00\x00\x00\x01", 0);
/* push a rst_stream with bad flags */
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr,
PFX_STR "\x00\x00\x00\x03\x10\x00\x00\x00\x01", 0);
return 0;

@ -27,7 +27,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -36,7 +36,7 @@ int main(int argc, char** argv) {
grpc_test_init(argc, argv);
/* test adding prioritization data */
GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL,
GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr,
PFX_STR "\x00\x00\x00\x88\x00\x00\x00\x00\x01",
GRPC_BAD_CLIENT_DISCONNECT);

@ -46,7 +46,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq,
void* registered_method) {
while (grpc_server_has_open_connections(server)) {
GPR_ASSERT(grpc_completion_queue_next(
cq, grpc_timeout_milliseconds_to_deadline(20), NULL)
cq, grpc_timeout_milliseconds_to_deadline(20), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
}
}
@ -90,7 +90,7 @@ int main(int argc, char** argv) {
addbuf(message, sizeof(message));
}
}
grpc_run_bad_client_test(verifier, NULL, g_buffer, g_count,
grpc_run_bad_client_test(verifier, nullptr, g_buffer, g_count,
GRPC_BAD_CLIENT_LARGE_REQUEST);
gpr_free(g_buffer);

@ -36,7 +36,7 @@ static void* tag(intptr_t t) { return (void*)t; }
static void run_test(const char* target, size_t nops) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_ssl_credentials_create(nullptr, nullptr, nullptr);
grpc_channel* channel;
grpc_call* c;
@ -46,7 +46,7 @@ static void run_test(const char* target, size_t nops) {
grpc_status_code status;
grpc_call_error error;
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
cq_verifier* cqv = cq_verifier_create(cq);
grpc_op ops[6];
@ -64,36 +64,36 @@ static void run_test(const char* target, size_t nops) {
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
channel = grpc_secure_channel_create(ssl_creds, target, &args, NULL);
channel = grpc_secure_channel_create(ssl_creds, target, &args, nullptr);
grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr:1234");
c = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
c = grpc_channel_create_call(channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_slice_from_static_string("/foo"), &host,
deadline, NULL);
deadline, nullptr);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, nops, tag(1), NULL);
error = grpc_call_start_batch(c, ops, nops, tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);

@ -34,7 +34,7 @@ static void sigint_handler(int x) { got_sigint = 1; }
const char* bad_ssl_addr(int argc, char** argv) {
gpr_cmdline* cl;
const char* addr = NULL;
const char* addr = nullptr;
cl = gpr_cmdline_create("test server");
gpr_cmdline_add_string(cl, "bind", "Bind host:port", &addr);
gpr_cmdline_parse(cl, argc, argv);
@ -48,17 +48,17 @@ void bad_ssl_run(grpc_server* server) {
int shutdown_finished = 0;
grpc_event ev;
grpc_call_error error;
grpc_call* s = NULL;
grpc_call* s = nullptr;
grpc_call_details call_details;
grpc_metadata_array request_metadata_recv;
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
grpc_completion_queue* shutdown_cq;
grpc_call_details_init(&call_details);
grpc_metadata_array_init(&request_metadata_recv);
grpc_server_register_completion_queue(server, cq, NULL);
grpc_server_register_completion_queue(server, cq, nullptr);
grpc_server_start(server);
error = grpc_server_request_call(server, &s, &call_details,
@ -69,11 +69,11 @@ void bad_ssl_run(grpc_server* server) {
while (!shutdown_finished) {
if (got_sigint && !shutdown_started) {
gpr_log(GPR_INFO, "Shutting down due to SIGINT");
shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
grpc_server_shutdown_and_notify(server, shutdown_cq, NULL);
shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
grpc_server_shutdown_and_notify(server, shutdown_cq, nullptr);
GPR_ASSERT(
grpc_completion_queue_pluck(shutdown_cq, NULL,
grpc_timeout_seconds_to_deadline(5), NULL)
grpc_completion_queue_pluck(shutdown_cq, nullptr,
grpc_timeout_seconds_to_deadline(5), nullptr)
.type == GRPC_OP_COMPLETE);
grpc_completion_queue_destroy(shutdown_cq);
grpc_completion_queue_shutdown(cq);
@ -83,7 +83,7 @@ void bad_ssl_run(grpc_server* server) {
cq,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_micros(1000000, GPR_TIMESPAN)),
NULL);
nullptr);
switch (ev.type) {
case GRPC_OP_COMPLETE:
GPR_ASSERT(ev.tag == (void*)1);
@ -98,7 +98,7 @@ void bad_ssl_run(grpc_server* server) {
}
}
GPR_ASSERT(s == NULL);
GPR_ASSERT(s == nullptr);
grpc_call_details_destroy(&call_details);
grpc_metadata_array_destroy(&request_metadata_recv);
}

@ -59,8 +59,8 @@ int main(int argc, char** argv) {
grpc_init();
ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL);
server = grpc_server_create(NULL, NULL);
grpc_ssl_server_credentials_create(nullptr, &pem_key_cert_pair, 1, 0, nullptr);
server = grpc_server_create(nullptr, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
grpc_server_credentials_release(ssl_creds);

@ -50,8 +50,8 @@ int main(int argc, char** argv) {
pem_key_cert_pair.cert_chain = (const char*)GRPC_SLICE_START_PTR(cert_slice);
ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL);
server = grpc_server_create(NULL, NULL);
grpc_ssl_server_credentials_create(nullptr, &pem_key_cert_pair, 1, 0, nullptr);
server = grpc_server_create(nullptr, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
grpc_server_credentials_release(ssl_creds);

@ -43,7 +43,7 @@ static void test_create(void) {
to_add[0] = arg_int;
to_add[1] = arg_string;
ch_args = grpc_channel_args_copy_and_add(NULL, to_add, 2);
ch_args = grpc_channel_args_copy_and_add(nullptr, to_add, 2);
GPR_ASSERT(ch_args->num_args == 2);
GPR_ASSERT(strcmp(ch_args->args[0].key, arg_int.key) == 0);
@ -64,7 +64,7 @@ static void test_set_compression_algorithm(void) {
grpc_channel_args* ch_args;
ch_args =
grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_GZIP);
grpc_channel_args_set_compression_algorithm(nullptr, GRPC_COMPRESS_GZIP);
GPR_ASSERT(ch_args->num_args == 1);
GPR_ASSERT(strcmp(ch_args->args[0].key,
GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM) == 0);
@ -80,7 +80,7 @@ static void test_compression_algorithm_states(void) {
unsigned states_bitset;
size_t i;
ch_args = grpc_channel_args_copy_and_add(NULL, NULL, 0);
ch_args = grpc_channel_args_copy_and_add(nullptr, nullptr, 0);
/* by default, all enabled */
states_bitset =
(unsigned)grpc_channel_args_compression_algorithm_get_states(ch_args);
@ -129,9 +129,9 @@ static void test_compression_algorithm_states(void) {
static void test_set_socket_mutator(void) {
grpc_channel_args* ch_args;
grpc_socket_mutator mutator;
grpc_socket_mutator_init(&mutator, NULL);
grpc_socket_mutator_init(&mutator, nullptr);
ch_args = grpc_channel_args_set_socket_mutator(NULL, &mutator);
ch_args = grpc_channel_args_set_socket_mutator(nullptr, &mutator);
GPR_ASSERT(ch_args->num_args == 1);
GPR_ASSERT(strcmp(ch_args->args[0].key, GRPC_ARG_SOCKET_MUTATOR) == 0);
GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_POINTER);

@ -71,8 +71,8 @@ void set_arg_once_fn(grpc_channel_stack* channel_stack,
static void test_channel_stack_builder_filter_replace(void) {
grpc_channel* channel =
grpc_insecure_channel_create("target name isn't used", NULL, NULL);
GPR_ASSERT(channel != NULL);
grpc_insecure_channel_create("target name isn't used", nullptr, nullptr);
GPR_ASSERT(channel != nullptr);
// Make sure the high priority filter has been created.
GPR_ASSERT(g_replacement_fn_called);
// ... and that the low priority one hasn't.

@ -74,8 +74,8 @@ static void free_channel(grpc_exec_ctx* exec_ctx, void* arg,
}
static void free_call(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
grpc_call_stack_destroy(exec_ctx, static_cast<grpc_call_stack*>(arg), NULL,
NULL);
grpc_call_stack_destroy(exec_ctx, static_cast<grpc_call_stack*>(arg), nullptr,
nullptr);
gpr_free(arg);
}
@ -114,7 +114,7 @@ static void test_create_channel_stack(void) {
channel_stack = static_cast<grpc_channel_stack*>(
gpr_malloc(grpc_channel_stack_size(&filters, 1)));
grpc_channel_stack_init(&exec_ctx, 1, free_channel, channel_stack, &filters,
1, &chan_args, NULL, "test", channel_stack);
1, &chan_args, nullptr, "test", channel_stack);
GPR_ASSERT(channel_stack->count == 1);
channel_elem = grpc_channel_stack_element(channel_stack, 0);
channel_data = (int*)channel_elem->channel_data;

@ -79,26 +79,26 @@ int main(int argc, char** argv) {
"http-client", "connected", NULL);
errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_SERVER_CHANNEL,
"server", "http-server", "connected", NULL);
errors += CHECK_STACK(NULL, &minimal_stack_args, GRPC_CLIENT_CHANNEL,
errors += CHECK_STACK(nullptr, &minimal_stack_args, GRPC_CLIENT_CHANNEL,
"client-channel", NULL);
// tests with a default stack
errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL,
errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_DIRECT_CHANNEL,
"message_size", "deadline", "connected", NULL);
errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size",
errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_SUBCHANNEL, "message_size",
"connected", NULL);
errors += CHECK_STACK("unknown", NULL, GRPC_SERVER_CHANNEL, "server",
errors += CHECK_STACK("unknown", nullptr, GRPC_SERVER_CHANNEL, "server",
"message_size", "deadline", "connected", NULL);
errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL,
errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_DIRECT_CHANNEL,
"message_size", "deadline", "http-client",
"message_compress", "connected", NULL);
errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size",
errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_SUBCHANNEL, "message_size",
"http-client", "message_compress", "connected", NULL);
errors += CHECK_STACK("chttp2", NULL, GRPC_SERVER_CHANNEL, "server",
errors += CHECK_STACK("chttp2", nullptr, GRPC_SERVER_CHANNEL, "server",
"message_size", "deadline", "http-server",
"message_compress", "connected", NULL);
errors +=
CHECK_STACK(NULL, NULL, GRPC_CLIENT_CHANNEL, "client-channel", NULL);
CHECK_STACK(nullptr, nullptr, GRPC_CLIENT_CHANNEL, "client-channel", NULL);
GPR_ASSERT(errors == 0);
grpc_shutdown();
@ -120,7 +120,7 @@ static int check_stack(const char* file, int line, const char* transport_name,
grpc_transport fake_transport = {&fake_transport_vtable};
grpc_channel_stack_builder_set_target(builder, "foo.test.google.fr");
grpc_channel_args* channel_args = grpc_channel_args_copy(init_args);
if (transport_name != NULL) {
if (transport_name != nullptr) {
grpc_channel_stack_builder_set_transport(builder, &fake_transport);
}
{
@ -139,12 +139,12 @@ static int check_stack(const char* file, int line, const char* transport_name,
va_start(args, channel_stack_type);
for (;;) {
char* a = va_arg(args, char*);
if (a == NULL) break;
if (a == nullptr) break;
if (v.count != 0) gpr_strvec_add(&v, gpr_strdup(", "));
gpr_strvec_add(&v, gpr_strdup(a));
}
va_end(args);
char* expect = gpr_strvec_flatten(&v, NULL);
char* expect = gpr_strvec_flatten(&v, nullptr);
gpr_strvec_destroy(&v);
// build up our "got" list
@ -153,11 +153,11 @@ static int check_stack(const char* file, int line, const char* transport_name,
grpc_channel_stack_builder_create_iterator_at_first(builder);
while (grpc_channel_stack_builder_move_next(it)) {
const char* name = grpc_channel_stack_builder_iterator_filter_name(it);
if (name == NULL) continue;
if (name == nullptr) continue;
if (v.count != 0) gpr_strvec_add(&v, gpr_strdup(", "));
gpr_strvec_add(&v, gpr_strdup(name));
}
char* got = gpr_strvec_flatten(&v, NULL);
char* got = gpr_strvec_flatten(&v, nullptr);
gpr_strvec_destroy(&v);
grpc_channel_stack_builder_iterator_destroy(it);
@ -189,7 +189,7 @@ static int check_stack(const char* file, int line, const char* transport_name,
}
}
gpr_strvec_add(&v, gpr_strdup("}"));
char* args_str = gpr_strvec_flatten(&v, NULL);
char* args_str = gpr_strvec_flatten(&v, nullptr);
gpr_strvec_destroy(&v);
gpr_log(file, line, GPR_LOG_SEVERITY_ERROR,

@ -126,19 +126,19 @@ static gpr_timespec n_millis_time(int n) {
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, n_millis_time(5000), NULL);
ev = grpc_completion_queue_next(cq, n_millis_time(5000), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void kill_server(const servers_fixture* f, size_t i) {
gpr_log(GPR_INFO, "KILLING SERVER %" PRIuPTR, i);
GPR_ASSERT(f->servers[i] != NULL);
GPR_ASSERT(f->servers[i] != nullptr);
grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000),
n_millis_time(5000), NULL)
n_millis_time(5000), nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->servers[i]);
f->servers[i] = NULL;
f->servers[i] = nullptr;
}
typedef struct request_data {
@ -153,12 +153,12 @@ static void revive_server(const servers_fixture* f, request_data* rdata,
size_t i) {
int got_port;
gpr_log(GPR_INFO, "RAISE AGAIN SERVER %" PRIuPTR, i);
GPR_ASSERT(f->servers[i] == NULL);
GPR_ASSERT(f->servers[i] == nullptr);
gpr_log(GPR_DEBUG, "revive: %s", f->servers_hostports[i]);
f->servers[i] = grpc_server_create(NULL, NULL);
grpc_server_register_completion_queue(f->servers[i], f->cq, NULL);
f->servers[i] = grpc_server_create(nullptr, nullptr);
grpc_server_register_completion_queue(f->servers[i], f->cq, nullptr);
GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port(
f->servers[i], f->servers_hostports[i])) > 0);
grpc_server_start(f->servers[i]);
@ -187,13 +187,13 @@ static servers_fixture* setup_servers(const char* server_host,
gpr_malloc(sizeof(grpc_server*) * num_servers));
f->servers_hostports =
static_cast<char**>(gpr_malloc(sizeof(char*) * num_servers));
f->cq = grpc_completion_queue_create_for_next(NULL);
f->shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f->cq = grpc_completion_queue_create_for_next(nullptr);
f->shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
for (i = 0; i < num_servers; i++) {
grpc_metadata_array_init(&f->request_metadata_recv[i]);
gpr_join_host_port(&f->servers_hostports[i], server_host,
grpc_pick_unused_port_or_die());
f->servers[i] = 0;
f->servers[i] = nullptr;
revive_server(f, rdata, i);
}
return f;
@ -203,10 +203,10 @@ static void teardown_servers(servers_fixture* f) {
size_t i;
/* Destroy server. */
for (i = 0; i < f->num_servers; i++) {
if (f->servers[i] == NULL) continue;
if (f->servers[i] == nullptr) continue;
grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000),
n_millis_time(5000), NULL)
n_millis_time(5000), nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->servers[i]);
}
@ -286,9 +286,9 @@ static request_sequences perform_request(servers_fixture* f,
memset(s_valid, 0, f->num_servers * sizeof(int));
grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr");
c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq,
c = grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq,
grpc_slice_from_static_string("/foo"), &host,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
GPR_ASSERT(c);
completed_client = 0;
@ -297,17 +297,17 @@ static request_sequences perform_request(servers_fixture* f,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata =
&rdata->initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata =
@ -315,15 +315,15 @@ static request_sequences perform_request(servers_fixture* f,
op->data.recv_status_on_client.status = &rdata->status;
op->data.recv_status_on_client.status_details = &rdata->details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL));
grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr));
s_idx = -1;
while (
(ev = grpc_completion_queue_next(
f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), NULL))
f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), nullptr))
.type != GRPC_QUEUE_TIMEOUT) {
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
read_tag = ((int)(intptr_t)ev.tag);
@ -352,7 +352,7 @@ static request_sequences perform_request(servers_fixture* f,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
@ -360,16 +360,16 @@ static request_sequences perform_request(servers_fixture* f,
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(f->server_calls[s_idx],
ops, (size_t)(op - ops),
tag(102), NULL));
tag(102), nullptr));
CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
if (!completed_client) {
@ -394,7 +394,7 @@ static request_sequences perform_request(servers_fixture* f,
&f->request_metadata_recv[s_idx], f->cq,
f->cq, tag(1000 + (int)s_idx)));
} else { /* no response from server */
grpc_call_cancel(c, NULL);
grpc_call_cancel(c, nullptr);
if (!completed_client) {
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
cq_verify(cqv);
@ -403,7 +403,7 @@ static request_sequences perform_request(servers_fixture* f,
GPR_ASSERT(
grpc_completion_queue_next(
f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), NULL)
f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), nullptr)
.type == GRPC_QUEUE_TIMEOUT);
grpc_metadata_array_destroy(&rdata->initial_metadata_recv);
@ -443,22 +443,22 @@ static grpc_call** perform_multirequest(servers_fixture* f,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr");
for (i = 0; i < concurrent_calls; i++) {
calls[i] =
grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq,
grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq,
grpc_slice_from_static_string("/foo"), &host,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
GPR_ASSERT(calls[i]);
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[i], ops,
(size_t)(op - ops), tag(1),
NULL));
nullptr));
}
return calls;
@ -478,7 +478,7 @@ void run_spec(const test_spec* spec) {
/* Create client. */
servers_hostports_str = gpr_strjoin_sep((const char**)f->servers_hostports,
f->num_servers, ",", NULL);
f->num_servers, ",", nullptr);
gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str);
arg_array[0].type = GRPC_ARG_INTEGER;
@ -491,7 +491,7 @@ void run_spec(const test_spec* spec) {
args.num_args = 2;
args.args = arg_array;
client = grpc_insecure_channel_create(client_hostport, &args, NULL);
client = grpc_insecure_channel_create(client_hostport, &args, nullptr);
gpr_log(GPR_INFO, "Testing '%s' with servers=%s client=%s", spec->description,
servers_hostports_str, client_hostport);
@ -517,7 +517,7 @@ static grpc_channel* create_client(const servers_fixture* f) {
grpc_channel_args args;
servers_hostports_str = gpr_strjoin_sep((const char**)f->servers_hostports,
f->num_servers, ",", NULL);
f->num_servers, ",", nullptr);
gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str);
arg_array[0].type = GRPC_ARG_INTEGER;
@ -534,7 +534,7 @@ static grpc_channel* create_client(const servers_fixture* f) {
args.num_args = GPR_ARRAY_SIZE(arg_array);
args.args = arg_array;
client = grpc_insecure_channel_create(client_hostport, &args, NULL);
client = grpc_insecure_channel_create(client_hostport, &args, nullptr);
gpr_free(client_hostport);
gpr_free(servers_hostports_str);
@ -557,7 +557,7 @@ static void test_ping() {
client = create_client(f);
grpc_channel_ping(client, f->cq, tag(0), NULL);
grpc_channel_ping(client, f->cq, tag(0), nullptr);
CQ_EXPECT_COMPLETION(cqv, tag(0), 0);
/* check that we're still in idle, and start connecting */
@ -577,7 +577,7 @@ static void test_ping() {
}
for (i = 1; i <= 5; i++) {
grpc_channel_ping(client, f->cq, tag(i), NULL);
grpc_channel_ping(client, f->cq, tag(i), nullptr);
CQ_EXPECT_COMPLETION(cqv, tag(i), 1);
cq_verify(cqv);
}
@ -604,7 +604,7 @@ static void test_pending_calls(size_t concurrent_calls) {
calls = perform_multirequest(f, client, concurrent_calls);
grpc_call_cancel(
calls[0],
NULL); /* exercise the cancel pick path whilst there are pending picks */
nullptr); /* exercise the cancel pick path whilst there are pending picks */
gpr_free(rdata.call_details);
@ -621,7 +621,7 @@ static void test_pending_calls(size_t concurrent_calls) {
static void test_get_channel_info() {
grpc_channel* channel =
grpc_insecure_channel_create("ipv4:127.0.0.1:1234", NULL, NULL);
grpc_insecure_channel_create("ipv4:127.0.0.1:1234", nullptr, nullptr);
// Ensures that resolver returns.
grpc_channel_check_connectivity_state(channel, true /* try_to_connect */);
// First, request no fields. This is a no-op.
@ -629,10 +629,10 @@ static void test_get_channel_info() {
memset(&channel_info, 0, sizeof(channel_info));
grpc_channel_get_info(channel, &channel_info);
// Request LB policy name.
char* lb_policy_name = NULL;
char* lb_policy_name = nullptr;
channel_info.lb_policy_name = &lb_policy_name;
grpc_channel_get_info(channel, &channel_info);
GPR_ASSERT(lb_policy_name != NULL);
GPR_ASSERT(lb_policy_name != nullptr);
GPR_ASSERT(strcmp(lb_policy_name, "pick_first") == 0);
gpr_free(lb_policy_name);
// Request service config, which does not exist, so we'll get nothing back.
@ -640,7 +640,7 @@ static void test_get_channel_info() {
char* service_config_json = const_cast<char*>("dummy_string");
channel_info.service_config_json = &service_config_json;
grpc_channel_get_info(channel, &channel_info);
GPR_ASSERT(service_config_json == NULL);
GPR_ASSERT(service_config_json == nullptr);
// Recreate the channel such that it has a service config.
grpc_channel_destroy(channel);
grpc_arg arg;
@ -648,8 +648,8 @@ static void test_get_channel_info() {
arg.key = const_cast<char*>(GRPC_ARG_SERVICE_CONFIG);
arg.value.string =
const_cast<char*>("{\"loadBalancingPolicy\": \"ROUND_ROBIN\"}");
grpc_channel_args* args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, NULL);
grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1);
channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, nullptr);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, args);
@ -659,7 +659,7 @@ static void test_get_channel_info() {
grpc_channel_check_connectivity_state(channel, true /* try_to_connect */);
// Now request the service config again.
grpc_channel_get_info(channel, &channel_info);
GPR_ASSERT(service_config_json != NULL);
GPR_ASSERT(service_config_json != nullptr);
GPR_ASSERT(strcmp(service_config_json, arg.value.string) == 0);
gpr_free(service_config_json);
// Clean up.
@ -884,7 +884,7 @@ static void dump_array(const char* desc, const int* data, const size_t count) {
gpr_asprintf(&tmp, " %d", data[i]);
gpr_strvec_add(&s, tmp);
}
tmp = gpr_strvec_flatten(&s, NULL);
tmp = gpr_strvec_flatten(&s, nullptr);
gpr_strvec_destroy(&s);
gpr_log(GPR_DEBUG, "%s", tmp);
gpr_free(tmp);
@ -970,8 +970,8 @@ int main(int argc, char** argv) {
grpc_tracer_set_enabled("round_robin", 1);
GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, "this-lb-policy-does-not-exist",
NULL) == NULL);
GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, NULL, NULL) == NULL);
nullptr) == nullptr);
GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, nullptr, nullptr) == nullptr);
spec = test_spec_create(NUM_ITERS, NUM_SERVERS);
/* everything is fine, all servers stay up the whole time and life's peachy

@ -62,7 +62,7 @@ static void test_grpc_parse_ipv4(const char* uri_text, const char* host,
GPR_ASSERT(1 == grpc_parse_ipv4(uri, &addr));
struct sockaddr_in* addr_in = (struct sockaddr_in*)addr.addr;
GPR_ASSERT(AF_INET == addr_in->sin_family);
GPR_ASSERT(NULL != grpc_inet_ntop(AF_INET, &addr_in->sin_addr, ntop_buf,
GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET, &addr_in->sin_addr, ntop_buf,
sizeof(ntop_buf)));
GPR_ASSERT(0 == strcmp(ntop_buf, host));
GPR_ASSERT(ntohs(addr_in->sin_port) == port);
@ -81,7 +81,7 @@ static void test_grpc_parse_ipv6(const char* uri_text, const char* host,
GPR_ASSERT(1 == grpc_parse_ipv6(uri, &addr));
struct sockaddr_in6* addr_in6 = (struct sockaddr_in6*)addr.addr;
GPR_ASSERT(AF_INET6 == addr_in6->sin6_family);
GPR_ASSERT(NULL != grpc_inet_ntop(AF_INET6, &addr_in6->sin6_addr, ntop_buf,
GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET6, &addr_in6->sin6_addr, ntop_buf,
sizeof(ntop_buf)));
GPR_ASSERT(0 == strcmp(ntop_buf, host));
GPR_ASSERT(ntohs(addr_in6->sin6_port) == port);

@ -72,11 +72,11 @@ static grpc_ares_request* my_dns_lookup_ares(
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure");
} else {
gpr_mu_unlock(&g_mu);
*lb_addrs = grpc_lb_addresses_create(1, NULL);
grpc_lb_addresses_set_address(*lb_addrs, 0, NULL, 0, false, NULL, NULL);
*lb_addrs = grpc_lb_addresses_create(1, nullptr);
grpc_lb_addresses_set_address(*lb_addrs, 0, nullptr, 0, false, nullptr, nullptr);
}
GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
return NULL;
return nullptr;
}
static grpc_resolver* create_resolver(grpc_exec_ctx* exec_ctx,
@ -107,7 +107,7 @@ static bool wait_loop(int deadline_seconds, gpr_event* ev) {
deadline_seconds--;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_timer_check(&exec_ctx, NULL);
grpc_timer_check(&exec_ctx, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}
return false;
@ -161,7 +161,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx));
grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(wait_loop(5, &ev1));
GPR_ASSERT(result == NULL);
GPR_ASSERT(result == nullptr);
gpr_event ev2;
gpr_event_init(&ev2);
@ -170,7 +170,7 @@ int main(int argc, char** argv) {
GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx));
grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(wait_loop(30, &ev2));
GPR_ASSERT(result != NULL);
GPR_ASSERT(result != nullptr);
grpc_channel_args_destroy(&exec_ctx, result);
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test");

@ -39,7 +39,7 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
args.uri = uri;
args.combiner = g_combiner;
resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
GPR_ASSERT(resolver != NULL);
GPR_ASSERT(resolver != nullptr);
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds");
grpc_uri_destroy(uri);
grpc_exec_ctx_finish(&exec_ctx);
@ -57,7 +57,7 @@ static void test_fails(grpc_resolver_factory* factory, const char* string) {
args.uri = uri;
args.combiner = g_combiner;
resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
GPR_ASSERT(resolver == NULL);
GPR_ASSERT(resolver == nullptr);
grpc_uri_destroy(uri);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -79,23 +79,23 @@ static void test_fake_resolver() {
grpc_fake_resolver_response_generator_create();
grpc_resolver* resolver =
build_fake_resolver(&exec_ctx, combiner, response_generator);
GPR_ASSERT(resolver != NULL);
GPR_ASSERT(resolver != nullptr);
// Setup expectations.
grpc_uri* uris[] = {grpc_uri_parse(&exec_ctx, "ipv4:10.2.1.1:1234", true),
grpc_uri_parse(&exec_ctx, "ipv4:127.0.0.1:4321", true)};
const char* balancer_names[] = {"name1", "name2"};
const bool is_balancer[] = {true, false};
grpc_lb_addresses* addresses = grpc_lb_addresses_create(3, NULL);
grpc_lb_addresses* addresses = grpc_lb_addresses_create(3, nullptr);
for (size_t i = 0; i < GPR_ARRAY_SIZE(uris); ++i) {
grpc_lb_addresses_set_address_from_uri(
addresses, i, uris[i], is_balancer[i], balancer_names[i], NULL);
addresses, i, uris[i], is_balancer[i], balancer_names[i], nullptr);
grpc_uri_destroy(uris[i]);
}
const grpc_arg addresses_arg =
grpc_lb_addresses_create_channel_arg(addresses);
grpc_channel_args* results =
grpc_channel_args_copy_and_add(NULL, &addresses_arg, 1);
grpc_channel_args_copy_and_add(nullptr, &addresses_arg, 1);
grpc_lb_addresses_destroy(&exec_ctx, addresses);
on_resolution_arg on_res_arg;
memset(&on_res_arg, 0, sizeof(on_res_arg));
@ -112,25 +112,25 @@ static void test_fake_resolver() {
on_resolution);
grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
grpc_timeout_seconds_to_deadline(5)) != nullptr);
// Setup update.
grpc_uri* uris_update[] = {
grpc_uri_parse(&exec_ctx, "ipv4:192.168.1.0:31416", true)};
const char* balancer_names_update[] = {"name3"};
const bool is_balancer_update[] = {false};
grpc_lb_addresses* addresses_update = grpc_lb_addresses_create(1, NULL);
grpc_lb_addresses* addresses_update = grpc_lb_addresses_create(1, nullptr);
for (size_t i = 0; i < GPR_ARRAY_SIZE(uris_update); ++i) {
grpc_lb_addresses_set_address_from_uri(addresses_update, i, uris_update[i],
is_balancer_update[i],
balancer_names_update[i], NULL);
balancer_names_update[i], nullptr);
grpc_uri_destroy(uris_update[i]);
}
grpc_arg addresses_update_arg =
grpc_lb_addresses_create_channel_arg(addresses_update);
grpc_channel_args* results_update =
grpc_channel_args_copy_and_add(NULL, &addresses_update_arg, 1);
grpc_channel_args_copy_and_add(nullptr, &addresses_update_arg, 1);
grpc_lb_addresses_destroy(&exec_ctx, addresses_update);
// Setup expectations for the update.
@ -148,7 +148,7 @@ static void test_fake_resolver() {
&on_res_arg_update.resolver_result, on_resolution);
grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev,
grpc_timeout_seconds_to_deadline(5)) != NULL);
grpc_timeout_seconds_to_deadline(5)) != nullptr);
// Requesting a new resolution without re-senting the response shouldn't
// trigger the resolution callback.
@ -158,7 +158,7 @@ static void test_fake_resolver() {
grpc_exec_ctx_flush(&exec_ctx);
GPR_ASSERT(gpr_event_wait(&on_res_arg.ev,
grpc_timeout_milliseconds_to_deadline(100)) ==
NULL);
nullptr);
GRPC_COMBINER_UNREF(&exec_ctx, combiner, "test_fake_resolver");
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_fake_resolver");

@ -52,7 +52,7 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) {
args.uri = uri;
args.combiner = g_combiner;
resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
GPR_ASSERT(resolver != NULL);
GPR_ASSERT(resolver != nullptr);
on_resolution_arg on_res_arg;
memset(&on_res_arg, 0, sizeof(on_res_arg));
@ -79,7 +79,7 @@ static void test_fails(grpc_resolver_factory* factory, const char* string) {
args.uri = uri;
args.combiner = g_combiner;
resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args);
GPR_ASSERT(resolver == NULL);
GPR_ASSERT(resolver == nullptr);
grpc_uri_destroy(uri);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -42,7 +42,7 @@ static void test_succeeds(const char* uri_text, const char* scheme,
static void test_fails(const char* uri_text) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(NULL == grpc_uri_parse(&exec_ctx, uri_text, 0));
GPR_ASSERT(nullptr == grpc_uri_parse(&exec_ctx, uri_text, 0));
grpc_exec_ctx_finish(&exec_ctx);
}
@ -60,7 +60,7 @@ static void test_query_parts() {
GPR_ASSERT(4 == uri->num_query_parts);
GPR_ASSERT(0 == strcmp("a", uri->query_parts[0]));
GPR_ASSERT(NULL == uri->query_parts_values[0]);
GPR_ASSERT(nullptr == uri->query_parts_values[0]);
GPR_ASSERT(0 == strcmp("b", uri->query_parts[1]));
GPR_ASSERT(0 == strcmp("B", uri->query_parts_values[1]));
@ -69,12 +69,12 @@ static void test_query_parts() {
GPR_ASSERT(0 == strcmp("", uri->query_parts_values[2]));
GPR_ASSERT(0 == strcmp("", uri->query_parts[3]));
GPR_ASSERT(NULL == uri->query_parts_values[3]);
GPR_ASSERT(nullptr == uri->query_parts_values[3]);
GPR_ASSERT(NULL == grpc_uri_get_query_arg(uri, "a"));
GPR_ASSERT(nullptr == grpc_uri_get_query_arg(uri, "a"));
GPR_ASSERT(0 == strcmp("B", grpc_uri_get_query_arg(uri, "b")));
GPR_ASSERT(0 == strcmp("", grpc_uri_get_query_arg(uri, "c")));
GPR_ASSERT(NULL == grpc_uri_get_query_arg(uri, ""));
GPR_ASSERT(nullptr == grpc_uri_get_query_arg(uri, ""));
GPR_ASSERT(0 == strcmp("frag", uri->fragment));
grpc_exec_ctx_finish(&exec_ctx);
@ -111,8 +111,8 @@ static void test_query_parts() {
GPR_ASSERT(0 == strcmp("/path", uri->path));
GPR_ASSERT(0 == strcmp("", uri->query));
GPR_ASSERT(0 == uri->num_query_parts);
GPR_ASSERT(NULL == uri->query_parts);
GPR_ASSERT(NULL == uri->query_parts_values);
GPR_ASSERT(nullptr == uri->query_parts);
GPR_ASSERT(nullptr == uri->query_parts_values);
GPR_ASSERT(0 == strcmp("", uri->fragment));
grpc_exec_ctx_finish(&exec_ctx);
grpc_uri_destroy(uri);

@ -68,11 +68,11 @@ static void test_algorithm_failure(void) {
gpr_log(GPR_DEBUG, "test_algorithm_failure");
GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT,
NULL) == 0);
nullptr) == 0);
GPR_ASSERT(
grpc_compression_algorithm_name(static_cast<grpc_compression_algorithm>(
GRPC_COMPRESS_ALGORITHMS_COUNT + 1),
NULL) == 0);
nullptr) == 0);
mdstr = grpc_slice_from_static_string("this-is-an-invalid-algorithm");
GPR_ASSERT(grpc_compression_algorithm_from_slice(mdstr) ==
GRPC_COMPRESS_ALGORITHMS_COUNT);

@ -66,7 +66,7 @@ static void test_stream_compression_simple_compress_decompress() {
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr,
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
bool end_of_context;
@ -99,7 +99,7 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint()
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr,
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
grpc_stream_compression_context_destroy(compress_ctx);
@ -149,7 +149,7 @@ test_stream_compression_simple_compress_decompress_with_large_data() {
GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr,
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
bool end_of_context;
@ -180,7 +180,7 @@ static void test_stream_compression_drop_context() {
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr,
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
grpc_stream_compression_context_destroy(compress_ctx);
@ -189,7 +189,7 @@ static void test_stream_compression_drop_context() {
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
slice = grpc_slice_from_static_string(test_str2);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr,
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
grpc_stream_compression_context_destroy(compress_ctx);
@ -249,7 +249,7 @@ static void test_stream_compression_sync_flush() {
GRPC_STREAM_COMPRESSION_GZIP_COMPRESS);
grpc_slice slice = grpc_slice_from_static_string(test_str);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr,
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_SYNC));
@ -268,7 +268,7 @@ static void test_stream_compression_sync_flush() {
grpc_slice_buffer_init(&sink);
slice = grpc_slice_from_static_string(test_str2);
grpc_slice_buffer_add(&source, slice);
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL,
GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr,
~(size_t)0,
GRPC_STREAM_COMPRESSION_FLUSH_FINISH));
grpc_stream_compression_context_destroy(compress_ctx);

@ -135,8 +135,8 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp,
grpc_tcp_server_acceptor* acceptor) {
gpr_free(acceptor);
test_tcp_server* server = (test_tcp_server*)arg;
GRPC_CLOSURE_INIT(&on_read, handle_read, NULL, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&on_write, done_write, NULL, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&on_read, handle_read, nullptr, grpc_schedule_on_exec_ctx);
GRPC_CLOSURE_INIT(&on_write, done_write, nullptr, grpc_schedule_on_exec_ctx);
grpc_slice_buffer_init(&state.temp_incoming_buffer);
grpc_slice_buffer_init(&state.outgoing_buffer);
state.tcp = tcp;
@ -161,15 +161,15 @@ static void start_rpc(int target_port, grpc_status_code expected_status,
cq_verifier* cqv;
grpc_slice details;
state.cq = grpc_completion_queue_create_for_next(NULL);
state.cq = grpc_completion_queue_create_for_next(nullptr);
cqv = cq_verifier_create(state.cq);
gpr_join_host_port(&state.target, "127.0.0.1", target_port);
state.channel = grpc_insecure_channel_create(state.target, NULL, NULL);
state.channel = grpc_insecure_channel_create(state.target, nullptr, nullptr);
grpc_slice host = grpc_slice_from_static_string("localhost");
state.call = grpc_channel_create_call(
state.channel, NULL, GRPC_PROPAGATE_DEFAULTS, state.cq,
state.channel, nullptr, GRPC_PROPAGATE_DEFAULTS, state.cq,
grpc_slice_from_static_string("/Service/Method"), &host,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
grpc_metadata_array_init(&initial_metadata_recv);
grpc_metadata_array_init(&trailing_metadata_recv);
@ -179,26 +179,26 @@ static void start_rpc(int target_port, grpc_status_code expected_status,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error =
grpc_call_start_batch(state.call, ops, (size_t)(op - ops), tag(1), NULL);
grpc_call_start_batch(state.call, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
@ -206,7 +206,7 @@ static void start_rpc(int target_port, grpc_status_code expected_status,
cq_verify(cqv);
GPR_ASSERT(status == expected_status);
if (expected_detail != NULL) {
if (expected_detail != nullptr) {
GPR_ASSERT(-1 != grpc_slice_slice(details, grpc_slice_from_static_string(
expected_detail)));
}
@ -224,7 +224,7 @@ static void cleanup_rpc(grpc_exec_ctx* exec_ctx) {
grpc_call_unref(state.call);
grpc_completion_queue_shutdown(state.cq);
do {
ev = grpc_completion_queue_next(state.cq, n_sec_deadline(1), NULL);
ev = grpc_completion_queue_next(state.cq, n_sec_deadline(1), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(state.cq);
grpc_channel_destroy(state.channel);
@ -262,7 +262,7 @@ static void poll_server_until_read_done(test_tcp_server* server,
poll_args* pa = (poll_args*)gpr_malloc(sizeof(*pa));
pa->server = server;
pa->signal_when_done = signal_when_done;
gpr_thd_new(&id, actually_poll_server, pa, NULL);
gpr_thd_new(&id, actually_poll_server, pa, nullptr);
}
static void run_test(const char* response_payload,
@ -331,7 +331,7 @@ int main(int argc, char** argv) {
/* unparseable response */
run_test(UNPARSEABLE_RESP, sizeof(UNPARSEABLE_RESP) - 1, GRPC_STATUS_UNKNOWN,
NULL);
nullptr);
/* http1 response */
run_test(HTTP1_RESP, sizeof(HTTP1_RESP) - 1, GRPC_STATUS_UNAVAILABLE,

@ -53,11 +53,11 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
grpc_metadata_array_init(&trailing_metadata_recv);
cq = grpc_completion_queue_create_for_next(NULL);
cq = grpc_completion_queue_create_for_next(nullptr);
cqv = cq_verifier_create(cq);
/* if using service config, create channel args */
grpc_channel_args* args = NULL;
grpc_channel_args* args = nullptr;
if (use_service_config) {
GPR_ASSERT(wait_for_ready);
grpc_arg arg;
@ -80,12 +80,12 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
char* addr;
gpr_join_host_port(&addr, "127.0.0.1", port);
gpr_log(GPR_INFO, "server: %s", addr);
chan = grpc_insecure_channel_create(addr, args, NULL);
chan = grpc_insecure_channel_create(addr, args, nullptr);
grpc_slice host = grpc_slice_from_static_string("nonexistant");
gpr_timespec deadline = grpc_timeout_seconds_to_deadline(2);
call = grpc_channel_create_call(
chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_slice_from_static_string("/service/method"), &host, deadline, NULL);
chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_slice_from_static_string("/service/method"), &host, deadline, nullptr);
gpr_free(addr);
@ -96,17 +96,17 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
op->flags = (wait_for_ready && !use_service_config)
? GRPC_INITIAL_METADATA_WAIT_FOR_READY
: 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(
call, ops, (size_t)(op - ops), tag(1), NULL));
call, ops, (size_t)(op - ops), tag(1), nullptr));
/* verify that all tags get completed */
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
cq_verify(cqv);
@ -119,7 +119,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
grpc_completion_queue_shutdown(cq);
while (
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL)
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr)
.type != GRPC_QUEUE_SHUTDOWN)
;
grpc_completion_queue_destroy(cq);
@ -132,7 +132,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) {
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
if (args != NULL) grpc_channel_args_destroy(&exec_ctx, args);
if (args != nullptr) grpc_channel_args_destroy(&exec_ctx, args);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -64,7 +64,7 @@ struct cq_verifier {
cq_verifier* cq_verifier_create(grpc_completion_queue* cq) {
cq_verifier* v = (cq_verifier*)gpr_malloc(sizeof(cq_verifier));
v->cq = cq;
v->first_expectation = NULL;
v->first_expectation = nullptr;
return v;
}
@ -203,7 +203,7 @@ static void expectation_to_strvec(gpr_strvec* buf, expectation* e) {
static void expectations_to_strvec(gpr_strvec* buf, cq_verifier* v) {
expectation* e;
for (e = v->first_expectation; e != NULL; e = e->next) {
for (e = v->first_expectation; e != nullptr; e = e->next) {
expectation_to_strvec(buf, e);
gpr_strvec_add(buf, gpr_strdup("\n"));
}
@ -215,7 +215,7 @@ static void fail_no_event_received(cq_verifier* v) {
gpr_strvec_init(&buf);
gpr_strvec_add(&buf, gpr_strdup("no event received, but expected:\n"));
expectations_to_strvec(&buf, v);
msg = gpr_strvec_flatten(&buf, NULL);
msg = gpr_strvec_flatten(&buf, nullptr);
gpr_log(GPR_ERROR, "%s", msg);
gpr_strvec_destroy(&buf);
gpr_free(msg);
@ -230,7 +230,7 @@ static void verify_matches(expectation* e, grpc_event* ev) {
gpr_strvec expected;
gpr_strvec_init(&expected);
expectation_to_strvec(&expected, e);
char* s = gpr_strvec_flatten(&expected, NULL);
char* s = gpr_strvec_flatten(&expected, nullptr);
gpr_strvec_destroy(&expected);
gpr_log(GPR_ERROR, "actual success does not match expected: %s", s);
gpr_free(s);
@ -250,32 +250,32 @@ static void verify_matches(expectation* e, grpc_event* ev) {
void cq_verify(cq_verifier* v) {
const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10);
while (v->first_expectation != NULL) {
grpc_event ev = grpc_completion_queue_next(v->cq, deadline, NULL);
while (v->first_expectation != nullptr) {
grpc_event ev = grpc_completion_queue_next(v->cq, deadline, nullptr);
if (ev.type == GRPC_QUEUE_TIMEOUT) {
fail_no_event_received(v);
break;
}
expectation* e;
expectation* prev = NULL;
for (e = v->first_expectation; e != NULL; e = e->next) {
expectation* prev = nullptr;
for (e = v->first_expectation; e != nullptr; e = e->next) {
if (e->tag == ev.tag) {
verify_matches(e, &ev);
if (e == v->first_expectation) v->first_expectation = e->next;
if (prev != NULL) prev->next = e->next;
if (prev != nullptr) prev->next = e->next;
gpr_free(e);
break;
}
prev = e;
}
if (e == NULL) {
if (e == nullptr) {
char* s = grpc_event_string(&ev);
gpr_log(GPR_ERROR, "cq returned unexpected event: %s", s);
gpr_free(s);
gpr_strvec expectations;
gpr_strvec_init(&expectations);
expectations_to_strvec(&expectations, v);
s = gpr_strvec_flatten(&expectations, NULL);
s = gpr_strvec_flatten(&expectations, nullptr);
gpr_strvec_destroy(&expectations);
gpr_log(GPR_ERROR, "expected tags:\n%s", s);
gpr_free(s);
@ -290,9 +290,9 @@ void cq_verify_empty_timeout(cq_verifier* v, int timeout_sec) {
gpr_time_from_seconds(timeout_sec, GPR_TIMESPAN));
grpc_event ev;
GPR_ASSERT(v->first_expectation == NULL && "expectation queue must be empty");
GPR_ASSERT(v->first_expectation == nullptr && "expectation queue must be empty");
ev = grpc_completion_queue_next(v->cq, deadline, NULL);
ev = grpc_completion_queue_next(v->cq, deadline, nullptr);
if (ev.type != GRPC_QUEUE_TIMEOUT) {
char* s = grpc_event_string(&ev);
gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s);

@ -19,6 +19,8 @@
/* This check is for testing only. */
#ifndef GRPC_UV
#include <grpc/support/alloc.h>
#include "test/core/end2end/cq_verifier_internal.h"
/* the verifier itself */
@ -27,13 +29,12 @@ struct cq_verifier {
grpc_completion_queue* cq;
/* start of expectation list */
expectation* first_expectation;
uv_timer_t timer;
};
cq_verifier* cq_verifier_create(grpc_completion_queue* cq) {
cq_verifier* v = static_cast<cq_verifier*>(gpr_malloc(sizeof(cq_verifier)));
v->cq = cq;
cq_verifier_set_first_expectation(v, NULL);
cq_verifier_set_first_expectation(v, nullptr);
return v;
}
@ -53,7 +54,7 @@ void cq_verifier_set_first_expectation(cq_verifier* v, expectation* e) {
grpc_event cq_verifier_next_event(cq_verifier* v, int timeout_seconds) {
const gpr_timespec deadline =
grpc_timeout_seconds_to_deadline(timeout_seconds);
return grpc_completion_queue_next(v->cq, deadline, NULL);
return grpc_completion_queue_next(v->cq, deadline, nullptr);
}
#endif /* GRPC_UV */

@ -48,7 +48,7 @@ static gpr_timespec ms_from_now(int ms) {
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, ms_from_now(5000), NULL);
ev = grpc_completion_queue_next(cq, ms_from_now(5000), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -93,9 +93,9 @@ void test_connect(const char* server_host, const char* client_host, int port,
grpc_call_details_init(&call_details);
/* Create server. */
cq = grpc_completion_queue_create_for_next(NULL);
server = grpc_server_create(NULL, NULL);
grpc_server_register_completion_queue(server, cq, NULL);
cq = grpc_completion_queue_create_for_next(nullptr);
server = grpc_server_create(nullptr, nullptr);
grpc_server_register_completion_queue(server, cq, nullptr);
GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port(
server, server_hostport)) > 0);
if (port == 0) {
@ -126,7 +126,7 @@ void test_connect(const char* server_host, const char* client_host, int port,
gpr_free(uri_part_str);
}
client_hostport = gpr_strjoin_sep((const char**)hosts_with_port,
uri_parts.count, ",", NULL);
uri_parts.count, ",", nullptr);
for (i = 0; i < uri_parts.count; i++) {
gpr_free(hosts_with_port[i]);
}
@ -136,7 +136,7 @@ void test_connect(const char* server_host, const char* client_host, int port,
} else {
gpr_join_host_port(&client_hostport, client_host, port);
}
client = grpc_insecure_channel_create(client_hostport, NULL, NULL);
client = grpc_insecure_channel_create(client_hostport, nullptr, nullptr);
gpr_log(GPR_INFO, "Testing with server=%s client=%s (expecting %s)",
server_hostport, client_hostport, expect_ok ? "success" : "failure");
@ -155,9 +155,9 @@ void test_connect(const char* server_host, const char* client_host, int port,
/* Send a trivial request. */
grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr");
c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
c = grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_slice_from_static_string("/foo"), &host,
deadline, NULL);
deadline, nullptr);
GPR_ASSERT(c);
memset(ops, 0, sizeof(ops));
@ -165,25 +165,25 @@ void test_connect(const char* server_host, const char* client_host, int port,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = expect_ok ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
if (expect_ok) {
@ -211,7 +211,7 @@ void test_connect(const char* server_host, const char* client_host, int port,
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
@ -246,11 +246,11 @@ void test_connect(const char* server_host, const char* client_host, int port,
grpc_channel_destroy(client);
/* Destroy server. */
shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(server);
grpc_completion_queue_destroy(shutdown_cq);
@ -270,10 +270,10 @@ void test_connect(const char* server_host, const char* client_host, int port,
}
int external_dns_works(const char* host) {
grpc_resolved_addresses* res = NULL;
grpc_resolved_addresses* res = nullptr;
grpc_error* error = grpc_blocking_resolve_address(host, "80", &res);
GRPC_ERROR_UNREF(error);
if (res != NULL) {
if (res != nullptr) {
grpc_resolved_addresses_destroy(res);
return 1;
}

@ -27,19 +27,19 @@ const char* get_host_override_string(const char* str,
if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) {
return str;
} else {
return NULL;
return nullptr;
}
}
const grpc_slice* get_host_override_slice(const char* str,
grpc_end2end_test_config config) {
const char* r = get_host_override_string(str, config);
if (r != NULL) {
if (r != nullptr) {
static grpc_slice ret;
ret = grpc_slice_from_static_string(r);
return &ret;
}
return NULL;
return nullptr;
}
void validate_host_override_string(const char* pattern, grpc_slice str,

@ -51,8 +51,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -71,7 +71,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
static_cast<fullstack_fixture_data*>(f->fixture_data);
grpc_arg arg = make_census_enable_arg();
client_args = grpc_channel_args_copy_and_add(client_args, &arg, 1);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@ -89,13 +89,13 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
grpc_server_destroy(f->server);
}
server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1);
f->server = grpc_server_create(server_args, NULL);
f->server = grpc_server_create(server_args, nullptr);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, server_args);
grpc_exec_ctx_finish(&exec_ctx);
}
grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}

@ -55,8 +55,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression(
memset(&f, 0, sizeof(f));
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -65,7 +65,7 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
fullstack_compression_fixture_data* ffd =
static_cast<fullstack_compression_fixture_data*>(f->fixture_data);
if (ffd->client_args_compression != NULL) {
if (ffd->client_args_compression != nullptr) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression);
grpc_exec_ctx_finish(&exec_ctx);
@ -73,14 +73,14 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f,
ffd->client_args_compression = grpc_channel_args_set_compression_algorithm(
client_args, GRPC_COMPRESS_GZIP);
f->client = grpc_insecure_channel_create(ffd->localaddr,
ffd->client_args_compression, NULL);
ffd->client_args_compression, nullptr);
}
void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f,
grpc_channel_args* server_args) {
fullstack_compression_fixture_data* ffd =
static_cast<fullstack_compression_fixture_data*>(f->fixture_data);
if (ffd->server_args_compression != NULL) {
if (ffd->server_args_compression != nullptr) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression);
grpc_exec_ctx_finish(&exec_ctx);
@ -90,8 +90,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(ffd->server_args_compression, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(ffd->server_args_compression, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}

@ -46,8 +46,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -56,8 +56,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx,
const grpc_metadata* md, size_t md_count,
grpc_process_auth_metadata_done_cb cb,
void* user_data) {
GPR_ASSERT(state == NULL);
cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
GPR_ASSERT(state == nullptr);
cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr);
}
static void chttp2_init_client_secure_fullstack(
@ -66,8 +66,8 @@ static void chttp2_init_client_secure_fullstack(
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client != nullptr);
grpc_channel_credentials_release(creds);
}
@ -79,8 +79,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
@ -103,7 +103,7 @@ static void chttp2_init_client_fake_secure_fullstack(
static int fail_server_auth_check(grpc_channel_args* server_args) {
size_t i;
if (server_args == NULL) return 0;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) ==
0) {
@ -118,7 +118,7 @@ static void chttp2_init_server_fake_secure_fullstack(
grpc_server_credentials* fake_ts_creds =
grpc_fake_transport_security_server_credentials_create();
if (fail_server_auth_check(server_args)) {
grpc_auth_metadata_processor processor = {process_auth_failure, NULL, NULL};
grpc_auth_metadata_processor processor = {process_auth_failure, nullptr, nullptr};
grpc_server_credentials_set_auth_metadata_processor(fake_ts_creds,
processor);
}

@ -58,8 +58,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = fixture_data;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
create_sockets(fixture_data->fd_pair);
@ -84,12 +84,12 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
sp_fixture_data* sfd = static_cast<sp_fixture_data*>(f->fixture_data);
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
f->server = grpc_server_create(server_args, nullptr);
GPR_ASSERT(f->server);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
grpc_server_add_insecure_channel_from_fd(f->server, NULL, sfd->fd_pair[1]);
grpc_server_add_insecure_channel_from_fd(f->server, nullptr, sfd->fd_pair[1]);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -66,7 +66,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -77,8 +77,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}

@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -66,7 +66,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -77,8 +77,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}

@ -54,8 +54,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -64,7 +64,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -85,8 +85,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args_new, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args_new, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
grpc_channel_args_destroy(&exec_ctx, server_args_new);

@ -50,8 +50,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -60,7 +60,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -71,8 +71,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}

@ -57,8 +57,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
ffd->proxy = grpc_end2end_http_proxy_create(client_args);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -72,7 +72,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
/* If testing for proxy auth, add credentials to proxy uri */
const grpc_arg* proxy_auth_arg =
grpc_channel_args_find(client_args, GRPC_ARG_HTTP_PROXY_AUTH_CREDS);
if (proxy_auth_arg == NULL || proxy_auth_arg->type != GRPC_ARG_STRING) {
if (proxy_auth_arg == nullptr || proxy_auth_arg->type != GRPC_ARG_STRING) {
gpr_asprintf(&proxy_uri, "http://%s",
grpc_end2end_http_proxy_get_proxy_name(ffd->proxy));
} else {
@ -81,7 +81,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
}
gpr_setenv("http_proxy", proxy_uri);
gpr_free(proxy_uri);
f->client = grpc_insecure_channel_create(ffd->server_addr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->server_addr, client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -92,8 +92,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->server_addr));
grpc_server_start(f->server);
}

@ -52,8 +52,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -62,7 +62,7 @@ void chttp2_init_client_load_reporting(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
load_reporting_fixture_data* ffd =
static_cast<load_reporting_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -75,13 +75,13 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture* f,
grpc_server_destroy(f->server);
}
server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1);
f->server = grpc_server_create(server_args, NULL);
f->server = grpc_server_create(server_args, nullptr);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, server_args);
grpc_exec_ctx_finish(&exec_ctx);
}
grpc_server_register_completion_queue(f->server, f->cq, NULL);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}

@ -49,7 +49,7 @@ static const grpc_metadata* find_metadata(const grpc_metadata* md,
return &md[i];
}
}
return NULL;
return nullptr;
}
typedef struct {
@ -64,15 +64,15 @@ static void process_oauth2_success(void* state, grpc_auth_context* ctx,
find_metadata(md, md_count, "authorization", oauth2_md);
test_processor_state* s;
GPR_ASSERT(state != NULL);
GPR_ASSERT(state != nullptr);
s = (test_processor_state*)state;
GPR_ASSERT(s->pseudo_refcount == 1);
GPR_ASSERT(oauth2 != NULL);
GPR_ASSERT(oauth2 != nullptr);
grpc_auth_context_add_cstring_property(ctx, client_identity_property_name,
client_identity);
GPR_ASSERT(grpc_auth_context_set_peer_identity_property_name(
ctx, client_identity_property_name) == 1);
cb(user_data, oauth2, 1, NULL, 0, GRPC_STATUS_OK, NULL);
cb(user_data, oauth2, 1, nullptr, 0, GRPC_STATUS_OK, nullptr);
}
static void process_oauth2_failure(void* state, grpc_auth_context* ctx,
@ -82,11 +82,11 @@ static void process_oauth2_failure(void* state, grpc_auth_context* ctx,
const grpc_metadata* oauth2 =
find_metadata(md, md_count, "authorization", oauth2_md);
test_processor_state* s;
GPR_ASSERT(state != NULL);
GPR_ASSERT(state != nullptr);
s = (test_processor_state*)state;
GPR_ASSERT(s->pseudo_refcount == 1);
GPR_ASSERT(oauth2 != NULL);
cb(user_data, oauth2, 1, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
GPR_ASSERT(oauth2 != nullptr);
cb(user_data, oauth2, 1, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr);
}
static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
@ -101,8 +101,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -113,8 +113,8 @@ static void chttp2_init_client_secure_fullstack(
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client != nullptr);
grpc_channel_credentials_release(creds);
}
@ -126,8 +126,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
@ -145,11 +145,11 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(test_root_cert, NULL, NULL);
grpc_ssl_credentials_create(test_root_cert, nullptr, nullptr);
grpc_call_credentials* oauth2_creds = grpc_md_only_test_credentials_create(
&exec_ctx, "authorization", oauth2_md, true /* is_async */);
grpc_channel_credentials* ssl_oauth2_creds =
grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, NULL);
grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, nullptr);
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
@ -165,7 +165,7 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack(
static int fail_server_auth_check(grpc_channel_args* server_args) {
size_t i;
if (server_args == NULL) return 0;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) ==
0) {
@ -201,7 +201,7 @@ static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials* ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL);
grpc_ssl_server_credentials_create(nullptr, &pem_key_cert_pair, 1, 0, nullptr);
grpc_server_credentials_set_auth_metadata_processor(
ssl_creds, test_processor_create(fail_server_auth_check(server_args)));
chttp2_init_server_secure_fullstack(f, server_args, ssl_creds);

@ -42,14 +42,14 @@ typedef struct fullstack_fixture_data {
static grpc_server* create_proxy_server(const char* port,
grpc_channel_args* server_args) {
grpc_server* s = grpc_server_create(server_args, NULL);
grpc_server* s = grpc_server_create(server_args, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(s, port));
return s;
}
static grpc_channel* create_proxy_client(const char* target,
grpc_channel_args* client_args) {
return grpc_insecure_channel_create(target, client_args, NULL);
return grpc_insecure_channel_create(target, client_args, nullptr);
}
static const grpc_end2end_proxy_def proxy_def = {create_proxy_server,
@ -65,8 +65,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -76,7 +76,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(
grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, NULL);
grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -87,8 +87,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(
f->server, grpc_end2end_proxy_get_server_port(ffd->proxy)));
grpc_server_start(f->server);

@ -53,7 +53,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr,
grpc_server_get_channel_args(f->server));
grpc_exec_ctx_finish(&exec_ctx);
}
@ -80,10 +80,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = sfd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", nullptr);
return f;
}
@ -100,7 +100,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1);
client_setup_transport(&exec_ctx, &cs, transport);
GPR_ASSERT(f->client);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}
@ -110,13 +110,13 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
transport =
grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0);
server_setup_transport(f, transport);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -47,7 +47,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr,
grpc_server_get_channel_args(f->server));
grpc_exec_ctx_finish(&exec_ctx);
}
@ -74,10 +74,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = sfd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL);
*sfd = grpc_iomgr_create_endpoint_pair("fixture", nullptr);
return f;
}
@ -94,7 +94,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1);
client_setup_transport(&exec_ctx, &cs, transport);
GPR_ASSERT(f->client);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}
@ -104,13 +104,13 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
transport =
grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0);
server_setup_transport(f, transport);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -47,7 +47,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq));
grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL,
grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr,
grpc_server_get_channel_args(f->server));
grpc_exec_ctx_finish(&exec_ctx);
}
@ -74,8 +74,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(
grpc_end2end_test_fixture f;
memset(&f, 0, sizeof(f));
f.fixture_data = sfd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
grpc_arg a[3];
a[0].key = const_cast<char*>(GRPC_ARG_TCP_READ_CHUNK_SIZE);
@ -105,7 +105,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f,
grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1);
client_setup_transport(&exec_ctx, &cs, transport);
GPR_ASSERT(f->client);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}
@ -115,13 +115,13 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f,
grpc_endpoint_pair* sfd = static_cast<grpc_endpoint_pair*>(f->fixture_data);
grpc_transport* transport;
GPR_ASSERT(!f->server);
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
transport =
grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0);
server_setup_transport(f, transport);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}

@ -50,8 +50,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -60,8 +60,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx,
const grpc_metadata* md, size_t md_count,
grpc_process_auth_metadata_done_cb cb,
void* user_data) {
GPR_ASSERT(state == NULL);
cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
GPR_ASSERT(state == nullptr);
cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr);
}
static void chttp2_init_client_secure_fullstack(
@ -70,8 +70,8 @@ static void chttp2_init_client_secure_fullstack(
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client != nullptr);
grpc_channel_credentials_release(creds);
}
@ -83,8 +83,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
@ -101,7 +101,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_ssl_credentials_create(nullptr, nullptr, nullptr);
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
@ -118,7 +118,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
static int fail_server_auth_check(grpc_channel_args* server_args) {
size_t i;
if (server_args == NULL) return 0;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) ==
0) {
@ -133,9 +133,9 @@ static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials* ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL);
grpc_ssl_server_credentials_create(nullptr, &pem_cert_key_pair, 1, 0, nullptr);
if (fail_server_auth_check(server_args)) {
grpc_auth_metadata_processor processor = {process_auth_failure, NULL, NULL};
grpc_auth_metadata_processor processor = {process_auth_failure, nullptr, nullptr};
grpc_server_credentials_set_auth_metadata_processor(ssl_creds, processor);
}
chttp2_init_server_secure_fullstack(f, server_args, ssl_creds);
@ -166,8 +166,8 @@ int main(int argc, char** argv) {
/* Set the SSL roots env var. */
roots_file = gpr_tmpfile("chttp2_simple_ssl_fullstack_test", &roots_filename);
GPR_ASSERT(roots_filename != NULL);
GPR_ASSERT(roots_file != NULL);
GPR_ASSERT(roots_filename != nullptr);
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);

@ -41,11 +41,11 @@ typedef struct fullstack_secure_fixture_data {
static grpc_server* create_proxy_server(const char* port,
grpc_channel_args* server_args) {
grpc_server* s = grpc_server_create(server_args, NULL);
grpc_server* s = grpc_server_create(server_args, nullptr);
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials* ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL);
grpc_ssl_server_credentials_create(nullptr, &pem_cert_key_pair, 1, 0, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(s, port, ssl_creds));
grpc_server_credentials_release(ssl_creds);
return s;
@ -55,7 +55,7 @@ static grpc_channel* create_proxy_client(const char* target,
grpc_channel_args* client_args) {
grpc_channel* channel;
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_ssl_credentials_create(nullptr, nullptr, nullptr);
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
@ -63,7 +63,7 @@ static grpc_channel* create_proxy_client(const char* target,
grpc_channel_args* new_client_args =
grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1);
channel =
grpc_secure_channel_create(ssl_creds, target, new_client_args, NULL);
grpc_secure_channel_create(ssl_creds, target, new_client_args, nullptr);
grpc_channel_credentials_release(ssl_creds);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@ -87,8 +87,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -97,8 +97,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx,
const grpc_metadata* md, size_t md_count,
grpc_process_auth_metadata_done_cb cb,
void* user_data) {
GPR_ASSERT(state == NULL);
cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
GPR_ASSERT(state == nullptr);
cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr);
}
static void chttp2_init_client_secure_fullstack(
@ -108,8 +108,8 @@ static void chttp2_init_client_secure_fullstack(
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
f->client = grpc_secure_channel_create(
creds, grpc_end2end_proxy_get_client_target(ffd->proxy), client_args,
NULL);
GPR_ASSERT(f->client != NULL);
nullptr);
GPR_ASSERT(f->client != nullptr);
grpc_channel_credentials_release(creds);
}
@ -121,8 +121,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(
f->server, grpc_end2end_proxy_get_server_port(ffd->proxy), server_creds));
grpc_server_credentials_release(server_creds);
@ -139,7 +139,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
static void chttp2_init_client_simple_ssl_secure_fullstack(
grpc_end2end_test_fixture* f, grpc_channel_args* client_args) {
grpc_channel_credentials* ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
grpc_ssl_credentials_create(nullptr, nullptr, nullptr);
grpc_arg ssl_name_override = {
GRPC_ARG_STRING,
const_cast<char*>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG),
@ -156,7 +156,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack(
static int fail_server_auth_check(grpc_channel_args* server_args) {
size_t i;
if (server_args == NULL) return 0;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) ==
0) {
@ -171,9 +171,9 @@ static void chttp2_init_server_simple_ssl_secure_fullstack(
grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key,
test_server1_cert};
grpc_server_credentials* ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL);
grpc_ssl_server_credentials_create(nullptr, &pem_cert_key_pair, 1, 0, nullptr);
if (fail_server_auth_check(server_args)) {
grpc_auth_metadata_processor processor = {process_auth_failure, NULL, NULL};
grpc_auth_metadata_processor processor = {process_auth_failure, nullptr, nullptr};
grpc_server_credentials_set_auth_metadata_processor(ssl_creds, processor);
}
chttp2_init_server_secure_fullstack(f, server_args, ssl_creds);
@ -205,8 +205,8 @@ int main(int argc, char** argv) {
/* Set the SSL roots env var. */
roots_file = gpr_tmpfile("chttp2_simple_ssl_fullstack_test", &roots_filename);
GPR_ASSERT(roots_filename != NULL);
GPR_ASSERT(roots_file != NULL);
GPR_ASSERT(roots_filename != nullptr);
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);

@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack(
unique++);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -66,7 +66,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
fullstack_fixture_data* ffd =
static_cast<fullstack_fixture_data*>(f->fixture_data);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL);
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr);
}
void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
@ -76,8 +76,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr));
grpc_server_start(f->server);
}

@ -108,7 +108,7 @@ static void proxy_connection_unref(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "endpoints: %p %p", conn->client_endpoint,
conn->server_endpoint);
grpc_endpoint_destroy(exec_ctx, conn->client_endpoint);
if (conn->server_endpoint != NULL) {
if (conn->server_endpoint != nullptr) {
grpc_endpoint_destroy(exec_ctx, conn->server_endpoint);
}
grpc_pollset_set_destroy(exec_ctx, conn->pollset_set);
@ -137,7 +137,7 @@ static void proxy_connection_failed(grpc_exec_ctx* exec_ctx,
grpc_endpoint_shutdown(exec_ctx, conn->client_endpoint,
GRPC_ERROR_REF(error));
if (conn->server_endpoint != NULL) {
if (conn->server_endpoint != nullptr) {
grpc_endpoint_shutdown(exec_ctx, conn->server_endpoint,
GRPC_ERROR_REF(error));
}
@ -315,8 +315,8 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx,
char* proxy_auth_header_val,
char* expected_cred) {
GPR_ASSERT(proxy_auth_header_val != NULL);
GPR_ASSERT(expected_cred != NULL);
GPR_ASSERT(proxy_auth_header_val != nullptr);
GPR_ASSERT(expected_cred != nullptr);
if (strncmp(proxy_auth_header_val, "Basic ", 6) != 0) {
return false;
}
@ -349,7 +349,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
for (size_t i = 0; i < conn->client_read_buffer.count; ++i) {
if (GRPC_SLICE_LENGTH(conn->client_read_buffer.slices[i]) > 0) {
error = grpc_http_parser_parse(&conn->http_parser,
conn->client_read_buffer.slices[i], NULL);
conn->client_read_buffer.slices[i], nullptr);
if (error != GRPC_ERROR_NONE) {
proxy_connection_failed(exec_ctx, conn, true /* is_client */,
"HTTP proxy request parse", error);
@ -380,7 +380,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
// If proxy auth is being used, check if the header is present and as expected
const grpc_arg* proxy_auth_arg = grpc_channel_args_find(
conn->proxy->channel_args, GRPC_ARG_HTTP_PROXY_AUTH_CREDS);
if (proxy_auth_arg != NULL && proxy_auth_arg->type == GRPC_ARG_STRING) {
if (proxy_auth_arg != nullptr && proxy_auth_arg->type == GRPC_ARG_STRING) {
bool client_authenticated = false;
for (size_t i = 0; i < conn->http_request.hdr_count; i++) {
if (strcmp(conn->http_request.hdrs[i].key, "Proxy-Authorization") == 0) {
@ -400,7 +400,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
}
}
// Resolve address.
grpc_resolved_addresses* resolved_addresses = NULL;
grpc_resolved_addresses* resolved_addresses = nullptr;
error = grpc_blocking_resolve_address(conn->http_request.path, "80",
&resolved_addresses);
if (error != GRPC_ERROR_NONE) {
@ -415,7 +415,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
const grpc_millis deadline =
grpc_exec_ctx_now(exec_ctx) + 10 * GPR_MS_PER_SEC;
grpc_tcp_client_connect(exec_ctx, &conn->on_server_connect_done,
&conn->server_endpoint, conn->pollset_set, NULL,
&conn->server_endpoint, conn->pollset_set, nullptr,
&resolved_addresses->addrs[0], deadline);
grpc_resolved_addresses_destroy(resolved_addresses);
}
@ -469,7 +469,7 @@ static void thread_main(void* arg) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
do {
gpr_ref(&proxy->users);
grpc_pollset_worker* worker = NULL;
grpc_pollset_worker* worker = nullptr;
gpr_mu_lock(proxy->mu);
GRPC_LOG_IF_ERROR(
"grpc_pollset_work",
@ -496,7 +496,7 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create(
// Create TCP server.
proxy->channel_args = grpc_channel_args_copy(args);
grpc_error* error = grpc_tcp_server_create(
&exec_ctx, NULL, proxy->channel_args, &proxy->server);
&exec_ctx, nullptr, proxy->channel_args, &proxy->server);
GPR_ASSERT(error == GRPC_ERROR_NONE);
// Bind to port.
grpc_resolved_address resolved_addr;

@ -47,15 +47,15 @@ static grpc_end2end_test_fixture inproc_create_fixture(
memset(&f, 0, sizeof(f));
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
void inproc_init_client(grpc_end2end_test_fixture* f,
grpc_channel_args* client_args) {
f->client = grpc_inproc_channel_create(f->server, client_args, NULL);
f->client = grpc_inproc_channel_create(f->server, client_args, nullptr);
GPR_ASSERT(f->client);
}
@ -64,8 +64,8 @@ void inproc_init_server(grpc_end2end_test_fixture* f,
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
grpc_server_start(f->server);
}

@ -89,11 +89,11 @@ grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def,
gpr_log(GPR_DEBUG, "PROXY ADDR:%s BACKEND:%s", proxy->proxy_port,
proxy->server_port);
proxy->cq = grpc_completion_queue_create_for_next(NULL);
proxy->cq = grpc_completion_queue_create_for_next(nullptr);
proxy->server = def->create_server(proxy->proxy_port, server_args);
proxy->client = def->create_client(proxy->server_port, client_args);
grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL);
grpc_server_register_completion_queue(proxy->server, proxy->cq, nullptr);
grpc_server_start(proxy->server);
grpc_call_details_init(&proxy->new_call_details);
@ -159,12 +159,12 @@ static void on_p2s_recv_initial_metadata(void* arg, int success) {
if (!pc->proxy->shutdown) {
op.op = GRPC_OP_SEND_INITIAL_METADATA;
op.flags = 0;
op.reserved = NULL;
op.reserved = nullptr;
op.data.send_initial_metadata.count = pc->p2s_initial_metadata.count;
op.data.send_initial_metadata.metadata = pc->p2s_initial_metadata.metadata;
refpc(pc, "on_c2p_sent_initial_metadata");
err = grpc_call_start_batch(
pc->c2p, &op, 1, new_closure(on_c2p_sent_initial_metadata, pc), NULL);
pc->c2p, &op, 1, new_closure(on_c2p_sent_initial_metadata, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@ -187,11 +187,11 @@ static void on_p2s_sent_message(void* arg, int success) {
if (!pc->proxy->shutdown && success) {
op.op = GRPC_OP_RECV_MESSAGE;
op.flags = 0;
op.reserved = NULL;
op.reserved = nullptr;
op.data.recv_message.recv_message = &pc->c2p_msg;
refpc(pc, "on_c2p_recv_msg");
err = grpc_call_start_batch(pc->c2p, &op, 1,
new_closure(on_c2p_recv_msg, pc), NULL);
new_closure(on_c2p_recv_msg, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@ -209,26 +209,26 @@ static void on_c2p_recv_msg(void* arg, int success) {
grpc_call_error err;
if (!pc->proxy->shutdown && success) {
if (pc->c2p_msg != NULL) {
if (pc->c2p_msg != nullptr) {
op.op = GRPC_OP_SEND_MESSAGE;
op.flags = 0;
op.reserved = NULL;
op.reserved = nullptr;
op.data.send_message.send_message = pc->c2p_msg;
refpc(pc, "on_p2s_sent_message");
err = grpc_call_start_batch(pc->p2s, &op, 1,
new_closure(on_p2s_sent_message, pc), NULL);
new_closure(on_p2s_sent_message, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
} else {
op.op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op.flags = 0;
op.reserved = NULL;
op.reserved = nullptr;
refpc(pc, "on_p2s_sent_close");
err = grpc_call_start_batch(pc->p2s, &op, 1,
new_closure(on_p2s_sent_close, pc), NULL);
new_closure(on_p2s_sent_close, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
}
} else {
if (pc->c2p_msg != NULL) {
if (pc->c2p_msg != nullptr) {
grpc_byte_buffer_destroy(pc->c2p_msg);
}
}
@ -247,11 +247,11 @@ static void on_c2p_sent_message(void* arg, int success) {
if (!pc->proxy->shutdown && success) {
op.op = GRPC_OP_RECV_MESSAGE;
op.flags = 0;
op.reserved = NULL;
op.reserved = nullptr;
op.data.recv_message.recv_message = &pc->p2s_msg;
refpc(pc, "on_p2s_recv_msg");
err = grpc_call_start_batch(pc->p2s, &op, 1,
new_closure(on_p2s_recv_msg, pc), NULL);
new_closure(on_p2s_recv_msg, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@ -266,11 +266,11 @@ static void on_p2s_recv_msg(void* arg, int success) {
if (!pc->proxy->shutdown && success && pc->p2s_msg) {
op.op = GRPC_OP_SEND_MESSAGE;
op.flags = 0;
op.reserved = NULL;
op.reserved = nullptr;
op.data.send_message.send_message = pc->p2s_msg;
refpc(pc, "on_c2p_sent_message");
err = grpc_call_start_batch(pc->c2p, &op, 1,
new_closure(on_c2p_sent_message, pc), NULL);
new_closure(on_c2p_sent_message, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
} else {
grpc_byte_buffer_destroy(pc->p2s_msg);
@ -292,7 +292,7 @@ static void on_p2s_status(void* arg, int success) {
GPR_ASSERT(success);
op.op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op.flags = 0;
op.reserved = NULL;
op.reserved = nullptr;
op.data.send_status_from_server.trailing_metadata_count =
pc->p2s_trailing_metadata.count;
op.data.send_status_from_server.trailing_metadata =
@ -301,7 +301,7 @@ static void on_p2s_status(void* arg, int success) {
op.data.send_status_from_server.status_details = &pc->p2s_status_details;
refpc(pc, "on_c2p_sent_status");
err = grpc_call_start_batch(pc->c2p, &op, 1,
new_closure(on_c2p_sent_status, pc), NULL);
new_closure(on_c2p_sent_status, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
}
@ -329,10 +329,10 @@ static void on_new_call(void* arg, int success) {
pc->p2s = grpc_channel_create_call(
proxy->client, pc->c2p, GRPC_PROPAGATE_DEFAULTS, proxy->cq,
proxy->new_call_details.method, &proxy->new_call_details.host,
proxy->new_call_details.deadline, NULL);
proxy->new_call_details.deadline, nullptr);
gpr_ref_init(&pc->refs, 1);
op.reserved = NULL;
op.reserved = nullptr;
op.op = GRPC_OP_RECV_INITIAL_METADATA;
op.flags = 0;
@ -340,7 +340,7 @@ static void on_new_call(void* arg, int success) {
&pc->p2s_initial_metadata;
refpc(pc, "on_p2s_recv_initial_metadata");
err = grpc_call_start_batch(
pc->p2s, &op, 1, new_closure(on_p2s_recv_initial_metadata, pc), NULL);
pc->p2s, &op, 1, new_closure(on_p2s_recv_initial_metadata, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_SEND_INITIAL_METADATA;
@ -349,7 +349,7 @@ static void on_new_call(void* arg, int success) {
op.data.send_initial_metadata.metadata = pc->c2p_initial_metadata.metadata;
refpc(pc, "on_p2s_sent_initial_metadata");
err = grpc_call_start_batch(
pc->p2s, &op, 1, new_closure(on_p2s_sent_initial_metadata, pc), NULL);
pc->p2s, &op, 1, new_closure(on_p2s_sent_initial_metadata, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_MESSAGE;
@ -357,7 +357,7 @@ static void on_new_call(void* arg, int success) {
op.data.recv_message.recv_message = &pc->c2p_msg;
refpc(pc, "on_c2p_recv_msg");
err = grpc_call_start_batch(pc->c2p, &op, 1,
new_closure(on_c2p_recv_msg, pc), NULL);
new_closure(on_c2p_recv_msg, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_MESSAGE;
@ -365,7 +365,7 @@ static void on_new_call(void* arg, int success) {
op.data.recv_message.recv_message = &pc->p2s_msg;
refpc(pc, "on_p2s_recv_msg");
err = grpc_call_start_batch(pc->p2s, &op, 1,
new_closure(on_p2s_recv_msg, pc), NULL);
new_closure(on_p2s_recv_msg, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_STATUS_ON_CLIENT;
@ -376,7 +376,7 @@ static void on_new_call(void* arg, int success) {
op.data.recv_status_on_client.status_details = &pc->p2s_status_details;
refpc(pc, "on_p2s_status");
err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_status, pc),
NULL);
nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
op.op = GRPC_OP_RECV_CLOSE_ON_SERVER;
@ -384,7 +384,7 @@ static void on_new_call(void* arg, int success) {
op.data.recv_close_on_server.cancelled = &pc->c2p_server_cancelled;
refpc(pc, "on_c2p_closed");
err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_closed, pc),
NULL);
nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
request_call(proxy);
@ -394,12 +394,12 @@ static void on_new_call(void* arg, int success) {
unrefpc(pc, "init");
} else {
GPR_ASSERT(proxy->new_call == NULL);
GPR_ASSERT(proxy->new_call == nullptr);
}
}
static void request_call(grpc_end2end_proxy* proxy) {
proxy->new_call = NULL;
proxy->new_call = nullptr;
GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(
proxy->server, &proxy->new_call,
&proxy->new_call_details,
@ -412,7 +412,7 @@ static void thread_main(void* arg) {
closure* cl;
for (;;) {
grpc_event ev = grpc_completion_queue_next(
proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL);
proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr);
switch (ev.type) {
case GRPC_QUEUE_TIMEOUT:
gpr_log(GPR_ERROR, "Should never reach here");

@ -84,7 +84,7 @@ static uint8_t next_byte(input_stream* inp) {
static void end(input_stream* inp) { inp->cur = inp->end; }
static char* read_string(input_stream* inp, bool* special) {
char* str = NULL;
char* str = nullptr;
size_t cap = 0;
size_t sz = 0;
char c;
@ -96,7 +96,7 @@ static char* read_string(input_stream* inp, bool* special) {
c = (char)next_byte(inp);
str[sz++] = c;
} while (c != 0 && c != 1);
if (special != NULL) {
if (special != nullptr) {
*special = (c == 1);
}
if (c == 1) {
@ -109,10 +109,10 @@ static void read_buffer(input_stream* inp, char** buffer, size_t* length,
bool* special) {
*length = next_byte(inp);
if (*length == 255) {
if (special != NULL) *special = true;
if (special != nullptr) *special = true;
*length = next_byte(inp);
} else {
if (special != NULL) *special = false;
if (special != nullptr) *special = false;
}
*buffer = static_cast<char*>(gpr_malloc(*length));
for (size_t i = 0; i < *length; i++) {
@ -201,12 +201,12 @@ static grpc_channel_args* read_args(input_stream* inp) {
switch (next_byte(inp)) {
case 1:
args[i].type = GRPC_ARG_STRING;
args[i].key = read_string(inp, NULL);
args[i].value.string = read_string(inp, NULL);
args[i].key = read_string(inp, nullptr);
args[i].value.string = read_string(inp, nullptr);
break;
case 2:
args[i].type = GRPC_ARG_INTEGER;
args[i].key = read_string(inp, NULL);
args[i].key = read_string(inp, nullptr);
args[i].value.integer = read_int(inp);
break;
case 3:
@ -248,11 +248,11 @@ static const char* read_cred_artifact(cred_artifact_ctx* ctx, input_stream* inp,
const char** builtins,
size_t num_builtins) {
uint8_t b = next_byte(inp);
if (b == 0) return NULL;
if (b == 1) return ctx->release[ctx->num_release++] = read_string(inp, NULL);
if (b == 0) return nullptr;
if (b == 1) return ctx->release[ctx->num_release++] = read_string(inp, nullptr);
if (b >= num_builtins + 1) {
end(inp);
return NULL;
return nullptr;
}
return builtins[b - 1];
}
@ -272,8 +272,8 @@ static grpc_channel_credentials* read_ssl_channel_creds(input_stream* inp) {
GPR_ARRAY_SIZE(builtin_cert_chains));
grpc_ssl_pem_key_cert_pair key_cert_pair = {private_key, certs};
grpc_channel_credentials* creds = grpc_ssl_credentials_create(
root_certs, private_key != NULL && certs != NULL ? &key_cert_pair : NULL,
NULL);
root_certs, private_key != nullptr && certs != nullptr ? &key_cert_pair : nullptr,
nullptr);
cred_artifact_ctx_finish(&ctx);
return creds;
}
@ -282,45 +282,45 @@ static grpc_call_credentials* read_call_creds(input_stream* inp) {
switch (next_byte(inp)) {
default:
end(inp);
return NULL;
return nullptr;
case 0:
return NULL;
return nullptr;
case 1: {
grpc_call_credentials* c1 = read_call_creds(inp);
grpc_call_credentials* c2 = read_call_creds(inp);
if (c1 != NULL && c2 != NULL) {
if (c1 != nullptr && c2 != nullptr) {
grpc_call_credentials* out =
grpc_composite_call_credentials_create(c1, c2, NULL);
grpc_composite_call_credentials_create(c1, c2, nullptr);
grpc_call_credentials_release(c1);
grpc_call_credentials_release(c2);
return out;
} else if (c1 != NULL) {
} else if (c1 != nullptr) {
return c1;
} else if (c2 != NULL) {
} else if (c2 != nullptr) {
return c2;
} else {
return NULL;
return nullptr;
}
GPR_UNREACHABLE_CODE(return NULL);
GPR_UNREACHABLE_CODE(return nullptr);
}
case 2: {
cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT;
const char* access_token = read_cred_artifact(&ctx, inp, NULL, 0);
const char* access_token = read_cred_artifact(&ctx, inp, nullptr, 0);
grpc_call_credentials* out =
access_token == NULL
? NULL
: grpc_access_token_credentials_create(access_token, NULL);
access_token == nullptr
? nullptr
: grpc_access_token_credentials_create(access_token, nullptr);
cred_artifact_ctx_finish(&ctx);
return out;
}
case 3: {
cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT;
const char* auth_token = read_cred_artifact(&ctx, inp, NULL, 0);
const char* auth_selector = read_cred_artifact(&ctx, inp, NULL, 0);
grpc_call_credentials* out = auth_token == NULL || auth_selector == NULL
? NULL
const char* auth_token = read_cred_artifact(&ctx, inp, nullptr, 0);
const char* auth_selector = read_cred_artifact(&ctx, inp, nullptr, 0);
grpc_call_credentials* out = auth_token == nullptr || auth_selector == nullptr
? nullptr
: grpc_google_iam_credentials_create(
auth_token, auth_selector, NULL);
auth_token, auth_selector, nullptr);
cred_artifact_ctx_finish(&ctx);
return out;
}
@ -336,9 +336,9 @@ static grpc_channel_credentials* read_channel_creds(input_stream* inp) {
case 1: {
grpc_channel_credentials* c1 = read_channel_creds(inp);
grpc_call_credentials* c2 = read_call_creds(inp);
if (c1 != NULL && c2 != NULL) {
if (c1 != nullptr && c2 != nullptr) {
grpc_channel_credentials* out =
grpc_composite_channel_credentials_create(c1, c2, NULL);
grpc_composite_channel_credentials_create(c1, c2, nullptr);
grpc_channel_credentials_release(c1);
grpc_call_credentials_release(c2);
return out;
@ -346,17 +346,17 @@ static grpc_channel_credentials* read_channel_creds(input_stream* inp) {
return c1;
} else if (c2) {
grpc_call_credentials_release(c2);
return NULL;
return nullptr;
} else {
return NULL;
return nullptr;
}
GPR_UNREACHABLE_CODE(return NULL);
GPR_UNREACHABLE_CODE(return nullptr);
}
case 2:
return NULL;
return nullptr;
default:
end(inp);
return NULL;
return nullptr;
}
}
@ -378,7 +378,7 @@ static void finish_resolve(grpc_exec_ctx* exec_ctx, void* arg,
addr_req* r = static_cast<addr_req*>(arg);
if (error == GRPC_ERROR_NONE && 0 == strcmp(r->addr, "server")) {
if (r->addrs != NULL) {
if (r->addrs != nullptr) {
grpc_resolved_addresses* addrs =
static_cast<grpc_resolved_addresses*>(gpr_malloc(sizeof(*addrs)));
addrs->naddrs = 1;
@ -386,9 +386,9 @@ static void finish_resolve(grpc_exec_ctx* exec_ctx, void* arg,
gpr_malloc(sizeof(*addrs->addrs)));
addrs->addrs[0].len = 0;
*r->addrs = addrs;
} else if (r->lb_addrs != NULL) {
grpc_lb_addresses* lb_addrs = grpc_lb_addresses_create(1, NULL);
grpc_lb_addresses_set_address(lb_addrs, 0, NULL, 0, false, NULL, NULL);
} else if (r->lb_addrs != nullptr) {
grpc_lb_addresses* lb_addrs = grpc_lb_addresses_create(1, nullptr);
grpc_lb_addresses_set_address(lb_addrs, 0, nullptr, 0, false, nullptr, nullptr);
*r->lb_addrs = lb_addrs;
}
GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, GRPC_ERROR_NONE);
@ -411,7 +411,7 @@ void my_resolve_address(grpc_exec_ctx* exec_ctx, const char* addr,
r->addr = gpr_strdup(addr);
r->on_done = on_done;
r->addrs = addresses;
r->lb_addrs = NULL;
r->lb_addrs = nullptr;
grpc_timer_init(
exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx),
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
@ -425,12 +425,12 @@ grpc_ares_request* my_dns_lookup_ares(
addr_req* r = static_cast<addr_req*>(gpr_malloc(sizeof(*r)));
r->addr = gpr_strdup(addr);
r->on_done = on_done;
r->addrs = NULL;
r->addrs = nullptr;
r->lb_addrs = lb_addrs;
grpc_timer_init(
exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx),
GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx));
return NULL;
return nullptr;
}
////////////////////////////////////////////////////////////////////////////////
@ -455,18 +455,18 @@ typedef struct {
static void do_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
future_connect* fc = static_cast<future_connect*>(arg);
if (error != GRPC_ERROR_NONE) {
*fc->ep = NULL;
*fc->ep = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_REF(error));
} else if (g_server != NULL) {
} else if (g_server != nullptr) {
grpc_endpoint* client;
grpc_endpoint* server;
grpc_passthru_endpoint_create(&client, &server, g_resource_quota, NULL);
grpc_passthru_endpoint_create(&client, &server, g_resource_quota, nullptr);
*fc->ep = client;
grpc_transport* transport =
grpc_create_chttp2_transport(exec_ctx, NULL, server, 0);
grpc_server_setup_transport(exec_ctx, g_server, transport, NULL, NULL);
grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL);
grpc_create_chttp2_transport(exec_ctx, nullptr, server, 0);
grpc_server_setup_transport(exec_ctx, g_server, transport, nullptr, nullptr);
grpc_chttp2_transport_start_reading(exec_ctx, transport, nullptr);
GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_NONE);
} else {
@ -478,7 +478,7 @@ static void do_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
static void sched_connect(grpc_exec_ctx* exec_ctx, grpc_closure* closure,
grpc_endpoint** ep, gpr_timespec deadline) {
if (gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) < 0) {
*ep = NULL;
*ep = nullptr;
GRPC_CLOSURE_SCHED(
exec_ctx, closure,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connect deadline exceeded"));
@ -551,7 +551,7 @@ static void validate_connectivity_watch(void* p, bool success) {
}
static void free_non_null(void* p) {
GPR_ASSERT(p != NULL);
GPR_ASSERT(p != nullptr);
gpr_free(p);
}
@ -594,7 +594,7 @@ static call_state* g_active_call;
static call_state* new_call(call_state* sibling, call_state_type type) {
call_state* c = static_cast<call_state*>(gpr_malloc(sizeof(*c)));
memset(c, 0, sizeof(*c));
if (sibling != NULL) {
if (sibling != nullptr) {
c->next = sibling;
c->prev = sibling->prev;
c->next->prev = c->prev->next = c;
@ -608,7 +608,7 @@ static call_state* new_call(call_state* sibling, call_state_type type) {
static call_state* maybe_delete_call_state(call_state* call) {
call_state* next = call->next;
if (call->call != NULL) return next;
if (call->call != nullptr) return next;
if (call->pending_ops != 0) return next;
if (call == g_active_call) {
@ -682,7 +682,7 @@ static void read_metadata(input_stream* inp, size_t* count,
static call_state* destroy_call(call_state* call) {
grpc_call_unref(call->call);
call->call = NULL;
call->call = nullptr;
return maybe_delete_call_state(call);
}
@ -691,7 +691,7 @@ static void finished_request_call(void* csp, bool success) {
GPR_ASSERT(cs->pending_ops > 0);
--cs->pending_ops;
if (success) {
GPR_ASSERT(cs->call != NULL);
GPR_ASSERT(cs->call != nullptr);
cs->type = SERVER;
} else {
maybe_delete_call_state(cs);
@ -708,16 +708,16 @@ static void finished_batch(void* p, bool success) {
--bi->cs->pending_ops;
if ((bi->has_ops & (1u << GRPC_OP_RECV_MESSAGE)) &&
(bi->cs->done_flags & DONE_FLAG_CALL_CLOSED)) {
GPR_ASSERT(bi->cs->recv_message == NULL);
GPR_ASSERT(bi->cs->recv_message == nullptr);
}
if ((bi->has_ops & (1u << GRPC_OP_RECV_MESSAGE) &&
bi->cs->recv_message != NULL)) {
bi->cs->recv_message != nullptr)) {
grpc_byte_buffer_destroy(bi->cs->recv_message);
bi->cs->recv_message = NULL;
bi->cs->recv_message = nullptr;
}
if ((bi->has_ops & (1u << GRPC_OP_SEND_MESSAGE))) {
grpc_byte_buffer_destroy(bi->cs->send_message);
bi->cs->send_message = NULL;
bi->cs->send_message = nullptr;
}
if ((bi->has_ops & (1u << GRPC_OP_RECV_STATUS_ON_CLIENT)) ||
(bi->has_ops & (1u << GRPC_OP_RECV_CLOSE_ON_SERVER))) {
@ -738,7 +738,7 @@ static validator* make_finished_batch_validator(call_state* cs,
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_test_only_set_slice_hash_seed(0);
char* grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER");
if (squelch && grpc_trace_fuzzer == NULL) gpr_set_log_function(dont_log);
if (squelch && grpc_trace_fuzzer == nullptr) gpr_set_log_function(dont_log);
gpr_free(grpc_trace_fuzzer);
input_stream inp = {data, data + size};
grpc_tcp_client_connect_impl = my_tcp_client_connect;
@ -753,28 +753,28 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_resolve_address = my_resolve_address;
grpc_dns_lookup_ares = my_dns_lookup_ares;
GPR_ASSERT(g_channel == NULL);
GPR_ASSERT(g_server == NULL);
GPR_ASSERT(g_channel == nullptr);
GPR_ASSERT(g_server == nullptr);
bool server_shutdown = false;
int pending_server_shutdowns = 0;
int pending_channel_watches = 0;
int pending_pings = 0;
g_active_call = new_call(NULL, ROOT);
g_active_call = new_call(nullptr, ROOT);
g_resource_quota = grpc_resource_quota_create("api_fuzzer");
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
while (!is_eof(&inp) || g_channel != NULL || g_server != NULL ||
while (!is_eof(&inp) || g_channel != nullptr || g_server != nullptr ||
pending_channel_watches > 0 || pending_pings > 0 ||
g_active_call->type != ROOT || g_active_call->next != g_active_call) {
if (is_eof(&inp)) {
if (g_channel != NULL) {
if (g_channel != nullptr) {
grpc_channel_destroy(g_channel);
g_channel = NULL;
g_channel = nullptr;
}
if (g_server != NULL) {
if (g_server != nullptr) {
if (!server_shutdown) {
grpc_server_shutdown_and_notify(
g_server, cq,
@ -784,12 +784,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
pending_server_shutdowns++;
} else if (pending_server_shutdowns == 0) {
grpc_server_destroy(g_server);
g_server = NULL;
g_server = nullptr;
}
}
call_state* s = g_active_call;
do {
if (s->type != PENDING_SERVER && s->call != NULL) {
if (s->type != PENDING_SERVER && s->call != nullptr) {
s = destroy_call(s);
} else {
s = s->next;
@ -809,7 +809,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// tickle completion queue
case 0: {
grpc_event ev = grpc_completion_queue_next(
cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
switch (ev.type) {
case GRPC_OP_COMPLETE: {
validator* v = static_cast<validator*>(ev.tag);
@ -833,13 +833,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// create an insecure channel
case 2: {
if (g_channel == NULL) {
char* target = read_string(&inp, NULL);
if (g_channel == nullptr) {
char* target = read_string(&inp, nullptr);
char* target_uri;
gpr_asprintf(&target_uri, "dns:%s", target);
grpc_channel_args* args = read_args(&inp);
g_channel = grpc_insecure_channel_create(target_uri, args, NULL);
GPR_ASSERT(g_channel != NULL);
g_channel = grpc_insecure_channel_create(target_uri, args, nullptr);
GPR_ASSERT(g_channel != nullptr);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, args);
@ -854,9 +854,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// destroy a channel
case 3: {
if (g_channel != NULL) {
if (g_channel != nullptr) {
grpc_channel_destroy(g_channel);
g_channel = NULL;
g_channel = nullptr;
} else {
end(&inp);
}
@ -864,16 +864,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// bring up a server
case 4: {
if (g_server == NULL) {
if (g_server == nullptr) {
grpc_channel_args* args = read_args(&inp);
g_server = grpc_server_create(args, NULL);
GPR_ASSERT(g_server != NULL);
g_server = grpc_server_create(args, nullptr);
GPR_ASSERT(g_server != nullptr);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, args);
grpc_exec_ctx_finish(&exec_ctx);
}
grpc_server_register_completion_queue(g_server, cq, NULL);
grpc_server_register_completion_queue(g_server, cq, nullptr);
grpc_server_start(g_server);
server_shutdown = false;
GPR_ASSERT(pending_server_shutdowns == 0);
@ -884,7 +884,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// begin server shutdown
case 5: {
if (g_server != NULL) {
if (g_server != nullptr) {
grpc_server_shutdown_and_notify(
g_server, cq,
create_validator(assert_success_and_decrement,
@ -898,7 +898,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// cancel all calls if shutdown
case 6: {
if (g_server != NULL && server_shutdown) {
if (g_server != nullptr && server_shutdown) {
grpc_server_cancel_all_calls(g_server);
} else {
end(&inp);
@ -907,10 +907,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// destroy server
case 7: {
if (g_server != NULL && server_shutdown &&
if (g_server != nullptr && server_shutdown &&
pending_server_shutdowns == 0) {
grpc_server_destroy(g_server);
g_server = NULL;
g_server = nullptr;
} else {
end(&inp);
}
@ -918,7 +918,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// check connectivity
case 8: {
if (g_channel != NULL) {
if (g_channel != nullptr) {
uint8_t try_to_connect = next_byte(&inp);
if (try_to_connect == 0 || try_to_connect == 1) {
grpc_channel_check_connectivity_state(g_channel, try_to_connect);
@ -932,7 +932,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// watch connectivity
case 9: {
if (g_channel != NULL) {
if (g_channel != nullptr) {
grpc_connectivity_state st =
grpc_channel_check_connectivity_state(g_channel, 0);
if (st != GRPC_CHANNEL_SHUTDOWN) {
@ -954,10 +954,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// create a call
case 10: {
bool ok = true;
if (g_channel == NULL) ok = false;
grpc_call* parent_call = NULL;
if (g_channel == nullptr) ok = false;
grpc_call* parent_call = nullptr;
if (g_active_call->type != ROOT) {
if (g_active_call->call == NULL || g_active_call->type == CLIENT) {
if (g_active_call->call == nullptr || g_active_call->type == CLIENT) {
end(&inp);
break;
}
@ -977,7 +977,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
call_state* cs = new_call(g_active_call, CLIENT);
cs->call =
grpc_channel_create_call(g_channel, parent_call, propagation_mask,
cq, method, &host, deadline, NULL);
cq, method, &host, deadline, nullptr);
} else {
end(&inp);
}
@ -993,7 +993,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// queue some ops on a call
case 12: {
if (g_active_call->type == PENDING_SERVER ||
g_active_call->type == ROOT || g_active_call->call == NULL) {
g_active_call->type == ROOT || g_active_call->call == nullptr) {
end(&inp);
break;
}
@ -1026,7 +1026,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
break;
case GRPC_OP_SEND_MESSAGE:
op->op = GRPC_OP_SEND_MESSAGE;
if (g_active_call->send_message != NULL) {
if (g_active_call->send_message != nullptr) {
ok = false;
} else {
has_ops |= 1 << GRPC_OP_SEND_MESSAGE;
@ -1078,14 +1078,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
&g_active_call->cancelled;
break;
}
op->reserved = NULL;
op->reserved = nullptr;
op->flags = read_uint32(&inp);
}
if (ok) {
validator* v = make_finished_batch_validator(g_active_call, has_ops);
g_active_call->pending_ops++;
grpc_call_error error =
grpc_call_start_batch(g_active_call->call, ops, num_ops, v, NULL);
grpc_call_start_batch(g_active_call->call, ops, num_ops, v, nullptr);
if (error != GRPC_CALL_OK) {
v->validate(v->arg, false);
gpr_free(v);
@ -1095,7 +1095,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
if (!ok && (has_ops & (1 << GRPC_OP_SEND_MESSAGE))) {
grpc_byte_buffer_destroy(g_active_call->send_message);
g_active_call->send_message = NULL;
g_active_call->send_message = nullptr;
}
gpr_free(ops);
@ -1103,8 +1103,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// cancel current call
case 13: {
if (g_active_call->type != ROOT && g_active_call->call != NULL) {
grpc_call_cancel(g_active_call->call, NULL);
if (g_active_call->type != ROOT && g_active_call->call != nullptr) {
grpc_call_cancel(g_active_call->call, nullptr);
} else {
end(&inp);
}
@ -1112,7 +1112,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// get a calls peer
case 14: {
if (g_active_call->type != ROOT && g_active_call->call != NULL) {
if (g_active_call->type != ROOT && g_active_call->call != nullptr) {
free_non_null(grpc_call_get_peer(g_active_call->call));
} else {
end(&inp);
@ -1121,7 +1121,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// get a channels target
case 15: {
if (g_channel != NULL) {
if (g_channel != nullptr) {
free_non_null(grpc_channel_get_target(g_channel));
} else {
end(&inp);
@ -1130,10 +1130,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// send a ping on a channel
case 16: {
if (g_channel != NULL) {
if (g_channel != nullptr) {
pending_pings++;
grpc_channel_ping(g_channel, cq,
create_validator(decrement, &pending_pings), NULL);
create_validator(decrement, &pending_pings), nullptr);
} else {
end(&inp);
}
@ -1141,21 +1141,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// enable a tracer
case 17: {
char* tracer = read_string(&inp, NULL);
char* tracer = read_string(&inp, nullptr);
grpc_tracer_set_enabled(tracer, 1);
gpr_free(tracer);
break;
}
// disable a tracer
case 18: {
char* tracer = read_string(&inp, NULL);
char* tracer = read_string(&inp, nullptr);
grpc_tracer_set_enabled(tracer, 0);
gpr_free(tracer);
break;
}
// request a server call
case 19: {
if (g_server == NULL) {
if (g_server == nullptr) {
end(&inp);
break;
}
@ -1175,7 +1175,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
case 20: {
if (g_active_call->type != ROOT &&
g_active_call->type != PENDING_SERVER &&
g_active_call->call != NULL) {
g_active_call->call != nullptr) {
destroy_call(g_active_call);
} else {
end(&inp);
@ -1189,14 +1189,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
// create a secure channel
case 22: {
if (g_channel == NULL) {
char* target = read_string(&inp, NULL);
if (g_channel == nullptr) {
char* target = read_string(&inp, nullptr);
char* target_uri;
gpr_asprintf(&target_uri, "dns:%s", target);
grpc_channel_args* args = read_args(&inp);
grpc_channel_credentials* creds = read_channel_creds(&inp);
g_channel = grpc_secure_channel_create(creds, target_uri, args, NULL);
GPR_ASSERT(g_channel != NULL);
g_channel = grpc_secure_channel_create(creds, target_uri, args, nullptr);
GPR_ASSERT(g_channel != nullptr);
{
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_channel_args_destroy(&exec_ctx, args);
@ -1213,15 +1213,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
}
GPR_ASSERT(g_channel == NULL);
GPR_ASSERT(g_server == NULL);
GPR_ASSERT(g_channel == nullptr);
GPR_ASSERT(g_server == nullptr);
GPR_ASSERT(g_active_call->type == ROOT);
GPR_ASSERT(g_active_call->next == g_active_call);
gpr_free(g_active_call);
grpc_completion_queue_shutdown(cq);
GPR_ASSERT(
grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL)
grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr)
.type == GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cq);

@ -52,21 +52,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_mock_endpoint_create(discard_write, resource_quota);
grpc_resource_quota_unref_internal(&exec_ctx, resource_quota);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
grpc_transport* transport =
grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 1);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_create_chttp2_transport(&exec_ctx, nullptr, mock_endpoint, 1);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_channel* channel = grpc_channel_create(
&exec_ctx, "test-target", NULL, GRPC_CLIENT_DIRECT_CHANNEL, transport);
&exec_ctx, "test-target", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, transport);
grpc_slice host = grpc_slice_from_static_string("localhost");
grpc_call* call = grpc_channel_create_call(
channel, NULL, 0, cq, grpc_slice_from_static_string("/foo"), &host,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
channel, nullptr, 0, cq, grpc_slice_from_static_string("/foo"), &host,
gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array_init(&initial_metadata_recv);
grpc_byte_buffer* response_payload_recv = NULL;
grpc_byte_buffer* response_payload_recv = nullptr;
grpc_metadata_array trailing_metadata_recv;
grpc_metadata_array_init(&trailing_metadata_recv);
grpc_status_code status;
@ -78,31 +78,31 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &response_payload_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
grpc_call_error error =
grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), NULL);
grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), nullptr);
int requested_calls = 1;
GPR_ASSERT(GRPC_CALL_OK == error);
@ -113,7 +113,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_event ev;
while (1) {
grpc_exec_ctx_flush(&exec_ctx);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
switch (ev.type) {
case GRPC_QUEUE_TIMEOUT:
goto done;
@ -127,15 +127,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
done:
if (requested_calls) {
grpc_call_cancel(call, NULL);
grpc_call_cancel(call, nullptr);
}
for (int i = 0; i < requested_calls; i++) {
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
}
grpc_completion_queue_shutdown(cq);
for (int i = 0; i < requested_calls; i++) {
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
}
grpc_call_unref(call);
@ -144,7 +144,7 @@ done:
grpc_metadata_array_destroy(&trailing_metadata_recv);
grpc_slice_unref(details);
grpc_channel_destroy(channel);
if (response_payload_recv != NULL) {
if (response_payload_recv != nullptr) {
grpc_byte_buffer_destroy(response_payload_recv);
}
grpc_shutdown();

@ -53,19 +53,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
&exec_ctx, mock_endpoint,
grpc_slice_from_copied_buffer((const char*)data, size));
grpc_server* server = grpc_server_create(NULL, NULL);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL);
grpc_server_register_completion_queue(server, cq, NULL);
grpc_server* server = grpc_server_create(nullptr, nullptr);
grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr);
grpc_server_register_completion_queue(server, cq, nullptr);
// TODO(ctiller): add registered methods (one for POST, one for PUT)
// void *registered_method =
// grpc_server_register_method(server, "/reg", NULL, 0);
grpc_server_start(server);
grpc_transport* transport =
grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 0);
grpc_server_setup_transport(&exec_ctx, server, transport, NULL, NULL);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
grpc_create_chttp2_transport(&exec_ctx, nullptr, mock_endpoint, 0);
grpc_server_setup_transport(&exec_ctx, server, transport, nullptr, nullptr);
grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_call* call1 = NULL;
grpc_call* call1 = nullptr;
grpc_call_details call_details1;
grpc_metadata_array request_metadata1;
grpc_call_details_init(&call_details1);
@ -80,7 +80,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_event ev;
while (1) {
grpc_exec_ctx_flush(&exec_ctx);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
switch (ev.type) {
case GRPC_QUEUE_TIMEOUT:
goto done;
@ -97,18 +97,18 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
done:
if (call1 != NULL) grpc_call_unref(call1);
if (call1 != nullptr) grpc_call_unref(call1);
grpc_call_details_destroy(&call_details1);
grpc_metadata_array_destroy(&request_metadata1);
grpc_server_shutdown_and_notify(server, cq, tag(0xdead));
grpc_server_cancel_all_calls(server);
for (int i = 0; i <= requested_calls; i++) {
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
}
grpc_completion_queue_shutdown(cq);
for (int i = 0; i <= requested_calls; i++) {
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL);
ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr);
GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN);
}
grpc_server_destroy(server);

@ -106,19 +106,19 @@ static grpc_ares_request* my_dns_lookup_ares(
gpr_mu_unlock(&g_mu);
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure");
} else {
*lb_addrs = grpc_lb_addresses_create(1, NULL);
*lb_addrs = grpc_lb_addresses_create(1, nullptr);
struct sockaddr_in* sa = static_cast<struct sockaddr_in*>(
gpr_zalloc(sizeof(struct sockaddr_in)));
sa->sin_family = AF_INET;
sa->sin_addr.s_addr = htonl(0x7f000001);
sa->sin_port = htons((uint16_t)g_resolve_port);
grpc_lb_addresses_set_address(*lb_addrs, 0, sa, sizeof(*sa), false, NULL,
NULL);
grpc_lb_addresses_set_address(*lb_addrs, 0, sa, sizeof(*sa), false, nullptr,
nullptr);
gpr_free(sa);
gpr_mu_unlock(&g_mu);
}
GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
return NULL;
return nullptr;
}
int main(int argc, char** argv) {
@ -157,7 +157,7 @@ int main(int argc, char** argv) {
grpc_metadata_array_init(&request_metadata2);
grpc_call_details_init(&request_details2);
cq = grpc_completion_queue_create_for_next(NULL);
cq = grpc_completion_queue_create_for_next(nullptr);
cqv = cq_verifier_create(cq);
/* reserve two ports */
@ -176,24 +176,24 @@ int main(int argc, char** argv) {
client_args.num_args = 1;
/* create a channel that picks first amongst the servers */
grpc_channel* chan = grpc_insecure_channel_create("test", &client_args, NULL);
grpc_channel* chan = grpc_insecure_channel_create("test", &client_args, nullptr);
/* and an initial call to them */
grpc_slice host = grpc_slice_from_static_string("127.0.0.1");
grpc_call* call1 =
grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_slice_from_static_string("/foo"), &host,
grpc_timeout_seconds_to_deadline(20), NULL);
grpc_timeout_seconds_to_deadline(20), nullptr);
/* send initial metadata to probe connectivity */
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call1, ops,
(size_t)(op - ops),
tag(0x101), NULL));
tag(0x101), nullptr));
/* and receive status to probe termination */
memset(ops, 0, sizeof(ops));
op = ops;
@ -202,17 +202,17 @@ int main(int argc, char** argv) {
op->data.recv_status_on_client.status = &status1;
op->data.recv_status_on_client.status_details = &details1;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call1, ops,
(size_t)(op - ops),
tag(0x102), NULL));
tag(0x102), nullptr));
/* bring a server up on the first port */
grpc_server* server1 = grpc_server_create(NULL, NULL);
grpc_server* server1 = grpc_server_create(nullptr, nullptr);
gpr_asprintf(&addr, "127.0.0.1:%d", port1);
grpc_server_add_insecure_http2_port(server1, addr);
grpc_server_register_completion_queue(server1, cq, NULL);
grpc_server_register_completion_queue(server1, cq, nullptr);
gpr_free(addr);
grpc_server_start(server1);
@ -244,7 +244,7 @@ int main(int argc, char** argv) {
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(server_call1, ops,
(size_t)(op - ops),
tag(0x302), NULL));
tag(0x302), nullptr));
/* shutdown first server:
* we should see a connectivity change and then nothing */
@ -256,20 +256,20 @@ int main(int argc, char** argv) {
/* and a new call: should go through to server2 when we start it */
grpc_call* call2 =
grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_slice_from_static_string("/foo"), &host,
grpc_timeout_seconds_to_deadline(20), NULL);
grpc_timeout_seconds_to_deadline(20), nullptr);
/* send initial metadata to probe connectivity */
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call2, ops,
(size_t)(op - ops),
tag(0x201), NULL));
tag(0x201), nullptr));
/* and receive status to probe termination */
memset(ops, 0, sizeof(ops));
op = ops;
@ -278,18 +278,18 @@ int main(int argc, char** argv) {
op->data.recv_status_on_client.status = &status2;
op->data.recv_status_on_client.status_details = &details2;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call2, ops,
(size_t)(op - ops),
tag(0x202), NULL));
tag(0x202), nullptr));
/* and bring up second server */
set_resolve_port(port2);
grpc_server* server2 = grpc_server_create(NULL, NULL);
grpc_server* server2 = grpc_server_create(nullptr, nullptr);
gpr_asprintf(&addr, "127.0.0.1:%d", port2);
grpc_server_add_insecure_http2_port(server2, addr);
grpc_server_register_completion_queue(server2, cq, NULL);
grpc_server_register_completion_queue(server2, cq, nullptr);
gpr_free(addr);
grpc_server_start(server2);
@ -313,14 +313,14 @@ int main(int argc, char** argv) {
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(server_call2, ops,
(size_t)(op - ops),
tag(0x402), NULL));
tag(0x402), nullptr));
/* shutdown second server: we should see nothing */
grpc_server_shutdown_and_notify(server2, cq, tag(0xdead2));
cq_verify_empty(cqv);
grpc_call_cancel(call1, NULL);
grpc_call_cancel(call2, NULL);
grpc_call_cancel(call1, nullptr);
grpc_call_cancel(call2, nullptr);
/* now everything else should finish */
CQ_EXPECT_COMPLETION(cqv, tag(0x102), 1);

@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack(
gpr_join_host_port(&ffd->localaddr, "localhost", port);
f.fixture_data = ffd;
f.cq = grpc_completion_queue_create_for_next(NULL);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
f.cq = grpc_completion_queue_create_for_next(nullptr);
f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
return f;
}
@ -66,8 +66,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx,
const grpc_metadata* md, size_t md_count,
grpc_process_auth_metadata_done_cb cb,
void* user_data) {
GPR_ASSERT(state == NULL);
cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL);
GPR_ASSERT(state == nullptr);
cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr);
}
static void chttp2_init_client_secure_fullstack(
@ -76,8 +76,8 @@ static void chttp2_init_client_secure_fullstack(
fullstack_secure_fixture_data* ffd =
static_cast<fullstack_secure_fixture_data*>(f->fixture_data);
f->client =
grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL);
GPR_ASSERT(f->client != NULL);
grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr);
GPR_ASSERT(f->client != nullptr);
grpc_channel_credentials_release(creds);
}
@ -89,8 +89,8 @@ static void chttp2_init_server_secure_fullstack(
if (f->server) {
grpc_server_destroy(f->server);
}
f->server = grpc_server_create(server_args, NULL);
grpc_server_register_completion_queue(f->server, f->cq, NULL);
f->server = grpc_server_create(server_args, nullptr);
grpc_server_register_completion_queue(f->server, f->cq, nullptr);
GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr,
server_creds));
grpc_server_credentials_release(server_creds);
@ -106,7 +106,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) {
static int fail_server_auth_check(grpc_channel_args* server_args) {
size_t i;
if (server_args == NULL) return 0;
if (server_args == nullptr) return 0;
for (i = 0; i < server_args->num_args; i++) {
if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) ==
0) {
@ -267,7 +267,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); }
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_time(), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -276,16 +276,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) {
grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
f->server = nullptr;
}
static void shutdown_client(grpc_end2end_test_fixture* f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
f->client = nullptr;
}
static void end_test(grpc_end2end_test_fixture* f) {
@ -308,9 +308,9 @@ static void simple_request_body(grpc_end2end_test_fixture f,
grpc_call_error error;
grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr:1234");
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"), &host,
deadline, NULL);
deadline, nullptr);
GPR_ASSERT(c);
memset(ops, 0, sizeof(ops));
@ -318,9 +318,9 @@ static void simple_request_body(grpc_end2end_test_fixture f,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(1), expected_result == SUCCESS);
@ -367,8 +367,8 @@ int main(int argc, char** argv) {
/* Set the SSL roots env var. */
roots_file =
gpr_tmpfile("chttp2_simple_ssl_cert_fullstack_test", &roots_filename);
GPR_ASSERT(roots_filename != NULL);
GPR_ASSERT(roots_file != NULL);
GPR_ASSERT(roots_filename != nullptr);
GPR_ASSERT(roots_file != nullptr);
GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size);
fclose(roots_file);
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename);

@ -60,7 +60,7 @@ static void prepare_test(int is_client) {
grpc_metadata_array_init(&g_state.initial_metadata_recv);
grpc_metadata_array_init(&g_state.trailing_metadata_recv);
g_state.deadline = grpc_timeout_seconds_to_deadline(5);
g_state.cq = grpc_completion_queue_create_for_next(NULL);
g_state.cq = grpc_completion_queue_create_for_next(nullptr);
g_state.cqv = cq_verifier_create(g_state.cq);
g_state.details = grpc_empty_slice();
memset(g_state.ops, 0, sizeof(g_state.ops));
@ -68,36 +68,36 @@ static void prepare_test(int is_client) {
if (is_client) {
/* create a call, channel to a non existant server */
g_state.chan =
grpc_insecure_channel_create("nonexistant:54321", NULL, NULL);
grpc_insecure_channel_create("nonexistant:54321", nullptr, nullptr);
grpc_slice host = grpc_slice_from_static_string("nonexistant");
g_state.call = grpc_channel_create_call(
g_state.chan, NULL, GRPC_PROPAGATE_DEFAULTS, g_state.cq,
grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, NULL);
g_state.chan, nullptr, GRPC_PROPAGATE_DEFAULTS, g_state.cq,
grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, nullptr);
} else {
g_state.server = grpc_server_create(NULL, NULL);
grpc_server_register_completion_queue(g_state.server, g_state.cq, NULL);
g_state.server = grpc_server_create(nullptr, nullptr);
grpc_server_register_completion_queue(g_state.server, g_state.cq, nullptr);
gpr_join_host_port(&server_hostport, "0.0.0.0", port);
grpc_server_add_insecure_http2_port(g_state.server, server_hostport);
grpc_server_start(g_state.server);
gpr_free(server_hostport);
gpr_join_host_port(&server_hostport, "localhost", port);
g_state.chan = grpc_insecure_channel_create(server_hostport, NULL, NULL);
g_state.chan = grpc_insecure_channel_create(server_hostport, nullptr, nullptr);
gpr_free(server_hostport);
grpc_slice host = grpc_slice_from_static_string("bar");
g_state.call = grpc_channel_create_call(
g_state.chan, NULL, GRPC_PROPAGATE_DEFAULTS, g_state.cq,
grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, NULL);
g_state.chan, nullptr, GRPC_PROPAGATE_DEFAULTS, g_state.cq,
grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, nullptr);
grpc_metadata_array_init(&g_state.server_initial_metadata_recv);
grpc_call_details_init(&g_state.call_details);
op = g_state.ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops),
tag(1), NULL));
tag(1), nullptr));
GPR_ASSERT(GRPC_CALL_OK ==
grpc_server_request_call(g_state.server, &g_state.server_call,
&g_state.call_details,
@ -119,12 +119,12 @@ static void cleanup_test() {
grpc_metadata_array_destroy(&g_state.trailing_metadata_recv);
if (!g_state.is_client) {
shutdown_cq = grpc_completion_queue_create_for_pluck(NULL);
shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr);
grpc_call_unref(g_state.server_call);
grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
nullptr)
.type == GRPC_OP_COMPLETE);
grpc_completion_queue_destroy(shutdown_cq);
grpc_server_destroy(g_state.server);
@ -133,7 +133,7 @@ static void cleanup_test() {
}
grpc_completion_queue_shutdown(g_state.cq);
while (grpc_completion_queue_next(g_state.cq,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL)
gpr_inf_future(GPR_CLOCK_REALTIME), nullptr)
.type != GRPC_QUEUE_SHUTDOWN)
;
grpc_completion_queue_destroy(g_state.cq);
@ -144,7 +144,7 @@ static void test_non_null_reserved_on_start_batch() {
prepare_test(1);
GPR_ASSERT(GRPC_CALL_ERROR ==
grpc_call_start_batch(g_state.call, NULL, 0, NULL, tag(1)));
grpc_call_start_batch(g_state.call, nullptr, 0, nullptr, tag(1)));
cleanup_test();
}
@ -162,7 +162,7 @@ static void test_non_null_reserved_on_op() {
op++;
GPR_ASSERT(GRPC_CALL_ERROR ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -176,11 +176,11 @@ static void test_send_initial_metadata_more_than_once() {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops),
tag(1), NULL));
tag(1), nullptr));
CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 0);
cq_verify(g_state.cqv);
@ -188,11 +188,11 @@ static void test_send_initial_metadata_more_than_once() {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -206,11 +206,11 @@ static void test_too_many_metadata() {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = (size_t)INT_MAX + 1;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -224,16 +224,16 @@ static void test_send_null_message() {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = NULL;
op->data.send_message.send_message = nullptr;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_INVALID_MESSAGE ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -250,21 +250,21 @@ static void test_send_messages_at_the_same_time() {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = request_payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = static_cast<grpc_byte_buffer*>(tag(2));
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
grpc_byte_buffer_destroy(request_payload);
cleanup_test();
}
@ -282,11 +282,11 @@ static void test_send_server_status_from_client() {
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -300,11 +300,11 @@ static void test_receive_initial_metadata_twice_at_client() {
op->data.recv_initial_metadata.recv_initial_metadata =
&g_state.initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops),
tag(1), NULL));
tag(1), nullptr));
CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 0);
cq_verify(g_state.cqv);
op = g_state.ops;
@ -312,11 +312,11 @@ static void test_receive_initial_metadata_twice_at_client() {
op->data.recv_initial_metadata.recv_initial_metadata =
&g_state.initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -324,17 +324,17 @@ static void test_receive_message_with_invalid_flags() {
gpr_log(GPR_INFO, "test_receive_message_with_invalid_flags");
grpc_op* op;
grpc_byte_buffer* payload = NULL;
grpc_byte_buffer* payload = nullptr;
prepare_test(1);
op = g_state.ops;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &payload;
op->flags = 1;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -342,22 +342,22 @@ static void test_receive_two_messages_at_the_same_time() {
gpr_log(GPR_INFO, "test_receive_two_messages_at_the_same_time");
grpc_op* op;
grpc_byte_buffer* payload = NULL;
grpc_byte_buffer* payload = nullptr;
prepare_test(1);
op = g_state.ops;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -369,13 +369,13 @@ static void test_recv_close_on_server_from_client() {
op = g_state.ops;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = NULL;
op->data.recv_close_on_server.cancelled = nullptr;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -392,25 +392,25 @@ static void test_recv_status_on_client_twice() {
op->data.recv_status_on_client.status = &g_state.status;
op->data.recv_status_on_client.status_details = &g_state.details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops),
tag(1), NULL));
tag(1), nullptr));
CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 1);
cq_verify(g_state.cqv);
op = g_state.ops;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = NULL;
op->data.recv_status_on_client.status = NULL;
op->data.recv_status_on_client.status_details = NULL;
op->data.recv_status_on_client.trailing_metadata = nullptr;
op->data.recv_status_on_client.status = nullptr;
op->data.recv_status_on_client.status_details = nullptr;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}
@ -423,11 +423,11 @@ static void test_send_close_from_client_on_server() {
op = g_state.ops;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER ==
grpc_call_start_batch(g_state.server_call, g_state.ops,
(size_t)(op - g_state.ops), tag(2), NULL));
(size_t)(op - g_state.ops), tag(2), nullptr));
cleanup_test();
}
@ -444,11 +444,11 @@ static void test_recv_status_on_client_from_server() {
op->data.recv_status_on_client.status = &g_state.status;
op->data.recv_status_on_client.status_details = &g_state.details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER ==
grpc_call_start_batch(g_state.server_call, g_state.ops,
(size_t)(op - g_state.ops), tag(2), NULL));
(size_t)(op - g_state.ops), tag(2), nullptr));
cleanup_test();
}
@ -465,11 +465,11 @@ static void test_send_status_from_server_with_invalid_flags() {
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 1;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS ==
grpc_call_start_batch(g_state.server_call, g_state.ops,
(size_t)(op - g_state.ops), tag(2), NULL));
(size_t)(op - g_state.ops), tag(2), nullptr));
cleanup_test();
}
@ -487,11 +487,11 @@ static void test_too_many_trailing_metadata() {
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA ==
grpc_call_start_batch(g_state.server_call, g_state.ops,
(size_t)(op - g_state.ops), tag(2), NULL));
(size_t)(op - g_state.ops), tag(2), nullptr));
cleanup_test();
}
@ -508,18 +508,18 @@ static void test_send_server_status_twice() {
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED;
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS ==
grpc_call_start_batch(g_state.server_call, g_state.ops,
(size_t)(op - g_state.ops), tag(2), NULL));
(size_t)(op - g_state.ops), tag(2), nullptr));
cleanup_test();
}
@ -531,13 +531,13 @@ static void test_recv_close_on_server_with_invalid_flags() {
op = g_state.ops;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = NULL;
op->data.recv_close_on_server.cancelled = nullptr;
op->flags = 1;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS ==
grpc_call_start_batch(g_state.server_call, g_state.ops,
(size_t)(op - g_state.ops), tag(2), NULL));
(size_t)(op - g_state.ops), tag(2), nullptr));
cleanup_test();
}
@ -549,18 +549,18 @@ static void test_recv_close_on_server_twice() {
op = g_state.ops;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = NULL;
op->data.recv_close_on_server.cancelled = nullptr;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = NULL;
op->data.recv_close_on_server.cancelled = nullptr;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS ==
grpc_call_start_batch(g_state.server_call, g_state.ops,
(size_t)(op - g_state.ops), tag(2), NULL));
(size_t)(op - g_state.ops), tag(2), nullptr));
cleanup_test();
}
@ -578,11 +578,11 @@ static void test_invalid_initial_metadata_reserved_key() {
op->data.send_initial_metadata.count = 1;
op->data.send_initial_metadata.metadata = &metadata;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA ==
grpc_call_start_batch(g_state.call, g_state.ops,
(size_t)(op - g_state.ops), tag(1), NULL));
(size_t)(op - g_state.ops), tag(1), nullptr));
cleanup_test();
}

@ -34,33 +34,33 @@ int main(int argc, char** argv) {
attr.cq_completion_type = GRPC_CQ_NEXT;
attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING;
cq1 = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
grpc_completion_queue_factory_lookup(&attr), &attr, nullptr);
attr.cq_polling_type = GRPC_CQ_NON_LISTENING;
cq2 = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
grpc_completion_queue_factory_lookup(&attr), &attr, nullptr);
attr.cq_polling_type = GRPC_CQ_NON_POLLING;
cq3 = grpc_completion_queue_create(
grpc_completion_queue_factory_lookup(&attr), &attr, NULL);
grpc_completion_queue_factory_lookup(&attr), &attr, nullptr);
server = grpc_server_create(NULL, NULL);
grpc_server_register_completion_queue(server, cq1, NULL);
server = grpc_server_create(nullptr, nullptr);
grpc_server_register_completion_queue(server, cq1, nullptr);
grpc_server_add_insecure_http2_port(server, "[::]:0");
grpc_server_register_completion_queue(server, cq2, NULL);
grpc_server_register_completion_queue(server, cq3, NULL);
grpc_server_register_completion_queue(server, cq2, nullptr);
grpc_server_register_completion_queue(server, cq3, nullptr);
grpc_server_start(server);
grpc_server_shutdown_and_notify(server, cq2, NULL);
grpc_server_shutdown_and_notify(server, cq2, nullptr);
grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME),
NULL); /* cue queue hang */
nullptr); /* cue queue hang */
grpc_completion_queue_shutdown(cq1);
grpc_completion_queue_shutdown(cq2);
grpc_completion_queue_shutdown(cq3);
grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_completion_queue_next(cq3, gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
grpc_completion_queue_next(cq3, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr);
grpc_server_destroy(server);
grpc_completion_queue_destroy(cq1);

@ -44,32 +44,32 @@ int main(int argc, char** argv) {
grpc_metadata_array_init(&trailing_metadata_recv);
cq = grpc_completion_queue_create_for_next(NULL);
cq = grpc_completion_queue_create_for_next(nullptr);
cqv = cq_verifier_create(cq);
/* create a call, channel to a non existant server */
chan = grpc_insecure_channel_create("nonexistant:54321", NULL, NULL);
chan = grpc_insecure_channel_create("nonexistant:54321", nullptr, nullptr);
grpc_slice host = grpc_slice_from_static_string("nonexistant");
call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq,
call = grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq,
grpc_slice_from_static_string("/Foo"), &host,
deadline, NULL);
deadline, nullptr);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(
call, ops, (size_t)(op - ops), tag(1), NULL));
call, ops, (size_t)(op - ops), tag(1), nullptr));
/* verify that all tags get completed */
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
cq_verify(cqv);
@ -78,7 +78,7 @@ int main(int argc, char** argv) {
grpc_completion_queue_shutdown(cq);
while (
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL)
grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr)
.type != GRPC_QUEUE_SHUTDOWN)
;
grpc_completion_queue_destroy(cq);

@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) {
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) {
grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
f->server = nullptr;
}
static void shutdown_client(grpc_end2end_test_fixture* f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
f->client = nullptr;
}
static void end_test(grpc_end2end_test_fixture* f) {
@ -94,28 +94,28 @@ static void test_with_authority_header(grpc_end2end_test_config config) {
grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
{{NULL, NULL, NULL, NULL}}},
{{nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key2"),
grpc_slice_from_static_string("val2"),
0,
{{NULL, NULL, NULL, NULL}}}};
{{nullptr, nullptr, nullptr, nullptr}}}};
grpc_end2end_test_fixture f =
begin_test(config, "test_with_authority_header", NULL, NULL);
begin_test(config, "test_with_authority_header", nullptr, nullptr);
cq_verifier* cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op* op;
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
grpc_byte_buffer* response_payload_recv = NULL;
grpc_byte_buffer* response_payload_recv = nullptr;
grpc_status_code status;
grpc_call_error error;
grpc_slice details;
grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr");
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"), &host,
deadline, NULL);
deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@ -127,35 +127,35 @@ static void test_with_authority_header(grpc_end2end_test_config config) {
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_c;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = request_payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &response_payload_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);

@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) {
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) {
grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
f->server = nullptr;
}
static void shutdown_client(grpc_end2end_test_fixture* f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
f->client = nullptr;
}
static void end_test(grpc_end2end_test_fixture* f) {
@ -101,9 +101,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
grpc_slice host = grpc_slice_from_static_string("slartibartfast.local");
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"), &host,
deadline, NULL);
deadline, nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@ -116,25 +116,25 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
@ -156,7 +156,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) {
static void test_invoke_simple_request(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f;
f = begin_test(config, "test_invoke_simple_request", NULL, NULL);
f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr);
simple_request_body(f);
end_test(&f);
config.tear_down_data(&f);

@ -37,20 +37,20 @@ static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5),
NULL);
nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
static void shutdown_server(grpc_end2end_test_fixture* f) {
if (!f->server) return;
grpc_server_destroy(f->server);
f->server = NULL;
f->server = nullptr;
}
static void shutdown_client(grpc_end2end_test_fixture* f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
f->client = nullptr;
}
static void end_test(grpc_end2end_test_fixture* f) {
@ -64,7 +64,7 @@ static void end_test(grpc_end2end_test_fixture* f) {
}
static void test_bad_ping(grpc_end2end_test_config config) {
grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL);
grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr);
cq_verifier* cqv = cq_verifier_create(f.cq);
grpc_arg client_a[3];
client_a[0].type = GRPC_ARG_INTEGER;
@ -109,10 +109,10 @@ static void test_bad_ping(grpc_end2end_test_config config) {
int was_cancelled = 2;
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
get_host_override_slice("foo.test.google.fr:1234", config), deadline,
NULL);
nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@ -124,27 +124,27 @@ static void test_bad_ping(grpc_end2end_test_config config) {
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->data.send_initial_metadata.metadata = NULL;
op->data.send_initial_metadata.metadata = nullptr;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
error =
@ -160,7 +160,7 @@ static void test_bad_ping(grpc_end2end_test_config config) {
// needed here.
int i;
for (i = 1; i <= MAX_PING_STRIKES + 1; i++) {
grpc_channel_ping(f.client, f.cq, tag(200 + i), NULL);
grpc_channel_ping(f.client, f.cq, tag(200 + i), nullptr);
CQ_EXPECT_COMPLETION(cqv, tag(200 + i), 1);
if (i == MAX_PING_STRIKES + 1) {
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
@ -173,7 +173,7 @@ static void test_bad_ping(grpc_end2end_test_config config) {
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
@ -181,14 +181,14 @@ static void test_bad_ping(grpc_end2end_test_config config) {
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(102), 1);

@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) {
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) {
grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
f->server = nullptr;
}
static void shutdown_client(grpc_end2end_test_fixture* f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
f->client = nullptr;
}
static void end_test(grpc_end2end_test_fixture* f) {
@ -102,33 +102,33 @@ static void test_request_response_with_metadata_and_payload(
grpc_slice_from_static_string(
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc"),
0,
{{NULL, NULL, NULL, NULL}}},
{{nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key2-bin"),
grpc_slice_from_static_string(
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d"),
0,
{{NULL, NULL, NULL, NULL}}}};
{{nullptr, nullptr, nullptr, nullptr}}}};
grpc_metadata meta_s[2] = {
{grpc_slice_from_static_string("key3-bin"),
grpc_slice_from_static_string(
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee"),
0,
{{NULL, NULL, NULL, NULL}}},
{{nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key4-bin"),
grpc_slice_from_static_string(
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"),
0,
{{NULL, NULL, NULL, NULL}}}};
{{nullptr, nullptr, nullptr, nullptr}}}};
grpc_end2end_test_fixture f = begin_test(
config, "test_request_response_with_metadata_and_payload", NULL, NULL);
config, "test_request_response_with_metadata_and_payload", nullptr, nullptr);
cq_verifier* cqv = cq_verifier_create(f.cq);
grpc_op ops[6];
grpc_op* op;
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
grpc_metadata_array request_metadata_recv;
grpc_byte_buffer* request_payload_recv = NULL;
grpc_byte_buffer* response_payload_recv = NULL;
grpc_byte_buffer* request_payload_recv = nullptr;
grpc_byte_buffer* response_payload_recv = nullptr;
grpc_call_details call_details;
grpc_status_code status;
grpc_call_error error;
@ -137,10 +137,10 @@ static void test_request_response_with_metadata_and_payload(
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
get_host_override_slice("foo.test.google.fr:1234", config), deadline,
NULL);
nullptr);
GPR_ASSERT(c);
grpc_metadata_array_init(&initial_metadata_recv);
@ -154,35 +154,35 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_c;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = request_payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &response_payload_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
error =
@ -198,14 +198,14 @@ static void test_request_response_with_metadata_and_payload(
op->data.send_initial_metadata.count = 2;
op->data.send_initial_metadata.metadata = meta_s;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &request_payload_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
@ -216,12 +216,12 @@ static void test_request_response_with_metadata_and_payload(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = response_payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
@ -244,9 +244,9 @@ static void test_request_response_with_metadata_and_payload(
"\xfd\xfe\xff");
op->data.send_status_from_server.status_details = &status_string;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(103), 1);

@ -45,19 +45,19 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config,
int fail_server_auth_check) {
grpc_end2end_test_fixture f;
gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name);
f = config.create_fixture(NULL, NULL);
config.init_client(&f, NULL);
f = config.create_fixture(nullptr, nullptr);
config.init_client(&f, nullptr);
if (fail_server_auth_check) {
grpc_arg fail_auth_arg = {
GRPC_ARG_STRING,
const_cast<char*>(FAIL_AUTH_CHECK_SERVER_ARG_NAME),
{NULL}};
{nullptr}};
grpc_channel_args args;
args.num_args = 1;
args.args = &fail_auth_arg;
config.init_server(&f, &args);
} else {
config.init_server(&f, NULL);
config.init_server(&f, nullptr);
}
return f;
}
@ -73,7 +73,7 @@ static gpr_timespec five_seconds_from_now(void) {
static void drain_cq(grpc_completion_queue* cq) {
grpc_event ev;
do {
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL);
ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr);
} while (ev.type != GRPC_QUEUE_SHUTDOWN);
}
@ -82,16 +82,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) {
grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000));
GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000),
grpc_timeout_seconds_to_deadline(5),
NULL)
nullptr)
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(f->server);
f->server = NULL;
f->server = nullptr;
}
static void shutdown_client(grpc_end2end_test_fixture* f) {
if (!f->client) return;
grpc_channel_destroy(f->client);
f->client = NULL;
f->client = nullptr;
}
static void end_test(grpc_end2end_test_fixture* f) {
@ -111,12 +111,12 @@ static void print_auth_context(int is_client, const grpc_auth_context* ctx) {
gpr_log(GPR_INFO, "\tauthenticated: %s",
grpc_auth_context_peer_is_authenticated(ctx) ? "YES" : "NO");
it = grpc_auth_context_peer_identity(ctx);
while ((p = grpc_auth_property_iterator_next(&it)) != NULL) {
while ((p = grpc_auth_property_iterator_next(&it)) != nullptr) {
gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value);
}
gpr_log(GPR_INFO, "\tall properties:");
it = grpc_auth_context_property_iterator(ctx);
while ((p = grpc_auth_property_iterator_next(&it)) != NULL) {
while ((p = grpc_auth_property_iterator_next(&it)) != nullptr) {
gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value);
}
}
@ -141,29 +141,29 @@ static void request_response_with_payload_and_call_creds(
grpc_metadata_array initial_metadata_recv;
grpc_metadata_array trailing_metadata_recv;
grpc_metadata_array request_metadata_recv;
grpc_byte_buffer* request_payload_recv = NULL;
grpc_byte_buffer* response_payload_recv = NULL;
grpc_byte_buffer* request_payload_recv = nullptr;
grpc_byte_buffer* response_payload_recv = nullptr;
grpc_call_details call_details;
grpc_status_code status;
grpc_call_error error;
grpc_slice details;
int was_cancelled = 2;
grpc_call_credentials* creds = NULL;
grpc_auth_context* s_auth_context = NULL;
grpc_auth_context* c_auth_context = NULL;
grpc_call_credentials* creds = nullptr;
grpc_auth_context* s_auth_context = nullptr;
grpc_auth_context* c_auth_context = nullptr;
f = begin_test(config, test_name, 0);
cqv = cq_verifier_create(f.cq);
gpr_timespec deadline = five_seconds_from_now();
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
get_host_override_slice("foo.test.google.fr:1234", config), deadline,
NULL);
nullptr);
GPR_ASSERT(c);
creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL);
GPR_ASSERT(creds != NULL);
creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr);
GPR_ASSERT(creds != nullptr);
GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK);
switch (mode) {
case NONE:
@ -171,12 +171,12 @@ static void request_response_with_payload_and_call_creds(
case OVERRIDE:
grpc_call_credentials_release(creds);
creds = grpc_google_iam_credentials_create(overridden_iam_token,
overridden_iam_selector, NULL);
GPR_ASSERT(creds != NULL);
overridden_iam_selector, nullptr);
GPR_ASSERT(creds != nullptr);
GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK);
break;
case DESTROY:
GPR_ASSERT(grpc_call_set_credentials(c, NULL) == GRPC_CALL_OK);
GPR_ASSERT(grpc_call_set_credentials(c, nullptr) == GRPC_CALL_OK);
break;
}
grpc_call_credentials_release(creds);
@ -191,35 +191,35 @@ static void request_response_with_payload_and_call_creds(
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = request_payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &response_payload_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv;
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
error =
@ -229,31 +229,31 @@ static void request_response_with_payload_and_call_creds(
CQ_EXPECT_COMPLETION(cqv, tag(101), 1);
cq_verify(cqv);
s_auth_context = grpc_call_auth_context(s);
GPR_ASSERT(s_auth_context != NULL);
GPR_ASSERT(s_auth_context != nullptr);
print_auth_context(0, s_auth_context);
grpc_auth_context_release(s_auth_context);
c_auth_context = grpc_call_auth_context(c);
GPR_ASSERT(c_auth_context != NULL);
GPR_ASSERT(c_auth_context != nullptr);
print_auth_context(1, c_auth_context);
grpc_auth_context_release(c_auth_context);
/* Cannot set creds on the server call object. */
GPR_ASSERT(grpc_call_set_credentials(s, NULL) != GRPC_CALL_OK);
GPR_ASSERT(grpc_call_set_credentials(s, nullptr) != GRPC_CALL_OK);
memset(ops, 0, sizeof(ops));
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &request_payload_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL);
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(102), 1);
@ -264,12 +264,12 @@ static void request_response_with_payload_and_call_creds(
op->op = GRPC_OP_RECV_CLOSE_ON_SERVER;
op->data.recv_close_on_server.cancelled = &was_cancelled;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = response_payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op->data.send_status_from_server.trailing_metadata_count = 0;
@ -277,9 +277,9 @@ static void request_response_with_payload_and_call_creds(
grpc_slice status_details = grpc_slice_from_static_string("xyz");
op->data.send_status_from_server.status_details = &status_details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL);
error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr);
GPR_ASSERT(GRPC_CALL_OK == error);
CQ_EXPECT_COMPLETION(cqv, tag(103), 1);
@ -383,7 +383,7 @@ static void test_request_with_server_rejecting_client_creds(
grpc_status_code status;
grpc_call_error error;
grpc_slice details;
grpc_byte_buffer* response_payload_recv = NULL;
grpc_byte_buffer* response_payload_recv = nullptr;
grpc_slice request_payload_slice =
grpc_slice_from_copied_string("hello world");
grpc_byte_buffer* request_payload =
@ -394,14 +394,14 @@ static void test_request_with_server_rejecting_client_creds(
cqv = cq_verifier_create(f.cq);
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq,
f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq,
grpc_slice_from_static_string("/foo"),
get_host_override_slice("foo.test.google.fr:1234", config), deadline,
NULL);
nullptr);
GPR_ASSERT(c);
creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL);
GPR_ASSERT(creds != NULL);
creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr);
GPR_ASSERT(creds != nullptr);
GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK);
grpc_call_credentials_release(creds);
@ -417,33 +417,33 @@ static void test_request_with_server_rejecting_client_creds(
op->data.recv_status_on_client.status = &status;
op->data.recv_status_on_client.status_details = &details;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = request_payload;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &response_payload_recv;
op->flags = 0;
op->reserved = NULL;
op->reserved = nullptr;
op++;
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL);
error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr);
GPR_ASSERT(error == GRPC_CALL_OK);
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);

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

Loading…
Cancel
Save