diff options
Diffstat (limited to 'test/core')
-rw-r--r-- | test/core/backoff/backoff_test.cc (renamed from test/core/backoff/backoff_test.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/bad_client.cc (renamed from test/core/bad_client/bad_client.c) | 0 | ||||
-rwxr-xr-x | test/core/bad_client/gen_build_yaml.py | 4 | ||||
-rwxr-xr-x | test/core/bad_client/generate_tests.bzl | 4 | ||||
-rw-r--r-- | test/core/bad_client/tests/badreq.cc (renamed from test/core/bad_client/tests/badreq.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/connection_prefix.cc (renamed from test/core/bad_client/tests/connection_prefix.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/head_of_line_blocking.cc (renamed from test/core/bad_client/tests/head_of_line_blocking.c) | 2 | ||||
-rw-r--r-- | test/core/bad_client/tests/headers.cc (renamed from test/core/bad_client/tests/headers.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/initial_settings_frame.cc (renamed from test/core/bad_client/tests/initial_settings_frame.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/large_metadata.cc (renamed from test/core/bad_client/tests/large_metadata.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/server_registered_method.cc (renamed from test/core/bad_client/tests/server_registered_method.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/simple_request.cc (renamed from test/core/bad_client/tests/simple_request.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/unknown_frame.cc (renamed from test/core/bad_client/tests/unknown_frame.c) | 0 | ||||
-rw-r--r-- | test/core/bad_client/tests/window_overflow.cc (renamed from test/core/bad_client/tests/window_overflow.c) | 2 | ||||
-rw-r--r-- | test/core/bad_ssl/bad_ssl_test.cc (renamed from test/core/bad_ssl/bad_ssl_test.c) | 9 | ||||
-rwxr-xr-x | test/core/bad_ssl/gen_build_yaml.py | 6 | ||||
-rwxr-xr-x | test/core/bad_ssl/generate_tests.bzl | 4 | ||||
-rw-r--r-- | test/core/bad_ssl/server_common.cc (renamed from test/core/bad_ssl/server_common.c) | 2 | ||||
-rw-r--r-- | test/core/bad_ssl/servers/alpn.cc (renamed from test/core/bad_ssl/servers/alpn.c) | 0 | ||||
-rw-r--r-- | test/core/bad_ssl/servers/cert.cc (renamed from test/core/bad_ssl/servers/cert.c) | 0 | ||||
-rw-r--r-- | test/core/census/context_test.cc (renamed from test/core/census/context_test.c) | 0 | ||||
-rw-r--r-- | test/core/census/intrusive_hash_map_test.cc (renamed from test/core/census/intrusive_hash_map_test.c) | 0 | ||||
-rw-r--r-- | test/core/census/mlog_test.cc (renamed from test/core/census/mlog_test.c) | 0 | ||||
-rw-r--r-- | test/core/census/resource_test.cc (renamed from test/core/census/resource_test.c) | 0 | ||||
-rw-r--r-- | test/core/census/trace_context_test.cc (renamed from test/core/census/trace_context_test.c) | 0 | ||||
-rw-r--r-- | test/core/channel/channel_args_test.cc (renamed from test/core/channel/channel_args_test.c) | 6 | ||||
-rw-r--r-- | test/core/channel/channel_stack_builder_test.cc (renamed from test/core/channel/channel_stack_builder_test.c) | 5 | ||||
-rw-r--r-- | test/core/channel/channel_stack_test.cc (renamed from test/core/channel/channel_stack_test.c) | 29 | ||||
-rw-r--r-- | test/core/channel/minimal_stack_is_minimal_test.cc (renamed from test/core/channel/minimal_stack_is_minimal_test.c) | 18 | ||||
-rw-r--r-- | test/core/client_channel/lb_policies_test.cc (renamed from test/core/client_channel/lb_policies_test.c) | 106 | ||||
-rw-r--r-- | test/core/client_channel/parse_address_test.cc (renamed from test/core/client_channel/parse_address_test.c) | 0 | ||||
-rw-r--r-- | test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc (renamed from test/core/client_channel/resolvers/dns_resolver_connectivity_test.c) | 12 | ||||
-rw-r--r-- | test/core/client_channel/resolvers/dns_resolver_test.cc (renamed from test/core/client_channel/resolvers/dns_resolver_test.c) | 0 | ||||
-rw-r--r-- | test/core/client_channel/resolvers/fake_resolver_test.cc (renamed from test/core/client_channel/resolvers/fake_resolver_test.c) | 6 | ||||
-rw-r--r-- | test/core/client_channel/resolvers/sockaddr_resolver_test.cc (renamed from test/core/client_channel/resolvers/sockaddr_resolver_test.c) | 2 | ||||
-rw-r--r-- | test/core/client_channel/uri_fuzzer_test.cc (renamed from test/core/client_channel/uri_fuzzer_test.c) | 2 | ||||
-rw-r--r-- | test/core/client_channel/uri_parser_test.cc (renamed from test/core/client_channel/uri_parser_test.c) | 0 | ||||
-rw-r--r-- | test/core/compression/algorithm_test.cc (renamed from test/core/compression/algorithm_test.c) | 9 | ||||
-rw-r--r-- | test/core/compression/compression_test.cc (renamed from test/core/compression/compression_test.c) | 12 | ||||
-rw-r--r-- | test/core/compression/message_compress_test.cc (renamed from test/core/compression/message_compress_test.c) | 28 | ||||
-rw-r--r-- | test/core/compression/stream_compression_test.cc (renamed from test/core/compression/stream_compression_test.c) | 3 | ||||
-rw-r--r-- | test/core/end2end/BUILD | 12 | ||||
-rw-r--r-- | test/core/end2end/bad_server_response_test.cc (renamed from test/core/end2end/bad_server_response_test.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/connection_refused_test.cc (renamed from test/core/end2end/connection_refused_test.c) | 6 | ||||
-rw-r--r-- | test/core/end2end/cq_verifier.cc (renamed from test/core/end2end/cq_verifier.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/cq_verifier_native.cc (renamed from test/core/end2end/cq_verifier_native.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/cq_verifier_uv.cc (renamed from test/core/end2end/cq_verifier_uv.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/data/client_certs.cc (renamed from test/core/end2end/data/client_certs.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/data/server1_cert.cc (renamed from test/core/end2end/data/server1_cert.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/data/server1_key.cc (renamed from test/core/end2end/data/server1_key.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/data/ssl_test_data.h | 8 | ||||
-rw-r--r-- | test/core/end2end/data/test_root_cert.cc (renamed from test/core/end2end/data/test_root_cert.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/dualstack_socket_test.cc (renamed from test/core/end2end/dualstack_socket_test.c) | 3 | ||||
-rw-r--r-- | test/core/end2end/end2end_nosec_tests.cc (renamed from test/core/end2end/end2end_nosec_tests.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/end2end_test_utils.cc (renamed from test/core/end2end/end2end_test_utils.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/end2end_tests.cc (renamed from test/core/end2end/end2end_tests.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_census.cc (renamed from test/core/end2end/fixtures/h2_census.c) | 14 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_compress.cc (renamed from test/core/end2end/fixtures/h2_compress.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_fakesec.cc (renamed from test/core/end2end/fixtures/h2_fakesec.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_fd.cc (renamed from test/core/end2end/fixtures/h2_fd.c) | 7 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_full+pipe.cc (renamed from test/core/end2end/fixtures/h2_full+pipe.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_full+trace.cc (renamed from test/core/end2end/fixtures/h2_full+trace.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_full+workarounds.cc (renamed from test/core/end2end/fixtures/h2_full+workarounds.c) | 14 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_full.cc (renamed from test/core/end2end/fixtures/h2_full.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_http_proxy.cc (renamed from test/core/end2end/fixtures/h2_http_proxy.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_load_reporting.cc (renamed from test/core/end2end/fixtures/h2_load_reporting.c) | 13 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_oauth2.cc (renamed from test/core/end2end/fixtures/h2_oauth2.c) | 22 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_proxy.cc (renamed from test/core/end2end/fixtures/h2_proxy.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_sockpair+trace.cc (renamed from test/core/end2end/fixtures/h2_sockpair+trace.c) | 13 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_sockpair.cc (renamed from test/core/end2end/fixtures/h2_sockpair.c) | 13 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_sockpair_1byte.cc (renamed from test/core/end2end/fixtures/h2_sockpair_1byte.c) | 34 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_ssl.cc (renamed from test/core/end2end/fixtures/h2_ssl.c) | 19 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_ssl_proxy.cc (renamed from test/core/end2end/fixtures/h2_ssl_proxy.c) | 26 | ||||
-rw-r--r-- | test/core/end2end/fixtures/h2_uds.cc (renamed from test/core/end2end/fixtures/h2_uds.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/fixtures/http_proxy_fixture.cc (renamed from test/core/end2end/fixtures/http_proxy_fixture.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/fixtures/inproc.cc (renamed from test/core/end2end/fixtures/inproc.c) | 6 | ||||
-rw-r--r-- | test/core/end2end/fixtures/proxy.cc (renamed from test/core/end2end/fixtures/proxy.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/api_fuzzer.cc (renamed from test/core/end2end/fuzzers/api_fuzzer.c) | 65 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/client_fuzzer.cc (renamed from test/core/end2end/fuzzers/client_fuzzer.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/fuzzers/server_fuzzer.cc (renamed from test/core/end2end/fuzzers/server_fuzzer.c) | 0 | ||||
-rwxr-xr-x | test/core/end2end/gen_build_yaml.py | 16 | ||||
-rwxr-xr-x | test/core/end2end/generate_tests.bzl | 6 | ||||
-rw-r--r-- | test/core/end2end/goaway_server_test.cc (renamed from test/core/end2end/goaway_server_test.c) | 12 | ||||
-rw-r--r-- | test/core/end2end/invalid_call_argument_test.cc (renamed from test/core/end2end/invalid_call_argument_test.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/multiple_server_queues_test.cc (renamed from test/core/end2end/multiple_server_queues_test.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/no_server_test.cc (renamed from test/core/end2end/no_server_test.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/authority_not_supported.cc (renamed from test/core/end2end/tests/authority_not_supported.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/bad_hostname.cc (renamed from test/core/end2end/tests/bad_hostname.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/bad_ping.cc (renamed from test/core/end2end/tests/bad_ping.c) | 48 | ||||
-rw-r--r-- | test/core/end2end/tests/binary_metadata.cc (renamed from test/core/end2end/tests/binary_metadata.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/call_creds.cc (renamed from test/core/end2end/tests/call_creds.c) | 4 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_after_accept.cc (renamed from test/core/end2end/tests/cancel_after_accept.c) | 6 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_after_client_done.cc (renamed from test/core/end2end/tests/cancel_after_client_done.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_after_invoke.cc (renamed from test/core/end2end/tests/cancel_after_invoke.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_after_round_trip.cc (renamed from test/core/end2end/tests/cancel_after_round_trip.c) | 6 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_before_invoke.cc (renamed from test/core/end2end/tests/cancel_before_invoke.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_in_a_vacuum.cc (renamed from test/core/end2end/tests/cancel_in_a_vacuum.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/cancel_with_status.cc (renamed from test/core/end2end/tests/cancel_with_status.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/compressed_payload.cc (renamed from test/core/end2end/tests/compressed_payload.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/connectivity.cc (renamed from test/core/end2end/tests/connectivity.c) | 3 | ||||
-rw-r--r-- | test/core/end2end/tests/default_host.cc (renamed from test/core/end2end/tests/default_host.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/disappearing_server.cc (renamed from test/core/end2end/tests/disappearing_server.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/empty_batch.cc (renamed from test/core/end2end/tests/empty_batch.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/filter_call_init_fails.cc (renamed from test/core/end2end/tests/filter_call_init_fails.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/filter_causes_close.cc (renamed from test/core/end2end/tests/filter_causes_close.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/filter_latency.cc (renamed from test/core/end2end/tests/filter_latency.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/graceful_server_shutdown.cc (renamed from test/core/end2end/tests/graceful_server_shutdown.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/high_initial_seqno.cc (renamed from test/core/end2end/tests/high_initial_seqno.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/tests/hpack_size.cc (renamed from test/core/end2end/tests/hpack_size.c) | 4 | ||||
-rw-r--r-- | test/core/end2end/tests/idempotent_request.cc (renamed from test/core/end2end/tests/idempotent_request.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/invoke_large_request.cc (renamed from test/core/end2end/tests/invoke_large_request.c) | 4 | ||||
-rw-r--r-- | test/core/end2end/tests/keepalive_timeout.cc (renamed from test/core/end2end/tests/keepalive_timeout.c) | 25 | ||||
-rw-r--r-- | test/core/end2end/tests/large_metadata.cc (renamed from test/core/end2end/tests/large_metadata.c) | 7 | ||||
-rw-r--r-- | test/core/end2end/tests/load_reporting_hook.cc (renamed from test/core/end2end/tests/load_reporting_hook.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/max_concurrent_streams.cc (renamed from test/core/end2end/tests/max_concurrent_streams.c) | 6 | ||||
-rw-r--r-- | test/core/end2end/tests/max_connection_age.cc (renamed from test/core/end2end/tests/max_connection_age.c) | 44 | ||||
-rw-r--r-- | test/core/end2end/tests/max_connection_idle.cc (renamed from test/core/end2end/tests/max_connection_idle.c) | 27 | ||||
-rw-r--r-- | test/core/end2end/tests/max_message_length.cc (renamed from test/core/end2end/tests/max_message_length.c) | 52 | ||||
-rw-r--r-- | test/core/end2end/tests/negative_deadline.cc (renamed from test/core/end2end/tests/negative_deadline.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/network_status_change.cc (renamed from test/core/end2end/tests/network_status_change.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/no_logging.cc (renamed from test/core/end2end/tests/no_logging.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/tests/no_op.cc (renamed from test/core/end2end/tests/no_op.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/payload.cc (renamed from test/core/end2end/tests/payload.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/ping.cc (renamed from test/core/end2end/tests/ping.c) | 42 | ||||
-rw-r--r-- | test/core/end2end/tests/ping_pong_streaming.cc (renamed from test/core/end2end/tests/ping_pong_streaming.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/proxy_auth.cc (renamed from test/core/end2end/tests/proxy_auth.c) | 9 | ||||
-rw-r--r-- | test/core/end2end/tests/registered_call.cc (renamed from test/core/end2end/tests/registered_call.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/request_with_flags.cc (renamed from test/core/end2end/tests/request_with_flags.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/request_with_payload.cc (renamed from test/core/end2end/tests/request_with_payload.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/resource_quota_server.cc (renamed from test/core/end2end/tests/resource_quota_server.c) | 2 | ||||
-rw-r--r-- | test/core/end2end/tests/server_finishes_request.cc (renamed from test/core/end2end/tests/server_finishes_request.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/shutdown_finishes_calls.cc (renamed from test/core/end2end/tests/shutdown_finishes_calls.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/shutdown_finishes_tags.cc (renamed from test/core/end2end/tests/shutdown_finishes_tags.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/simple_cacheable_request.cc (renamed from test/core/end2end/tests/simple_cacheable_request.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/simple_delayed_request.cc (renamed from test/core/end2end/tests/simple_delayed_request.c) | 6 | ||||
-rw-r--r-- | test/core/end2end/tests/simple_metadata.cc (renamed from test/core/end2end/tests/simple_metadata.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/simple_request.cc (renamed from test/core/end2end/tests/simple_request.c) | 6 | ||||
-rw-r--r-- | test/core/end2end/tests/stream_compression_compressed_payload.cc (renamed from test/core/end2end/tests/stream_compression_compressed_payload.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/stream_compression_payload.cc (renamed from test/core/end2end/tests/stream_compression_payload.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/stream_compression_ping_pong_streaming.cc (renamed from test/core/end2end/tests/stream_compression_ping_pong_streaming.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/streaming_error_response.cc (renamed from test/core/end2end/tests/streaming_error_response.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/trailing_metadata.cc (renamed from test/core/end2end/tests/trailing_metadata.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/workaround_cronet_compression.cc (renamed from test/core/end2end/tests/workaround_cronet_compression.c) | 11 | ||||
-rw-r--r-- | test/core/end2end/tests/write_buffering.cc (renamed from test/core/end2end/tests/write_buffering.c) | 0 | ||||
-rw-r--r-- | test/core/end2end/tests/write_buffering_at_end.cc (renamed from test/core/end2end/tests/write_buffering_at_end.c) | 0 | ||||
-rw-r--r-- | test/core/fling/client.cc (renamed from test/core/fling/client.c) | 4 | ||||
-rw-r--r-- | test/core/fling/fling_stream_test.cc (renamed from test/core/fling/fling_test.c) | 10 | ||||
-rw-r--r-- | test/core/fling/fling_test.cc (renamed from test/core/fling/fling_stream_test.c) | 16 | ||||
-rw-r--r-- | test/core/fling/server.cc (renamed from test/core/fling/server.c) | 4 | ||||
-rw-r--r-- | test/core/handshake/client_ssl.cc (renamed from test/core/handshake/client_ssl.c) | 16 | ||||
-rw-r--r-- | test/core/handshake/server_ssl.cc (renamed from test/core/handshake/server_ssl.c) | 3 | ||||
-rw-r--r-- | test/core/http/format_request_test.cc (renamed from test/core/http/format_request_test.c) | 33 | ||||
-rw-r--r-- | test/core/http/httpcli_test.cc (renamed from test/core/http/httpcli_test.c) | 16 | ||||
-rw-r--r-- | test/core/http/httpscli_test.cc (renamed from test/core/http/httpscli_test.c) | 22 | ||||
-rw-r--r-- | test/core/http/parser_test.cc (renamed from test/core/http/parser_test.c) | 19 | ||||
-rw-r--r-- | test/core/http/request_fuzzer.cc (renamed from test/core/http/request_fuzzer.c) | 0 | ||||
-rw-r--r-- | test/core/http/response_fuzzer.cc (renamed from test/core/http/response_fuzzer.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/combiner_test.cc (renamed from test/core/iomgr/combiner_test.c) | 17 | ||||
-rw-r--r-- | test/core/iomgr/endpoint_pair_test.cc (renamed from test/core/iomgr/endpoint_pair_test.c) | 13 | ||||
-rw-r--r-- | test/core/iomgr/endpoint_tests.cc (renamed from test/core/iomgr/endpoint_tests.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/error_test.cc (renamed from test/core/iomgr/error_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/ev_epollsig_linux_test.cc (renamed from test/core/iomgr/ev_epollsig_linux_test.c) | 11 | ||||
-rw-r--r-- | test/core/iomgr/fd_conservation_posix_test.cc (renamed from test/core/iomgr/fd_conservation_posix_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/fd_posix_test.cc (renamed from test/core/iomgr/fd_posix_test.c) | 22 | ||||
-rw-r--r-- | test/core/iomgr/load_file_test.cc (renamed from test/core/iomgr/load_file_test.c) | 2 | ||||
-rw-r--r-- | test/core/iomgr/pollset_set_test.cc (renamed from test/core/iomgr/pollset_set_test.c) | 5 | ||||
-rw-r--r-- | test/core/iomgr/resolve_address_posix_test.cc (renamed from test/core/iomgr/resolve_address_posix_test.c) | 11 | ||||
-rw-r--r-- | test/core/iomgr/resolve_address_test.cc (renamed from test/core/iomgr/resolve_address_test.c) | 6 | ||||
-rw-r--r-- | test/core/iomgr/resource_quota_test.cc (renamed from test/core/iomgr/resource_quota_test.c) | 6 | ||||
-rw-r--r-- | test/core/iomgr/sockaddr_utils_test.cc (renamed from test/core/iomgr/sockaddr_utils_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/socket_utils_test.cc (renamed from test/core/iomgr/socket_utils_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/tcp_client_posix_test.cc (renamed from test/core/iomgr/tcp_client_posix_test.c) | 4 | ||||
-rw-r--r-- | test/core/iomgr/tcp_client_uv_test.cc (renamed from test/core/iomgr/tcp_client_uv_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/tcp_posix_test.cc (renamed from test/core/iomgr/tcp_posix_test.c) | 43 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_posix_test.cc (renamed from test/core/iomgr/tcp_server_posix_test.c) | 15 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_uv_test.cc (renamed from test/core/iomgr/tcp_server_uv_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/time_averaged_stats_test.cc (renamed from test/core/iomgr/time_averaged_stats_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/timer_heap_test.cc (renamed from test/core/iomgr/timer_heap_test.c) | 11 | ||||
-rw-r--r-- | test/core/iomgr/timer_list_test.cc (renamed from test/core/iomgr/timer_list_test.c) | 0 | ||||
-rw-r--r-- | test/core/iomgr/udp_server_test.cc (renamed from test/core/iomgr/udp_server_test.c) | 7 | ||||
-rw-r--r-- | test/core/iomgr/wakeup_fd_cv_test.cc (renamed from test/core/iomgr/wakeup_fd_cv_test.c) | 0 | ||||
-rw-r--r-- | test/core/json/fuzzer.cc (renamed from test/core/json/fuzzer.c) | 2 | ||||
-rw-r--r-- | test/core/json/json_rewrite.cc (renamed from test/core/json/json_rewrite.c) | 34 | ||||
-rw-r--r-- | test/core/json/json_rewrite_test.cc (renamed from test/core/json/json_rewrite_test.c) | 30 | ||||
-rw-r--r-- | test/core/json/json_stream_error_test.cc (renamed from test/core/json/json_stream_error_test.c) | 0 | ||||
-rw-r--r-- | test/core/json/json_test.cc (renamed from test/core/json/json_test.c) | 0 | ||||
-rw-r--r-- | test/core/memory_usage/client.cc (renamed from test/core/memory_usage/client.c) | 2 | ||||
-rw-r--r-- | test/core/memory_usage/memory_usage_test.cc (renamed from test/core/memory_usage/memory_usage_test.c) | 10 | ||||
-rw-r--r-- | test/core/memory_usage/server.cc (renamed from test/core/memory_usage/server.c) | 4 | ||||
-rw-r--r-- | test/core/nanopb/fuzzer_response.cc (renamed from test/core/nanopb/fuzzer_response.c) | 0 | ||||
-rw-r--r-- | test/core/nanopb/fuzzer_serverlist.cc (renamed from test/core/nanopb/fuzzer_serverlist.c) | 0 | ||||
-rw-r--r-- | test/core/network_benchmarks/low_level_ping_pong.cc (renamed from test/core/network_benchmarks/low_level_ping_pong.c) | 0 | ||||
-rw-r--r-- | test/core/security/auth_context_test.cc (renamed from test/core/security/auth_context_test.c) | 0 | ||||
-rw-r--r-- | test/core/security/create_jwt.cc (renamed from test/core/security/create_jwt.c) | 6 | ||||
-rw-r--r-- | test/core/security/credentials_test.cc (renamed from test/core/security/credentials_test.c) | 11 | ||||
-rw-r--r-- | test/core/security/fetch_oauth2.cc (renamed from test/core/security/fetch_oauth2.c) | 2 | ||||
-rw-r--r-- | test/core/security/json_token_test.cc (renamed from test/core/security/json_token_test.c) | 6 | ||||
-rw-r--r-- | test/core/security/jwt_verifier_test.cc (renamed from test/core/security/jwt_verifier_test.c) | 4 | ||||
-rw-r--r-- | test/core/security/oauth2_utils.cc (renamed from test/core/security/oauth2_utils.c) | 0 | ||||
-rw-r--r-- | test/core/security/print_google_default_creds_token.cc (renamed from test/core/security/print_google_default_creds_token.c) | 10 | ||||
-rw-r--r-- | test/core/security/secure_endpoint_test.cc (renamed from test/core/security/secure_endpoint_test.c) | 7 | ||||
-rw-r--r-- | test/core/security/security_connector_test.cc (renamed from test/core/security/security_connector_test.c) | 0 | ||||
-rw-r--r-- | test/core/security/ssl_server_fuzzer.cc (renamed from test/core/security/ssl_server_fuzzer.c) | 5 | ||||
-rw-r--r-- | test/core/security/verify_jwt.cc (renamed from test/core/security/verify_jwt.c) | 8 | ||||
-rw-r--r-- | test/core/slice/b64_test.cc (renamed from test/core/slice/b64_test.c) | 0 | ||||
-rw-r--r-- | test/core/slice/percent_decode_fuzzer.cc (renamed from test/core/slice/percent_decode_fuzzer.c) | 0 | ||||
-rw-r--r-- | test/core/slice/percent_encode_fuzzer.cc (renamed from test/core/slice/percent_encode_fuzzer.c) | 0 | ||||
-rw-r--r-- | test/core/slice/percent_encoding_test.cc (renamed from test/core/slice/percent_encoding_test.c) | 0 | ||||
-rw-r--r-- | test/core/slice/slice_buffer_test.cc (renamed from test/core/slice/slice_buffer_test.c) | 0 | ||||
-rw-r--r-- | test/core/slice/slice_hash_table_test.cc (renamed from test/core/slice/slice_hash_table_test.c) | 14 | ||||
-rw-r--r-- | test/core/slice/slice_string_helpers_test.cc (renamed from test/core/slice/slice_string_helpers_test.c) | 3 | ||||
-rw-r--r-- | test/core/slice/slice_test.cc (renamed from test/core/slice/slice_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/census_log_tests.cc (renamed from test/core/statistics/census_log_tests.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/census_stub_test.cc (renamed from test/core/statistics/census_stub_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/hash_table_test.cc (renamed from test/core/statistics/hash_table_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/multiple_writers_circular_buffer_test.cc (renamed from test/core/statistics/multiple_writers_circular_buffer_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/multiple_writers_test.cc (renamed from test/core/statistics/multiple_writers_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/performance_test.cc (renamed from test/core/statistics/performance_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/quick_test.cc (renamed from test/core/statistics/quick_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/rpc_stats_test.cc (renamed from test/core/statistics/rpc_stats_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/small_log_test.cc (renamed from test/core/statistics/small_log_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/trace_test.cc (renamed from test/core/statistics/trace_test.c) | 0 | ||||
-rw-r--r-- | test/core/statistics/window_stats_test.cc (renamed from test/core/statistics/window_stats_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/alloc_test.cc (renamed from test/core/support/alloc_test.c) | 5 | ||||
-rw-r--r-- | test/core/support/arena_test.cc (renamed from test/core/support/arena_test.c) | 4 | ||||
-rw-r--r-- | test/core/support/avl_test.cc (renamed from test/core/support/avl_test.c) | 2 | ||||
-rw-r--r-- | test/core/support/cmdline_test.cc (renamed from test/core/support/cmdline_test.c) | 79 | ||||
-rw-r--r-- | test/core/support/cpu_test.cc (renamed from test/core/support/cpu_test.c) | 2 | ||||
-rw-r--r-- | test/core/support/env_test.cc (renamed from test/core/support/env_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/histogram_test.cc (renamed from test/core/support/histogram_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/host_port_test.cc (renamed from test/core/support/host_port_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/log_test.cc (renamed from test/core/support/log_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/mpscq_test.cc (renamed from test/core/support/mpscq_test.c) | 6 | ||||
-rw-r--r-- | test/core/support/murmur_hash_test.cc (renamed from test/core/support/murmur_hash_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/spinlock_test.cc (renamed from test/core/support/spinlock_test.c) | 9 | ||||
-rw-r--r-- | test/core/support/stack_lockfree_test.cc (renamed from test/core/support/stack_lockfree_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/string_test.cc (renamed from test/core/support/string_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/sync_test.cc (renamed from test/core/support/sync_test.c) | 22 | ||||
-rw-r--r-- | test/core/support/thd_test.cc (renamed from test/core/support/thd_test.c) | 2 | ||||
-rw-r--r-- | test/core/support/time_test.cc (renamed from test/core/support/time_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/tls_test.cc (renamed from test/core/support/tls_test.c) | 0 | ||||
-rw-r--r-- | test/core/support/useful_test.cc (renamed from test/core/support/useful_test.c) | 0 | ||||
-rw-r--r-- | test/core/surface/alarm_test.cc (renamed from test/core/surface/alarm_test.c) | 0 | ||||
-rw-r--r-- | test/core/surface/byte_buffer_reader_test.cc (renamed from test/core/surface/byte_buffer_reader_test.c) | 0 | ||||
-rw-r--r-- | test/core/surface/channel_create_test.cc (renamed from test/core/surface/channel_create_test.c) | 0 | ||||
-rw-r--r-- | test/core/surface/completion_queue_test.cc (renamed from test/core/surface/completion_queue_test.c) | 0 | ||||
-rw-r--r-- | test/core/surface/completion_queue_threading_test.cc (renamed from test/core/surface/completion_queue_threading_test.c) | 13 | ||||
-rw-r--r-- | test/core/surface/concurrent_connectivity_test.cc (renamed from test/core/surface/concurrent_connectivity_test.c) | 4 | ||||
-rw-r--r-- | test/core/surface/init_test.cc (renamed from test/core/surface/init_test.c) | 0 | ||||
-rw-r--r-- | test/core/surface/invalid_channel_args_test.cc (renamed from test/core/surface/invalid_channel_args_test.c) | 12 | ||||
-rw-r--r-- | test/core/surface/lame_client_test.cc (renamed from test/core/surface/lame_client_test.c) | 2 | ||||
-rw-r--r-- | test/core/surface/num_external_connectivity_watchers_test.cc (renamed from test/core/surface/num_external_connectivity_watchers_test.c) | 7 | ||||
-rw-r--r-- | test/core/surface/secure_channel_create_test.cc (renamed from test/core/surface/secure_channel_create_test.c) | 2 | ||||
-rw-r--r-- | test/core/surface/sequential_connectivity_test.cc (renamed from test/core/surface/sequential_connectivity_test.c) | 9 | ||||
-rw-r--r-- | test/core/surface/server_chttp2_test.cc (renamed from test/core/surface/server_chttp2_test.c) | 2 | ||||
-rw-r--r-- | test/core/surface/server_test.cc (renamed from test/core/surface/server_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/byte_stream_test.cc (renamed from test/core/transport/byte_stream_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/chttp2/alpn_test.cc (renamed from test/core/transport/chttp2/alpn_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/chttp2/bin_decoder_test.cc (renamed from test/core/transport/chttp2/bin_decoder_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/bin_encoder_test.cc (renamed from test/core/transport/chttp2/bin_encoder_test.c) | 4 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_encoder_test.cc (renamed from test/core/transport/chttp2/hpack_encoder_test.c) | 9 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_parser_fuzzer_test.cc (renamed from test/core/transport/chttp2/hpack_parser_fuzzer_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_parser_test.cc (renamed from test/core/transport/chttp2/hpack_parser_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/hpack_table_test.cc (renamed from test/core/transport/chttp2/hpack_table_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/chttp2/stream_map_test.cc (renamed from test/core/transport/chttp2/stream_map_test.c) | 2 | ||||
-rw-r--r-- | test/core/transport/chttp2/varint_test.cc (renamed from test/core/transport/chttp2/varint_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/connectivity_state_test.cc (renamed from test/core/transport/connectivity_state_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/metadata_test.cc (renamed from test/core/transport/metadata_test.c) | 12 | ||||
-rw-r--r-- | test/core/transport/status_conversion_test.cc (renamed from test/core/transport/status_conversion_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/stream_owned_slice_test.cc (renamed from test/core/transport/stream_owned_slice_test.c) | 0 | ||||
-rw-r--r-- | test/core/transport/timeout_encoding_test.cc (renamed from test/core/transport/timeout_encoding_test.c) | 0 | ||||
-rw-r--r-- | test/core/tsi/fake_transport_security_test.cc (renamed from test/core/tsi/fake_transport_security_test.c) | 7 | ||||
-rw-r--r-- | test/core/tsi/ssl_transport_security_test.cc (renamed from test/core/tsi/ssl_transport_security_test.c) | 37 | ||||
-rw-r--r-- | test/core/tsi/transport_security_test.cc (renamed from test/core/tsi/transport_security_test.c) | 2 | ||||
-rw-r--r-- | test/core/tsi/transport_security_test_lib.cc (renamed from test/core/tsi/transport_security_test_lib.c) | 33 | ||||
-rw-r--r-- | test/core/util/grpc_profiler.cc (renamed from test/core/util/grpc_profiler.c) | 0 | ||||
-rw-r--r-- | test/core/util/memory_counters.cc (renamed from test/core/util/memory_counters.c) | 0 | ||||
-rw-r--r-- | test/core/util/mock_endpoint.cc (renamed from test/core/util/mock_endpoint.c) | 0 | ||||
-rw-r--r-- | test/core/util/one_corpus_entry_fuzzer.cc (renamed from test/core/util/one_corpus_entry_fuzzer.c) | 0 | ||||
-rw-r--r-- | test/core/util/parse_hexstring.cc (renamed from test/core/util/parse_hexstring.c) | 0 | ||||
-rw-r--r-- | test/core/util/passthru_endpoint.cc (renamed from test/core/util/passthru_endpoint.c) | 0 | ||||
-rw-r--r-- | test/core/util/port.cc (renamed from test/core/util/port.c) | 0 | ||||
-rw-r--r-- | test/core/util/port_server_client.cc (renamed from test/core/util/port_server_client.c) | 10 | ||||
-rw-r--r-- | test/core/util/reconnect_server.cc (renamed from test/core/util/reconnect_server.c) | 2 | ||||
-rw-r--r-- | test/core/util/slice_splitter.cc (renamed from test/core/util/slice_splitter.c) | 0 | ||||
-rw-r--r-- | test/core/util/test_config.cc (renamed from test/core/util/test_config.c) | 0 | ||||
-rw-r--r-- | test/core/util/test_tcp_server.cc (renamed from test/core/util/test_tcp_server.c) | 7 | ||||
-rw-r--r-- | test/core/util/trickle_endpoint.cc (renamed from test/core/util/trickle_endpoint.c) | 0 |
288 files changed, 1012 insertions, 777 deletions
diff --git a/test/core/backoff/backoff_test.c b/test/core/backoff/backoff_test.cc index a29cce6cc7..a29cce6cc7 100644 --- a/test/core/backoff/backoff_test.c +++ b/test/core/backoff/backoff_test.cc diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.cc index b7b28a9ac4..b7b28a9ac4 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.cc diff --git a/test/core/bad_client/gen_build_yaml.py b/test/core/bad_client/gen_build_yaml.py index 61cf1f7cd7..14c8a27334 100755 --- a/test/core/bad_client/gen_build_yaml.py +++ b/test/core/bad_client/gen_build_yaml.py @@ -46,7 +46,7 @@ def main(): 'build': 'private', 'language': 'c', 'src': [ - 'test/core/bad_client/bad_client.c' + 'test/core/bad_client/bad_client.cc' ], 'headers': [ 'test/core/bad_client/bad_client.h' @@ -66,7 +66,7 @@ def main(): 'build': 'test', 'language': 'c', 'secure': 'no', - 'src': ['test/core/bad_client/tests/%s.c' % t], + 'src': ['test/core/bad_client/tests/%s.cc' % t], 'vs_proj_dir': 'test', 'exclude_iomgrs': ['uv'], 'deps': [ diff --git a/test/core/bad_client/generate_tests.bzl b/test/core/bad_client/generate_tests.bzl index 58b48d688f..cdea9cc2d1 100755 --- a/test/core/bad_client/generate_tests.bzl +++ b/test/core/bad_client/generate_tests.bzl @@ -38,7 +38,7 @@ BAD_CLIENT_TESTS = { def grpc_bad_client_tests(): native.cc_library( name = 'bad_client_test', - srcs = ['bad_client.c'], + srcs = ['bad_client.cc'], hdrs = ['bad_client.h'], copts = ['-std=c99'], deps = ['//test/core/util:grpc_test_util', '//:grpc', '//:gpr', '//test/core/end2end:cq_verifier'] @@ -46,7 +46,7 @@ def grpc_bad_client_tests(): for t, topt in BAD_CLIENT_TESTS.items(): native.cc_test( name = '%s_bad_client_test' % t, - srcs = ['tests/%s.c' % t], + srcs = ['tests/%s.cc' % t], deps = [':bad_client_test'], copts = ['-std=c99'], ) diff --git a/test/core/bad_client/tests/badreq.c b/test/core/bad_client/tests/badreq.cc index 7d9a103e43..7d9a103e43 100644 --- a/test/core/bad_client/tests/badreq.c +++ b/test/core/bad_client/tests/badreq.cc diff --git a/test/core/bad_client/tests/connection_prefix.c b/test/core/bad_client/tests/connection_prefix.cc index 6cc4b72314..6cc4b72314 100644 --- a/test/core/bad_client/tests/connection_prefix.c +++ b/test/core/bad_client/tests/connection_prefix.cc diff --git a/test/core/bad_client/tests/head_of_line_blocking.c b/test/core/bad_client/tests/head_of_line_blocking.cc index 04485d501f..cb89423907 100644 --- a/test/core/bad_client/tests/head_of_line_blocking.c +++ b/test/core/bad_client/tests/head_of_line_blocking.cc @@ -100,7 +100,7 @@ size_t g_count = 0; static void addbuf(const void *data, size_t len) { if (g_count + len > g_cap) { g_cap = GPR_MAX(g_count + len, g_cap * 2); - g_buffer = gpr_realloc(g_buffer, g_cap); + g_buffer = static_cast<char *>(gpr_realloc(g_buffer, g_cap)); } memcpy(g_buffer + g_count, data, len); g_count += len; diff --git a/test/core/bad_client/tests/headers.c b/test/core/bad_client/tests/headers.cc index c704dbbcb6..c704dbbcb6 100644 --- a/test/core/bad_client/tests/headers.c +++ b/test/core/bad_client/tests/headers.cc diff --git a/test/core/bad_client/tests/initial_settings_frame.c b/test/core/bad_client/tests/initial_settings_frame.cc index 0696ef9383..0696ef9383 100644 --- a/test/core/bad_client/tests/initial_settings_frame.c +++ b/test/core/bad_client/tests/initial_settings_frame.cc diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.cc index ca3d234be9..ca3d234be9 100644 --- a/test/core/bad_client/tests/large_metadata.c +++ b/test/core/bad_client/tests/large_metadata.cc diff --git a/test/core/bad_client/tests/server_registered_method.c b/test/core/bad_client/tests/server_registered_method.cc index f52350302b..f52350302b 100644 --- a/test/core/bad_client/tests/server_registered_method.c +++ b/test/core/bad_client/tests/server_registered_method.cc diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.cc index a516632819..a516632819 100644 --- a/test/core/bad_client/tests/simple_request.c +++ b/test/core/bad_client/tests/simple_request.cc diff --git a/test/core/bad_client/tests/unknown_frame.c b/test/core/bad_client/tests/unknown_frame.cc index 448803d12b..448803d12b 100644 --- a/test/core/bad_client/tests/unknown_frame.c +++ b/test/core/bad_client/tests/unknown_frame.cc diff --git a/test/core/bad_client/tests/window_overflow.c b/test/core/bad_client/tests/window_overflow.cc index e4b5f9711b..40552e5345 100644 --- a/test/core/bad_client/tests/window_overflow.c +++ b/test/core/bad_client/tests/window_overflow.cc @@ -58,7 +58,7 @@ size_t g_count = 0; static void addbuf(const void *data, size_t len) { if (g_count + len > g_cap) { g_cap = GPR_MAX(g_count + len, g_cap * 2); - g_buffer = gpr_realloc(g_buffer, g_cap); + g_buffer = static_cast<char *>(gpr_realloc(g_buffer, g_cap)); } memcpy(g_buffer + g_count, data, len); g_count += len; diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.cc index 793627bcdc..2183fbb633 100644 --- a/test/core/bad_ssl/bad_ssl_test.c +++ b/test/core/bad_ssl/bad_ssl_test.cc @@ -52,9 +52,10 @@ static void run_test(const char *target, size_t nops) { grpc_op ops[6]; grpc_op *op; - grpc_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args args; args.num_args = 1; @@ -141,7 +142,7 @@ int main(int argc, char **argv) { /* start the server */ gpr_asprintf(&args[0], "%s/bad_ssl_%s_server%s", root, test, gpr_subprocess_binary_extension()); - args[1] = "--bind"; + args[1] = const_cast<char *>("--bind"); gpr_join_host_port(&args[2], "::", port); svr = gpr_subprocess_create(4, (const char **)args); gpr_free(args[0]); diff --git a/test/core/bad_ssl/gen_build_yaml.py b/test/core/bad_ssl/gen_build_yaml.py index 30fdb5ea02..6b78e9c7aa 100755 --- a/test/core/bad_ssl/gen_build_yaml.py +++ b/test/core/bad_ssl/gen_build_yaml.py @@ -38,7 +38,7 @@ def main(): 'name': 'bad_ssl_test_server', 'build': 'private', 'language': 'c', - 'src': ['test/core/bad_ssl/server_common.c'], + 'src': ['test/core/bad_ssl/server_common.cc'], 'headers': ['test/core/bad_ssl/server_common.h'], 'vs_proj_dir': 'test', 'platforms': ['linux', 'posix', 'mac'], @@ -56,7 +56,7 @@ def main(): 'build': 'test', 'language': 'c', 'run': False, - 'src': ['test/core/bad_ssl/servers/%s.c' % t], + 'src': ['test/core/bad_ssl/servers/%s.cc' % t], 'vs_proj_dir': 'test/bad_ssl', 'platforms': ['linux', 'posix', 'mac'], 'deps': [ @@ -73,7 +73,7 @@ def main(): 'cpu_cost': BAD_CLIENT_TESTS[t].cpu_cost, 'build': 'test', 'language': 'c', - 'src': ['test/core/bad_ssl/bad_ssl_test.c'], + 'src': ['test/core/bad_ssl/bad_ssl_test.cc'], 'vs_proj_dir': 'test', 'platforms': ['linux', 'posix', 'mac'], 'deps': [ diff --git a/test/core/bad_ssl/generate_tests.bzl b/test/core/bad_ssl/generate_tests.bzl index b61fabc051..b7cb8f86e6 100755 --- a/test/core/bad_ssl/generate_tests.bzl +++ b/test/core/bad_ssl/generate_tests.bzl @@ -24,14 +24,14 @@ BAD_SSL_TESTS = ['cert', 'alpn'] def grpc_bad_ssl_tests(): native.cc_library( name = 'bad_ssl_test_server', - srcs = ['server_common.c'], + srcs = ['server_common.cc'], hdrs = ['server_common.h'], deps = ['//test/core/util:grpc_test_util', '//:grpc', '//test/core/end2end:ssl_test_data'] ) for t in BAD_SSL_TESTS: native.cc_test( name = 'bad_ssl_%s_server' % t, - srcs = ['servers/%s.c' % t], + srcs = ['servers/%s.cc' % t], deps = [':bad_ssl_test_server'], ) diff --git a/test/core/bad_ssl/server_common.c b/test/core/bad_ssl/server_common.cc index 0588d43c38..5def618257 100644 --- a/test/core/bad_ssl/server_common.c +++ b/test/core/bad_ssl/server_common.cc @@ -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; - char *addr = NULL; + const char *addr = NULL; cl = gpr_cmdline_create("test server"); gpr_cmdline_add_string(cl, "bind", "Bind host:port", &addr); gpr_cmdline_parse(cl, argc, argv); diff --git a/test/core/bad_ssl/servers/alpn.c b/test/core/bad_ssl/servers/alpn.cc index 3179054aff..3179054aff 100644 --- a/test/core/bad_ssl/servers/alpn.c +++ b/test/core/bad_ssl/servers/alpn.cc diff --git a/test/core/bad_ssl/servers/cert.c b/test/core/bad_ssl/servers/cert.cc index a1f3048164..a1f3048164 100644 --- a/test/core/bad_ssl/servers/cert.c +++ b/test/core/bad_ssl/servers/cert.cc diff --git a/test/core/census/context_test.c b/test/core/census/context_test.cc index ca5a6ec5cd..ca5a6ec5cd 100644 --- a/test/core/census/context_test.c +++ b/test/core/census/context_test.cc diff --git a/test/core/census/intrusive_hash_map_test.c b/test/core/census/intrusive_hash_map_test.cc index 0826b55c63..0826b55c63 100644 --- a/test/core/census/intrusive_hash_map_test.c +++ b/test/core/census/intrusive_hash_map_test.cc diff --git a/test/core/census/mlog_test.c b/test/core/census/mlog_test.cc index 968fd91da4..968fd91da4 100644 --- a/test/core/census/mlog_test.c +++ b/test/core/census/mlog_test.cc diff --git a/test/core/census/resource_test.c b/test/core/census/resource_test.cc index 48fc43e45b..48fc43e45b 100644 --- a/test/core/census/resource_test.c +++ b/test/core/census/resource_test.cc diff --git a/test/core/census/trace_context_test.c b/test/core/census/trace_context_test.cc index 6eb831a85e..6eb831a85e 100644 --- a/test/core/census/trace_context_test.c +++ b/test/core/census/trace_context_test.cc diff --git a/test/core/channel/channel_args_test.c b/test/core/channel/channel_args_test.cc index deaf2933ec..08dd1f47e3 100644 --- a/test/core/channel/channel_args_test.c +++ b/test/core/channel/channel_args_test.cc @@ -33,13 +33,13 @@ static void test_create(void) { grpc_arg to_add[2]; grpc_channel_args *ch_args; - arg_int.key = "int_arg"; + arg_int.key = const_cast<char *>("int_arg"); arg_int.type = GRPC_ARG_INTEGER; arg_int.value.integer = 123; - arg_string.key = "str key"; + arg_string.key = const_cast<char *>("str key"); arg_string.type = GRPC_ARG_STRING; - arg_string.value.string = "str value"; + arg_string.value.string = const_cast<char *>("str value"); to_add[0] = arg_int; to_add[1] = arg_string; diff --git a/test/core/channel/channel_stack_builder_test.c b/test/core/channel/channel_stack_builder_test.cc index 682efd1438..f9129605e9 100644 --- a/test/core/channel/channel_stack_builder_test.c +++ b/test/core/channel/channel_stack_builder_test.cc @@ -63,7 +63,7 @@ bool g_replacement_fn_called = false; bool g_original_fn_called = false; void set_arg_once_fn(grpc_channel_stack *channel_stack, grpc_channel_element *elem, void *arg) { - bool *called = arg; + bool *called = static_cast<bool *>(arg); // Make sure this function is only called once per arg. GPR_ASSERT(*called == false); *called = true; @@ -109,7 +109,8 @@ const grpc_channel_filter original_filter = { static bool add_replacement_filter(grpc_exec_ctx *exec_ctx, grpc_channel_stack_builder *builder, void *arg) { - const grpc_channel_filter *filter = arg; + const grpc_channel_filter *filter = + static_cast<const grpc_channel_filter *>(arg); // Get rid of any other version of the filter, as determined by having the // same name. GPR_ASSERT(grpc_channel_stack_builder_remove_filter(builder, filter->name)); diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.cc index a07ef89ba8..88007375b2 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.cc @@ -69,12 +69,13 @@ static void channel_func(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, static void free_channel(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_channel_stack_destroy(exec_ctx, arg); + grpc_channel_stack_destroy(exec_ctx, static_cast<grpc_channel_stack *>(arg)); gpr_free(arg); } static void free_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_call_stack_destroy(exec_ctx, arg, NULL, NULL); + grpc_call_stack_destroy(exec_ctx, static_cast<grpc_call_stack *>(arg), NULL, + NULL); gpr_free(arg); } @@ -104,13 +105,14 @@ static void test_create_channel_stack(void) { grpc_slice path = grpc_slice_from_static_string("/service/method"); arg.type = GRPC_ARG_INTEGER; - arg.key = "test_key"; + arg.key = const_cast<char *>("test_key"); arg.value.integer = 42; chan_args.num_args = 1; chan_args.args = &arg; - channel_stack = gpr_malloc(grpc_channel_stack_size(&filters, 1)); + 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); GPR_ASSERT(channel_stack->count == 1); @@ -118,15 +120,18 @@ static void test_create_channel_stack(void) { channel_data = (int *)channel_elem->channel_data; GPR_ASSERT(*channel_data == 0); - call_stack = gpr_malloc(channel_stack->call_stack_size); + call_stack = static_cast<grpc_call_stack *>( + gpr_malloc(channel_stack->call_stack_size)); const grpc_call_element_args args = { - .call_stack = call_stack, - .server_transport_data = NULL, - .context = NULL, - .path = path, - .start_time = gpr_now(GPR_CLOCK_MONOTONIC), - .deadline = GRPC_MILLIS_INF_FUTURE, - .arena = NULL}; + call_stack, /* call_stack */ + nullptr, /* server_transport_data */ + nullptr, /* context */ + path, /* path */ + gpr_now(GPR_CLOCK_MONOTONIC), /* start_time */ + GRPC_MILLIS_INF_FUTURE, /* deadline */ + nullptr, /* arena */ + nullptr /* call_combiner */ + }; grpc_error *error = grpc_call_stack_init(&exec_ctx, channel_stack, 1, free_call, call_stack, &args); GPR_ASSERT(error == GRPC_ERROR_NONE); diff --git a/test/core/channel/minimal_stack_is_minimal_test.c b/test/core/channel/minimal_stack_is_minimal_test.cc index b4528346f7..be6670c368 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.c +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -61,11 +61,11 @@ int main(int argc, char **argv) { int errors = 0; // tests with a minimal stack - grpc_arg minimal_stack_arg = {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MINIMAL_STACK, - .value.integer = 1}; - grpc_channel_args minimal_stack_args = {.num_args = 1, - .args = &minimal_stack_arg}; + grpc_arg minimal_stack_arg; + minimal_stack_arg.type = GRPC_ARG_INTEGER; + minimal_stack_arg.key = const_cast<char *>(GRPC_ARG_MINIMAL_STACK); + minimal_stack_arg.value.integer = 1; + grpc_channel_args minimal_stack_args = {1, &minimal_stack_arg}; errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_DIRECT_CHANNEL, "connected", NULL); errors += CHECK_STACK("unknown", &minimal_stack_args, GRPC_CLIENT_SUBCHANNEL, @@ -114,7 +114,9 @@ static int check_stack(const char *file, int line, const char *transport_name, unsigned channel_stack_type, ...) { // create dummy channel stack grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create(); - grpc_transport_vtable fake_transport_vtable = {.name = transport_name}; + grpc_transport_vtable fake_transport_vtable; + memset(&fake_transport_vtable, 0, sizeof(grpc_transport_vtable)); + fake_transport_vtable.name = transport_name; grpc_transport fake_transport = {.vtable = &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); @@ -194,7 +196,9 @@ static int check_stack(const char *file, int line, const char *transport_name, "**************************************************"); gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "FAILED transport=%s; stack_type=%s; channel_args=%s:", - transport_name, grpc_channel_stack_type_string(channel_stack_type), + transport_name, + grpc_channel_stack_type_string( + static_cast<grpc_channel_stack_type>(channel_stack_type)), args_str); gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "EXPECTED: %s", expect); gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "GOT: %s", got); diff --git a/test/core/client_channel/lb_policies_test.c b/test/core/client_channel/lb_policies_test.cc index ba37cd673f..4379af11da 100644 --- a/test/core/client_channel/lb_policies_test.c +++ b/test/core/client_channel/lb_policies_test.cc @@ -88,14 +88,16 @@ static test_spec *test_spec_create(size_t num_iters, size_t num_servers) { test_spec *spec; size_t i; - spec = gpr_malloc(sizeof(test_spec)); + spec = static_cast<test_spec *>(gpr_malloc(sizeof(test_spec))); spec->num_iters = num_iters; spec->num_servers = num_servers; - spec->kill_at = gpr_malloc(sizeof(int *) * num_iters); - spec->revive_at = gpr_malloc(sizeof(int *) * num_iters); + spec->kill_at = static_cast<int **>(gpr_malloc(sizeof(int *) * num_iters)); + spec->revive_at = static_cast<int **>(gpr_malloc(sizeof(int *) * num_iters)); for (i = 0; i < num_iters; i++) { - spec->kill_at[i] = gpr_malloc(sizeof(int) * num_servers); - spec->revive_at[i] = gpr_malloc(sizeof(int) * num_servers); + spec->kill_at[i] = + static_cast<int *>(gpr_malloc(sizeof(int) * num_servers)); + spec->revive_at[i] = + static_cast<int *>(gpr_malloc(sizeof(int) * num_servers)); } test_spec_reset(spec); @@ -172,16 +174,20 @@ static void revive_server(const servers_fixture *f, request_data *rdata, static servers_fixture *setup_servers(const char *server_host, request_data *rdata, const size_t num_servers) { - servers_fixture *f = gpr_malloc(sizeof(servers_fixture)); + servers_fixture *f = + static_cast<servers_fixture *>(gpr_malloc(sizeof(servers_fixture))); size_t i; f->num_servers = num_servers; - f->server_calls = gpr_malloc(sizeof(grpc_call *) * num_servers); - f->request_metadata_recv = - gpr_malloc(sizeof(grpc_metadata_array) * num_servers); + f->server_calls = + static_cast<grpc_call **>(gpr_malloc(sizeof(grpc_call *) * num_servers)); + f->request_metadata_recv = static_cast<grpc_metadata_array *>( + gpr_malloc(sizeof(grpc_metadata_array) * num_servers)); /* Create servers. */ - f->servers = gpr_malloc(sizeof(grpc_server *) * num_servers); - f->servers_hostports = gpr_malloc(sizeof(char *) * num_servers); + f->servers = static_cast<grpc_server **>( + 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); for (i = 0; i < num_servers; i++) { @@ -226,8 +232,10 @@ static void teardown_servers(servers_fixture *f) { static request_sequences request_sequences_create(size_t n) { request_sequences res; res.n = n; - res.connections = gpr_malloc(sizeof(*res.connections) * n); - res.connectivity_states = gpr_malloc(sizeof(*res.connectivity_states) * n); + res.connections = + static_cast<int *>(gpr_malloc(sizeof(*res.connections) * n)); + res.connectivity_states = + static_cast<int *>(gpr_malloc(sizeof(*res.connectivity_states) * n)); memset(res.connections, 0, sizeof(*res.connections) * n); memset(res.connectivity_states, 0, sizeof(*res.connectivity_states) * n); return res; @@ -255,7 +263,7 @@ static request_sequences perform_request(servers_fixture *f, int completed_client; const request_sequences sequences = request_sequences_create(spec->num_iters); - s_valid = gpr_malloc(sizeof(int) * f->num_servers); + s_valid = static_cast<int *>(gpr_malloc(sizeof(int) * f->num_servers)); for (iter_num = 0; iter_num < spec->num_iters; iter_num++) { cq_verifier *cqv = cq_verifier_create(f->cq); @@ -426,7 +434,8 @@ static grpc_call **perform_multirequest(servers_fixture *f, grpc_op *op; size_t i; - calls = gpr_malloc(sizeof(grpc_call *) * concurrent_calls); + calls = static_cast<grpc_call **>( + gpr_malloc(sizeof(grpc_call *) * concurrent_calls)); for (i = 0; i < f->num_servers; i++) { kill_server(f, i); } @@ -465,8 +474,8 @@ void run_spec(const test_spec *spec) { servers_fixture *f; grpc_channel_args args; grpc_arg arg_array[2]; - rdata.call_details = - gpr_malloc(sizeof(grpc_call_details) * spec->num_servers); + rdata.call_details = static_cast<grpc_call_details *>( + gpr_malloc(sizeof(grpc_call_details) * spec->num_servers)); f = setup_servers("127.0.0.1", &rdata, spec->num_servers); /* Create client. */ @@ -475,11 +484,12 @@ void run_spec(const test_spec *spec) { gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str); arg_array[0].type = GRPC_ARG_INTEGER; - arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms"; + arg_array[0].key = + const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms"); arg_array[0].value.integer = RETRY_TIMEOUT; arg_array[1].type = GRPC_ARG_STRING; - arg_array[1].key = GRPC_ARG_LB_POLICY_NAME; - arg_array[1].value.string = "round_robin"; + arg_array[1].key = const_cast<char *>(GRPC_ARG_LB_POLICY_NAME); + arg_array[1].value.string = const_cast<char *>("round_robin"); args.num_args = 2; args.args = arg_array; @@ -513,13 +523,15 @@ static grpc_channel *create_client(const servers_fixture *f) { gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str); arg_array[0].type = GRPC_ARG_INTEGER; - arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms"; + arg_array[0].key = + const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms"); arg_array[0].value.integer = RETRY_TIMEOUT; arg_array[1].type = GRPC_ARG_STRING; - arg_array[1].key = GRPC_ARG_LB_POLICY_NAME; - arg_array[1].value.string = "ROUND_ROBIN"; + arg_array[1].key = const_cast<char *>(GRPC_ARG_LB_POLICY_NAME); + arg_array[1].value.string = const_cast<char *>("ROUND_ROBIN"); arg_array[2].type = GRPC_ARG_INTEGER; - arg_array[2].key = GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS; + arg_array[2].key = + const_cast<char *>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS); arg_array[2].value.integer = 0; args.num_args = GPR_ARRAY_SIZE(arg_array); args.args = arg_array; @@ -540,7 +552,8 @@ static void test_ping() { const size_t num_servers = 1; int i; - rdata.call_details = gpr_malloc(sizeof(grpc_call_details) * num_servers); + rdata.call_details = static_cast<grpc_call_details *>( + gpr_malloc(sizeof(grpc_call_details) * num_servers)); f = setup_servers("127.0.0.1", &rdata, num_servers); cqv = cq_verifier_create(f->cq); @@ -585,8 +598,8 @@ static void test_pending_calls(size_t concurrent_calls) { request_data rdata; servers_fixture *f; test_spec *spec = test_spec_create(0, 4); - rdata.call_details = - gpr_malloc(sizeof(grpc_call_details) * spec->num_servers); + rdata.call_details = static_cast<grpc_call_details *>( + gpr_malloc(sizeof(grpc_call_details) * spec->num_servers)); f = setup_servers("127.0.0.1", &rdata, spec->num_servers); client = create_client(f); @@ -626,7 +639,7 @@ static void test_get_channel_info() { gpr_free(lb_policy_name); // Request service config, which does not exist, so we'll get nothing back. memset(&channel_info, 0, sizeof(channel_info)); - char *service_config_json = "dummy_string"; + 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); @@ -634,8 +647,9 @@ static void test_get_channel_info() { grpc_channel_destroy(channel); grpc_arg arg; arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVICE_CONFIG; - arg.value.string = "{\"loadBalancingPolicy\": \"ROUND_ROBIN\"}"; + 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); { @@ -676,7 +690,7 @@ static void verify_vanilla_round_robin(const servers_fixture *f, /* verify conn. seq. expectation */ /* get the first sequence of "num_servers" elements */ int *expected_connection_sequence = - gpr_malloc(sizeof(int) * expected_seq_length); + static_cast<int *>(gpr_malloc(sizeof(int) * expected_seq_length)); memcpy(expected_connection_sequence, sequences->connections, sizeof(int) * expected_seq_length); @@ -695,7 +709,8 @@ static void verify_vanilla_round_robin(const servers_fixture *f, /* All servers are available, therefore all client subchannels are READY, even * when we only need one for the client channel state to be READY */ for (size_t i = 0; i < sequences->n; i++) { - const grpc_connectivity_state actual = sequences->connectivity_states[i]; + const grpc_connectivity_state actual = + static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]); const grpc_connectivity_state expected = GRPC_CHANNEL_READY; if (actual != expected) { gpr_log(GPR_ERROR, @@ -721,7 +736,8 @@ static void verify_vanishing_floor_round_robin( /* verify conn. seq. expectation */ /* copy the first full sequence (without -1s) */ - expected_connection_sequence = gpr_malloc(sizeof(int) * expected_seq_length); + expected_connection_sequence = + static_cast<int *>(gpr_malloc(sizeof(int) * expected_seq_length)); memcpy(expected_connection_sequence, sequences->connections + 2, expected_seq_length * sizeof(int)); @@ -750,7 +766,8 @@ static void verify_vanishing_floor_round_robin( /* There's always at least one subchannel READY (connected), therefore the * overall state of the client channel is READY at all times. */ for (i = 0; i < sequences->n; i++) { - const grpc_connectivity_state actual = sequences->connectivity_states[i]; + const grpc_connectivity_state actual = + static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]); const grpc_connectivity_state expected = GRPC_CHANNEL_READY; if (actual != expected) { gpr_log(GPR_ERROR, @@ -785,7 +802,8 @@ static void verify_total_carnage_round_robin(const servers_fixture *f, * Note that all other states (IDLE, CONNECTING, TRANSIENT_FAILURE) are still * possible, as the policy transitions while attempting to reconnect. */ for (size_t i = 0; i < sequences->n; i++) { - const grpc_connectivity_state actual = sequences->connectivity_states[i]; + const grpc_connectivity_state actual = + static_cast<grpc_connectivity_state>(sequences->connectivity_states[i]); if (actual == GRPC_CHANNEL_READY || actual == GRPC_CHANNEL_SHUTDOWN) { gpr_log(GPR_ERROR, "CONNECTIVITY STATUS SEQUENCE FAILURE: got unexpected state " @@ -805,7 +823,8 @@ static void verify_partial_carnage_round_robin( /* verify conn. seq. expectation */ /* get the first sequence of "num_servers" elements */ - expected_connection_sequence = gpr_malloc(sizeof(int) * expected_seq_length); + expected_connection_sequence = + static_cast<int *>(gpr_malloc(sizeof(int) * expected_seq_length)); memcpy(expected_connection_sequence, sequences->connections, sizeof(int) * expected_seq_length); @@ -827,7 +846,8 @@ static void verify_partial_carnage_round_robin( /* We can assert that the first client channel state should be READY, when all * servers were available */ - grpc_connectivity_state actual = sequences->connectivity_states[0]; + grpc_connectivity_state actual = + static_cast<grpc_connectivity_state>(sequences->connectivity_states[0]); grpc_connectivity_state expected = GRPC_CHANNEL_READY; if (actual != expected) { gpr_log(GPR_ERROR, @@ -841,7 +861,8 @@ static void verify_partial_carnage_round_robin( /* ... and that the last one shouldn't be READY (or SHUTDOWN): all servers are * gone. It may be all other states (IDLE, CONNECTING, TRANSIENT_FAILURE), as * the policy transitions while attempting to reconnect. */ - actual = sequences->connectivity_states[num_iters - 1]; + actual = static_cast<grpc_connectivity_state>( + sequences->connectivity_states[num_iters - 1]); for (i = 0; i < sequences->n; i++) { if (actual == GRPC_CHANNEL_READY || actual == GRPC_CHANNEL_SHUTDOWN) { gpr_log(GPR_ERROR, @@ -894,7 +915,8 @@ static void verify_rebirth_round_robin(const servers_fixture *f, /* We can assert that the first client channel state should be READY, when all * servers were available; same thing for the last one. In the middle * somewhere there must exist at least one TRANSIENT_FAILURE */ - grpc_connectivity_state actual = sequences->connectivity_states[0]; + grpc_connectivity_state actual = + static_cast<grpc_connectivity_state>(sequences->connectivity_states[0]); grpc_connectivity_state expected = GRPC_CHANNEL_READY; if (actual != expected) { gpr_log(GPR_ERROR, @@ -905,7 +927,8 @@ static void verify_rebirth_round_robin(const servers_fixture *f, abort(); } - actual = sequences->connectivity_states[num_iters - 1]; + actual = static_cast<grpc_connectivity_state>( + sequences->connectivity_states[num_iters - 1]); expected = GRPC_CHANNEL_READY; if (actual != expected) { gpr_log(GPR_ERROR, @@ -931,7 +954,8 @@ static void verify_rebirth_round_robin(const servers_fixture *f, "instead:"); for (size_t i = 0; i < num_iters; i++) { gpr_log(GPR_ERROR, "[%d]: %s", (int)i, - grpc_connectivity_state_name(sequences->connectivity_states[i])); + grpc_connectivity_state_name(static_cast<grpc_connectivity_state>( + sequences->connectivity_states[i]))); } } } diff --git a/test/core/client_channel/parse_address_test.c b/test/core/client_channel/parse_address_test.cc index d011176869..d011176869 100644 --- a/test/core/client_channel/parse_address_test.c +++ b/test/core/client_channel/parse_address_test.cc diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc index 4597285063..4dfee8cf90 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.c +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc @@ -49,9 +49,11 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure"); } else { gpr_mu_unlock(&g_mu); - *addrs = gpr_malloc(sizeof(**addrs)); + *addrs = + static_cast<grpc_resolved_addresses *>(gpr_malloc(sizeof(**addrs))); (*addrs)->naddrs = 1; - (*addrs)->addrs = gpr_malloc(sizeof(*(*addrs)->addrs)); + (*addrs)->addrs = static_cast<grpc_resolved_address *>( + gpr_malloc(sizeof(*(*addrs)->addrs))); (*addrs)->addrs[0].len = 123; } GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); @@ -95,7 +97,7 @@ static grpc_resolver *create_resolver(grpc_exec_ctx *exec_ctx, } static void on_done(grpc_exec_ctx *exec_ctx, void *ev, grpc_error *error) { - gpr_event_set(ev, (void *)1); + gpr_event_set((gpr_event *)ev, (void *)1); } // interleave waiting for an event with a timer check @@ -121,7 +123,7 @@ typedef struct next_args { static void call_resolver_next_now_lock_taken(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error_unused) { - next_args *a = arg; + next_args *a = static_cast<next_args *>(arg); grpc_resolver_next_locked(exec_ctx, a->resolver, a->result, a->on_complete); gpr_free(a); } @@ -130,7 +132,7 @@ static void call_resolver_next_after_locking(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver, grpc_channel_args **result, grpc_closure *on_complete) { - next_args *a = gpr_malloc(sizeof(*a)); + next_args *a = static_cast<next_args *>(gpr_malloc(sizeof(*a))); a->resolver = resolver; a->result = result; a->on_complete = on_complete; diff --git a/test/core/client_channel/resolvers/dns_resolver_test.c b/test/core/client_channel/resolvers/dns_resolver_test.cc index a14926f173..a14926f173 100644 --- a/test/core/client_channel/resolvers/dns_resolver_test.c +++ b/test/core/client_channel/resolvers/dns_resolver_test.cc diff --git a/test/core/client_channel/resolvers/fake_resolver_test.c b/test/core/client_channel/resolvers/fake_resolver_test.cc index 9b0854d6d8..ed14151ae3 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.c +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -56,7 +56,7 @@ typedef struct on_resolution_arg { } on_resolution_arg; void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - on_resolution_arg *res = arg; + on_resolution_arg *res = static_cast<on_resolution_arg *>(arg); // We only check the addresses channel arg because that's the only one // explicitly set by the test via // grpc_fake_resolver_response_generator_set_response. @@ -84,7 +84,7 @@ static void test_fake_resolver() { // 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)}; - char *balancer_names[] = {"name1", "name2"}; + const char *balancer_names[] = {"name1", "name2"}; const bool is_balancer[] = {true, false}; grpc_lb_addresses *addresses = grpc_lb_addresses_create(3, NULL); for (size_t i = 0; i < GPR_ARRAY_SIZE(uris); ++i) { @@ -117,7 +117,7 @@ static void test_fake_resolver() { // Setup update. grpc_uri *uris_update[] = { grpc_uri_parse(&exec_ctx, "ipv4:192.168.1.0:31416", true)}; - char *balancer_names_update[] = {"name3"}; + const char *balancer_names_update[] = {"name3"}; const bool is_balancer_update[] = {false}; grpc_lb_addresses *addresses_update = grpc_lb_addresses_create(1, NULL); for (size_t i = 0; i < GPR_ARRAY_SIZE(uris_update); ++i) { diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.c b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc index 8b88619164..254ce59bc2 100644 --- a/test/core/client_channel/resolvers/sockaddr_resolver_test.c +++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc @@ -36,7 +36,7 @@ typedef struct on_resolution_arg { } on_resolution_arg; void on_resolution_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - on_resolution_arg *res = arg; + on_resolution_arg *res = static_cast<on_resolution_arg *>(arg); grpc_channel_args_destroy(exec_ctx, res->resolver_result); } diff --git a/test/core/client_channel/uri_fuzzer_test.c b/test/core/client_channel/uri_fuzzer_test.cc index e51d0031ec..8c071454bc 100644 --- a/test/core/client_channel/uri_fuzzer_test.c +++ b/test/core/client_channel/uri_fuzzer_test.cc @@ -29,7 +29,7 @@ bool squelch = true; bool leak_check = true; int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - char *s = gpr_malloc(size + 1); + char *s = static_cast<char *>(gpr_malloc(size + 1)); memcpy(s, data, size); s[size] = 0; diff --git a/test/core/client_channel/uri_parser_test.c b/test/core/client_channel/uri_parser_test.cc index f53cae196b..f53cae196b 100644 --- a/test/core/client_channel/uri_parser_test.c +++ b/test/core/client_channel/uri_parser_test.cc diff --git a/test/core/compression/algorithm_test.c b/test/core/compression/algorithm_test.cc index a11e6e90ac..4ca979e30f 100644 --- a/test/core/compression/algorithm_test.c +++ b/test/core/compression/algorithm_test.cc @@ -69,8 +69,10 @@ static void test_algorithm_failure(void) { GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT, NULL) == 0); - GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT + 1, - NULL) == 0); + GPR_ASSERT( + grpc_compression_algorithm_name(static_cast<grpc_compression_algorithm>( + GRPC_COMPRESS_ALGORITHMS_COUNT + 1), + NULL) == 0); mdstr = grpc_slice_from_static_string("this-is-an-invalid-algorithm"); GPR_ASSERT(grpc_compression_algorithm_from_slice(mdstr) == GRPC_COMPRESS_ALGORITHMS_COUNT); @@ -78,7 +80,8 @@ static void test_algorithm_failure(void) { grpc_compression_algorithm_slice(GRPC_COMPRESS_ALGORITHMS_COUNT), grpc_empty_slice())); GPR_ASSERT(grpc_slice_eq( - grpc_compression_algorithm_slice(GRPC_COMPRESS_ALGORITHMS_COUNT + 1), + grpc_compression_algorithm_slice(static_cast<grpc_compression_algorithm>( + static_cast<int>(GRPC_COMPRESS_ALGORITHMS_COUNT) + 1)), grpc_empty_slice())); grpc_slice_unref_internal(&exec_ctx, mdstr); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/compression/compression_test.c b/test/core/compression/compression_test.cc index 326a800300..f4fa3a8d63 100644 --- a/test/core/compression/compression_test.c +++ b/test/core/compression/compression_test.cc @@ -181,21 +181,27 @@ static void test_compression_enable_disable_algorithm(void) { grpc_compression_options_init(&options); for (algorithm = GRPC_COMPRESS_NONE; - algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) { + algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; + algorithm = static_cast<grpc_compression_algorithm>( + static_cast<int>(algorithm) + 1)) { /* all algorithms are enabled by default */ GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options, algorithm) != 0); } /* disable one by one */ for (algorithm = GRPC_COMPRESS_NONE; - algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) { + algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; + algorithm = static_cast<grpc_compression_algorithm>( + static_cast<int>(algorithm) + 1)) { grpc_compression_options_disable_algorithm(&options, algorithm); GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options, algorithm) == 0); } /* re-enable one by one */ for (algorithm = GRPC_COMPRESS_NONE; - algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; algorithm++) { + algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT; + algorithm = static_cast<grpc_compression_algorithm>( + static_cast<int>(algorithm) + 1)) { grpc_compression_options_enable_algorithm(&options, algorithm); GPR_ASSERT(grpc_compression_options_is_algorithm_enabled(&options, algorithm) != 0); diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.cc index f7f4893dee..1395d42739 100644 --- a/test/core/compression/message_compress_test.c +++ b/test/core/compression/message_compress_test.cc @@ -148,16 +148,17 @@ static grpc_slice create_test_value(test_value id) { static void test_tiny_data_compress(void) { grpc_slice_buffer input; grpc_slice_buffer output; - grpc_compression_algorithm i; grpc_slice_buffer_init(&input); grpc_slice_buffer_init(&output); grpc_slice_buffer_add(&input, create_test_value(ONE_A)); - for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) { + for (int i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) { if (i == GRPC_COMPRESS_NONE) continue; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GPR_ASSERT(0 == grpc_msg_compress(&exec_ctx, i, &input, &output)); + GPR_ASSERT(0 == grpc_msg_compress( + &exec_ctx, static_cast<grpc_compression_algorithm>(i), + &input, &output)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(1 == output.count); } @@ -252,8 +253,10 @@ static void test_bad_compression_algorithm(void) { &input, &output); GPR_ASSERT(0 == was_compressed); - was_compressed = grpc_msg_compress( - &exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output); + was_compressed = + grpc_msg_compress(&exec_ctx, static_cast<grpc_compression_algorithm>( + GRPC_COMPRESS_ALGORITHMS_COUNT + 123), + &input, &output); GPR_ASSERT(0 == was_compressed); grpc_exec_ctx_finish(&exec_ctx); @@ -276,8 +279,10 @@ static void test_bad_decompression_algorithm(void) { &exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output); GPR_ASSERT(0 == was_decompressed); - was_decompressed = grpc_msg_decompress( - &exec_ctx, GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output); + was_decompressed = + grpc_msg_decompress(&exec_ctx, static_cast<grpc_compression_algorithm>( + GRPC_COMPRESS_ALGORITHMS_COUNT + 123), + &input, &output); GPR_ASSERT(0 == was_decompressed); grpc_exec_ctx_finish(&exec_ctx); @@ -300,8 +305,13 @@ int main(int argc, char **argv) { for (j = 0; j < GPR_ARRAY_SIZE(uncompressed_split_modes); j++) { for (k = 0; k < GPR_ARRAY_SIZE(compressed_split_modes); k++) { for (m = 0; m < TEST_VALUE_COUNT; m++) { - grpc_slice slice = create_test_value(m); - assert_passthrough(slice, i, j, k, get_compressability(m, i)); + grpc_slice slice = create_test_value(static_cast<test_value>(m)); + assert_passthrough( + slice, static_cast<grpc_compression_algorithm>(i), + static_cast<grpc_slice_split_mode>(j), + static_cast<grpc_slice_split_mode>(k), + get_compressability(static_cast<test_value>(m), + static_cast<grpc_compression_algorithm>(i))); grpc_slice_unref(slice); } } diff --git a/test/core/compression/stream_compression_test.c b/test/core/compression/stream_compression_test.cc index afed6cd6b5..d136408710 100644 --- a/test/core/compression/stream_compression_test.c +++ b/test/core/compression/stream_compression_test.cc @@ -134,7 +134,8 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint() #define LARGE_DATA_SIZE (1024 * 1024) static void test_stream_compression_simple_compress_decompress_with_large_data() { - char *test_str = gpr_malloc(LARGE_DATA_SIZE * sizeof(char)); + char *test_str = + static_cast<char *>(gpr_malloc(LARGE_DATA_SIZE * sizeof(char))); generate_random_payload(test_str, LARGE_DATA_SIZE); grpc_slice_buffer source, relay, sink; grpc_slice_buffer_init(&source); diff --git a/test/core/end2end/BUILD b/test/core/end2end/BUILD index 49bfc43646..1589880e1f 100644 --- a/test/core/end2end/BUILD +++ b/test/core/end2end/BUILD @@ -22,7 +22,7 @@ load(":generate_tests.bzl", "grpc_end2end_tests") grpc_cc_library( name = "cq_verifier", - srcs = ["cq_verifier.c"], + srcs = ["cq_verifier.cc"], hdrs = ["cq_verifier.h"], language = "C", visibility = ["//test:__subpackages__"], @@ -36,9 +36,9 @@ grpc_cc_library( grpc_cc_library( name = "ssl_test_data", srcs = [ - "data/client_certs.c", - "data/server1_cert.c", - "data/server1_key.c", + "data/client_certs.cc", + "data/server1_cert.cc", + "data/server1_key.cc", "data/test_root_cert.c", ], hdrs = ["data/ssl_test_data.h"], @@ -49,7 +49,7 @@ grpc_cc_library( grpc_cc_library( name = "http_proxy", - srcs = ["fixtures/http_proxy_fixture.c"], + srcs = ["fixtures/http_proxy_fixture.cc"], hdrs = ["fixtures/http_proxy_fixture.h"], language = "C", deps = [ @@ -61,7 +61,7 @@ grpc_cc_library( grpc_cc_library( name = "proxy", - srcs = ["fixtures/proxy.c"], + srcs = ["fixtures/proxy.cc"], hdrs = ["fixtures/proxy.h"], language = "C", deps = [ diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.cc index 2070fa5b02..2070fa5b02 100644 --- a/test/core/end2end/bad_server_response_test.c +++ b/test/core/end2end/bad_server_response_test.cc diff --git a/test/core/end2end/connection_refused_test.c b/test/core/end2end/connection_refused_test.cc index 40227dece4..b295682ce8 100644 --- a/test/core/end2end/connection_refused_test.c +++ b/test/core/end2end/connection_refused_test.cc @@ -62,8 +62,8 @@ static void run_test(bool wait_for_ready, bool use_service_config) { GPR_ASSERT(wait_for_ready); grpc_arg arg; arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVICE_CONFIG; - arg.value.string = + arg.key = const_cast<char *>(GRPC_ARG_SERVICE_CONFIG); + arg.value.string = const_cast<char *>( "{\n" " \"methodConfig\": [ {\n" " \"name\": [\n" @@ -71,7 +71,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { " ],\n" " \"waitForReady\": true\n" " } ]\n" - "}"; + "}"); args = grpc_channel_args_copy_and_add(args, &arg, 1); } diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.cc index bb978923b2..bb978923b2 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.cc diff --git a/test/core/end2end/cq_verifier_native.c b/test/core/end2end/cq_verifier_native.cc index f19b15c465..f19b15c465 100644 --- a/test/core/end2end/cq_verifier_native.c +++ b/test/core/end2end/cq_verifier_native.cc diff --git a/test/core/end2end/cq_verifier_uv.c b/test/core/end2end/cq_verifier_uv.cc index fc873b784f..fc873b784f 100644 --- a/test/core/end2end/cq_verifier_uv.c +++ b/test/core/end2end/cq_verifier_uv.cc diff --git a/test/core/end2end/data/client_certs.c b/test/core/end2end/data/client_certs.cc index 78770674c4..6e61501234 100644 --- a/test/core/end2end/data/client_certs.c +++ b/test/core/end2end/data/client_certs.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_self_signed_client_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, diff --git a/test/core/end2end/data/server1_cert.c b/test/core/end2end/data/server1_cert.cc index 8d149607b6..5e017c4da7 100644 --- a/test/core/end2end/data/server1_cert.c +++ b/test/core/end2end/data/server1_cert.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_server1_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, diff --git a/test/core/end2end/data/server1_key.c b/test/core/end2end/data/server1_key.cc index eee5cc6d82..92a77aa21f 100644 --- a/test/core/end2end/data/server1_key.c +++ b/test/core/end2end/data/server1_key.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_server1_key[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x20, 0x4b, diff --git a/test/core/end2end/data/ssl_test_data.h b/test/core/end2end/data/ssl_test_data.h index e9c7dbceb2..303f3a6eda 100644 --- a/test/core/end2end/data/ssl_test_data.h +++ b/test/core/end2end/data/ssl_test_data.h @@ -19,10 +19,6 @@ #ifndef GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H #define GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H -#ifdef __cplusplus -extern "C" { -#endif - extern const char test_root_cert[]; extern const char test_server1_cert[]; extern const char test_server1_key[]; @@ -31,8 +27,4 @@ extern const char test_self_signed_client_key[]; extern const char test_signed_client_cert[]; extern const char test_signed_client_key[]; -#ifdef __cplusplus -} -#endif - #endif /* GRPC_TEST_CORE_END2END_DATA_SSL_TEST_DATA_H */ diff --git a/test/core/end2end/data/test_root_cert.c b/test/core/end2end/data/test_root_cert.cc index ef39ca56ab..81ca410e14 100644 --- a/test/core/end2end/data/test_root_cert.c +++ b/test/core/end2end/data/test_root_cert.cc @@ -16,6 +16,8 @@ * */ +#include "test/core/end2end/data/ssl_test_data.h" + const char test_root_cert[] = { 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.cc index f9150f145a..bfb2e227ac 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.cc @@ -118,7 +118,8 @@ void test_connect(const char *server_host, const char *client_host, int port, grpc_slice_new((char *)client_host, strlen(client_host), do_nothing); grpc_slice_buffer_init(&uri_parts); grpc_slice_split(uri_slice, ",", &uri_parts); - hosts_with_port = gpr_malloc(sizeof(char *) * uri_parts.count); + hosts_with_port = + static_cast<char **>(gpr_malloc(sizeof(char *) * uri_parts.count)); for (i = 0; i < uri_parts.count; i++) { char *uri_part_str = grpc_slice_to_c_string(uri_parts.slices[i]); gpr_asprintf(&hosts_with_port[i], "%s:%d", uri_part_str, port); diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.cc index 3236feea56..3236feea56 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.cc diff --git a/test/core/end2end/end2end_test_utils.c b/test/core/end2end/end2end_test_utils.cc index c1f119548a..c1f119548a 100644 --- a/test/core/end2end/end2end_test_utils.c +++ b/test/core/end2end/end2end_test_utils.cc diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.cc index ca9443b642..ca9443b642 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.cc diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.cc index 9870ccb34a..d7058187b4 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.cc @@ -44,7 +44,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -59,14 +60,15 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( static grpc_arg make_census_enable_arg(void) { grpc_arg arg; arg.type = GRPC_ARG_INTEGER; - arg.key = GRPC_ARG_ENABLE_CENSUS; + arg.key = const_cast<char *>(GRPC_ARG_ENABLE_CENSUS); arg.value.integer = 1; return arg; } void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + 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); @@ -80,7 +82,8 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); grpc_arg arg = make_census_enable_arg(); if (f->server) { grpc_server_destroy(f->server); @@ -98,7 +101,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.cc index 9866dea7eb..bdfeef259d 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.cc @@ -47,7 +47,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression( grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); fullstack_compression_fixture_data *ffd = - gpr_malloc(sizeof(fullstack_compression_fixture_data)); + static_cast<fullstack_compression_fixture_data *>( + gpr_malloc(sizeof(fullstack_compression_fixture_data))); memset(ffd, 0, sizeof(fullstack_compression_fixture_data)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -62,7 +63,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression( void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_compression_fixture_data *ffd = f->fixture_data; + fullstack_compression_fixture_data *ffd = + static_cast<fullstack_compression_fixture_data *>(f->fixture_data); if (ffd->client_args_compression != NULL) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression); @@ -76,7 +78,8 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture *f, void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_compression_fixture_data *ffd = f->fixture_data; + fullstack_compression_fixture_data *ffd = + static_cast<fullstack_compression_fixture_data *>(f->fixture_data); if (ffd->server_args_compression != NULL) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression); @@ -95,7 +98,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture *f, void chttp2_tear_down_fullstack_compression(grpc_end2end_test_fixture *f) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - fullstack_compression_fixture_data *ffd = f->fixture_data; + fullstack_compression_fixture_data *ffd = + static_cast<fullstack_compression_fixture_data *>(f->fixture_data); grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression); grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression); gpr_free(ffd->localaddr); diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.cc index e622d952be..7cbcfcca91 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.cc @@ -39,7 +39,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); fullstack_secure_fixture_data *ffd = - gpr_malloc(sizeof(fullstack_secure_fixture_data)); + static_cast<fullstack_secure_fixture_data *>( + gpr_malloc(sizeof(fullstack_secure_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -62,7 +63,8 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx, static void chttp2_init_client_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *client_args, grpc_channel_credentials *creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + 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); @@ -72,7 +74,8 @@ static void chttp2_init_client_secure_fullstack( static void chttp2_init_server_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *server_args, grpc_server_credentials *server_creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -85,7 +88,8 @@ static void chttp2_init_server_secure_fullstack( } void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_fd.c b/test/core/end2end/fixtures/h2_fd.cc index e82c120221..2dc7898d56 100644 --- a/test/core/end2end/fixtures/h2_fd.c +++ b/test/core/end2end/fixtures/h2_fd.cc @@ -50,7 +50,8 @@ static void create_sockets(int sv[2]) { static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_channel_args *client_args, grpc_channel_args *server_args) { - sp_fixture_data *fixture_data = gpr_malloc(sizeof(*fixture_data)); + sp_fixture_data *fixture_data = + static_cast<sp_fixture_data *>(gpr_malloc(sizeof(*fixture_data))); grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); @@ -66,7 +67,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - sp_fixture_data *sfd = f->fixture_data; + sp_fixture_data *sfd = static_cast<sp_fixture_data *>(f->fixture_data); GPR_ASSERT(!f->client); f->client = grpc_insecure_channel_create_from_fd( @@ -79,7 +80,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - sp_fixture_data *sfd = f->fixture_data; + sp_fixture_data *sfd = static_cast<sp_fixture_data *>(f->fixture_data); GPR_ASSERT(!f->server); f->server = grpc_server_create(server_args, NULL); GPR_ASSERT(f->server); diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.cc index c764bd704a..beff1be239 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.cc @@ -49,7 +49,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -63,14 +64,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); GPR_ASSERT(f->client); } void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -81,7 +84,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.cc index 7eb29e0d32..efed0c536f 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.cc @@ -49,7 +49,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -63,14 +64,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); GPR_ASSERT(f->client); } void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -81,7 +84,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_full+workarounds.c b/test/core/end2end/fixtures/h2_full+workarounds.cc index a98e5ad57f..d4930ce90d 100644 --- a/test/core/end2end/fixtures/h2_full+workarounds.c +++ b/test/core/end2end/fixtures/h2_full+workarounds.cc @@ -37,7 +37,7 @@ #include "test/core/util/test_config.h" static char *workarounds_arg[GRPC_MAX_WORKAROUND_ID] = { - GRPC_ARG_WORKAROUND_CRONET_COMPRESSION}; + const_cast<char *>(GRPC_ARG_WORKAROUND_CRONET_COMPRESSION)}; typedef struct fullstack_fixture_data { char *localaddr; @@ -47,7 +47,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -61,7 +62,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); GPR_ASSERT(f->client); } @@ -70,7 +72,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { int i; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); grpc_arg args[GRPC_MAX_WORKAROUND_ID]; for (i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) { args[i].key = workarounds_arg[i]; @@ -91,7 +94,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.cc index ae68bd9698..d132198157 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.cc @@ -43,7 +43,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -57,14 +58,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); GPR_ASSERT(f->client); } void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -75,7 +78,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_http_proxy.c b/test/core/end2end/fixtures/h2_http_proxy.cc index 6145892365..5630b491b0 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.c +++ b/test/core/end2end/fixtures/h2_http_proxy.cc @@ -47,7 +47,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); const int server_port = grpc_pick_unused_port_or_die(); gpr_join_host_port(&ffd->server_addr, "localhost", server_port); @@ -64,7 +65,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); char *proxy_uri; /* If testing for proxy auth, add credentials to proxy uri */ @@ -85,7 +87,8 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -96,7 +99,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); gpr_free(ffd->server_addr); grpc_end2end_http_proxy_destroy(ffd->proxy); gpr_free(ffd); diff --git a/test/core/end2end/fixtures/h2_load_reporting.c b/test/core/end2end/fixtures/h2_load_reporting.cc index 8a05bb722a..e461f13e06 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.c +++ b/test/core/end2end/fixtures/h2_load_reporting.cc @@ -45,8 +45,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); - load_reporting_fixture_data *ffd = - gpr_malloc(sizeof(load_reporting_fixture_data)); + load_reporting_fixture_data *ffd = static_cast<load_reporting_fixture_data *>( + gpr_malloc(sizeof(load_reporting_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -60,14 +60,16 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting( void chttp2_init_client_load_reporting(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - load_reporting_fixture_data *ffd = f->fixture_data; + 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); GPR_ASSERT(f->client); } void chttp2_init_server_load_reporting(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - load_reporting_fixture_data *ffd = f->fixture_data; + load_reporting_fixture_data *ffd = + static_cast<load_reporting_fixture_data *>(f->fixture_data); grpc_arg arg = grpc_load_reporting_enable_arg(); if (f->server) { grpc_server_destroy(f->server); @@ -85,7 +87,8 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture *f, } void chttp2_tear_down_load_reporting(grpc_end2end_test_fixture *f) { - load_reporting_fixture_data *ffd = f->fixture_data; + load_reporting_fixture_data *ffd = + static_cast<load_reporting_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.cc index ee1d0b1416..f1e49f20cd 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.cc @@ -92,7 +92,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); fullstack_secure_fixture_data *ffd = - gpr_malloc(sizeof(fullstack_secure_fixture_data)); + static_cast<fullstack_secure_fixture_data *>( + gpr_malloc(sizeof(fullstack_secure_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -107,7 +108,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( static void chttp2_init_client_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *client_args, grpc_channel_credentials *creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + 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); @@ -117,7 +119,8 @@ static void chttp2_init_client_secure_fullstack( static void chttp2_init_server_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *server_args, grpc_server_credentials *server_creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -130,7 +133,8 @@ static void chttp2_init_server_secure_fullstack( } void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } @@ -144,9 +148,10 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack( &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_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args *new_client_args = grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); chttp2_init_client_secure_fullstack(f, new_client_args, ssl_oauth2_creds); @@ -175,7 +180,8 @@ static void processor_destroy(void *state) { } static grpc_auth_metadata_processor test_processor_create(int failing) { - test_processor_state *s = gpr_malloc(sizeof(*s)); + test_processor_state *s = + static_cast<test_processor_state *>(gpr_malloc(sizeof(*s))); grpc_auth_metadata_processor result; s->pseudo_refcount = 1; result.state = s; diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.cc index 069130baf4..e1eb9687d0 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.cc @@ -58,7 +58,8 @@ static const grpc_end2end_proxy_def proxy_def = {create_proxy_server, static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); memset(&f, 0, sizeof(f)); ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); @@ -72,7 +73,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + 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); GPR_ASSERT(f->client); @@ -80,7 +82,8 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -92,7 +95,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); grpc_end2end_proxy_destroy(ffd->proxy); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.cc index 39ccb84b52..81d0768969 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc @@ -49,9 +49,9 @@ connected_channel without a client_channel */ static void server_setup_transport(void *ts, grpc_transport *transport) { - grpc_end2end_test_fixture *f = ts; + grpc_end2end_test_fixture *f = static_cast<grpc_end2end_test_fixture *>(ts); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + 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_get_channel_args(f->server)); @@ -65,7 +65,7 @@ typedef struct { static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts, grpc_transport *transport) { - sp_client_setup *cs = ts; + sp_client_setup *cs = static_cast<sp_client_setup *>(ts); cs->f->client = grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args, @@ -74,7 +74,8 @@ static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts, static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_channel_args *client_args, grpc_channel_args *server_args) { - grpc_endpoint_pair *sfd = gpr_malloc(sizeof(grpc_endpoint_pair)); + grpc_endpoint_pair *sfd = + static_cast<grpc_endpoint_pair *>(gpr_malloc(sizeof(grpc_endpoint_pair))); grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); @@ -90,7 +91,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data); grpc_transport *transport; sp_client_setup cs; cs.client_args = client_args; @@ -106,7 +107,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + 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); diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.cc index 03566ead9b..78b5ad8877 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.cc @@ -43,9 +43,9 @@ connected_channel without a client_channel */ static void server_setup_transport(void *ts, grpc_transport *transport) { - grpc_end2end_test_fixture *f = ts; + grpc_end2end_test_fixture *f = static_cast<grpc_end2end_test_fixture *>(ts); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + 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_get_channel_args(f->server)); @@ -59,7 +59,7 @@ typedef struct { static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts, grpc_transport *transport) { - sp_client_setup *cs = ts; + sp_client_setup *cs = static_cast<sp_client_setup *>(ts); cs->f->client = grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args, @@ -68,7 +68,8 @@ static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts, static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_channel_args *client_args, grpc_channel_args *server_args) { - grpc_endpoint_pair *sfd = gpr_malloc(sizeof(grpc_endpoint_pair)); + grpc_endpoint_pair *sfd = + static_cast<grpc_endpoint_pair *>(gpr_malloc(sizeof(grpc_endpoint_pair))); grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); @@ -84,7 +85,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data); grpc_transport *transport; sp_client_setup cs; cs.client_args = client_args; @@ -100,7 +101,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + 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); diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.cc index c75a3876d5..b144771f2a 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc @@ -43,9 +43,9 @@ connected_channel without a client_channel */ static void server_setup_transport(void *ts, grpc_transport *transport) { - grpc_end2end_test_fixture *f = ts; + grpc_end2end_test_fixture *f = static_cast<grpc_end2end_test_fixture *>(ts); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + 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_get_channel_args(f->server)); @@ -59,7 +59,7 @@ typedef struct { static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts, grpc_transport *transport) { - sp_client_setup *cs = ts; + sp_client_setup *cs = static_cast<sp_client_setup *>(ts); cs->f->client = grpc_channel_create(exec_ctx, "socketpair-target", cs->client_args, @@ -68,7 +68,8 @@ static void client_setup_transport(grpc_exec_ctx *exec_ctx, void *ts, static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_channel_args *client_args, grpc_channel_args *server_args) { - grpc_endpoint_pair *sfd = gpr_malloc(sizeof(grpc_endpoint_pair)); + grpc_endpoint_pair *sfd = + static_cast<grpc_endpoint_pair *>(gpr_malloc(sizeof(grpc_endpoint_pair))); grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); @@ -76,16 +77,17 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( f.cq = grpc_completion_queue_create_for_next(NULL); f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = 1}, - {.key = GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = 1}, - {.key = GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = 1}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[3]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = 1; + a[1].key = const_cast<char *>(GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE); + a[1].type = GRPC_ARG_INTEGER; + a[1].value.integer = 1; + a[2].key = const_cast<char *>(GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE); + a[2].type = GRPC_ARG_INTEGER; + a[2].value.integer = 1; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; *sfd = grpc_iomgr_create_endpoint_pair("fixture", &args); return f; @@ -94,7 +96,7 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + grpc_endpoint_pair *sfd = static_cast<grpc_endpoint_pair *>(f->fixture_data); grpc_transport *transport; sp_client_setup cs; cs.client_args = client_args; @@ -110,7 +112,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture *f, static void chttp2_init_server_socketpair(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_endpoint_pair *sfd = f->fixture_data; + 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); diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.cc index 0bac464e69..045a8b7f05 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.cc @@ -43,7 +43,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( grpc_end2end_test_fixture f; int port = grpc_pick_unused_port_or_die(); fullstack_secure_fixture_data *ffd = - gpr_malloc(sizeof(fullstack_secure_fixture_data)); + static_cast<fullstack_secure_fixture_data *>( + gpr_malloc(sizeof(fullstack_secure_fixture_data))); memset(&f, 0, sizeof(f)); gpr_join_host_port(&ffd->localaddr, "localhost", port); @@ -66,7 +67,8 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx, static void chttp2_init_client_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *client_args, grpc_channel_credentials *creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + 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); @@ -76,7 +78,8 @@ static void chttp2_init_client_secure_fullstack( static void chttp2_init_server_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *server_args, grpc_server_credentials *server_creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -89,7 +92,8 @@ static void chttp2_init_server_secure_fullstack( } void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } @@ -98,9 +102,10 @@ 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_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args *new_client_args = grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds); diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.cc index 8bc7183510..b9b68c8780 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc @@ -56,9 +56,10 @@ static grpc_channel *create_proxy_client(const char *target, grpc_channel *channel; grpc_channel_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL, NULL); - grpc_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args *new_client_args = grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); channel = @@ -79,7 +80,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; fullstack_secure_fixture_data *ffd = - gpr_malloc(sizeof(fullstack_secure_fixture_data)); + static_cast<fullstack_secure_fixture_data *>( + gpr_malloc(sizeof(fullstack_secure_fixture_data))); memset(&f, 0, sizeof(f)); ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); @@ -102,7 +104,8 @@ static void process_auth_failure(void *state, grpc_auth_context *ctx, static void chttp2_init_client_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *client_args, grpc_channel_credentials *creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + 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); @@ -113,7 +116,8 @@ static void chttp2_init_client_secure_fullstack( static void chttp2_init_server_secure_fullstack( grpc_end2end_test_fixture *f, grpc_channel_args *server_args, grpc_server_credentials *server_creds) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -126,7 +130,8 @@ static void chttp2_init_server_secure_fullstack( } void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture *f) { - fullstack_secure_fixture_data *ffd = f->fixture_data; + fullstack_secure_fixture_data *ffd = + static_cast<fullstack_secure_fixture_data *>(f->fixture_data); grpc_end2end_proxy_destroy(ffd->proxy); gpr_free(ffd); } @@ -135,9 +140,10 @@ 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_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args *new_client_args = grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); chttp2_init_client_secure_fullstack(f, new_client_args, ssl_creds); diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.cc index 05a31985e7..f9336b5edc 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.cc @@ -48,7 +48,8 @@ static int unique = 1; static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; - fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); + fullstack_fixture_data *ffd = static_cast<fullstack_fixture_data *>( + gpr_malloc(sizeof(fullstack_fixture_data))); memset(&f, 0, sizeof(f)); gpr_asprintf(&ffd->localaddr, "unix:/tmp/grpc_fullstack_test.%d.%d", getpid(), @@ -63,13 +64,15 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *client_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); } void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, grpc_channel_args *server_args) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); if (f->server) { grpc_server_destroy(f->server); } @@ -80,7 +83,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, } void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { - fullstack_fixture_data *ffd = f->fixture_data; + fullstack_fixture_data *ffd = + static_cast<fullstack_fixture_data *>(f->fixture_data); gpr_free(ffd->localaddr); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/http_proxy_fixture.c b/test/core/end2end/fixtures/http_proxy_fixture.cc index d29401fdc3..d29401fdc3 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.c +++ b/test/core/end2end/fixtures/http_proxy_fixture.cc diff --git a/test/core/end2end/fixtures/inproc.c b/test/core/end2end/fixtures/inproc.cc index 6f742f0293..c075dc629f 100644 --- a/test/core/end2end/fixtures/inproc.c +++ b/test/core/end2end/fixtures/inproc.cc @@ -42,7 +42,8 @@ typedef struct inproc_fixture_data { static grpc_end2end_test_fixture inproc_create_fixture( grpc_channel_args *client_args, grpc_channel_args *server_args) { grpc_end2end_test_fixture f; - inproc_fixture_data *ffd = gpr_malloc(sizeof(inproc_fixture_data)); + inproc_fixture_data *ffd = static_cast<inproc_fixture_data *>( + gpr_malloc(sizeof(inproc_fixture_data))); memset(&f, 0, sizeof(f)); f.fixture_data = ffd; @@ -69,7 +70,8 @@ void inproc_init_server(grpc_end2end_test_fixture *f, } void inproc_tear_down(grpc_end2end_test_fixture *f) { - inproc_fixture_data *ffd = f->fixture_data; + inproc_fixture_data *ffd = + static_cast<inproc_fixture_data *>(f->fixture_data); gpr_free(ffd); } diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.cc index 6a2d75da09..6a2d75da09 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.cc diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.cc index 0a787bbf30..2db8ed474a 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.c +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -91,7 +91,7 @@ static char *read_string(input_stream *inp, bool *special) { do { if (cap == sz) { cap = GPR_MAX(3 * cap / 2, cap + 8); - str = gpr_realloc(str, cap); + str = static_cast<char *>(gpr_realloc(str, cap)); } c = (char)next_byte(inp); str[sz++] = c; @@ -114,7 +114,7 @@ static void read_buffer(input_stream *inp, char **buffer, size_t *length, } else { if (special != NULL) *special = false; } - *buffer = gpr_malloc(*length); + *buffer = static_cast<char *>(gpr_malloc(*length)); for (size_t i = 0; i < *length; i++) { (*buffer)[i] = (char)next_byte(inp); } @@ -196,7 +196,7 @@ static int read_int(input_stream *inp) { return (int)read_uint32(inp); } static grpc_channel_args *read_args(input_stream *inp) { size_t n = next_byte(inp); - grpc_arg *args = gpr_malloc(sizeof(*args) * n); + grpc_arg *args = static_cast<grpc_arg *>(gpr_malloc(sizeof(*args) * n)); for (size_t i = 0; i < n; i++) { switch (next_byte(inp)) { case 1: @@ -222,7 +222,8 @@ static grpc_channel_args *read_args(input_stream *inp) { break; } } - grpc_channel_args *a = gpr_malloc(sizeof(*a)); + grpc_channel_args *a = + static_cast<grpc_channel_args *>(gpr_malloc(sizeof(*a))); a->args = args; a->num_args = n; return a; @@ -373,13 +374,15 @@ typedef struct addr_req { static void finish_resolve(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - addr_req *r = arg; + addr_req *r = static_cast<addr_req *>(arg); if (error == GRPC_ERROR_NONE && 0 == strcmp(r->addr, "server")) { if (r->addrs != NULL) { - grpc_resolved_addresses *addrs = gpr_malloc(sizeof(*addrs)); + grpc_resolved_addresses *addrs = + static_cast<grpc_resolved_addresses *>(gpr_malloc(sizeof(*addrs))); addrs->naddrs = 1; - addrs->addrs = gpr_malloc(sizeof(*addrs->addrs)); + addrs->addrs = static_cast<grpc_resolved_address *>( + gpr_malloc(sizeof(*addrs->addrs))); addrs->addrs[0].len = 0; *r->addrs = addrs; } else if (r->lb_addrs != NULL) { @@ -403,7 +406,7 @@ void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, grpc_pollset_set *interested_parties, grpc_closure *on_done, grpc_resolved_addresses **addresses) { - addr_req *r = gpr_malloc(sizeof(*r)); + addr_req *r = static_cast<addr_req *>(gpr_malloc(sizeof(*r))); r->addr = gpr_strdup(addr); r->on_done = on_done; r->addrs = addresses; @@ -418,7 +421,7 @@ grpc_ares_request *my_dns_lookup_ares( const char *default_port, grpc_pollset_set *interested_parties, grpc_closure *on_done, grpc_lb_addresses **lb_addrs, bool check_grpclb, char **service_config_json) { - addr_req *r = gpr_malloc(sizeof(*r)); + addr_req *r = static_cast<addr_req *>(gpr_malloc(sizeof(*r))); r->addr = gpr_strdup(addr); r->on_done = on_done; r->addrs = NULL; @@ -449,7 +452,7 @@ typedef struct { } future_connect; static void do_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - future_connect *fc = arg; + future_connect *fc = static_cast<future_connect *>(arg); if (error != GRPC_ERROR_NONE) { *fc->ep = NULL; GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_REF(error)); @@ -480,7 +483,7 @@ static void sched_connect(grpc_exec_ctx *exec_ctx, grpc_closure *closure, return; } - future_connect *fc = gpr_malloc(sizeof(*fc)); + future_connect *fc = static_cast<future_connect *>(gpr_malloc(sizeof(*fc))); fc->closure = closure; fc->ep = ep; fc->deadline = deadline; @@ -508,7 +511,7 @@ typedef struct validator { static validator *create_validator(void (*validate)(void *arg, bool success), void *arg) { - validator *v = gpr_malloc(sizeof(*v)); + validator *v = static_cast<validator *>(gpr_malloc(sizeof(*v))); v->validate = validate; v->arg = arg; return v; @@ -528,14 +531,15 @@ typedef struct connectivity_watch { static connectivity_watch *make_connectivity_watch(gpr_timespec s, int *counter) { - connectivity_watch *o = gpr_malloc(sizeof(*o)); + connectivity_watch *o = + static_cast<connectivity_watch *>(gpr_malloc(sizeof(*o))); o->deadline = s; o->counter = counter; return o; } static void validate_connectivity_watch(void *p, bool success) { - connectivity_watch *w = p; + connectivity_watch *w = static_cast<connectivity_watch *>(p); if (!success) { GPR_ASSERT(gpr_time_cmp(gpr_now(w->deadline.clock_type), w->deadline) >= 0); } @@ -585,7 +589,7 @@ typedef struct call_state { static call_state *g_active_call; static call_state *new_call(call_state *sibling, call_state_type type) { - call_state *c = gpr_malloc(sizeof(*c)); + call_state *c = static_cast<call_state *>(gpr_malloc(sizeof(*c))); memset(c, 0, sizeof(*c)); if (sibling != NULL) { c->next = sibling; @@ -634,8 +638,8 @@ static call_state *maybe_delete_call_state(call_state *call) { static void add_to_free(call_state *call, void *p) { if (call->num_to_free == call->cap_to_free) { call->cap_to_free = GPR_MAX(8, 2 * call->cap_to_free); - call->to_free = - gpr_realloc(call->to_free, sizeof(*call->to_free) * call->cap_to_free); + call->to_free = static_cast<void **>( + gpr_realloc(call->to_free, sizeof(*call->to_free) * call->cap_to_free)); } call->to_free[call->num_to_free++] = p; } @@ -643,12 +647,12 @@ static void add_to_free(call_state *call, void *p) { static grpc_slice *add_slice_to_unref(call_state *call, grpc_slice s) { if (call->num_slices_to_unref == call->cap_slices_to_unref) { call->cap_slices_to_unref = GPR_MAX(8, 2 * call->cap_slices_to_unref); - call->slices_to_unref = - gpr_realloc(call->slices_to_unref, - sizeof(*call->slices_to_unref) * call->cap_slices_to_unref); + call->slices_to_unref = static_cast<grpc_slice **>(gpr_realloc( + call->slices_to_unref, + sizeof(*call->slices_to_unref) * call->cap_slices_to_unref)); } call->slices_to_unref[call->num_slices_to_unref] = - gpr_malloc(sizeof(grpc_slice)); + static_cast<grpc_slice *>(gpr_malloc(sizeof(grpc_slice))); *call->slices_to_unref[call->num_slices_to_unref++] = s; return call->slices_to_unref[call->num_slices_to_unref - 1]; } @@ -657,7 +661,8 @@ static void read_metadata(input_stream *inp, size_t *count, grpc_metadata **metadata, call_state *cs) { *count = next_byte(inp); if (*count) { - *metadata = gpr_malloc(*count * sizeof(**metadata)); + *metadata = + static_cast<grpc_metadata *>(gpr_malloc(*count * sizeof(**metadata))); memset(*metadata, 0, *count * sizeof(**metadata)); for (size_t i = 0; i < *count; i++) { (*metadata)[i].key = read_string_like_slice(inp); @@ -667,7 +672,7 @@ static void read_metadata(input_stream *inp, size_t *count, add_slice_to_unref(cs, (*metadata)[i].value); } } else { - *metadata = gpr_malloc(1); + *metadata = static_cast<grpc_metadata *>(gpr_malloc(1)); } add_to_free(cs, *metadata); } @@ -679,7 +684,7 @@ static call_state *destroy_call(call_state *call) { } static void finished_request_call(void *csp, bool success) { - call_state *cs = csp; + call_state *cs = static_cast<call_state *>(csp); GPR_ASSERT(cs->pending_ops > 0); --cs->pending_ops; if (success) { @@ -696,7 +701,7 @@ typedef struct { } batch_info; static void finished_batch(void *p, bool success) { - batch_info *bi = p; + batch_info *bi = static_cast<batch_info *>(p); --bi->cs->pending_ops; if ((bi->has_ops & (1u << GRPC_OP_RECV_MESSAGE)) && (bi->cs->done_flags & DONE_FLAG_CALL_CLOSED)) { @@ -721,7 +726,7 @@ static void finished_batch(void *p, bool success) { static validator *make_finished_batch_validator(call_state *cs, uint8_t has_ops) { - batch_info *bi = gpr_malloc(sizeof(*bi)); + batch_info *bi = static_cast<batch_info *>(gpr_malloc(sizeof(*bi))); bi->cs = cs; bi->has_ops = has_ops; return create_validator(finished_batch, bi); @@ -803,7 +808,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); switch (ev.type) { case GRPC_OP_COMPLETE: { - validator *v = ev.tag; + validator *v = static_cast<validator *>(ev.tag); v->validate(v->arg, ev.success); gpr_free(v); break; @@ -992,7 +997,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { end(&inp); break; } - grpc_op *ops = gpr_malloc(sizeof(grpc_op) * num_ops); + grpc_op *ops = + static_cast<grpc_op *>(gpr_malloc(sizeof(grpc_op) * num_ops)); if (num_ops > 0) memset(ops, 0, sizeof(grpc_op) * num_ops); bool ok = true; size_t i; @@ -1035,7 +1041,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { &op->data.send_status_from_server.trailing_metadata_count, &op->data.send_status_from_server.trailing_metadata, g_active_call); - op->data.send_status_from_server.status = next_byte(&inp); + op->data.send_status_from_server.status = + static_cast<grpc_status_code>(next_byte(&inp)); op->data.send_status_from_server.status_details = add_slice_to_unref(g_active_call, read_buffer_like_slice(&inp)); diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.cc index 88ba6bad83..88ba6bad83 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.c +++ b/test/core/end2end/fuzzers/client_fuzzer.cc diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.cc index ef4c0a4bfd..ef4c0a4bfd 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.c +++ b/test/core/end2end/fuzzers/server_fuzzer.cc diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index f7f996d5c1..7c8e7f420a 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -220,9 +220,9 @@ def main(): 'build': 'private', 'language': 'c', 'secure': True, - 'src': ['test/core/end2end/end2end_tests.c', - 'test/core/end2end/end2end_test_utils.c'] + [ - 'test/core/end2end/tests/%s.c' % t + 'src': ['test/core/end2end/end2end_tests.cc', + 'test/core/end2end/end2end_test_utils.cc'] + [ + 'test/core/end2end/tests/%s.cc' % t for t in sorted(END2END_TESTS.keys())], 'headers': ['test/core/end2end/tests/cancel_test_helpers.h', 'test/core/end2end/end2end_tests.h'], @@ -235,9 +235,9 @@ def main(): 'build': 'private', 'language': 'c', 'secure': False, - 'src': ['test/core/end2end/end2end_nosec_tests.c', - 'test/core/end2end/end2end_test_utils.c'] + [ - 'test/core/end2end/tests/%s.c' % t + 'src': ['test/core/end2end/end2end_nosec_tests.cc', + 'test/core/end2end/end2end_test_utils.cc'] + [ + 'test/core/end2end/tests/%s.cc' % t for t in sorted(END2END_TESTS.keys()) if not END2END_TESTS[t].secure], 'headers': ['test/core/end2end/tests/cancel_test_helpers.h', @@ -252,7 +252,7 @@ def main(): 'build': 'test', 'language': 'c', 'run': False, - 'src': ['test/core/end2end/fixtures/%s.c' % f], + 'src': ['test/core/end2end/fixtures/%s.cc' % f], 'platforms': END2END_FIXTURES[f].platforms, 'ci_platforms': (END2END_FIXTURES[f].platforms if END2END_FIXTURES[f].ci_mac else without( @@ -269,7 +269,7 @@ def main(): 'build': 'test', 'language': 'c', 'secure': False, - 'src': ['test/core/end2end/fixtures/%s.c' % f], + 'src': ['test/core/end2end/fixtures/%s.cc' % f], 'run': False, 'platforms': END2END_FIXTURES[f].platforms, 'ci_platforms': (END2END_FIXTURES[f].platforms diff --git a/test/core/end2end/generate_tests.bzl b/test/core/end2end/generate_tests.bzl index 89a95edfd7..94f9f98a2a 100755 --- a/test/core/end2end/generate_tests.bzl +++ b/test/core/end2end/generate_tests.bzl @@ -186,8 +186,8 @@ def compatible(fopt, topt): def grpc_end2end_tests(): grpc_cc_library( name = 'end2end_tests', - srcs = ['end2end_tests.c', 'end2end_test_utils.c'] + [ - 'tests/%s.c' % t + srcs = ['end2end_tests.cc', 'end2end_test_utils.cc'] + [ + 'tests/%s.cc' % t for t in sorted(END2END_TESTS.keys())], hdrs = [ 'tests/cancel_test_helpers.h', @@ -205,7 +205,7 @@ def grpc_end2end_tests(): for f, fopt in END2END_FIXTURES.items(): grpc_cc_binary( name = '%s_test' % f, - srcs = ['fixtures/%s.c' % f], + srcs = ['fixtures/%s.cc' % f], language = "C", deps = [ ':end2end_tests', diff --git a/test/core/end2end/goaway_server_test.c b/test/core/end2end/goaway_server_test.cc index c3aca13249..c0d7fb81b5 100644 --- a/test/core/end2end/goaway_server_test.c +++ b/test/core/end2end/goaway_server_test.cc @@ -74,9 +74,11 @@ static void my_resolve_address(grpc_exec_ctx *exec_ctx, const char *addr, gpr_mu_unlock(&g_mu); error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure"); } else { - *addrs = gpr_malloc(sizeof(**addrs)); + *addrs = + static_cast<grpc_resolved_addresses *>(gpr_malloc(sizeof(**addrs))); (*addrs)->naddrs = 1; - (*addrs)->addrs = gpr_malloc(sizeof(*(*addrs)->addrs)); + (*addrs)->addrs = static_cast<grpc_resolved_address *>( + gpr_malloc(sizeof(*(*addrs)->addrs))); memset((*addrs)->addrs, 0, sizeof(*(*addrs)->addrs)); struct sockaddr_in *sa = (struct sockaddr_in *)(*addrs)->addrs[0].addr; sa->sin_family = AF_INET; @@ -106,7 +108,8 @@ static grpc_ares_request *my_dns_lookup_ares( error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure"); } else { *lb_addrs = grpc_lb_addresses_create(1, NULL); - struct sockaddr_in *sa = gpr_zalloc(sizeof(struct sockaddr_in)); + 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); @@ -167,7 +170,8 @@ int main(int argc, char **argv) { grpc_channel_args client_args; grpc_arg arg_array[1]; arg_array[0].type = GRPC_ARG_INTEGER; - arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms"; + arg_array[0].key = + const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms"); arg_array[0].value.integer = 1000; client_args.args = arg_array; client_args.num_args = 1; diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.cc index e3fd5a8fbe..ac704a6bc0 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.cc @@ -258,7 +258,7 @@ static void test_send_messages_at_the_same_time() { op->reserved = NULL; op++; op->op = GRPC_OP_SEND_MESSAGE; - op->data.send_message.send_message = tag(2); + op->data.send_message.send_message = static_cast<grpc_byte_buffer *>(tag(2)); op->flags = 0; op->reserved = NULL; op++; diff --git a/test/core/end2end/multiple_server_queues_test.c b/test/core/end2end/multiple_server_queues_test.cc index f231c62dd0..f231c62dd0 100644 --- a/test/core/end2end/multiple_server_queues_test.c +++ b/test/core/end2end/multiple_server_queues_test.cc diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.cc index 962499bb4f..962499bb4f 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.cc diff --git a/test/core/end2end/tests/authority_not_supported.c b/test/core/end2end/tests/authority_not_supported.cc index b54d6d0d6f..b54d6d0d6f 100644 --- a/test/core/end2end/tests/authority_not_supported.c +++ b/test/core/end2end/tests/authority_not_supported.cc diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.cc index 32093f2ecf..32093f2ecf 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.cc diff --git a/test/core/end2end/tests/bad_ping.c b/test/core/end2end/tests/bad_ping.cc index 34cc8e78cd..50e02ed720 100644 --- a/test/core/end2end/tests/bad_ping.c +++ b/test/core/end2end/tests/bad_ping.cc @@ -66,30 +66,30 @@ 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); cq_verifier *cqv = cq_verifier_create(f.cq); - grpc_arg client_a[] = { - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS, - .value.integer = 10}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA, - .value.integer = 0}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_BDP_PROBE, - .value.integer = 0}}; - grpc_arg server_a[] = { - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS, - .value.integer = 300000 /* 5 minutes */}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_MAX_PING_STRIKES, - .value.integer = MAX_PING_STRIKES}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_BDP_PROBE, - .value.integer = 0}}; - grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a), - .args = client_a}; - grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a), - .args = server_a}; + grpc_arg client_a[3]; + client_a[0].type = GRPC_ARG_INTEGER; + client_a[0].key = + const_cast<char *>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS); + client_a[0].value.integer = 10; + client_a[1].type = GRPC_ARG_INTEGER; + client_a[1].key = const_cast<char *>(GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA); + client_a[1].value.integer = 0; + client_a[2].type = GRPC_ARG_INTEGER; + client_a[2].key = const_cast<char *>(GRPC_ARG_HTTP2_BDP_PROBE); + client_a[2].value.integer = 0; + grpc_arg server_a[3]; + server_a[0].type = GRPC_ARG_INTEGER; + server_a[0].key = + const_cast<char *>(GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS); + server_a[0].value.integer = 300000 /* 5 minutes */; + server_a[1].type = GRPC_ARG_INTEGER; + server_a[1].key = const_cast<char *>(GRPC_ARG_HTTP2_MAX_PING_STRIKES); + server_a[1].value.integer = MAX_PING_STRIKES; + server_a[2].type = GRPC_ARG_INTEGER; + server_a[2].key = const_cast<char *>(GRPC_ARG_HTTP2_BDP_PROBE); + server_a[2].value.integer = 0; + grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a}; + grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a}; config.init_client(&f, &client_args); config.init_server(&f, &server_args); diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.cc index e949daee1d..e949daee1d 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.cc diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.cc index 600005c9a9..dfe6d19160 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.cc @@ -49,7 +49,9 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, config.init_client(&f, NULL); if (fail_server_auth_check) { grpc_arg fail_auth_arg = { - GRPC_ARG_STRING, FAIL_AUTH_CHECK_SERVER_ARG_NAME, {NULL}}; + GRPC_ARG_STRING, + const_cast<char *>(FAIL_AUTH_CHECK_SERVER_ARG_NAME), + {NULL}}; grpc_channel_args args; args.num_args = 1; args.args = &fail_auth_arg; diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.cc index c3ac0c3201..58e807b83b 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.cc @@ -125,8 +125,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, if (use_service_config) { grpc_arg arg; arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVICE_CONFIG; - arg.value.string = + arg.key = const_cast<char *>(GRPC_ARG_SERVICE_CONFIG); + arg.value.string = const_cast<char *>( "{\n" " \"methodConfig\": [ {\n" " \"name\": [\n" @@ -134,7 +134,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, " ],\n" " \"timeout\": \"5s\"\n" " } ]\n" - "}"; + "}"); args = grpc_channel_args_copy_and_add(args, &arg, 1); } diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.cc index 0e2a751d83..0e2a751d83 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.cc diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.cc index aad9fdbf94..aad9fdbf94 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.cc diff --git a/test/core/end2end/tests/cancel_after_round_trip.c b/test/core/end2end/tests/cancel_after_round_trip.cc index bc41bd3a6d..202eeb5fb6 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.c +++ b/test/core/end2end/tests/cancel_after_round_trip.cc @@ -127,8 +127,8 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, if (use_service_config) { grpc_arg arg; arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVICE_CONFIG; - arg.value.string = + arg.key = const_cast<char *>(GRPC_ARG_SERVICE_CONFIG); + arg.value.string = const_cast<char *>( "{\n" " \"methodConfig\": [ {\n" " \"name\": [\n" @@ -136,7 +136,7 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, " ],\n" " \"timeout\": \"5s\"\n" " } ]\n" - "}"; + "}"); args = grpc_channel_args_copy_and_add(args, &arg, 1); } diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.cc index 397e8b8ba6..397e8b8ba6 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.cc diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.cc index cd9551bef9..cd9551bef9 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.cc diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.cc index ab8c4f4187..ab8c4f4187 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.cc diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.cc index ba03773036..ba03773036 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.cc diff --git a/test/core/end2end/tests/connectivity.c b/test/core/end2end/tests/connectivity.cc index 610243ee3a..2cba25965a 100644 --- a/test/core/end2end/tests/connectivity.c +++ b/test/core/end2end/tests/connectivity.cc @@ -56,7 +56,8 @@ static void test_connectivity(grpc_end2end_test_config config) { grpc_channel_args client_args; grpc_arg arg_array[1]; arg_array[0].type = GRPC_ARG_INTEGER; - arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms"; + arg_array[0].key = + const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms"); arg_array[0].value.integer = 1000; client_args.args = arg_array; client_args.num_args = 1; diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.cc index d1db9b342a..d1db9b342a 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.cc diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.cc index 19e4c05605..19e4c05605 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.cc diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.cc index ee57c16780..ee57c16780 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.cc diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.cc index 09e9dbcd7b..09e9dbcd7b 100644 --- a/test/core/end2end/tests/filter_call_init_fails.c +++ b/test/core/end2end/tests/filter_call_init_fails.cc diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.cc index ee7aeb3f33..ee7aeb3f33 100644 --- a/test/core/end2end/tests/filter_causes_close.c +++ b/test/core/end2end/tests/filter_causes_close.cc diff --git a/test/core/end2end/tests/filter_latency.c b/test/core/end2end/tests/filter_latency.cc index c24934f05d..c24934f05d 100644 --- a/test/core/end2end/tests/filter_latency.c +++ b/test/core/end2end/tests/filter_latency.cc diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.cc index 9b3ff98195..9b3ff98195 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.cc diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.cc index 04b94838bb..2b72d09e68 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.cc @@ -211,7 +211,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, char *name; client_arg.type = GRPC_ARG_INTEGER; - client_arg.key = GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER; + client_arg.key = const_cast<char *>(GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER); client_arg.value.integer = initial_sequence_number; client_args.num_args = 1; diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.cc index 9358c119b1..e838be9f8b 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.cc @@ -360,13 +360,13 @@ static void test_size(grpc_end2end_test_config config, int encode_size, char *name; server_arg.type = GRPC_ARG_INTEGER; - server_arg.key = GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER; + server_arg.key = const_cast<char *>(GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER); server_arg.value.integer = decode_size; server_args.num_args = 1; server_args.args = &server_arg; client_arg.type = GRPC_ARG_INTEGER; - client_arg.key = GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER; + client_arg.key = const_cast<char *>(GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER); client_arg.value.integer = encode_size; client_args.num_args = 1; client_args.args = &client_arg; diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.cc index 829ece6631..829ece6631 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.cc diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.cc index ff269fa3ee..c0e63103a8 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.cc @@ -96,10 +96,10 @@ static void test_invoke_large_request(grpc_end2end_test_config config, grpc_arg args[2]; args[0].type = GRPC_ARG_INTEGER; - args[0].key = GRPC_ARG_HTTP2_MAX_FRAME_SIZE; + args[0].key = const_cast<char *>(GRPC_ARG_HTTP2_MAX_FRAME_SIZE); args[0].value.integer = max_frame_size; args[1].type = GRPC_ARG_INTEGER; - args[1].key = GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES; + args[1].key = const_cast<char *>(GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES); args[1].value.integer = lookahead_bytes; grpc_channel_args channel_args = {GPR_ARRAY_SIZE(args), args}; diff --git a/test/core/end2end/tests/keepalive_timeout.c b/test/core/end2end/tests/keepalive_timeout.cc index 0053368ecc..721c1364d0 100644 --- a/test/core/end2end/tests/keepalive_timeout.c +++ b/test/core/end2end/tests/keepalive_timeout.cc @@ -98,18 +98,19 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { grpc_byte_buffer *response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); - grpc_arg keepalive_arg_elems[] = {{.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_KEEPALIVE_TIME_MS, - .value.integer = 1500}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_KEEPALIVE_TIMEOUT_MS, - .value.integer = 0}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_BDP_PROBE, - .value.integer = 0}}; - grpc_channel_args keepalive_args = { - .num_args = GPR_ARRAY_SIZE(keepalive_arg_elems), - .args = keepalive_arg_elems}; + grpc_arg keepalive_arg_elems[3]; + keepalive_arg_elems[0].type = GRPC_ARG_INTEGER; + keepalive_arg_elems[0].key = const_cast<char *>(GRPC_ARG_KEEPALIVE_TIME_MS); + keepalive_arg_elems[0].value.integer = 1500; + keepalive_arg_elems[1].type = GRPC_ARG_INTEGER; + keepalive_arg_elems[1].key = + const_cast<char *>(GRPC_ARG_KEEPALIVE_TIMEOUT_MS); + keepalive_arg_elems[1].value.integer = 0; + keepalive_arg_elems[2].type = GRPC_ARG_INTEGER; + keepalive_arg_elems[2].key = const_cast<char *>(GRPC_ARG_HTTP2_BDP_PROBE); + keepalive_arg_elems[2].value.integer = 0; + grpc_channel_args keepalive_args = {GPR_ARRAY_SIZE(keepalive_arg_elems), + keepalive_arg_elems}; grpc_end2end_test_fixture f = begin_test(config, "keepalive_timeout", &keepalive_args, NULL); diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.cc index 81a45d827a..c2aa4d187b 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.cc @@ -94,9 +94,10 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_metadata meta; const size_t large_size = 64 * 1024; - grpc_arg arg = {GRPC_ARG_INTEGER, - GRPC_ARG_MAX_METADATA_SIZE, - {.integer = (int)large_size + 1024}}; + grpc_arg arg; + arg.type = GRPC_ARG_INTEGER; + arg.key = const_cast<char *>(GRPC_ARG_MAX_METADATA_SIZE); + arg.value.integer = (int)large_size + 1024; grpc_channel_args args = {1, &arg}; grpc_end2end_test_fixture f = begin_test(config, "test_request_with_large_metadata", &args, &args); diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.cc index 7b503790db..7b503790db 100644 --- a/test/core/end2end/tests/load_reporting_hook.c +++ b/test/core/end2end/tests/load_reporting_hook.cc diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.cc index d18c13997c..deb44bbc3e 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.cc @@ -221,7 +221,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { int got_client_start; int got_server_start; - server_arg.key = GRPC_ARG_MAX_CONCURRENT_STREAMS; + server_arg.key = const_cast<char *>(GRPC_ARG_MAX_CONCURRENT_STREAMS); server_arg.type = GRPC_ARG_INTEGER; server_arg.value.integer = 1; @@ -461,7 +461,7 @@ static void test_max_concurrent_streams_with_timeout_on_first( grpc_op *op; int was_cancelled; - server_arg.key = GRPC_ARG_MAX_CONCURRENT_STREAMS; + server_arg.key = const_cast<char *>(GRPC_ARG_MAX_CONCURRENT_STREAMS); server_arg.type = GRPC_ARG_INTEGER; server_arg.value.integer = 1; @@ -655,7 +655,7 @@ static void test_max_concurrent_streams_with_timeout_on_second( grpc_op *op; int was_cancelled; - server_arg.key = GRPC_ARG_MAX_CONCURRENT_STREAMS; + server_arg.key = const_cast<char *>(GRPC_ARG_MAX_CONCURRENT_STREAMS); server_arg.type = GRPC_ARG_INTEGER; server_arg.value.integer = 1; diff --git a/test/core/end2end/tests/max_connection_age.c b/test/core/end2end/tests/max_connection_age.cc index b6daa59d7b..01cae9e3e0 100644 --- a/test/core/end2end/tests/max_connection_age.c +++ b/test/core/end2end/tests/max_connection_age.cc @@ -80,17 +80,17 @@ static void end_test(grpc_end2end_test_fixture *f) { static void test_max_age_forcibly_close(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); cq_verifier *cqv = cq_verifier_create(f.cq); - grpc_arg server_a[] = {{.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_AGE_MS, - .value.integer = MAX_CONNECTION_AGE_MS}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS, - .value.integer = MAX_CONNECTION_AGE_GRACE_MS}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_IDLE_MS, - .value.integer = MAX_CONNECTION_IDLE_MS}}; - grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a), - .args = server_a}; + grpc_arg server_a[3]; + server_a[0].type = GRPC_ARG_INTEGER; + server_a[0].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_AGE_MS); + server_a[0].value.integer = MAX_CONNECTION_AGE_MS; + server_a[1].type = GRPC_ARG_INTEGER; + server_a[1].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS); + server_a[1].value.integer = MAX_CONNECTION_AGE_GRACE_MS; + server_a[2].type = GRPC_ARG_INTEGER; + server_a[2].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_IDLE_MS); + server_a[2].value.integer = MAX_CONNECTION_IDLE_MS; + grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a}; config.init_client(&f, NULL); config.init_server(&f, &server_args); @@ -223,17 +223,17 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { static void test_max_age_gracefully_close(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); cq_verifier *cqv = cq_verifier_create(f.cq); - grpc_arg server_a[] = {{.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_AGE_MS, - .value.integer = MAX_CONNECTION_AGE_MS}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS, - .value.integer = INT_MAX}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_IDLE_MS, - .value.integer = MAX_CONNECTION_IDLE_MS}}; - grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a), - .args = server_a}; + grpc_arg server_a[3]; + server_a[0].type = GRPC_ARG_INTEGER; + server_a[0].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_AGE_MS); + server_a[0].value.integer = MAX_CONNECTION_AGE_MS; + server_a[1].type = GRPC_ARG_INTEGER; + server_a[1].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS); + server_a[1].value.integer = INT_MAX; + server_a[2].type = GRPC_ARG_INTEGER; + server_a[2].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_IDLE_MS); + server_a[2].value.integer = MAX_CONNECTION_IDLE_MS; + grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a}; config.init_client(&f, NULL); config.init_server(&f, &server_args); diff --git a/test/core/end2end/tests/max_connection_idle.c b/test/core/end2end/tests/max_connection_idle.cc index f26b0be40e..a44d15452c 100644 --- a/test/core/end2end/tests/max_connection_idle.c +++ b/test/core/end2end/tests/max_connection_idle.cc @@ -171,19 +171,20 @@ static void test_max_connection_idle(grpc_end2end_test_config config) { grpc_connectivity_state state = GRPC_CHANNEL_IDLE; cq_verifier *cqv = cq_verifier_create(f.cq); - grpc_arg client_a[] = {{.type = GRPC_ARG_INTEGER, - .key = "grpc.testing.fixed_reconnect_backoff_ms", - .value.integer = 1000}}; - grpc_arg server_a[] = {{.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_IDLE_MS, - .value.integer = MAX_CONNECTION_IDLE_MS}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_MAX_CONNECTION_AGE_MS, - .value.integer = MAX_CONNECTION_AGE_MS}}; - grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a), - .args = client_a}; - grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a), - .args = server_a}; + grpc_arg client_a[1]; + client_a[0].type = GRPC_ARG_INTEGER; + client_a[0].key = + const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms"); + client_a[0].value.integer = 1000; + grpc_arg server_a[2]; + server_a[0].type = GRPC_ARG_INTEGER; + server_a[0].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_IDLE_MS); + server_a[0].value.integer = MAX_CONNECTION_IDLE_MS; + server_a[1].type = GRPC_ARG_INTEGER; + server_a[1].key = const_cast<char *>(GRPC_ARG_MAX_CONNECTION_AGE_MS); + server_a[1].value.integer = MAX_CONNECTION_AGE_MS; + grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a}; + grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a}; config.init_client(&f, &client_args); config.init_server(&f, &server_args); diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.cc index 01eb8d365e..2ee7b0be42 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.cc @@ -132,31 +132,34 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, GPR_ASSERT(send_limit); grpc_arg arg; arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVICE_CONFIG; + arg.key = const_cast<char *>(GRPC_ARG_SERVICE_CONFIG); arg.value.string = use_string_json_value - ? "{\n" - " \"methodConfig\": [ {\n" - " \"name\": [\n" - " { \"service\": \"service\", \"method\": \"method\" }\n" - " ],\n" - " \"maxRequestMessageBytes\": \"5\"\n" - " } ]\n" - "}" - : "{\n" - " \"methodConfig\": [ {\n" - " \"name\": [\n" - " { \"service\": \"service\", \"method\": \"method\" }\n" - " ],\n" - " \"maxRequestMessageBytes\": 5\n" - " } ]\n" - "}"; + ? const_cast<char *>( + "{\n" + " \"methodConfig\": [ {\n" + " \"name\": [\n" + " { \"service\": \"service\", \"method\": \"method\" }\n" + " ],\n" + " \"maxRequestMessageBytes\": \"5\"\n" + " } ]\n" + "}") + : const_cast<char *>( + "{\n" + " \"methodConfig\": [ {\n" + " \"name\": [\n" + " { \"service\": \"service\", \"method\": \"method\" }\n" + " ],\n" + " \"maxRequestMessageBytes\": 5\n" + " } ]\n" + "}"); client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1); } else { // Set limit via channel args. grpc_arg arg; - arg.key = send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH - : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH; + arg.key = send_limit + ? const_cast<char *>(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) + : const_cast<char *>(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH); arg.type = GRPC_ARG_INTEGER; arg.value.integer = 5; grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1); @@ -322,8 +325,8 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, GPR_ASSERT(!send_limit); grpc_arg arg; arg.type = GRPC_ARG_STRING; - arg.key = GRPC_ARG_SERVICE_CONFIG; - arg.value.string = + arg.key = const_cast<char *>(GRPC_ARG_SERVICE_CONFIG); + arg.value.string = const_cast<char *>( use_string_json_value ? "{\n" " \"methodConfig\": [ {\n" @@ -340,13 +343,14 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, " ],\n" " \"maxResponseMessageBytes\": 5\n" " } ]\n" - "}"; + "}"); client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1); } else { // Set limit via channel args. grpc_arg arg; - arg.key = send_limit ? GRPC_ARG_MAX_SEND_MESSAGE_LENGTH - : GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH; + arg.key = send_limit + ? const_cast<char *>(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH) + : const_cast<char *>(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH); arg.type = GRPC_ARG_INTEGER; arg.value.integer = 5; grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1); diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.cc index c8667f4f4d..c8667f4f4d 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.cc diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.cc index 4d77174e22..4d77174e22 100644 --- a/test/core/end2end/tests/network_status_change.c +++ b/test/core/end2end/tests/network_status_change.cc diff --git a/test/core/end2end/tests/no_logging.c b/test/core/end2end/tests/no_logging.cc index f7d50c24dd..d898ef0581 100644 --- a/test/core/end2end/tests/no_logging.c +++ b/test/core/end2end/tests/no_logging.cc @@ -36,7 +36,7 @@ enum { TIMEOUT = 200000 }; static void *tag(intptr_t t) { return (void *)t; } -extern void gpr_default_log(gpr_log_func_args *args); +extern "C" void gpr_default_log(gpr_log_func_args *args); static void test_no_log(gpr_log_func_args *args) { char *message = NULL; diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.cc index 8400c27486..8400c27486 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.cc diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.cc index d98eed68e0..d98eed68e0 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.cc diff --git a/test/core/end2end/tests/ping.c b/test/core/end2end/tests/ping.cc index 23c82569ba..e6b0e55b01 100644 --- a/test/core/end2end/tests/ping.c +++ b/test/core/end2end/tests/ping.cc @@ -37,27 +37,27 @@ static void test_ping(grpc_end2end_test_config config, grpc_connectivity_state state = GRPC_CHANNEL_IDLE; int i; - grpc_arg client_a[] = { - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS, - .value.integer = 10}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA, - .value.integer = 0}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS, - .value.integer = 1}}; - grpc_arg server_a[] = { - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS, - .value.integer = 0}, - {.type = GRPC_ARG_INTEGER, - .key = GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS, - .value.integer = 1}}; - grpc_channel_args client_args = {.num_args = GPR_ARRAY_SIZE(client_a), - .args = client_a}; - grpc_channel_args server_args = {.num_args = GPR_ARRAY_SIZE(server_a), - .args = server_a}; + grpc_arg client_a[3]; + client_a[0].type = GRPC_ARG_INTEGER; + client_a[0].key = + const_cast<char *>(GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS); + client_a[0].value.integer = 10; + client_a[1].type = GRPC_ARG_INTEGER; + client_a[1].key = const_cast<char *>(GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA); + client_a[1].value.integer = 0; + client_a[2].type = GRPC_ARG_INTEGER; + client_a[2].key = const_cast<char *>(GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS); + client_a[2].value.integer = 1; + grpc_arg server_a[2]; + server_a[0].type = GRPC_ARG_INTEGER; + server_a[0].key = + const_cast<char *>(GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS); + server_a[0].value.integer = 0; + server_a[1].type = GRPC_ARG_INTEGER; + server_a[1].key = const_cast<char *>(GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS); + server_a[1].value.integer = 1; + grpc_channel_args client_args = {GPR_ARRAY_SIZE(client_a), client_a}; + grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a}; config.init_client(&f, &client_args); config.init_server(&f, &server_args); diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.cc index 1c44262c3d..1c44262c3d 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.cc diff --git a/test/core/end2end/tests/proxy_auth.c b/test/core/end2end/tests/proxy_auth.cc index d922049bcb..fe87399f03 100644 --- a/test/core/end2end/tests/proxy_auth.c +++ b/test/core/end2end/tests/proxy_auth.cc @@ -217,10 +217,11 @@ static void simple_request_body(grpc_end2end_test_config config, static void test_invoke_proxy_auth(grpc_end2end_test_config config) { /* Indicate that the proxy requires user auth */ - grpc_arg client_arg = {.type = GRPC_ARG_STRING, - .key = GRPC_ARG_HTTP_PROXY_AUTH_CREDS, - .value.string = GRPC_TEST_HTTP_PROXY_AUTH_CREDS}; - grpc_channel_args client_args = {.num_args = 1, .args = &client_arg}; + grpc_arg client_arg; + client_arg.type = GRPC_ARG_STRING; + client_arg.key = const_cast<char *>(GRPC_ARG_HTTP_PROXY_AUTH_CREDS); + client_arg.value.string = const_cast<char *>(GRPC_TEST_HTTP_PROXY_AUTH_CREDS); + grpc_channel_args client_args = {1, &client_arg}; grpc_end2end_test_fixture f = begin_test(config, "test_invoke_proxy_auth", &client_args, NULL); simple_request_body(config, f); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.cc index 4598029818..4598029818 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.cc diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.cc index dfb7d58743..dfb7d58743 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.cc diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.cc index 575e54c7d9..575e54c7d9 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.cc diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.cc index 93befeee0c..e710e39e1d 100644 --- a/test/core/end2end/tests/resource_quota_server.c +++ b/test/core/end2end/tests/resource_quota_server.cc @@ -117,7 +117,7 @@ void resource_quota_server(grpc_end2end_test_config config) { #define SERVER_END_BASE_TAG 0x4000 grpc_arg arg; - arg.key = GRPC_ARG_RESOURCE_QUOTA; + arg.key = const_cast<char *>(GRPC_ARG_RESOURCE_QUOTA); arg.type = GRPC_ARG_POINTER; arg.value.pointer.p = resource_quota; arg.value.pointer.vtable = grpc_resource_quota_arg_vtable(); diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.cc index 49b9f27396..49b9f27396 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.cc diff --git a/test/core/end2end/tests/shutdown_finishes_calls.c b/test/core/end2end/tests/shutdown_finishes_calls.cc index f90359f09a..f90359f09a 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.c +++ b/test/core/end2end/tests/shutdown_finishes_calls.cc diff --git a/test/core/end2end/tests/shutdown_finishes_tags.c b/test/core/end2end/tests/shutdown_finishes_tags.cc index 7914cc95ba..7914cc95ba 100644 --- a/test/core/end2end/tests/shutdown_finishes_tags.c +++ b/test/core/end2end/tests/shutdown_finishes_tags.cc diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.cc index faa5c193dc..faa5c193dc 100644 --- a/test/core/end2end/tests/simple_cacheable_request.c +++ b/test/core/end2end/tests/simple_cacheable_request.cc diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.cc index c3f66a07aa..a4cbcbfedf 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.cc @@ -191,7 +191,8 @@ static void test_simple_delayed_request_short(grpc_end2end_test_config config) { grpc_channel_args client_args; grpc_arg arg_array[1]; arg_array[0].type = GRPC_ARG_INTEGER; - arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms"; + arg_array[0].key = + const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms"); arg_array[0].value.integer = 1000; client_args.args = arg_array; client_args.num_args = 1; @@ -210,7 +211,8 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) { grpc_channel_args client_args; grpc_arg arg_array[1]; arg_array[0].type = GRPC_ARG_INTEGER; - arg_array[0].key = "grpc.testing.fixed_reconnect_backoff_ms"; + arg_array[0].key = + const_cast<char *>("grpc.testing.fixed_reconnect_backoff_ms"); arg_array[0].value.integer = 1000; client_args.args = arg_array; client_args.num_args = 1; diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.cc index 17e7f696e2..17e7f696e2 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.cc diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.cc index 7ce7e1f285..48c9824894 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.cc @@ -103,8 +103,10 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice details; int was_cancelled = 2; char *peer; - grpc_stats_data *before = gpr_malloc(sizeof(grpc_stats_data)); - grpc_stats_data *after = gpr_malloc(sizeof(grpc_stats_data)); + grpc_stats_data *before = + static_cast<grpc_stats_data *>(gpr_malloc(sizeof(grpc_stats_data))); + grpc_stats_data *after = + static_cast<grpc_stats_data *>(gpr_malloc(sizeof(grpc_stats_data))); grpc_stats_collect(before); diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.c b/test/core/end2end/tests/stream_compression_compressed_payload.cc index 8b47741cd4..8b47741cd4 100644 --- a/test/core/end2end/tests/stream_compression_compressed_payload.c +++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc diff --git a/test/core/end2end/tests/stream_compression_payload.c b/test/core/end2end/tests/stream_compression_payload.cc index e47d2aa93c..e47d2aa93c 100644 --- a/test/core/end2end/tests/stream_compression_payload.c +++ b/test/core/end2end/tests/stream_compression_payload.cc diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.c b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc index 4c1a34cc64..4c1a34cc64 100644 --- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.c +++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.cc index 8891b8674c..8891b8674c 100644 --- a/test/core/end2end/tests/streaming_error_response.c +++ b/test/core/end2end/tests/streaming_error_response.cc diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.cc index 7aa78a04b8..7aa78a04b8 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.cc diff --git a/test/core/end2end/tests/workaround_cronet_compression.c b/test/core/end2end/tests/workaround_cronet_compression.cc index 44e8e04643..17e59ad6d4 100644 --- a/test/core/end2end/tests/workaround_cronet_compression.c +++ b/test/core/end2end/tests/workaround_cronet_compression.cc @@ -145,7 +145,7 @@ static void request_with_payload_template( grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args *client_args_old = client_args; grpc_arg arg; - arg.key = GRPC_ARG_PRIMARY_USER_AGENT_STRING; + arg.key = const_cast<char *>(GRPC_ARG_PRIMARY_USER_AGENT_STRING); arg.type = GRPC_ARG_STRING; arg.value.string = user_agent_override; client_args = grpc_channel_args_copy_and_add(client_args_old, &arg, 1); @@ -366,11 +366,14 @@ typedef struct workaround_cronet_compression_config { static workaround_cronet_compression_config workaround_configs[] = { {NULL, GRPC_COMPRESS_GZIP}, - {"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)", + {const_cast<char *>( + "grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)"), GRPC_COMPRESS_NONE}, - {"grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)", + {const_cast<char *>( + "grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; chttp2; gentle)"), GRPC_COMPRESS_GZIP}, - {"grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)", + {const_cast<char *>( + "grpc-objc/1.4.0 grpc-c/3.0.0-dev (ios; cronet_http; gentle)"), GRPC_COMPRESS_GZIP}}; static const size_t workaround_configs_num = sizeof(workaround_configs) / sizeof(*workaround_configs); diff --git a/test/core/end2end/tests/write_buffering.c b/test/core/end2end/tests/write_buffering.cc index d7d1e5fa3d..d7d1e5fa3d 100644 --- a/test/core/end2end/tests/write_buffering.c +++ b/test/core/end2end/tests/write_buffering.cc diff --git a/test/core/end2end/tests/write_buffering_at_end.c b/test/core/end2end/tests/write_buffering_at_end.cc index 6113843390..6113843390 100644 --- a/test/core/end2end/tests/write_buffering_at_end.c +++ b/test/core/end2end/tests/write_buffering_at_end.cc diff --git a/test/core/fling/client.c b/test/core/fling/client.cc index be7bfc2280..356ec4bb28 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.cc @@ -151,10 +151,10 @@ int main(int argc, char **argv) { int payload_size = 1; int secure = 0; - char *target = "localhost:443"; + const char *target = "localhost:443"; gpr_cmdline *cl; grpc_event event; - char *scenario_name = "ping-pong-request"; + const char *scenario_name = "ping-pong-request"; scenario sc = {NULL, NULL, NULL}; gpr_timers_set_log_filename("latency_trace.fling_client.txt"); diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_stream_test.cc index 90b48e7737..4e3b63e192 100644 --- a/test/core/fling/fling_test.c +++ b/test/core/fling/fling_stream_test.cc @@ -44,9 +44,9 @@ int main(int argc, char **argv) { /* start the server */ gpr_asprintf(&args[0], "%s/fling_server%s", root, gpr_subprocess_binary_extension()); - args[1] = "--bind"; + args[1] = const_cast<char *>("--bind"); gpr_join_host_port(&args[2], "::", port); - args[3] = "--no-secure"; + args[3] = const_cast<char *>("--no-secure"); svr = gpr_subprocess_create(4, (const char **)args); gpr_free(args[0]); gpr_free(args[2]); @@ -54,10 +54,10 @@ int main(int argc, char **argv) { /* start the client */ gpr_asprintf(&args[0], "%s/fling_client%s", root, gpr_subprocess_binary_extension()); - args[1] = "--target"; + args[1] = const_cast<char *>("--target"); gpr_join_host_port(&args[2], "127.0.0.1", port); - args[3] = "--scenario=ping-pong-request"; - args[4] = "--no-secure"; + args[3] = const_cast<char *>("--scenario=ping-pong-stream"); + args[4] = const_cast<char *>("--no-secure"); args[5] = 0; cli = gpr_subprocess_create(6, (const char **)args); gpr_free(args[0]); diff --git a/test/core/fling/fling_stream_test.c b/test/core/fling/fling_test.cc index 566d9ae6f0..a7681d572a 100644 --- a/test/core/fling/fling_stream_test.c +++ b/test/core/fling/fling_test.cc @@ -26,9 +26,9 @@ #include "src/core/lib/support/string.h" #include "test/core/util/port.h" -int main(int argc, char **argv) { - char *me = argv[0]; - char *lslash = strrchr(me, '/'); +int main(int argc, const char **argv) { + const char *me = argv[0]; + const char *lslash = strrchr(me, '/'); char root[1024]; int port = grpc_pick_unused_port_or_die(); char *args[10]; @@ -44,9 +44,9 @@ int main(int argc, char **argv) { /* start the server */ gpr_asprintf(&args[0], "%s/fling_server%s", root, gpr_subprocess_binary_extension()); - args[1] = "--bind"; + args[1] = const_cast<char *>("--bind"); gpr_join_host_port(&args[2], "::", port); - args[3] = "--no-secure"; + args[3] = const_cast<char *>("--no-secure"); svr = gpr_subprocess_create(4, (const char **)args); gpr_free(args[0]); gpr_free(args[2]); @@ -54,10 +54,10 @@ int main(int argc, char **argv) { /* start the client */ gpr_asprintf(&args[0], "%s/fling_client%s", root, gpr_subprocess_binary_extension()); - args[1] = "--target"; + args[1] = const_cast<char *>("--target"); gpr_join_host_port(&args[2], "127.0.0.1", port); - args[3] = "--scenario=ping-pong-stream"; - args[4] = "--no-secure"; + args[3] = const_cast<char *>("--scenario=ping-pong-request"); + args[4] = const_cast<char *>("--no-secure"); args[5] = 0; cli = gpr_subprocess_create(6, (const char **)args); gpr_free(args[0]); diff --git a/test/core/fling/server.c b/test/core/fling/server.cc index b3a7fa21ec..34e5f79f0b 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.cc @@ -177,7 +177,7 @@ int main(int argc, char **argv) { int shutdown_finished = 0; int secure = 0; - char *addr = NULL; + const char *addr = NULL; char *fake_argv[1]; @@ -247,7 +247,7 @@ int main(int argc, char **argv) { cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); - s = ev.tag; + s = static_cast<call_state *>(ev.tag); switch (ev.type) { case GRPC_OP_COMPLETE: switch ((intptr_t)s) { diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.cc index de660fe1c4..f501948b96 100644 --- a/test/core/handshake/client_ssl.c +++ b/test/core/handshake/client_ssl.cc @@ -230,8 +230,7 @@ static bool client_ssl_test(char *server_alpn_preferred) { gpr_thd_options thdopt = gpr_thd_options_default(); gpr_thd_id thdid; gpr_thd_options_set_joinable(&thdopt); - server_args args = {.socket = server_socket, - .alpn_preferred = server_alpn_preferred}; + server_args args = {server_socket, server_alpn_preferred}; GPR_ASSERT(gpr_thd_new(&thdid, server_thread, &args, &thdopt)); // Load key pair and establish client SSL credentials. @@ -253,9 +252,10 @@ static bool client_ssl_test(char *server_alpn_preferred) { // lazy, this won't necessarily establish a connection yet. char *target; gpr_asprintf(&target, "127.0.0.1:%d", port); - grpc_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args grpc_args; grpc_args.num_args = 1; grpc_args.args = &ssl_name_override; @@ -305,14 +305,14 @@ static bool client_ssl_test(char *server_alpn_preferred) { int main(int argc, char *argv[]) { // Handshake succeeeds when the server has grpc-exp as the ALPN preference. - GPR_ASSERT(client_ssl_test("grpc-exp")); + GPR_ASSERT(client_ssl_test(const_cast<char *>("grpc-exp"))); // Handshake succeeeds when the server has h2 as the ALPN preference. This // covers legacy gRPC servers which don't support grpc-exp. - GPR_ASSERT(client_ssl_test("h2")); + GPR_ASSERT(client_ssl_test(const_cast<char *>("h2"))); // Handshake fails when the server uses a fake protocol as its ALPN // preference. This validates the client is correctly validating ALPN returns // and sanity checks the client_ssl_test. - GPR_ASSERT(!client_ssl_test("foo")); + GPR_ASSERT(!client_ssl_test(const_cast<char *>("foo"))); return 0; } diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.cc index 85a8b4de41..7b24459688 100644 --- a/test/core/handshake/server_ssl.c +++ b/test/core/handshake/server_ssl.cc @@ -175,7 +175,8 @@ static bool server_ssl_test(const char *alpn_list[], unsigned int alpn_list_len, for (unsigned int i = 0; i < alpn_list_len; ++i) { alpn_protos_len += (unsigned int)strlen(alpn_list[i]); } - unsigned char *alpn_protos = gpr_malloc(alpn_protos_len); + unsigned char *alpn_protos = + static_cast<unsigned char *>(gpr_malloc(alpn_protos_len)); unsigned char *p = alpn_protos; for (unsigned int i = 0; i < alpn_list_len; ++i) { const uint8_t len = (uint8_t)strlen(alpn_list[i]); diff --git a/test/core/http/format_request_test.c b/test/core/http/format_request_test.cc index 0279a1b5e3..b2d903458d 100644 --- a/test/core/http/format_request_test.c +++ b/test/core/http/format_request_test.cc @@ -24,13 +24,14 @@ #include "test/core/util/test_config.h" static void test_format_get_request(void) { - grpc_http_header hdr = {"x-yz", "abc"}; + grpc_http_header hdr = {const_cast<char *>("x-yz"), + const_cast<char *>("abc")}; grpc_httpcli_request req; grpc_slice slice; memset(&req, 0, sizeof(req)); - req.host = "example.com"; - req.http.path = "/index.html"; + req.host = const_cast<char *>("example.com"); + req.http.path = const_cast<char *>("/index.html"); req.http.hdr_count = 1; req.http.hdrs = &hdr; @@ -49,15 +50,16 @@ static void test_format_get_request(void) { } static void test_format_post_request(void) { - grpc_http_header hdr = {"x-yz", "abc"}; + grpc_http_header hdr = {const_cast<char *>("x-yz"), + const_cast<char *>("abc")}; grpc_httpcli_request req; grpc_slice slice; char body_bytes[] = "fake body"; size_t body_len = 9; memset(&req, 0, sizeof(req)); - req.host = "example.com"; - req.http.path = "/index.html"; + req.host = const_cast<char *>("example.com"); + req.http.path = const_cast<char *>("/index.html"); req.http.hdr_count = 1; req.http.hdrs = &hdr; @@ -79,13 +81,14 @@ static void test_format_post_request(void) { } static void test_format_post_request_no_body(void) { - grpc_http_header hdr = {"x-yz", "abc"}; + grpc_http_header hdr = {const_cast<char *>("x-yz"), + const_cast<char *>("abc")}; grpc_httpcli_request req; grpc_slice slice; memset(&req, 0, sizeof(req)); - req.host = "example.com"; - req.http.path = "/index.html"; + req.host = const_cast<char *>("example.com"); + req.http.path = const_cast<char *>("/index.html"); req.http.hdr_count = 1; req.http.hdrs = &hdr; @@ -110,13 +113,13 @@ static void test_format_post_request_content_type_override(void) { char body_bytes[] = "fake%20body"; size_t body_len = 11; - hdrs[0].key = "x-yz"; - hdrs[0].value = "abc"; - hdrs[1].key = "Content-Type"; - hdrs[1].value = "application/x-www-form-urlencoded"; + hdrs[0].key = const_cast<char *>("x-yz"); + hdrs[0].value = const_cast<char *>("abc"); + hdrs[1].key = const_cast<char *>("Content-Type"); + hdrs[1].value = const_cast<char *>("application/x-www-form-urlencoded"); memset(&req, 0, sizeof(req)); - req.host = "example.com"; - req.http.path = "/index.html"; + req.host = const_cast<char *>("example.com"); + req.http.path = const_cast<char *>("/index.html"); req.http.hdr_count = 2; req.http.hdrs = hdrs; diff --git a/test/core/http/httpcli_test.c b/test/core/http/httpcli_test.cc index cc1c16d695..925f63decc 100644 --- a/test/core/http/httpcli_test.c +++ b/test/core/http/httpcli_test.cc @@ -44,7 +44,7 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { const char *expect = "<html><head><title>Hello world!</title></head>" "<body><p>This is a test</p></body></html>"; - grpc_http_response *response = arg; + grpc_http_response *response = static_cast<grpc_http_response *>(arg); GPR_ASSERT(response); GPR_ASSERT(response->status == 200); GPR_ASSERT(response->body_length == strlen(expect)); @@ -70,7 +70,7 @@ static void test_get(int port) { memset(&req, 0, sizeof(req)); req.host = host; - req.http.path = "/get"; + req.http.path = const_cast<char *>("/get"); req.handshaker = &grpc_httpcli_plaintext; grpc_http_response response; @@ -110,7 +110,7 @@ static void test_post(int port) { memset(&req, 0, sizeof(req)); req.host = host; - req.http.path = "/post"; + req.http.path = const_cast<char *>("/post"); req.handshaker = &grpc_httpcli_plaintext; grpc_http_response response; @@ -139,7 +139,8 @@ static void test_post(int port) { } static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(p)); + grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset( + static_cast<grpc_polling_entity *>(p))); } int main(int argc, char **argv) { @@ -154,7 +155,7 @@ int main(int argc, char **argv) { /* figure out where we are */ char *root; if (lslash) { - root = gpr_malloc((size_t)(lslash - me + 1)); + root = static_cast<char *>(gpr_malloc((size_t)(lslash - me + 1))); memcpy(root, me, (size_t)(lslash - me)); root[lslash - me] = 0; } else { @@ -171,7 +172,7 @@ int main(int argc, char **argv) { } /* start the server */ - args[1 + arg_shift] = "--port"; + args[1 + arg_shift] = const_cast<char *>("--port"); gpr_asprintf(&args[2 + arg_shift], "%d", port); server = gpr_subprocess_create(3 + arg_shift, (const char **)args); GPR_ASSERT(server); @@ -186,7 +187,8 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); grpc_httpcli_context_init(&g_context); - grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); + grpc_pollset *pollset = + static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(pollset, &g_mu); g_pops = grpc_polling_entity_create_from_pollset(pollset); diff --git a/test/core/http/httpscli_test.c b/test/core/http/httpscli_test.cc index f8a3cfdd76..179b3a720b 100644 --- a/test/core/http/httpscli_test.c +++ b/test/core/http/httpscli_test.cc @@ -44,7 +44,7 @@ static void on_finish(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { const char *expect = "<html><head><title>Hello world!</title></head>" "<body><p>This is a test</p></body></html>"; - grpc_http_response *response = arg; + grpc_http_response *response = static_cast<grpc_http_response *>(arg); GPR_ASSERT(response); GPR_ASSERT(response->status == 200); GPR_ASSERT(response->body_length == strlen(expect)); @@ -70,8 +70,8 @@ static void test_get(int port) { memset(&req, 0, sizeof(req)); req.host = host; - req.ssl_host_override = "foo.test.google.fr"; - req.http.path = "/get"; + req.ssl_host_override = const_cast<char *>("foo.test.google.fr"); + req.http.path = const_cast<char *>("/get"); req.handshaker = &grpc_httpcli_ssl; grpc_http_response response; @@ -111,8 +111,8 @@ static void test_post(int port) { memset(&req, 0, sizeof(req)); req.host = host; - req.ssl_host_override = "foo.test.google.fr"; - req.http.path = "/post"; + req.ssl_host_override = const_cast<char *>("foo.test.google.fr"); + req.http.path = const_cast<char *>("/post"); req.handshaker = &grpc_httpcli_ssl; grpc_http_response response; @@ -141,7 +141,8 @@ static void test_post(int port) { } static void destroy_pops(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset(p)); + grpc_pollset_destroy(exec_ctx, grpc_polling_entity_pollset( + static_cast<grpc_polling_entity *>(p))); } int main(int argc, char **argv) { @@ -156,7 +157,7 @@ int main(int argc, char **argv) { /* figure out where we are */ char *root; if (lslash) { - root = gpr_malloc((size_t)(lslash - me + 1)); + root = static_cast<char *>(gpr_malloc((size_t)(lslash - me + 1))); memcpy(root, me, (size_t)(lslash - me)); root[lslash - me] = 0; } else { @@ -173,9 +174,9 @@ int main(int argc, char **argv) { } /* start the server */ - args[1 + arg_shift] = "--port"; + args[1 + arg_shift] = const_cast<char *>("--port"); gpr_asprintf(&args[2 + arg_shift], "%d", port); - args[3 + arg_shift] = "--ssl"; + args[3 + arg_shift] = const_cast<char *>("--ssl"); server = gpr_subprocess_create(4 + arg_shift, (const char **)args); GPR_ASSERT(server); gpr_free(args[0]); @@ -189,7 +190,8 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); grpc_httpcli_context_init(&g_context); - grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); + grpc_pollset *pollset = + static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(pollset, &g_mu); g_pops = grpc_polling_entity_create_from_pollset(pollset); diff --git a/test/core/http/parser_test.c b/test/core/http/parser_test.cc index a7044c03bc..9eff49122c 100644 --- a/test/core/http/parser_test.c +++ b/test/core/http/parser_test.cc @@ -29,9 +29,11 @@ #include "test/core/util/test_config.h" static void test_request_succeeds(grpc_slice_split_mode split_mode, - char *request_text, char *expect_method, + const char *request_text, + const char *expect_method, grpc_http_version expect_version, - char *expect_path, char *expect_body, ...) { + const char *expect_path, + const char *expect_body, ...) { grpc_http_parser parser; grpc_slice input_slice = grpc_slice_from_copied_string(request_text); size_t num_slices; @@ -87,8 +89,9 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode, gpr_free(slices); } -static void test_succeeds(grpc_slice_split_mode split_mode, char *response_text, - int expect_status, char *expect_body, ...) { +static void test_succeeds(grpc_slice_split_mode split_mode, + const char *response_text, int expect_status, + const char *expect_body, ...) { grpc_http_parser parser; grpc_slice input_slice = grpc_slice_from_copied_string(response_text); size_t num_slices; @@ -141,7 +144,8 @@ static void test_succeeds(grpc_slice_split_mode split_mode, char *response_text, gpr_free(slices); } -static void test_fails(grpc_slice_split_mode split_mode, char *response_text) { +static void test_fails(grpc_slice_split_mode split_mode, + const char *response_text) { grpc_http_parser parser; grpc_slice input_slice = grpc_slice_from_copied_string(response_text); size_t num_slices; @@ -174,7 +178,7 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response_text) { } static void test_request_fails(grpc_slice_split_mode split_mode, - char *request_text) { + const char *request_text) { grpc_http_parser parser; grpc_slice input_slice = grpc_slice_from_copied_string(request_text); size_t num_slices; @@ -286,7 +290,8 @@ int main(int argc, char **argv) { test_request_fails(split_modes[i], "GET / HTTP/1.2\r\n"); test_request_fails(split_modes[i], "GET / HTTP/1.0\n"); - tmp1 = gpr_malloc(2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH); + tmp1 = + static_cast<char *>(gpr_malloc(2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH)); memset(tmp1, 'a', 2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1); tmp1[2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1] = 0; gpr_asprintf(&tmp2, "HTTP/1.0 200 OK\r\nxyz: %s\r\n\r\n", tmp1); diff --git a/test/core/http/request_fuzzer.c b/test/core/http/request_fuzzer.cc index aefe9eb0f9..aefe9eb0f9 100644 --- a/test/core/http/request_fuzzer.c +++ b/test/core/http/request_fuzzer.cc diff --git a/test/core/http/response_fuzzer.c b/test/core/http/response_fuzzer.cc index d5bb67500d..d5bb67500d 100644 --- a/test/core/http/response_fuzzer.c +++ b/test/core/http/response_fuzzer.cc diff --git a/test/core/iomgr/combiner_test.c b/test/core/iomgr/combiner_test.cc index 38f512de0e..7d2d098d2b 100644 --- a/test/core/iomgr/combiner_test.c +++ b/test/core/iomgr/combiner_test.cc @@ -35,7 +35,7 @@ static void test_no_op(void) { static void set_event_to_true(grpc_exec_ctx *exec_ctx, void *value, grpc_error *error) { - gpr_event_set(value, (void *)1); + gpr_event_set(static_cast<gpr_event *>(value), (void *)1); } static void test_execute_one(void) { @@ -68,19 +68,19 @@ typedef struct { } ex_args; static void check_one(grpc_exec_ctx *exec_ctx, void *a, grpc_error *error) { - ex_args *args = a; + ex_args *args = static_cast<ex_args *>(a); GPR_ASSERT(*args->ctr == args->value - 1); *args->ctr = args->value; gpr_free(a); } static void execute_many_loop(void *a) { - thd_args *args = a; + thd_args *args = static_cast<thd_args *>(a); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; size_t n = 1; for (size_t i = 0; i < 10; i++) { for (size_t j = 0; j < 10000; j++) { - ex_args *c = gpr_malloc(sizeof(*c)); + ex_args *c = static_cast<ex_args *>(gpr_malloc(sizeof(*c))); c->ctr = &args->ctr; c->value = n++; GRPC_CLOSURE_SCHED(&exec_ctx, @@ -131,10 +131,11 @@ static void in_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { } static void add_finally(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - GRPC_CLOSURE_SCHED(exec_ctx, - GRPC_CLOSURE_CREATE(in_finally, arg, - grpc_combiner_finally_scheduler(arg)), - GRPC_ERROR_NONE); + GRPC_CLOSURE_SCHED( + exec_ctx, GRPC_CLOSURE_CREATE(in_finally, arg, + grpc_combiner_finally_scheduler( + static_cast<grpc_combiner *>(arg))), + GRPC_ERROR_NONE); } static void test_execute_finally(void) { diff --git a/test/core/iomgr/endpoint_pair_test.c b/test/core/iomgr/endpoint_pair_test.cc index f2ce3d0d12..c7ce6c0419 100644 --- a/test/core/iomgr/endpoint_pair_test.c +++ b/test/core/iomgr/endpoint_pair_test.cc @@ -34,10 +34,11 @@ static grpc_endpoint_test_fixture create_fixture_endpoint_pair( size_t slice_size) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_endpoint_test_fixture f; - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; grpc_endpoint_pair p = grpc_iomgr_create_endpoint_pair("test", &args); f.client_ep = p.client; @@ -55,7 +56,7 @@ static grpc_endpoint_test_config configs[] = { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -63,7 +64,7 @@ int main(int argc, char **argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); grpc_endpoint_tests(configs[0], g_pollset, g_mu); GRPC_CLOSURE_INIT(&destroyed, destroy_pollset, g_pollset, diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.cc index 61e901f645..61e901f645 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.cc diff --git a/test/core/iomgr/error_test.c b/test/core/iomgr/error_test.cc index 51f8af1957..51f8af1957 100644 --- a/test/core/iomgr/error_test.c +++ b/test/core/iomgr/error_test.cc diff --git a/test/core/iomgr/ev_epollsig_linux_test.c b/test/core/iomgr/ev_epollsig_linux_test.cc index 37aadacd49..23079c12c6 100644 --- a/test/core/iomgr/ev_epollsig_linux_test.c +++ b/test/core/iomgr/ev_epollsig_linux_test.cc @@ -92,14 +92,15 @@ static void test_fd_cleanup(grpc_exec_ctx *exec_ctx, test_fd *tfds, static void test_pollset_init(test_pollset *pollsets, int num_pollsets) { int i; for (i = 0; i < num_pollsets; i++) { - pollsets[i].pollset = gpr_zalloc(grpc_pollset_size()); + pollsets[i].pollset = + static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(pollsets[i].pollset, &pollsets[i].mu); } } static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, (grpc_pollset *)p); } static void test_pollset_cleanup(grpc_exec_ctx *exec_ctx, @@ -232,7 +233,7 @@ typedef struct threading_shared { static __thread int thread_wakeups = 0; static void test_threading_loop(void *arg) { - threading_shared *shared = arg; + threading_shared *shared = static_cast<threading_shared *>(arg); while (thread_wakeups < 1000000) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_pollset_worker *worker; @@ -247,7 +248,7 @@ static void test_threading_loop(void *arg) { static void test_threading_wakeup(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - threading_shared *shared = arg; + threading_shared *shared = static_cast<threading_shared *>(arg); ++shared->wakeups; ++thread_wakeups; if (error == GRPC_ERROR_NONE) { @@ -261,7 +262,7 @@ static void test_threading_wakeup(grpc_exec_ctx *exec_ctx, void *arg, static void test_threading(void) { threading_shared shared; - shared.pollset = gpr_zalloc(grpc_pollset_size()); + shared.pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(shared.pollset, &shared.mu); gpr_thd_id thds[10]; diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.cc index d29b1e8e41..d29b1e8e41 100644 --- a/test/core/iomgr/fd_conservation_posix_test.c +++ b/test/core/iomgr/fd_conservation_posix_test.cc diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.cc index 1c62f34d3e..63363a43a5 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.cc @@ -113,7 +113,7 @@ typedef struct { Close session FD and start to shutdown listen FD. */ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ bool success) { - session *se = arg; + session *se = static_cast<session *>(arg); server *sv = se->sv; grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, false /* already_closed */, "a"); @@ -126,7 +126,7 @@ static void session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ /* Called when data become readable in a session. */ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ grpc_error *error) { - session *se = arg; + session *se = static_cast<session *>(arg); int fd = grpc_fd_wrapped_fd(se->em_fd); ssize_t read_once = 0; @@ -171,7 +171,7 @@ static void session_read_cb(grpc_exec_ctx *exec_ctx, void *arg, /*session */ Close listen FD and signal that server can be shutdown. */ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */, int success) { - server *sv = arg; + server *sv = static_cast<server *>(arg); grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, false /* already_closed */, "b"); @@ -186,7 +186,7 @@ static void listen_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*server */, /* Called when a new TCP connection request arrives in the listening port. */ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/ grpc_error *error) { - server *sv = arg; + server *sv = static_cast<server *>(arg); int fd; int flags; session *se; @@ -204,7 +204,7 @@ static void listen_cb(grpc_exec_ctx *exec_ctx, void *arg, /*=sv_arg*/ GPR_ASSERT(fd < FD_SETSIZE); flags = fcntl(fd, F_GETFL, 0); fcntl(fd, F_SETFL, flags | O_NONBLOCK); - se = gpr_malloc(sizeof(*se)); + se = static_cast<session *>(gpr_malloc(sizeof(*se))); se->sv = sv; se->em_fd = grpc_fd_create(fd, "listener"); grpc_pollset_add_fd(exec_ctx, g_pollset, se->em_fd); @@ -291,7 +291,7 @@ static void client_init(client *cl) { /* Called when a client upload session is ready to shutdown. */ static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx, void *arg /*client */, int success) { - client *cl = arg; + client *cl = static_cast<client *>(arg); grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, false /* already_closed */, "c"); cl->done = 1; @@ -302,7 +302,7 @@ static void client_session_shutdown_cb(grpc_exec_ctx *exec_ctx, /* Write as much as possible, then register notify_on_write. */ static void client_session_write(grpc_exec_ctx *exec_ctx, void *arg, /*client */ grpc_error *error) { - client *cl = arg; + client *cl = static_cast<client *>(arg); int fd = grpc_fd_wrapped_fd(cl->em_fd); ssize_t write_once = 0; @@ -409,7 +409,7 @@ void destroy_change_data(fd_change_data *fdc) {} static void first_read_callback(grpc_exec_ctx *exec_ctx, void *arg /* fd_change_data */, grpc_error *error) { - fd_change_data *fdc = arg; + fd_change_data *fdc = static_cast<fd_change_data *>(arg); gpr_mu_lock(g_mu); fdc->cb_that_ran = first_read_callback; @@ -421,7 +421,7 @@ static void first_read_callback(grpc_exec_ctx *exec_ctx, static void second_read_callback(grpc_exec_ctx *exec_ctx, void *arg /* fd_change_data */, grpc_error *error) { - fd_change_data *fdc = arg; + fd_change_data *fdc = static_cast<fd_change_data *>(arg); gpr_mu_lock(g_mu); fdc->cb_that_ran = second_read_callback; @@ -516,7 +516,7 @@ static void test_grpc_fd_change(void) { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -524,7 +524,7 @@ int main(int argc, char **argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); test_grpc_fd(); test_grpc_fd_change(); diff --git a/test/core/iomgr/load_file_test.c b/test/core/iomgr/load_file_test.cc index 537c3430b1..5fb8266b10 100644 --- a/test/core/iomgr/load_file_test.c +++ b/test/core/iomgr/load_file_test.cc @@ -122,7 +122,7 @@ static void test_load_big_file(void) { grpc_error *error; char *tmp_name; static const size_t buffer_size = 124631; - unsigned char *buffer = gpr_malloc(buffer_size); + unsigned char *buffer = static_cast<unsigned char *>(gpr_malloc(buffer_size)); unsigned char *current; size_t i; diff --git a/test/core/iomgr/pollset_set_test.c b/test/core/iomgr/pollset_set_test.cc index cddc146ce0..ae19c81d6d 100644 --- a/test/core/iomgr/pollset_set_test.c +++ b/test/core/iomgr/pollset_set_test.cc @@ -65,14 +65,15 @@ typedef struct test_pollset { static void init_test_pollsets(test_pollset *pollsets, const int num_pollsets) { for (int i = 0; i < num_pollsets; i++) { - pollsets[i].ps = gpr_zalloc(grpc_pollset_size()); + pollsets[i].ps = + static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(pollsets[i].ps, &pollsets[i].mu); } } static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } static void cleanup_test_pollsets(grpc_exec_ctx *exec_ctx, diff --git a/test/core/iomgr/resolve_address_posix_test.c b/test/core/iomgr/resolve_address_posix_test.cc index cb9d6080fb..572b4222b5 100644 --- a/test/core/iomgr/resolve_address_posix_test.c +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -50,7 +50,7 @@ static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} void args_init(grpc_exec_ctx *exec_ctx, args_struct *args) { gpr_event_init(&args->ev); - args->pollset = gpr_zalloc(grpc_pollset_size()); + args->pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(args->pollset, &args->mu); args->pollset_set = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset); @@ -78,7 +78,7 @@ static grpc_millis n_sec_deadline(int seconds) { } static void actually_poll(void *argsp) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_millis deadline = n_sec_deadline(10); while (true) { @@ -109,7 +109,7 @@ static void poll_pollset_until_request_done(args_struct *args) { static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err == GRPC_ERROR_NONE); GPR_ASSERT(args->addrs != NULL); GPR_ASSERT(args->addrs->naddrs > 0); @@ -117,7 +117,7 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, } static void must_fail(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err != GRPC_ERROR_NONE); gpr_atm_rel_store(&args->done_atm, 1); } @@ -142,7 +142,8 @@ static void test_unix_socket_path_name_too_long(void) { const char prefix[] = "unix:/path/name"; size_t path_name_length = GPR_ARRAY_SIZE(((struct sockaddr_un *)0)->sun_path) + 6; - char *path_name = gpr_malloc(sizeof(char) * path_name_length); + char *path_name = + static_cast<char *>(gpr_malloc(sizeof(char) * path_name_length)); memset(path_name, 'a', path_name_length); memcpy(path_name, prefix, strlen(prefix) - 1); path_name[path_name_length - 1] = '\0'; diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.cc index 178bbbb95f..da6aab3518 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.cc @@ -43,7 +43,7 @@ static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} void args_init(grpc_exec_ctx *exec_ctx, args_struct *args) { gpr_event_init(&args->ev); - args->pollset = gpr_zalloc(grpc_pollset_size()); + args->pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(args->pollset, &args->mu); args->pollset_set = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset); @@ -98,7 +98,7 @@ static void poll_pollset_until_request_done(args_struct *args) { static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err == GRPC_ERROR_NONE); GPR_ASSERT(args->addrs != NULL); GPR_ASSERT(args->addrs->naddrs > 0); @@ -110,7 +110,7 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *argsp, } static void must_fail(grpc_exec_ctx *exec_ctx, void *argsp, grpc_error *err) { - args_struct *args = argsp; + args_struct *args = static_cast<args_struct *>(argsp); GPR_ASSERT(err != GRPC_ERROR_NONE); gpr_atm_rel_store(&args->done_atm, 1); gpr_mu_lock(args->mu); diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.cc index b588f3d120..f0002e0947 100644 --- a/test/core/iomgr/resource_quota_test.c +++ b/test/core/iomgr/resource_quota_test.cc @@ -58,7 +58,7 @@ typedef struct { static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args, grpc_error *error) { GPR_ASSERT(error == GRPC_ERROR_NONE); - reclaimer_args *a = args; + reclaimer_args *a = static_cast<reclaimer_args *>(args); grpc_resource_user_free(exec_ctx, a->resource_user, a->size); grpc_resource_user_finish_reclamation(exec_ctx, a->resource_user); GRPC_CLOSURE_RUN(exec_ctx, a->then, GRPC_ERROR_NONE); @@ -66,7 +66,7 @@ static void reclaimer_cb(grpc_exec_ctx *exec_ctx, void *args, } grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size, grpc_closure *then) { - reclaimer_args *a = gpr_malloc(sizeof(*a)); + reclaimer_args *a = static_cast<reclaimer_args *>(gpr_malloc(sizeof(*a))); a->size = size; a->resource_user = resource_user; a->then = then; @@ -76,7 +76,7 @@ grpc_closure *make_reclaimer(grpc_resource_user *resource_user, size_t size, static void unused_reclaimer_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { GPR_ASSERT(error == GRPC_ERROR_CANCELLED); - GRPC_CLOSURE_RUN(exec_ctx, arg, GRPC_ERROR_NONE); + GRPC_CLOSURE_RUN(exec_ctx, static_cast<grpc_closure *>(arg), GRPC_ERROR_NONE); } grpc_closure *make_unused_reclaimer(grpc_closure *then) { return GRPC_CLOSURE_CREATE(unused_reclaimer_cb, then, diff --git a/test/core/iomgr/sockaddr_utils_test.c b/test/core/iomgr/sockaddr_utils_test.cc index e4a4ddaa99..e4a4ddaa99 100644 --- a/test/core/iomgr/sockaddr_utils_test.c +++ b/test/core/iomgr/sockaddr_utils_test.cc diff --git a/test/core/iomgr/socket_utils_test.c b/test/core/iomgr/socket_utils_test.cc index 30f0c943dc..30f0c943dc 100644 --- a/test/core/iomgr/socket_utils_test.c +++ b/test/core/iomgr/socket_utils_test.cc diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.cc index b8b76d1c42..b2dcb1d04f 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.cc @@ -190,7 +190,7 @@ void test_fails(void) { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -199,7 +199,7 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); g_pollset_set = grpc_pollset_set_create(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); grpc_pollset_set_add_pollset(&exec_ctx, g_pollset_set, g_pollset); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/iomgr/tcp_client_uv_test.c b/test/core/iomgr/tcp_client_uv_test.cc index edfccbe867..edfccbe867 100644 --- a/test/core/iomgr/tcp_client_uv_test.c +++ b/test/core/iomgr/tcp_client_uv_test.cc diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.cc index 6501160c6f..8a4433b55c 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.cc @@ -171,10 +171,10 @@ static void read_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER, a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args, "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); @@ -223,10 +223,11 @@ static void large_read_test(size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "large_read_test"), &args, "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); @@ -363,10 +364,10 @@ static void write_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER, a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "write_test"), &args, "test"); grpc_endpoint_add_to_pollset(&exec_ctx, ep, g_pollset); @@ -433,10 +434,11 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { create_sockets(sv); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; ep = grpc_tcp_create(&exec_ctx, grpc_fd_create(sv[1], "read_test"), &args, "test"); GPR_ASSERT(grpc_tcp_fd(ep) == sv[1] && sv[1] >= 0); @@ -525,10 +527,11 @@ static grpc_endpoint_test_fixture create_fixture_tcp_socketpair( create_sockets(sv); grpc_resource_quota *resource_quota = grpc_resource_quota_create("tcp_posix_test_socketpair"); - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; - grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; + grpc_channel_args args = {GPR_ARRAY_SIZE(a), a}; f.client_ep = grpc_tcp_create( &exec_ctx, grpc_fd_create(sv[0], "fixture:client"), &args, "test"); f.server_ep = grpc_tcp_create( diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.cc index 782dfb413a..a44e3954f2 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -112,7 +112,7 @@ static void on_connect_result_set(on_connect_result *result, static void server_weak_ref_shutdown(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - server_weak_ref *weak_ref = arg; + server_weak_ref *weak_ref = static_cast<server_weak_ref *>(arg); weak_ref->server = NULL; } @@ -429,22 +429,25 @@ static void test_connect(size_t num_connects, static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { grpc_closure destroyed; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_arg chan_args[] = { - {GRPC_ARG_INTEGER, GRPC_ARG_EXPAND_WILDCARD_ADDRS, {.integer = 1}}}; + grpc_arg chan_args[1]; + chan_args[0].type = GRPC_ARG_INTEGER; + chan_args[0].key = const_cast<char *>(GRPC_ARG_EXPAND_WILDCARD_ADDRS); + chan_args[0].value.integer = 1; const grpc_channel_args channel_args = {1, chan_args}; struct ifaddrs *ifa = NULL; struct ifaddrs *ifa_it; // Zalloc dst_addrs to avoid oversized frames. - test_addrs *dst_addrs = gpr_zalloc(sizeof(*dst_addrs)); + test_addrs *dst_addrs = + static_cast<test_addrs *>(gpr_zalloc(sizeof(*dst_addrs))); grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); test_no_op(); diff --git a/test/core/iomgr/tcp_server_uv_test.c b/test/core/iomgr/tcp_server_uv_test.cc index 9fafd3177a..9fafd3177a 100644 --- a/test/core/iomgr/tcp_server_uv_test.c +++ b/test/core/iomgr/tcp_server_uv_test.cc diff --git a/test/core/iomgr/time_averaged_stats_test.c b/test/core/iomgr/time_averaged_stats_test.cc index 508e3c5bf8..508e3c5bf8 100644 --- a/test/core/iomgr/time_averaged_stats_test.c +++ b/test/core/iomgr/time_averaged_stats_test.cc diff --git a/test/core/iomgr/timer_heap_test.c b/test/core/iomgr/timer_heap_test.cc index ee5a474fd1..3eb25dd0be 100644 --- a/test/core/iomgr/timer_heap_test.c +++ b/test/core/iomgr/timer_heap_test.cc @@ -35,7 +35,8 @@ static gpr_atm random_deadline(void) { return rand(); } static grpc_timer *create_test_elements(size_t num_elements) { - grpc_timer *elems = gpr_malloc(num_elements * sizeof(grpc_timer)); + grpc_timer *elems = + static_cast<grpc_timer *>(gpr_malloc(num_elements * sizeof(grpc_timer))); size_t i; for (i = 0; i < num_elements; i++) { elems[i].deadline = random_deadline(); @@ -75,7 +76,7 @@ static void test1(void) { const size_t num_test_operations = 10000; size_t i; grpc_timer *test_elements = create_test_elements(num_test_elements); - uint8_t *inpq = gpr_malloc(num_test_elements); + uint8_t *inpq = static_cast<uint8_t *>(gpr_malloc(num_test_elements)); gpr_log(GPR_INFO, "test1"); @@ -135,7 +136,8 @@ typedef struct { static elem_struct *search_elems(elem_struct *elems, size_t count, bool inserted) { - size_t *search_order = gpr_malloc(count * sizeof(*search_order)); + size_t *search_order = + static_cast<size_t *>(gpr_malloc(count * sizeof(*search_order))); for (size_t i = 0; i < count; i++) { search_order[i] = i; } @@ -160,7 +162,8 @@ static void test2(void) { grpc_timer_heap pq; static const size_t elems_size = 1000; - elem_struct *elems = gpr_malloc(elems_size * sizeof(elem_struct)); + elem_struct *elems = + static_cast<elem_struct *>(gpr_malloc(elems_size * sizeof(elem_struct))); size_t num_inserted = 0; grpc_timer_heap_init(&pq); diff --git a/test/core/iomgr/timer_list_test.c b/test/core/iomgr/timer_list_test.cc index c3d9f9d88d..c3d9f9d88d 100644 --- a/test/core/iomgr/timer_list_test.c +++ b/test/core/iomgr/timer_list_test.cc diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.cc index 2e44d0abc8..51c7ab8c29 100644 --- a/test/core/iomgr/udp_server_test.c +++ b/test/core/iomgr/udp_server_test.cc @@ -118,7 +118,8 @@ static const grpc_socket_factory_vtable test_socket_factory_vtable = { test_socket_factory_compare, test_socket_factory_destroy}; static test_socket_factory *test_socket_factory_create(void) { - test_socket_factory *factory = gpr_malloc(sizeof(test_socket_factory)); + test_socket_factory *factory = static_cast<test_socket_factory *>( + gpr_malloc(sizeof(test_socket_factory))); grpc_socket_factory_init(&factory->base, &test_socket_factory_vtable); factory->number_of_socket_calls = 0; factory->number_of_bind_calls = 0; @@ -292,7 +293,7 @@ static void test_receive(int number_of_clients) { static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, p); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(p)); } int main(int argc, char **argv) { @@ -300,7 +301,7 @@ int main(int argc, char **argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_test_init(argc, argv); grpc_init(); - g_pollset = gpr_zalloc(grpc_pollset_size()); + g_pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(g_pollset, &g_mu); test_no_op(); diff --git a/test/core/iomgr/wakeup_fd_cv_test.c b/test/core/iomgr/wakeup_fd_cv_test.cc index 0b211274f2..0b211274f2 100644 --- a/test/core/iomgr/wakeup_fd_cv_test.c +++ b/test/core/iomgr/wakeup_fd_cv_test.cc diff --git a/test/core/json/fuzzer.c b/test/core/json/fuzzer.cc index b825904d41..a8b75f72a2 100644 --- a/test/core/json/fuzzer.c +++ b/test/core/json/fuzzer.cc @@ -33,7 +33,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { char *s; struct grpc_memory_counters counters; grpc_memory_counters_init(); - s = gpr_malloc(size); + s = static_cast<char *>(gpr_malloc(size)); memcpy(s, data, size); grpc_json *x; if ((x = grpc_json_parse_string_with_len(s, size))) { diff --git a/test/core/json/json_rewrite.c b/test/core/json/json_rewrite.cc index dfe32f5adf..27443e3c49 100644 --- a/test/core/json/json_rewrite.c +++ b/test/core/json/json_rewrite.cc @@ -45,18 +45,18 @@ typedef struct json_reader_userdata { } json_reader_userdata; static void json_writer_output_char(void *userdata, char c) { - json_writer_userdata *state = userdata; + json_writer_userdata *state = static_cast<json_writer_userdata *>(userdata); fputc(c, state->out); } static void json_writer_output_string(void *userdata, const char *str) { - json_writer_userdata *state = userdata; + json_writer_userdata *state = static_cast<json_writer_userdata *>(userdata); fputs(str, state->out); } static void json_writer_output_string_with_len(void *userdata, const char *str, size_t len) { - json_writer_userdata *state = userdata; + json_writer_userdata *state = static_cast<json_writer_userdata *>(userdata); fwrite(str, len, 1, state->out); } @@ -68,19 +68,20 @@ static void check_string(json_reader_userdata *state, size_t needed) { if (state->free_space >= needed) return; needed -= state->free_space; needed = (needed + 0xffu) & ~0xffu; - state->scratchpad = gpr_realloc(state->scratchpad, state->allocated + needed); + state->scratchpad = static_cast<char *>( + gpr_realloc(state->scratchpad, state->allocated + needed)); state->free_space += needed; state->allocated += needed; } static void json_reader_string_clear(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); state->free_space = state->allocated; state->string_len = 0; } static void json_reader_string_add_char(void *userdata, uint32_t c) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); check_string(state, 1); GPR_ASSERT(c < 256); state->scratchpad[state->string_len++] = (char)c; @@ -115,7 +116,7 @@ static void json_reader_string_add_utf32(void *userdata, uint32_t c) { static uint32_t json_reader_read_char(void *userdata) { int r; - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); r = fgetc(state->in); if (r == EOF) r = GRPC_JSON_READ_CHAR_EOF; @@ -123,8 +124,9 @@ static uint32_t json_reader_read_char(void *userdata) { } static void json_reader_container_begins(void *userdata, grpc_json_type type) { - json_reader_userdata *state = userdata; - stacked_container *container = gpr_malloc(sizeof(stacked_container)); + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); + stacked_container *container = + static_cast<stacked_container *>(gpr_malloc(sizeof(stacked_container))); container->type = type; container->next = state->top; @@ -134,7 +136,7 @@ static void json_reader_container_begins(void *userdata, grpc_json_type type) { } static grpc_json_type json_reader_container_ends(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); stacked_container *container = state->top; grpc_json_writer_container_ends(state->writer, container->type); @@ -144,21 +146,21 @@ static grpc_json_type json_reader_container_ends(void *userdata) { } static void json_reader_set_key(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); json_reader_string_add_char(userdata, 0); grpc_json_writer_object_key(state->writer, state->scratchpad); } static void json_reader_set_string(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); json_reader_string_add_char(userdata, 0); grpc_json_writer_value_string(state->writer, state->scratchpad); } static int json_reader_set_number(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, state->scratchpad, state->string_len); @@ -167,19 +169,19 @@ static int json_reader_set_number(void *userdata) { } static void json_reader_set_true(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, "true", 4); } static void json_reader_set_false(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, "false", 5); } static void json_reader_set_null(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, "null", 4); } diff --git a/test/core/json/json_rewrite_test.c b/test/core/json/json_rewrite_test.cc index a654971b34..ba22709a70 100644 --- a/test/core/json/json_rewrite_test.c +++ b/test/core/json/json_rewrite_test.cc @@ -47,7 +47,7 @@ typedef struct json_reader_userdata { } json_reader_userdata; static void json_writer_output_char(void *userdata, char c) { - json_writer_userdata *state = userdata; + json_writer_userdata *state = static_cast<json_writer_userdata *>(userdata); int cmp = fgetc(state->cmp); /* treat CRLF as LF */ @@ -79,19 +79,20 @@ static void check_string(json_reader_userdata *state, size_t needed) { if (state->free_space >= needed) return; needed -= state->free_space; needed = (needed + 0xffu) & ~0xffu; - state->scratchpad = gpr_realloc(state->scratchpad, state->allocated + needed); + state->scratchpad = static_cast<char *>( + gpr_realloc(state->scratchpad, state->allocated + needed)); state->free_space += needed; state->allocated += needed; } static void json_reader_string_clear(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); state->free_space = state->allocated; state->string_len = 0; } static void json_reader_string_add_char(void *userdata, uint32_t c) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); check_string(state, 1); GPR_ASSERT(c <= 256); state->scratchpad[state->string_len++] = (char)c; @@ -126,7 +127,7 @@ static void json_reader_string_add_utf32(void *userdata, uint32_t c) { static uint32_t json_reader_read_char(void *userdata) { int r; - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); if (!state->did_eagain) { state->did_eagain = 1; @@ -141,8 +142,9 @@ static uint32_t json_reader_read_char(void *userdata) { } static void json_reader_container_begins(void *userdata, grpc_json_type type) { - json_reader_userdata *state = userdata; - stacked_container *container = gpr_malloc(sizeof(stacked_container)); + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); + stacked_container *container = + static_cast<stacked_container *>(gpr_malloc(sizeof(stacked_container))); container->type = type; container->next = state->top; @@ -152,7 +154,7 @@ static void json_reader_container_begins(void *userdata, grpc_json_type type) { } static grpc_json_type json_reader_container_ends(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); stacked_container *container = state->top; grpc_json_writer_container_ends(state->writer, container->type); @@ -162,21 +164,21 @@ static grpc_json_type json_reader_container_ends(void *userdata) { } static void json_reader_set_key(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); json_reader_string_add_char(userdata, 0); grpc_json_writer_object_key(state->writer, state->scratchpad); } static void json_reader_set_string(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); json_reader_string_add_char(userdata, 0); grpc_json_writer_value_string(state->writer, state->scratchpad); } static int json_reader_set_number(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, state->scratchpad, state->string_len); @@ -185,19 +187,19 @@ static int json_reader_set_number(void *userdata) { } static void json_reader_set_true(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, "true", 4); } static void json_reader_set_false(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, "false", 5); } static void json_reader_set_null(void *userdata) { - json_reader_userdata *state = userdata; + json_reader_userdata *state = static_cast<json_reader_userdata *>(userdata); grpc_json_writer_value_raw_with_len(state->writer, "null", 4); } diff --git a/test/core/json/json_stream_error_test.c b/test/core/json/json_stream_error_test.cc index 379cd5d078..379cd5d078 100644 --- a/test/core/json/json_stream_error_test.c +++ b/test/core/json/json_stream_error_test.cc diff --git a/test/core/json/json_test.c b/test/core/json/json_test.cc index bbc6f7a4e6..bbc6f7a4e6 100644 --- a/test/core/json/json_test.c +++ b/test/core/json/json_test.cc diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.cc index 6392554d85..fbf907fe33 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.cc @@ -183,7 +183,7 @@ int main(int argc, char **argv) { grpc_slice slice = grpc_slice_from_copied_string("x"); char *fake_argv[1]; - char *target = "localhost:443"; + const char *target = "localhost:443"; gpr_cmdline *cl; grpc_event event; diff --git a/test/core/memory_usage/memory_usage_test.c b/test/core/memory_usage/memory_usage_test.cc index f4ee6c65e3..7bf165719b 100644 --- a/test/core/memory_usage/memory_usage_test.c +++ b/test/core/memory_usage/memory_usage_test.cc @@ -44,9 +44,9 @@ int main(int argc, char **argv) { /* start the server */ gpr_asprintf(&args[0], "%s/memory_profile_server%s", root, gpr_subprocess_binary_extension()); - args[1] = "--bind"; + args[1] = const_cast<char *>("--bind"); gpr_join_host_port(&args[2], "::", port); - args[3] = "--no-secure"; + args[3] = const_cast<char *>("--no-secure"); svr = gpr_subprocess_create(4, (const char **)args); gpr_free(args[0]); gpr_free(args[2]); @@ -54,10 +54,10 @@ int main(int argc, char **argv) { /* start the client */ gpr_asprintf(&args[0], "%s/memory_profile_client%s", root, gpr_subprocess_binary_extension()); - args[1] = "--target"; + args[1] = const_cast<char *>("--target"); gpr_join_host_port(&args[2], "127.0.0.1", port); - args[3] = "--warmup=1000"; - args[4] = "--benchmark=9000"; + args[3] = const_cast<char *>("--warmup=1000"); + args[4] = const_cast<char *>("--benchmark=9000"); cli = gpr_subprocess_create(5, (const char **)args); gpr_free(args[0]); gpr_free(args[2]); diff --git a/test/core/memory_usage/server.c b/test/core/memory_usage/server.cc index b25341ead2..8dee58e274 100644 --- a/test/core/memory_usage/server.c +++ b/test/core/memory_usage/server.cc @@ -151,7 +151,7 @@ int main(int argc, char **argv) { int shutdown_finished = 0; int secure = 0; - char *addr = NULL; + const char *addr = NULL; char *fake_argv[1]; @@ -231,7 +231,7 @@ int main(int argc, char **argv) { cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros(1000000, GPR_TIMESPAN)), NULL); - fling_call *s = ev.tag; + fling_call *s = static_cast<fling_call *>(ev.tag); switch (ev.type) { case GRPC_OP_COMPLETE: switch (s->state) { diff --git a/test/core/nanopb/fuzzer_response.c b/test/core/nanopb/fuzzer_response.cc index c9b63979a1..c9b63979a1 100644 --- a/test/core/nanopb/fuzzer_response.c +++ b/test/core/nanopb/fuzzer_response.cc diff --git a/test/core/nanopb/fuzzer_serverlist.c b/test/core/nanopb/fuzzer_serverlist.cc index dd70f0c331..dd70f0c331 100644 --- a/test/core/nanopb/fuzzer_serverlist.c +++ b/test/core/nanopb/fuzzer_serverlist.cc diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.cc index 1550003eb9..1550003eb9 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.c +++ b/test/core/network_benchmarks/low_level_ping_pong.cc diff --git a/test/core/security/auth_context_test.c b/test/core/security/auth_context_test.cc index 88daf28c99..88daf28c99 100644 --- a/test/core/security/auth_context_test.c +++ b/test/core/security/auth_context_test.cc diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.cc index 93ea27f425..2444dbeae7 100644 --- a/test/core/security/create_jwt.c +++ b/test/core/security/create_jwt.cc @@ -54,9 +54,9 @@ void create_jwt(const char *json_key_file_path, const char *service_url, } int main(int argc, char **argv) { - char *scope = NULL; - char *json_key_file_path = NULL; - char *service_url = NULL; + const char *scope = NULL; + const char *json_key_file_path = NULL; + const char *service_url = NULL; grpc_init(); gpr_cmdline *cl = gpr_cmdline_create("create_jwt"); gpr_cmdline_add_string(cl, "json_key", "File path of the json key.", diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.cc index 34f310142c..dfc071b64a 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.cc @@ -44,7 +44,8 @@ static grpc_channel_credentials *grpc_mock_channel_credentials_create( const grpc_channel_credentials_vtable *vtable) { - grpc_channel_credentials *c = gpr_malloc(sizeof(*c)); + grpc_channel_credentials *c = + static_cast<grpc_channel_credentials *>(gpr_malloc(sizeof(*c))); memset(c, 0, sizeof(*c)); c->type = "mock"; c->vtable = vtable; @@ -122,7 +123,7 @@ static char *test_json_key_str(void) { size_t result_len = strlen(test_json_key_str_part1) + strlen(test_json_key_str_part2) + strlen(test_json_key_str_part3); - char *result = gpr_malloc(result_len + 1); + char *result = static_cast<char *>(gpr_malloc(result_len + 1)); char *current = result; strcpy(result, test_json_key_str_part1); current += strlen(test_json_key_str_part1); @@ -363,7 +364,8 @@ static void check_request_metadata(grpc_exec_ctx *exec_ctx, void *arg, static request_metadata_state *make_request_metadata_state( grpc_error *expected_error, const expected_md *expected, size_t expected_size) { - request_metadata_state *state = gpr_zalloc(sizeof(*state)); + request_metadata_state *state = + static_cast<request_metadata_state *>(gpr_zalloc(sizeof(*state))); state->expected_error = expected_error; state->expected = expected; state->expected_size = expected_size; @@ -934,7 +936,8 @@ static int default_creds_gce_detection_httpcli_get_success_override( grpc_millis deadline, grpc_closure *on_done, grpc_httpcli_response *response) { *response = http_response(200, ""); - grpc_http_header *headers = gpr_malloc(sizeof(*headers) * 1); + grpc_http_header *headers = + static_cast<grpc_http_header *>(gpr_malloc(sizeof(*headers) * 1)); headers[0].key = gpr_strdup("Metadata-Flavor"); headers[0].value = gpr_strdup("Google"); response->hdr_count = 1; diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.cc index 3998cb51cd..1f1cf11545 100644 --- a/test/core/security/fetch_oauth2.c +++ b/test/core/security/fetch_oauth2.cc @@ -44,7 +44,7 @@ static grpc_call_credentials *create_refresh_token_creds( int main(int argc, char **argv) { grpc_call_credentials *creds = NULL; char *json_key_file_path = NULL; - char *json_refresh_token_file_path = NULL; + const char *json_refresh_token_file_path = NULL; char *token = NULL; int use_gce = 0; char *scope = NULL; diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.cc index 6573f70e72..70661a111b 100644 --- a/test/core/security/json_token_test.c +++ b/test/core/security/json_token_test.cc @@ -81,7 +81,7 @@ static char *test_json_key_str(const char *bad_part3) { const char *part3 = bad_part3 != NULL ? bad_part3 : test_json_key_str_part3; size_t result_len = strlen(test_json_key_str_part1) + strlen(test_json_key_str_part2) + strlen(part3); - char *result = gpr_malloc(result_len + 1); + char *result = static_cast<char *>(gpr_malloc(result_len + 1)); char *current = result; strcpy(result, test_json_key_str_part1); current += strlen(test_json_key_str_part1); @@ -211,12 +211,12 @@ static grpc_json *parse_json_part_from_jwt(const char *str, size_t len, char *decoded; grpc_json *json; grpc_slice slice; - b64 = gpr_malloc(len + 1); + b64 = static_cast<char *>(gpr_malloc(len + 1)); strncpy(b64, str, len); b64[len] = '\0'; slice = grpc_base64_decode(&exec_ctx, b64, 1); GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(slice)); - decoded = gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1); + decoded = static_cast<char *>(gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1)); strncpy(decoded, (const char *)GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice)); decoded[GRPC_SLICE_LENGTH(slice)] = '\0'; diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.cc index a4bfe0130e..b0b94ba250 100644 --- a/test/core/security/jwt_verifier_test.c +++ b/test/core/security/jwt_verifier_test.cc @@ -292,7 +292,7 @@ static void test_bad_subject_claims_failure(void) { static char *json_key_str(const char *last_part) { size_t result_len = strlen(json_key_str_part1) + strlen(json_key_str_part2) + strlen(last_part); - char *result = gpr_malloc(result_len + 1); + char *result = static_cast<char *>(gpr_malloc(result_len + 1)); char *current = result; strcpy(result, json_key_str_part1); current += strlen(json_key_str_part1); @@ -305,7 +305,7 @@ static char *json_key_str(const char *last_part) { static char *good_google_email_keys(void) { size_t result_len = strlen(good_google_email_keys_part1) + strlen(good_google_email_keys_part2); - char *result = gpr_malloc(result_len + 1); + char *result = static_cast<char *>(gpr_malloc(result_len + 1)); char *current = result; strcpy(result, good_google_email_keys_part1); current += strlen(good_google_email_keys_part1); diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.cc index 73d6c5bc7d..73d6c5bc7d 100644 --- a/test/core/security/oauth2_utils.c +++ b/test/core/security/oauth2_utils.cc diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.cc index 29c38dfdf8..81c992c4d6 100644 --- a/test/core/security/print_google_default_creds_token.c +++ b/test/core/security/print_google_default_creds_token.cc @@ -43,7 +43,7 @@ typedef struct { static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - synchronizer *sync = arg; + synchronizer *sync = static_cast<synchronizer *>(arg); if (error != GRPC_ERROR_NONE) { fprintf(stderr, "Fetching token failed: %s\n", grpc_error_string(error)); } else { @@ -67,9 +67,11 @@ int main(int argc, char **argv) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; synchronizer sync; grpc_channel_credentials *creds = NULL; - char *service_url = "https://test.foo.google.com/Foo"; + const char *service_url = "https://test.foo.google.com/Foo"; grpc_auth_metadata_context context; gpr_cmdline *cl = gpr_cmdline_create("print_google_default_creds_token"); + grpc_pollset *pollset = nullptr; + grpc_error *error = nullptr; gpr_cmdline_add_string(cl, "service_url", "Service URL for the token request.", &service_url); gpr_cmdline_parse(cl, argc, argv); @@ -86,14 +88,14 @@ int main(int argc, char **argv) { } memset(&sync, 0, sizeof(sync)); - grpc_pollset *pollset = gpr_zalloc(grpc_pollset_size()); + pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &sync.mu); sync.pops = grpc_polling_entity_create_from_pollset(pollset); sync.is_done = false; GRPC_CLOSURE_INIT(&sync.on_request_metadata, on_metadata_response, &sync, grpc_schedule_on_exec_ctx); - grpc_error *error = GRPC_ERROR_NONE; + error = GRPC_ERROR_NONE; if (grpc_call_credentials_get_request_metadata( &exec_ctx, ((grpc_composite_channel_credentials *)creds)->call_creds, &sync.pops, context, &sync.md_array, &sync.on_request_metadata, diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.cc index 839a05fa9b..fe7961d1d9 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.cc @@ -52,9 +52,10 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( grpc_endpoint_test_fixture f; grpc_endpoint_pair tcp; - grpc_arg a[] = {{.key = GRPC_ARG_TCP_READ_CHUNK_SIZE, - .type = GRPC_ARG_INTEGER, - .value.integer = (int)slice_size}}; + grpc_arg a[1]; + a[0].key = const_cast<char *>(GRPC_ARG_TCP_READ_CHUNK_SIZE); + a[0].type = GRPC_ARG_INTEGER; + a[0].value.integer = (int)slice_size; grpc_channel_args args = {.num_args = GPR_ARRAY_SIZE(a), .args = a}; tcp = grpc_iomgr_create_endpoint_pair("fixture", &args); grpc_endpoint_add_to_pollset(&exec_ctx, tcp.client, g_pollset); diff --git a/test/core/security/security_connector_test.c b/test/core/security/security_connector_test.cc index eecf0f462b..eecf0f462b 100644 --- a/test/core/security/security_connector_test.c +++ b/test/core/security/security_connector_test.cc diff --git a/test/core/security/ssl_server_fuzzer.c b/test/core/security/ssl_server_fuzzer.cc index f9b754b8f2..9d43a416c3 100644 --- a/test/core/security/ssl_server_fuzzer.c +++ b/test/core/security/ssl_server_fuzzer.cc @@ -42,8 +42,9 @@ struct handshake_state { static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_handshaker_args *args = arg; - struct handshake_state *state = args->user_data; + grpc_handshaker_args *args = static_cast<grpc_handshaker_args *>(arg); + struct handshake_state *state = + static_cast<struct handshake_state *>(args->user_data); GPR_ASSERT(state->done_callback_called == false); state->done_callback_called = true; // The fuzzer should not pass the handshake. diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.cc index cec6fb94b4..c6591cf546 100644 --- a/test/core/security/verify_jwt.c +++ b/test/core/security/verify_jwt.cc @@ -47,7 +47,7 @@ static void print_usage_and_exit(gpr_cmdline *cl, const char *argv0) { static void on_jwt_verification_done(grpc_exec_ctx *exec_ctx, void *user_data, grpc_jwt_verifier_status status, grpc_jwt_claims *claims) { - synchronizer *sync = user_data; + synchronizer *sync = static_cast<synchronizer *>(user_data); sync->success = (status == GRPC_JWT_VERIFIER_OK); if (sync->success) { @@ -75,8 +75,8 @@ int main(int argc, char **argv) { synchronizer sync; grpc_jwt_verifier *verifier; gpr_cmdline *cl; - char *jwt = NULL; - char *aud = NULL; + const char *jwt = NULL; + const char *aud = NULL; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_init(); @@ -92,7 +92,7 @@ int main(int argc, char **argv) { grpc_init(); - sync.pollset = gpr_zalloc(grpc_pollset_size()); + sync.pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(sync.pollset, &sync.mu); sync.is_done = 0; diff --git a/test/core/slice/b64_test.c b/test/core/slice/b64_test.cc index bd375aa6a7..bd375aa6a7 100644 --- a/test/core/slice/b64_test.c +++ b/test/core/slice/b64_test.cc diff --git a/test/core/slice/percent_decode_fuzzer.c b/test/core/slice/percent_decode_fuzzer.cc index ad4e3fed7a..ad4e3fed7a 100644 --- a/test/core/slice/percent_decode_fuzzer.c +++ b/test/core/slice/percent_decode_fuzzer.cc diff --git a/test/core/slice/percent_encode_fuzzer.c b/test/core/slice/percent_encode_fuzzer.cc index db3dc3bb3f..db3dc3bb3f 100644 --- a/test/core/slice/percent_encode_fuzzer.c +++ b/test/core/slice/percent_encode_fuzzer.cc diff --git a/test/core/slice/percent_encoding_test.c b/test/core/slice/percent_encoding_test.cc index fcc8d33db3..fcc8d33db3 100644 --- a/test/core/slice/percent_encoding_test.c +++ b/test/core/slice/percent_encoding_test.cc diff --git a/test/core/slice/slice_buffer_test.c b/test/core/slice/slice_buffer_test.cc index 2fba496bd0..2fba496bd0 100644 --- a/test/core/slice/slice_buffer_test.c +++ b/test/core/slice/slice_buffer_test.cc diff --git a/test/core/slice/slice_hash_table_test.c b/test/core/slice/slice_hash_table_test.cc index f3689aac64..a2006b3c10 100644 --- a/test/core/slice/slice_hash_table_test.c +++ b/test/core/slice/slice_hash_table_test.cc @@ -28,8 +28,8 @@ #include "test/core/util/test_config.h" typedef struct { - char* key; - char* value; + const char* key; + const char* value; } test_entry; static void populate_entries(const test_entry* input, size_t num_entries, @@ -44,7 +44,8 @@ static void check_values(const test_entry* input, size_t num_entries, grpc_slice_hash_table* table) { for (size_t i = 0; i < num_entries; ++i) { grpc_slice key = grpc_slice_from_static_string(input[i].key); - char* actual = grpc_slice_hash_table_get(table, key); + const char* actual = + static_cast<const char*>(grpc_slice_hash_table_get(table, key)); GPR_ASSERT(actual != NULL); GPR_ASSERT(strcmp(actual, input[i].value) == 0); grpc_slice_unref(key); @@ -67,7 +68,8 @@ static grpc_slice_hash_table* create_table_from_entries( int (*value_cmp_fn)(void*, void*)) { // Construct table. grpc_slice_hash_table_entry* entries = - gpr_zalloc(sizeof(*entries) * num_test_entries); + static_cast<grpc_slice_hash_table_entry*>( + gpr_zalloc(sizeof(*entries) * num_test_entries)); populate_entries(test_entries, num_test_entries, entries); grpc_slice_hash_table* table = grpc_slice_hash_table_create( num_test_entries, entries, destroy_string, value_cmp_fn); @@ -125,8 +127,8 @@ static void test_slice_hash_table() { } static int value_cmp_fn(void* a, void* b) { - const char* a_str = a; - const char* b_str = b; + const char* a_str = static_cast<const char*>(a); + const char* b_str = static_cast<const char*>(b); return strcmp(a_str, b_str); } diff --git a/test/core/slice/slice_string_helpers_test.c b/test/core/slice/slice_string_helpers_test.cc index 504acf8f84..8877da73f5 100644 --- a/test/core/slice/slice_string_helpers_test.c +++ b/test/core/slice/slice_string_helpers_test.cc @@ -67,7 +67,8 @@ static void test_strsplit(void) { LOG_TEST_NAME("test_strsplit"); - parts = gpr_malloc(sizeof(grpc_slice_buffer)); + parts = + static_cast<grpc_slice_buffer *>(gpr_malloc(sizeof(grpc_slice_buffer))); grpc_slice_buffer_init(parts); str = grpc_slice_from_copied_string("one, two, three, four"); diff --git a/test/core/slice/slice_test.c b/test/core/slice/slice_test.cc index cda37fb8d9..cda37fb8d9 100644 --- a/test/core/slice/slice_test.c +++ b/test/core/slice/slice_test.cc diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.cc index 229a5e55f9..229a5e55f9 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.cc diff --git a/test/core/statistics/census_stub_test.c b/test/core/statistics/census_stub_test.cc index f38d571abd..f38d571abd 100644 --- a/test/core/statistics/census_stub_test.c +++ b/test/core/statistics/census_stub_test.cc diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.cc index d714e15091..d714e15091 100644 --- a/test/core/statistics/hash_table_test.c +++ b/test/core/statistics/hash_table_test.cc diff --git a/test/core/statistics/multiple_writers_circular_buffer_test.c b/test/core/statistics/multiple_writers_circular_buffer_test.cc index 8abd76c3d1..8abd76c3d1 100644 --- a/test/core/statistics/multiple_writers_circular_buffer_test.c +++ b/test/core/statistics/multiple_writers_circular_buffer_test.cc diff --git a/test/core/statistics/multiple_writers_test.c b/test/core/statistics/multiple_writers_test.cc index de800e0d8a..de800e0d8a 100644 --- a/test/core/statistics/multiple_writers_test.c +++ b/test/core/statistics/multiple_writers_test.cc diff --git a/test/core/statistics/performance_test.c b/test/core/statistics/performance_test.cc index 6104acb612..6104acb612 100644 --- a/test/core/statistics/performance_test.c +++ b/test/core/statistics/performance_test.cc diff --git a/test/core/statistics/quick_test.c b/test/core/statistics/quick_test.cc index 1e044b6b59..1e044b6b59 100644 --- a/test/core/statistics/quick_test.c +++ b/test/core/statistics/quick_test.cc diff --git a/test/core/statistics/rpc_stats_test.c b/test/core/statistics/rpc_stats_test.cc index 01ac5a19ab..01ac5a19ab 100644 --- a/test/core/statistics/rpc_stats_test.c +++ b/test/core/statistics/rpc_stats_test.cc diff --git a/test/core/statistics/small_log_test.c b/test/core/statistics/small_log_test.cc index 4bcc35c37e..4bcc35c37e 100644 --- a/test/core/statistics/small_log_test.c +++ b/test/core/statistics/small_log_test.cc diff --git a/test/core/statistics/trace_test.c b/test/core/statistics/trace_test.cc index 63da9f71d3..63da9f71d3 100644 --- a/test/core/statistics/trace_test.c +++ b/test/core/statistics/trace_test.cc diff --git a/test/core/statistics/window_stats_test.c b/test/core/statistics/window_stats_test.cc index 254c14a6a8..254c14a6a8 100644 --- a/test/core/statistics/window_stats_test.c +++ b/test/core/statistics/window_stats_test.cc diff --git a/test/core/support/alloc_test.c b/test/core/support/alloc_test.cc index 088ae7d944..ef9785a275 100644 --- a/test/core/support/alloc_test.c +++ b/test/core/support/alloc_test.cc @@ -43,8 +43,9 @@ static void test_custom_allocs() { /* Restore and check we don't get funky values and that we don't leak */ gpr_set_allocation_functions(default_fns); - GPR_ASSERT((void *)sizeof(*i) != (i = gpr_malloc(sizeof(*i)))); - GPR_ASSERT((void *)2 != (i = gpr_realloc(i, 2))); + GPR_ASSERT((void *)sizeof(*i) != + (i = static_cast<char *>(gpr_malloc(sizeof(*i))))); + GPR_ASSERT((void *)2 != (i = static_cast<char *>(gpr_realloc(i, 2)))); gpr_free(i); } diff --git a/test/core/support/arena_test.c b/test/core/support/arena_test.cc index afb309280f..021bd18f5e 100644 --- a/test/core/support/arena_test.c +++ b/test/core/support/arena_test.cc @@ -50,7 +50,7 @@ static void test(const char *name, size_t init_size, const size_t *allocs, gpr_free(s); gpr_arena *a = gpr_arena_create(init_size); - void **ps = gpr_zalloc(sizeof(*ps) * nallocs); + void **ps = static_cast<void **>(gpr_zalloc(sizeof(*ps) * nallocs)); for (size_t i = 0; i < nallocs; i++) { ps[i] = gpr_arena_alloc(a, allocs[i]); // ensure no duplicate results @@ -81,7 +81,7 @@ typedef struct { } concurrent_test_args; static void concurrent_test_body(void *arg) { - concurrent_test_args *a = arg; + concurrent_test_args *a = static_cast<concurrent_test_args *>(arg); gpr_event_wait(&a->ev_start, gpr_inf_future(GPR_CLOCK_REALTIME)); for (size_t i = 0; i < concurrent_test_iterations(); i++) { *(char *)gpr_arena_alloc(a->arena, 1) = (char)i; diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.cc index 37424d6405..474e773225 100644 --- a/test/core/support/avl_test.c +++ b/test/core/support/avl_test.cc @@ -28,7 +28,7 @@ #include "test/core/util/test_config.h" static int *box(int x) { - int *b = gpr_malloc(sizeof(*b)); + int *b = static_cast<int *>(gpr_malloc(sizeof(*b))); *b = x; return b; } diff --git a/test/core/support/cmdline_test.c b/test/core/support/cmdline_test.cc index 72e7c7f9fc..a3740d4881 100644 --- a/test/core/support/cmdline_test.c +++ b/test/core/support/cmdline_test.cc @@ -30,7 +30,8 @@ static void test_simple_int(void) { int x = 1; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "-foo", "3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("-foo"), + const_cast<char *>("3")}; LOG_TEST(); @@ -45,7 +46,7 @@ static void test_simple_int(void) { static void test_eq_int(void) { int x = 1; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "-foo=3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("-foo=3")}; LOG_TEST(); @@ -60,7 +61,8 @@ static void test_eq_int(void) { static void test_2dash_int(void) { int x = 1; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo", "3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo"), + const_cast<char *>("3")}; LOG_TEST(); @@ -75,7 +77,7 @@ static void test_2dash_int(void) { static void test_2dash_eq_int(void) { int x = 1; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo=3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo=3")}; LOG_TEST(); @@ -88,9 +90,10 @@ static void test_2dash_eq_int(void) { } static void test_simple_string(void) { - char *x = NULL; + const char *x = NULL; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "-foo", "3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("-foo"), + const_cast<char *>("3")}; LOG_TEST(); @@ -103,9 +106,9 @@ static void test_simple_string(void) { } static void test_eq_string(void) { - char *x = NULL; + const char *x = NULL; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "-foo=3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("-foo=3")}; LOG_TEST(); @@ -118,9 +121,10 @@ static void test_eq_string(void) { } static void test_2dash_string(void) { - char *x = NULL; + const char *x = NULL; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo", "3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo"), + const_cast<char *>("3")}; LOG_TEST(); @@ -133,9 +137,9 @@ static void test_2dash_string(void) { } static void test_2dash_eq_string(void) { - char *x = NULL; + const char *x = NULL; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo=3"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo=3")}; LOG_TEST(); @@ -150,7 +154,7 @@ static void test_2dash_eq_string(void) { static void test_flag_on(void) { int x = 2; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo")}; LOG_TEST(); @@ -165,7 +169,7 @@ static void test_flag_on(void) { static void test_flag_no(void) { int x = 2; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--no-foo"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--no-foo")}; LOG_TEST(); @@ -180,7 +184,7 @@ static void test_flag_no(void) { static void test_flag_val_1(void) { int x = 2; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo=1"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo=1")}; LOG_TEST(); @@ -195,7 +199,7 @@ static void test_flag_val_1(void) { static void test_flag_val_0(void) { int x = 2; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo=0"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo=0")}; LOG_TEST(); @@ -210,7 +214,7 @@ static void test_flag_val_0(void) { static void test_flag_val_true(void) { int x = 2; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo=true"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo=true")}; LOG_TEST(); @@ -225,7 +229,7 @@ static void test_flag_val_true(void) { static void test_flag_val_false(void) { int x = 2; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--foo=false"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--foo=false")}; LOG_TEST(); @@ -238,12 +242,14 @@ static void test_flag_val_false(void) { } static void test_many(void) { - char *str = NULL; + const char *str = NULL; int x = 0; int flag = 2; gpr_cmdline *cl; - char *args[] = {(char *)__FILE__, "--str", "hello", "-x=4", "-no-flag"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--str"), + const_cast<char *>("hello"), const_cast<char *>("-x=4"), + const_cast<char *>("-no-flag")}; LOG_TEST(); @@ -259,7 +265,7 @@ static void test_many(void) { } static void extra_arg_cb(void *user_data, const char *arg) { - int *count = user_data; + int *count = static_cast<int *>(user_data); GPR_ASSERT(arg != NULL); GPR_ASSERT(strlen(arg) == 1); GPR_ASSERT(arg[0] == 'a' + *count); @@ -269,7 +275,8 @@ static void extra_arg_cb(void *user_data, const char *arg) { static void test_extra(void) { gpr_cmdline *cl; int count = 0; - char *args[] = {(char *)__FILE__, "a", "b", "c"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("a"), + const_cast<char *>("b"), const_cast<char *>("c")}; LOG_TEST(); @@ -284,7 +291,9 @@ static void test_extra(void) { static void test_extra_dashdash(void) { gpr_cmdline *cl; int count = 0; - char *args[] = {(char *)__FILE__, "--", "a", "b", "c"}; + char *args[] = {(char *)__FILE__, const_cast<char *>("--"), + const_cast<char *>("a"), const_cast<char *>("b"), + const_cast<char *>("c")}; LOG_TEST(); @@ -300,7 +309,7 @@ static void test_usage(void) { gpr_cmdline *cl; char *usage; - char *str = NULL; + const char *str = NULL; int x = 0; int flag = 2; @@ -331,11 +340,11 @@ static void test_usage(void) { static void test_help(void) { gpr_cmdline *cl; - char *str = NULL; + const char *str = NULL; int x = 0; int flag = 2; - char *help[] = {(char *)__FILE__, "-h"}; + char *help[] = {(char *)__FILE__, const_cast<char *>("-h")}; LOG_TEST(); @@ -355,11 +364,11 @@ static void test_help(void) { static void test_badargs1(void) { gpr_cmdline *cl; - char *str = NULL; + const char *str = NULL; int x = 0; int flag = 2; - char *bad_arg_name[] = {(char *)__FILE__, "--y"}; + char *bad_arg_name[] = {(char *)__FILE__, const_cast<char *>("--y")}; LOG_TEST(); @@ -380,11 +389,12 @@ static void test_badargs1(void) { static void test_badargs2(void) { gpr_cmdline *cl; - char *str = NULL; + const char *str = NULL; int x = 0; int flag = 2; - char *bad_int_value[] = {(char *)__FILE__, "--x", "henry"}; + char *bad_int_value[] = {(char *)__FILE__, const_cast<char *>("--x"), + const_cast<char *>("henry")}; LOG_TEST(); @@ -405,11 +415,12 @@ static void test_badargs2(void) { static void test_badargs3(void) { gpr_cmdline *cl; - char *str = NULL; + const char *str = NULL; int x = 0; int flag = 2; - char *bad_bool_value[] = {(char *)__FILE__, "--flag=henry"}; + char *bad_bool_value[] = {(char *)__FILE__, + const_cast<char *>("--flag=henry")}; LOG_TEST(); @@ -430,11 +441,11 @@ static void test_badargs3(void) { static void test_badargs4(void) { gpr_cmdline *cl; - char *str = NULL; + const char *str = NULL; int x = 0; int flag = 2; - char *bad_bool_value[] = {(char *)__FILE__, "--no-str"}; + char *bad_bool_value[] = {(char *)__FILE__, const_cast<char *>("--no-str")}; LOG_TEST(); diff --git a/test/core/support/cpu_test.c b/test/core/support/cpu_test.cc index 72db53fa49..7eaf65b110 100644 --- a/test/core/support/cpu_test.c +++ b/test/core/support/cpu_test.cc @@ -104,7 +104,7 @@ static void cpu_test(void) { ct.ncores = gpr_cpu_num_cores(); GPR_ASSERT(ct.ncores > 0); ct.nthreads = (int)ct.ncores * 3; - ct.used = gpr_malloc(ct.ncores * sizeof(int)); + ct.used = static_cast<int *>(gpr_malloc(ct.ncores * sizeof(int))); memset(ct.used, 0, ct.ncores * sizeof(int)); gpr_mu_init(&ct.mu); gpr_cv_init(&ct.done_cv); diff --git a/test/core/support/env_test.c b/test/core/support/env_test.cc index 661a546720..661a546720 100644 --- a/test/core/support/env_test.c +++ b/test/core/support/env_test.cc diff --git a/test/core/support/histogram_test.c b/test/core/support/histogram_test.cc index 0ee5d5cdd1..0ee5d5cdd1 100644 --- a/test/core/support/histogram_test.c +++ b/test/core/support/histogram_test.cc diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.cc index 2ff3bcf68e..2ff3bcf68e 100644 --- a/test/core/support/host_port_test.c +++ b/test/core/support/host_port_test.cc diff --git a/test/core/support/log_test.c b/test/core/support/log_test.cc index c221ff6783..c221ff6783 100644 --- a/test/core/support/log_test.c +++ b/test/core/support/log_test.cc diff --git a/test/core/support/mpscq_test.c b/test/core/support/mpscq_test.cc index 5e7dc9fca5..a4fa6a3e34 100644 --- a/test/core/support/mpscq_test.c +++ b/test/core/support/mpscq_test.cc @@ -34,7 +34,7 @@ typedef struct test_node { } test_node; static test_node *new_node(size_t i, size_t *ctr) { - test_node *n = gpr_malloc(sizeof(test_node)); + test_node *n = static_cast<test_node *>(gpr_malloc(sizeof(test_node))); n->i = i; n->ctr = ctr; return n; @@ -64,7 +64,7 @@ typedef struct { #define THREAD_ITERATIONS 10000 static void test_thread(void *args) { - thd_args *a = args; + thd_args *a = static_cast<thd_args *>(args); gpr_event_wait(a->start, gpr_inf_future(GPR_CLOCK_REALTIME)); for (size_t i = 1; i <= THREAD_ITERATIONS; i++) { gpr_mpscq_push(a->q, &new_node(i, &a->ctr)->node); @@ -119,7 +119,7 @@ typedef struct { } pull_args; static void pull_thread(void *arg) { - pull_args *pa = arg; + pull_args *pa = static_cast<pull_args *>(arg); gpr_event_wait(pa->start, gpr_inf_future(GPR_CLOCK_REALTIME)); for (;;) { diff --git a/test/core/support/murmur_hash_test.c b/test/core/support/murmur_hash_test.cc index 5677515d04..5677515d04 100644 --- a/test/core/support/murmur_hash_test.c +++ b/test/core/support/murmur_hash_test.cc diff --git a/test/core/support/spinlock_test.c b/test/core/support/spinlock_test.cc index b236a88ab7..8c8c8cedfa 100644 --- a/test/core/support/spinlock_test.c +++ b/test/core/support/spinlock_test.cc @@ -43,9 +43,10 @@ struct test { /* Return pointer to a new struct test. */ static struct test *test_new(int threads, int64_t iterations, int incr_step) { - struct test *m = gpr_malloc(sizeof(*m)); + struct test *m = static_cast<struct test *>(gpr_malloc(sizeof(*m))); m->thread_count = threads; - m->threads = gpr_malloc(sizeof(*m->threads) * (size_t)threads); + m->threads = static_cast<gpr_thd_id *>( + gpr_malloc(sizeof(*m->threads) * (size_t)threads)); m->iterations = iterations; m->counter = 0; m->thread_count = 0; @@ -113,7 +114,7 @@ static void test(const char *name, void (*body)(void *m), int timeout_s, /* Increment m->counter on each iteration; then mark thread as done. */ static void inc(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations; i++) { gpr_spinlock_lock(&m->mu); @@ -125,7 +126,7 @@ static void inc(void *v /*=m*/) { /* Increment m->counter under lock acquired with trylock, m->iterations times; then mark thread as done. */ static void inctry(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations;) { if (gpr_spinlock_trylock(&m->mu)) { diff --git a/test/core/support/stack_lockfree_test.c b/test/core/support/stack_lockfree_test.cc index 4b1f60ce01..4b1f60ce01 100644 --- a/test/core/support/stack_lockfree_test.c +++ b/test/core/support/stack_lockfree_test.cc diff --git a/test/core/support/string_test.c b/test/core/support/string_test.cc index bee2139477..bee2139477 100644 --- a/test/core/support/string_test.c +++ b/test/core/support/string_test.cc diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.cc index 178d77edcd..c005a2bbb1 100644 --- a/test/core/support/sync_test.c +++ b/test/core/support/sync_test.cc @@ -157,7 +157,7 @@ struct test { /* Return pointer to a new struct test. */ static struct test *test_new(int threads, int64_t iterations, int incr_step) { - struct test *m = gpr_malloc(sizeof(*m)); + struct test *m = static_cast<struct test *>(gpr_malloc(sizeof(*m))); m->threads = threads; m->iterations = iterations; m->counter = 0; @@ -263,7 +263,7 @@ static void test(const char *name, void (*body)(void *m), /* Increment m->counter on each iteration; then mark thread as done. */ static void inc(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations; i++) { gpr_mu_lock(&m->mu); @@ -276,7 +276,7 @@ static void inc(void *v /*=m*/) { /* Increment m->counter under lock acquired with trylock, m->iterations times; then mark thread as done. */ static void inctry(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations;) { if (gpr_mu_trylock(&m->mu)) { @@ -291,7 +291,7 @@ static void inctry(void *v /*=m*/) { /* Increment counter only when (m->counter%m->threads)==m->thread_id; then mark thread as done. */ static void inc_by_turns(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; int id = thread_id(m); for (i = 0; i != m->iterations; i++) { @@ -309,7 +309,7 @@ static void inc_by_turns(void *v /*=m*/) { /* Wait a millisecond and increment counter on each iteration; then mark thread as done. */ static void inc_with_1ms_delay(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations; i++) { gpr_timespec deadline; @@ -327,7 +327,7 @@ static void inc_with_1ms_delay(void *v /*=m*/) { /* Wait a millisecond and increment counter on each iteration, using an event for timing; then mark thread as done. */ static void inc_with_1ms_delay_event(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations; i++) { gpr_timespec deadline; @@ -345,7 +345,7 @@ static void inc_with_1ms_delay_event(void *v /*=m*/) { Even threads use queue_append(), and odd threads use queue_try_append() until it succeeds. */ static void many_producers(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; int x = thread_id(m); if ((x & 1) == 0) { @@ -365,7 +365,7 @@ static void many_producers(void *v /*=m*/) { wait an extra second to confirm that no more elements are arriving, then mark thread as done. */ static void consumer(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t n = m->iterations * m->threads; int64_t i; int value; @@ -385,7 +385,7 @@ static void consumer(void *v /*=m*/) { /* Increment m->stats_counter m->iterations times, transfer counter value to m->counter, then mark thread as done. */ static void statsinc(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations; i++) { gpr_stats_inc(&m->stats_counter, 1); @@ -400,7 +400,7 @@ static void statsinc(void *v /*=m*/) { m->thread_refcount once, and if it reaches zero, set m->event to (void*)1; then mark thread as done. */ static void refinc(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t i; for (i = 0; i != m->iterations; i++) { if (m->incr_step == 1) { @@ -419,7 +419,7 @@ static void refinc(void *v /*=m*/) { (m->threads * m->iterations * m->incr_step) times, and ensure that the last decrement caused the counter to reach zero, then mark thread as done. */ static void refcheck(void *v /*=m*/) { - struct test *m = v; + struct test *m = static_cast<struct test *>(v); int64_t n = m->iterations * m->threads * m->incr_step; int64_t i; GPR_ASSERT(gpr_event_wait(&m->event, gpr_inf_future(GPR_CLOCK_REALTIME)) == diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.cc index 2c578a242c..e6b4ea405b 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.cc @@ -37,7 +37,7 @@ struct test { /* A Thread body. Decrement t->n, and if is becomes zero, set t->done. */ static void thd_body(void *v) { - struct test *t = v; + struct test *t = static_cast<struct test *>(v); gpr_mu_lock(&t->mu); t->n--; if (t->n == 0) { diff --git a/test/core/support/time_test.c b/test/core/support/time_test.cc index 74b5ef6114..74b5ef6114 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.cc diff --git a/test/core/support/tls_test.c b/test/core/support/tls_test.cc index 5529d5cf59..5529d5cf59 100644 --- a/test/core/support/tls_test.c +++ b/test/core/support/tls_test.cc diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.cc index 2f84f485fc..2f84f485fc 100644 --- a/test/core/support/useful_test.c +++ b/test/core/support/useful_test.cc diff --git a/test/core/surface/alarm_test.c b/test/core/surface/alarm_test.cc index 4fd7cb93c6..4fd7cb93c6 100644 --- a/test/core/surface/alarm_test.c +++ b/test/core/surface/alarm_test.cc diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.cc index a6b4c86abc..a6b4c86abc 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.cc diff --git a/test/core/surface/channel_create_test.c b/test/core/surface/channel_create_test.cc index a6884750e7..a6884750e7 100644 --- a/test/core/surface/channel_create_test.c +++ b/test/core/surface/channel_create_test.cc diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.cc index e6372a379c..e6372a379c 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.cc diff --git a/test/core/surface/completion_queue_threading_test.c b/test/core/surface/completion_queue_threading_test.cc index 9996b6b840..abe119789f 100644 --- a/test/core/surface/completion_queue_threading_test.c +++ b/test/core/surface/completion_queue_threading_test.cc @@ -68,7 +68,7 @@ struct thread_state { }; static void pluck_one(void *arg) { - struct thread_state *state = arg; + struct thread_state *state = static_cast<struct thread_state *>(arg); grpc_completion_queue_pluck(state->cc, state->tag, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); } @@ -143,7 +143,7 @@ static void free_completion(grpc_exec_ctx *exec_ctx, void *arg, } static void producer_thread(void *arg) { - test_thread_options *opt = arg; + test_thread_options *opt = static_cast<test_thread_options *>(arg); int i; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -164,7 +164,8 @@ static void producer_thread(void *arg) { for (i = 0; i < TEST_THREAD_EVENTS; i++) { grpc_cq_end_op(&exec_ctx, opt->cc, (void *)(intptr_t)1, GRPC_ERROR_NONE, free_completion, NULL, - gpr_malloc(sizeof(grpc_cq_completion))); + static_cast<grpc_cq_completion *>( + gpr_malloc(sizeof(grpc_cq_completion)))); opt->events_triggered++; grpc_exec_ctx_finish(&exec_ctx); } @@ -175,7 +176,7 @@ static void producer_thread(void *arg) { } static void consumer_thread(void *arg) { - test_thread_options *opt = arg; + test_thread_options *opt = static_cast<test_thread_options *>(arg); grpc_event ev; gpr_log(GPR_INFO, "consumer %d started", opt->id); @@ -209,8 +210,8 @@ static void consumer_thread(void *arg) { } static void test_threading(size_t producers, size_t consumers) { - test_thread_options *options = - gpr_malloc((producers + consumers) * sizeof(test_thread_options)); + test_thread_options *options = static_cast<test_thread_options *>( + gpr_malloc((producers + consumers) * sizeof(test_thread_options))); gpr_event phase1 = GPR_EVENT_INIT; gpr_event phase2 = GPR_EVENT_INIT; grpc_completion_queue *cc = grpc_completion_queue_create_for_next(NULL); diff --git a/test/core/surface/concurrent_connectivity_test.c b/test/core/surface/concurrent_connectivity_test.cc index 3595885ff6..303180c0d1 100644 --- a/test/core/surface/concurrent_connectivity_test.c +++ b/test/core/surface/concurrent_connectivity_test.cc @@ -158,7 +158,7 @@ void bad_server_thread(void *vargs) { static void done_pollset_shutdown(grpc_exec_ctx *exec_ctx, void *pollset, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, pollset); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(pollset)); gpr_free(pollset); } @@ -211,7 +211,7 @@ int run_concurrent_connectivity_test() { /* Third round, bogus tcp server */ gpr_log(GPR_DEBUG, "Wave 3"); - args.pollset = gpr_zalloc(grpc_pollset_size()); + args.pollset = static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(args.pollset, &args.mu); gpr_event_init(&args.ready); gpr_thd_new(&server, bad_server_thread, &args, &options); diff --git a/test/core/surface/init_test.c b/test/core/surface/init_test.cc index b835a2a884..b835a2a884 100644 --- a/test/core/surface/init_test.c +++ b/test/core/surface/init_test.cc diff --git a/test/core/surface/invalid_channel_args_test.c b/test/core/surface/invalid_channel_args_test.cc index 9c84c30f03..e6099d4fca 100644 --- a/test/core/surface/invalid_channel_args_test.c +++ b/test/core/surface/invalid_channel_args_test.cc @@ -75,7 +75,7 @@ static void test_default_authority_type(void) { char *expected_error_message; client_arg.type = GRPC_ARG_INTEGER; - client_arg.key = GRPC_ARG_DEFAULT_AUTHORITY; + client_arg.key = const_cast<char *>(GRPC_ARG_DEFAULT_AUTHORITY); client_arg.value.integer = 0; client_args.num_args = 1; @@ -91,7 +91,7 @@ static void test_ssl_name_override_type(void) { char *expected_error_message; client_arg.type = GRPC_ARG_INTEGER; - client_arg.key = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG; + client_arg.key = const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); client_arg.value.integer = 0; client_args.num_args = 1; @@ -107,11 +107,11 @@ static void test_ssl_name_override_failed(void) { char *expected_error_message; client_arg[0].type = GRPC_ARG_STRING; - client_arg[0].key = GRPC_ARG_DEFAULT_AUTHORITY; - client_arg[0].value.string = "default"; + client_arg[0].key = const_cast<char *>(GRPC_ARG_DEFAULT_AUTHORITY); + client_arg[0].value.string = const_cast<char *>("default"); client_arg[1].type = GRPC_ARG_STRING; - client_arg[1].key = GRPC_SSL_TARGET_NAME_OVERRIDE_ARG; - client_arg[1].value.string = "ssl"; + client_arg[1].key = const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); + client_arg[1].value.string = const_cast<char *>("ssl"); client_args.num_args = 2; client_args.args = client_arg; diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.cc index f623e1a743..6d563d2f1f 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.cc @@ -34,7 +34,7 @@ static void *tag(intptr_t x) { return (void *)x; } void verify_connectivity(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_connectivity_state *state = arg; + grpc_connectivity_state *state = static_cast<grpc_connectivity_state *>(arg); GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == *state); GPR_ASSERT(error == GRPC_ERROR_NONE); } diff --git a/test/core/surface/num_external_connectivity_watchers_test.c b/test/core/surface/num_external_connectivity_watchers_test.cc index 16401bb7ac..f5f09b38e2 100644 --- a/test/core/surface/num_external_connectivity_watchers_test.c +++ b/test/core/surface/num_external_connectivity_watchers_test.cc @@ -168,9 +168,10 @@ static const test_fixture insecure_test = { static grpc_channel *secure_test_create_channel(const char *addr) { grpc_channel_credentials *ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); - grpc_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args *new_client_args = grpc_channel_args_copy_and_add(NULL, &ssl_name_override, 1); grpc_channel *channel = diff --git a/test/core/surface/secure_channel_create_test.c b/test/core/surface/secure_channel_create_test.cc index 0c45135501..ccb58ee793 100644 --- a/test/core/surface/secure_channel_create_test.c +++ b/test/core/surface/secure_channel_create_test.cc @@ -47,7 +47,7 @@ void test_security_connector_already_in_arg(void) { grpc_arg arg; arg.type = GRPC_ARG_POINTER; arg.value.pointer.p = NULL; - arg.key = GRPC_ARG_SECURITY_CONNECTOR; + arg.key = const_cast<char *>(GRPC_ARG_SECURITY_CONNECTOR); grpc_channel_args args; args.num_args = 1; args.args = &arg; diff --git a/test/core/surface/sequential_connectivity_test.c b/test/core/surface/sequential_connectivity_test.cc index d5fd2db81b..6596a3a0ce 100644 --- a/test/core/surface/sequential_connectivity_test.c +++ b/test/core/surface/sequential_connectivity_test.cc @@ -43,7 +43,7 @@ typedef struct { } server_thread_args; static void server_thread_func(void *args) { - server_thread_args *a = args; + server_thread_args *a = static_cast<server_thread_args *>(args); grpc_event ev = grpc_completion_queue_next( a->cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); @@ -145,9 +145,10 @@ static void secure_test_add_port(grpc_server *server, const char *addr) { static grpc_channel *secure_test_create_channel(const char *addr) { grpc_channel_credentials *ssl_creds = grpc_ssl_credentials_create(test_root_cert, NULL, NULL); - grpc_arg ssl_name_override = {GRPC_ARG_STRING, - GRPC_SSL_TARGET_NAME_OVERRIDE_ARG, - {"foo.test.google.fr"}}; + grpc_arg ssl_name_override = { + GRPC_ARG_STRING, + const_cast<char *>(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), + {const_cast<char *>("foo.test.google.fr")}}; grpc_channel_args *new_client_args = grpc_channel_args_copy_and_add(NULL, &ssl_name_override, 1); grpc_channel *channel = diff --git a/test/core/surface/server_chttp2_test.c b/test/core/surface/server_chttp2_test.cc index cd8931e0d7..ecd5314b83 100644 --- a/test/core/surface/server_chttp2_test.c +++ b/test/core/surface/server_chttp2_test.cc @@ -39,7 +39,7 @@ void test_unparsable_target(void) { void test_add_same_port_twice() { grpc_arg a; a.type = GRPC_ARG_INTEGER; - a.key = GRPC_ARG_ALLOW_REUSEPORT; + a.key = const_cast<char *>(GRPC_ARG_ALLOW_REUSEPORT); a.value.integer = 0; grpc_channel_args args = {1, &a}; diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.cc index 4c185cd8ea..08b8dca4d7 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.cc @@ -69,7 +69,7 @@ void test_request_call_on_no_server_cq(void) { void test_bind_server_twice(void) { grpc_arg a; a.type = GRPC_ARG_INTEGER; - a.key = GRPC_ARG_ALLOW_REUSEPORT; + a.key = const_cast<char *>(GRPC_ARG_ALLOW_REUSEPORT); a.value.integer = 0; grpc_channel_args args = {1, &a}; diff --git a/test/core/transport/byte_stream_test.c b/test/core/transport/byte_stream_test.cc index a0c5f961cf..a0c5f961cf 100644 --- a/test/core/transport/byte_stream_test.c +++ b/test/core/transport/byte_stream_test.cc diff --git a/test/core/transport/chttp2/alpn_test.c b/test/core/transport/chttp2/alpn_test.cc index 72c30c40eb..72c30c40eb 100644 --- a/test/core/transport/chttp2/alpn_test.c +++ b/test/core/transport/chttp2/alpn_test.cc diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.cc index 775161ec91..a09aadb18d 100644 --- a/test/core/transport/chttp2/bin_decoder_test.c +++ b/test/core/transport/chttp2/bin_decoder_test.cc @@ -30,7 +30,7 @@ static int all_ok = 1; static void expect_slice_eq(grpc_exec_ctx *exec_ctx, grpc_slice expected, - grpc_slice slice, char *debug, int line) { + grpc_slice slice, const char *debug, int line) { if (!grpc_slice_eq(slice, expected)) { char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.cc index acadcf6c89..d073f74d27 100644 --- a/test/core/transport/chttp2/bin_encoder_test.c +++ b/test/core/transport/chttp2/bin_encoder_test.cc @@ -31,8 +31,8 @@ static int all_ok = 1; -static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug, - int line) { +static void expect_slice_eq(grpc_slice expected, grpc_slice slice, + const char *debug, int line) { if (!grpc_slice_eq(slice, expected)) { char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII); diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.cc index a2af83b6cb..b203df1892 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -58,7 +58,8 @@ static void verify(grpc_exec_ctx *exec_ctx, const verify_params params, grpc_slice expect = parse_hexstring(expected); size_t i; va_list l; - grpc_linked_mdelem *e = gpr_malloc(sizeof(*e) * nheaders); + grpc_linked_mdelem *e = + static_cast<grpc_linked_mdelem *>(gpr_malloc(sizeof(*e) * nheaders)); grpc_metadata_batch b; grpc_metadata_batch_init(&b); @@ -89,7 +90,8 @@ static void verify(grpc_exec_ctx *exec_ctx, const verify_params params, if (cap_to_delete == num_to_delete) { cap_to_delete = GPR_MAX(2 * cap_to_delete, 1000); - to_delete = gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete); + to_delete = static_cast<void **>( + gpr_realloc(to_delete, sizeof(*to_delete) * cap_to_delete)); } to_delete[num_to_delete++] = e; @@ -209,7 +211,8 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx *exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(value))); size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem, use_true_binary); size_t initial_table_size = g_compressor.table_size; - grpc_linked_mdelem *e = gpr_malloc(sizeof(*e)); + grpc_linked_mdelem *e = + static_cast<grpc_linked_mdelem *>(gpr_malloc(sizeof(*e))); grpc_metadata_batch b; grpc_metadata_batch_init(&b); e[0].md = elem; diff --git a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc index 03834084cb..03834084cb 100644 --- a/test/core/transport/chttp2/hpack_parser_fuzzer_test.c +++ b/test/core/transport/chttp2/hpack_parser_fuzzer_test.cc diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.cc index 0946c05261..27b4a1c2c0 100644 --- a/test/core/transport/chttp2/hpack_parser_test.c +++ b/test/core/transport/chttp2/hpack_parser_test.cc @@ -32,7 +32,7 @@ typedef struct { va_list args; } test_checker; static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem md) { const char *ekey, *evalue; - test_checker *chk = ud; + test_checker *chk = static_cast<test_checker *>(ud); ekey = va_arg(chk->args, char *); GPR_ASSERT(ekey); evalue = va_arg(chk->args, char *); diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.cc index 430ece33c7..430ece33c7 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.cc diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.cc index ae2583ab84..7df7b1b2a6 100644 --- a/test/core/transport/chttp2/stream_map_test.c +++ b/test/core/transport/chttp2/stream_map_test.cc @@ -92,7 +92,7 @@ static void test_basic_add_find(uint32_t n) { /* verify that for_each gets the right values during test_delete_evens_XXX */ static void verify_for_each(void *user_data, uint32_t stream_id, void *ptr) { - uint32_t *for_each_check = user_data; + uint32_t *for_each_check = static_cast<uint32_t *>(user_data); GPR_ASSERT(ptr); GPR_ASSERT(*for_each_check == stream_id); *for_each_check += 2; diff --git a/test/core/transport/chttp2/varint_test.c b/test/core/transport/chttp2/varint_test.cc index 0986a2cde6..0986a2cde6 100644 --- a/test/core/transport/chttp2/varint_test.c +++ b/test/core/transport/chttp2/varint_test.cc diff --git a/test/core/transport/connectivity_state_test.c b/test/core/transport/connectivity_state_test.cc index 4ef8683107..4ef8683107 100644 --- a/test/core/transport/connectivity_state_test.c +++ b/test/core/transport/connectivity_state_test.cc diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.cc index f7124d29a7..e043078560 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.cc @@ -114,7 +114,8 @@ static void test_create_many_ephemeral_metadata(bool intern_keys, static void test_create_many_persistant_metadata(void) { char buffer[GPR_LTOA_MIN_BUFSIZE]; long i; - grpc_mdelem *created = gpr_malloc(sizeof(grpc_mdelem) * MANY); + grpc_mdelem *created = + static_cast<grpc_mdelem *>(gpr_malloc(sizeof(grpc_mdelem) * MANY)); grpc_mdelem md; gpr_log(GPR_INFO, "test_create_many_persistant_metadata"); @@ -226,8 +227,9 @@ static void test_things_stick_around(void) { size_t i, j; char *buffer; size_t nstrs = 1000; - grpc_slice *strs = gpr_malloc(sizeof(grpc_slice) * nstrs); - size_t *shuf = gpr_malloc(sizeof(size_t) * nstrs); + grpc_slice *strs = + static_cast<grpc_slice *>(gpr_malloc(sizeof(grpc_slice) * nstrs)); + size_t *shuf = static_cast<size_t *>(gpr_malloc(sizeof(size_t) * nstrs)); grpc_slice test; gpr_log(GPR_INFO, "test_things_stick_around"); @@ -281,9 +283,9 @@ static void test_user_data_works(void) { grpc_init(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - ud1 = gpr_malloc(sizeof(int)); + ud1 = static_cast<int *>(gpr_malloc(sizeof(int))); *ud1 = 1; - ud2 = gpr_malloc(sizeof(int)); + ud2 = static_cast<int *>(gpr_malloc(sizeof(int))); *ud2 = 2; md = grpc_mdelem_from_slices( &exec_ctx, grpc_slice_intern(grpc_slice_from_static_string("abc")), diff --git a/test/core/transport/status_conversion_test.c b/test/core/transport/status_conversion_test.cc index de8fa4458a..de8fa4458a 100644 --- a/test/core/transport/status_conversion_test.c +++ b/test/core/transport/status_conversion_test.cc diff --git a/test/core/transport/stream_owned_slice_test.c b/test/core/transport/stream_owned_slice_test.cc index 774ad4e72e..774ad4e72e 100644 --- a/test/core/transport/stream_owned_slice_test.c +++ b/test/core/transport/stream_owned_slice_test.cc diff --git a/test/core/transport/timeout_encoding_test.c b/test/core/transport/timeout_encoding_test.cc index 30357faed3..30357faed3 100644 --- a/test/core/transport/timeout_encoding_test.c +++ b/test/core/transport/timeout_encoding_test.cc diff --git a/test/core/tsi/fake_transport_security_test.c b/test/core/tsi/fake_transport_security_test.cc index 11be8802b7..6561028860 100644 --- a/test/core/tsi/fake_transport_security_test.c +++ b/test/core/tsi/fake_transport_security_test.cc @@ -64,7 +64,8 @@ static const struct tsi_test_fixture_vtable vtable = { fake_test_destruct}; static tsi_test_fixture *fake_tsi_test_fixture_create() { - fake_tsi_test_fixture *fake_fixture = gpr_zalloc(sizeof(*fake_fixture)); + fake_tsi_test_fixture *fake_fixture = + static_cast<fake_tsi_test_fixture *>(gpr_zalloc(sizeof(*fake_fixture))); tsi_test_fixture_init(&fake_fixture->base); fake_fixture->base.vtable = &vtable; return &fake_fixture->base; @@ -91,8 +92,8 @@ void fake_tsi_test_do_handshake() { } void fake_tsi_test_do_round_trip_for_all_configs() { - unsigned int *bit_array = - gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS); + unsigned int *bit_array = static_cast<unsigned int *>( + gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS)); const unsigned int mask = 1U << (TSI_TEST_NUM_OF_ARGUMENTS - 1); for (unsigned int val = 0; val < TSI_TEST_NUM_OF_COMBINATIONS; val++) { unsigned int v = val; diff --git a/test/core/tsi/ssl_transport_security_test.c b/test/core/tsi/ssl_transport_security_test.cc index 2399b054b1..27b2049dd8 100644 --- a/test/core/tsi/ssl_transport_security_test.c +++ b/test/core/tsi/ssl_transport_security_test.cc @@ -326,8 +326,8 @@ static const struct tsi_test_fixture_vtable vtable = { ssl_test_destruct}; static char *load_file(const char *dir_path, const char *file_name) { - char *file_path = - gpr_zalloc(sizeof(char) * (strlen(dir_path) + strlen(file_name) + 1)); + char *file_path = static_cast<char *>( + gpr_zalloc(sizeof(char) * (strlen(dir_path) + strlen(file_name) + 1))); memcpy(file_path, dir_path, strlen(dir_path)); memcpy(file_path + strlen(dir_path), file_name, strlen(file_name)); grpc_slice slice; @@ -339,12 +339,14 @@ static char *load_file(const char *dir_path, const char *file_name) { } static tsi_test_fixture *ssl_tsi_test_fixture_create() { - ssl_tsi_test_fixture *ssl_fixture = gpr_zalloc(sizeof(*ssl_fixture)); + ssl_tsi_test_fixture *ssl_fixture = + static_cast<ssl_tsi_test_fixture *>(gpr_zalloc(sizeof(*ssl_fixture))); tsi_test_fixture_init(&ssl_fixture->base); ssl_fixture->base.test_unused_bytes = false; ssl_fixture->base.vtable = &vtable; /* Create ssl_key_cert_lib. */ - ssl_key_cert_lib *key_cert_lib = gpr_zalloc(sizeof(*key_cert_lib)); + ssl_key_cert_lib *key_cert_lib = + static_cast<ssl_key_cert_lib *>(gpr_zalloc(sizeof(*key_cert_lib))); key_cert_lib->use_bad_server_cert = false; key_cert_lib->use_bad_client_cert = false; key_cert_lib->server_num_key_cert_pairs = @@ -352,11 +354,13 @@ static tsi_test_fixture *ssl_tsi_test_fixture_create() { key_cert_lib->bad_server_num_key_cert_pairs = SSL_TSI_TEST_BAD_SERVER_KEY_CERT_PAIRS_NUM; key_cert_lib->server_pem_key_cert_pairs = - gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) * - key_cert_lib->server_num_key_cert_pairs); + static_cast<tsi_ssl_pem_key_cert_pair *>( + gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) * + key_cert_lib->server_num_key_cert_pairs)); key_cert_lib->bad_server_pem_key_cert_pairs = - gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) * - key_cert_lib->bad_server_num_key_cert_pairs); + static_cast<tsi_ssl_pem_key_cert_pair *>( + gpr_malloc(sizeof(tsi_ssl_pem_key_cert_pair) * + key_cert_lib->bad_server_num_key_cert_pairs)); key_cert_lib->server_pem_key_cert_pairs[0].private_key = load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "server0.key"); key_cert_lib->server_pem_key_cert_pairs[0].cert_chain = @@ -380,11 +384,12 @@ static tsi_test_fixture *ssl_tsi_test_fixture_create() { key_cert_lib->root_cert = load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "ca.pem"); ssl_fixture->key_cert_lib = key_cert_lib; /* Create ssl_alpn_lib. */ - ssl_alpn_lib *alpn_lib = gpr_zalloc(sizeof(*alpn_lib)); + ssl_alpn_lib *alpn_lib = + static_cast<ssl_alpn_lib *>(gpr_zalloc(sizeof(*alpn_lib))); alpn_lib->server_alpn_protocols = - gpr_zalloc(sizeof(char *) * SSL_TSI_TEST_ALPN_NUM); + static_cast<char **>(gpr_zalloc(sizeof(char *) * SSL_TSI_TEST_ALPN_NUM)); alpn_lib->client_alpn_protocols = - gpr_zalloc(sizeof(char *) * SSL_TSI_TEST_ALPN_NUM); + static_cast<char **>(gpr_zalloc(sizeof(char *) * SSL_TSI_TEST_ALPN_NUM)); alpn_lib->server_alpn_protocols[0] = gpr_strdup(SSL_TSI_TEST_ALPN1); alpn_lib->server_alpn_protocols[1] = gpr_strdup(SSL_TSI_TEST_ALPN3); alpn_lib->client_alpn_protocols[0] = gpr_strdup(SSL_TSI_TEST_ALPN2); @@ -431,7 +436,8 @@ void ssl_tsi_test_do_handshake_with_server_name_indication_exact_domain() { /* server1 cert contains "waterzooi.test.google.be" in SAN. */ tsi_test_fixture *fixture = ssl_tsi_test_fixture_create(); ssl_tsi_test_fixture *ssl_fixture = (ssl_tsi_test_fixture *)fixture; - ssl_fixture->server_name_indication = "waterzooi.test.google.be"; + ssl_fixture->server_name_indication = + const_cast<char *>("waterzooi.test.google.be"); tsi_test_do_handshake(fixture); tsi_test_fixture_destroy(fixture); } @@ -440,7 +446,8 @@ void ssl_tsi_test_do_handshake_with_server_name_indication_wild_star_domain() { /* server1 cert contains "*.test.google.fr" in SAN. */ tsi_test_fixture *fixture = ssl_tsi_test_fixture_create(); ssl_tsi_test_fixture *ssl_fixture = (ssl_tsi_test_fixture *)fixture; - ssl_fixture->server_name_indication = "juju.test.google.fr"; + ssl_fixture->server_name_indication = + const_cast<char *>("juju.test.google.fr"); tsi_test_do_handshake(fixture); tsi_test_fixture_destroy(fixture); } @@ -495,8 +502,8 @@ void ssl_tsi_test_do_handshake_alpn_client_server_ok() { } void ssl_tsi_test_do_round_trip_for_all_configs() { - unsigned int *bit_array = - gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS); + unsigned int *bit_array = static_cast<unsigned int *>( + gpr_zalloc(sizeof(unsigned int) * TSI_TEST_NUM_OF_ARGUMENTS)); const unsigned int mask = 1U << (TSI_TEST_NUM_OF_ARGUMENTS - 1); for (unsigned int val = 0; val < TSI_TEST_NUM_OF_COMBINATIONS; val++) { unsigned int v = val; diff --git a/test/core/tsi/transport_security_test.c b/test/core/tsi/transport_security_test.cc index 27932a8169..c1be1e952d 100644 --- a/test/core/tsi/transport_security_test.c +++ b/test/core/tsi/transport_security_test.cc @@ -200,7 +200,7 @@ typedef struct { } parsed_names; name_list *name_list_add(const char *n) { - name_list *result = gpr_malloc(sizeof(name_list)); + name_list *result = static_cast<name_list *>(gpr_malloc(sizeof(name_list))); result->name = n; result->next = NULL; return result; diff --git a/test/core/tsi/transport_security_test_lib.c b/test/core/tsi/transport_security_test_lib.cc index 329b2371bf..454b79c0cc 100644 --- a/test/core/tsi/transport_security_test_lib.c +++ b/test/core/tsi/transport_security_test_lib.cc @@ -57,10 +57,12 @@ static handshaker_args *handshaker_args_create(tsi_test_fixture *fixture, bool is_client) { GPR_ASSERT(fixture != NULL); GPR_ASSERT(fixture->config != NULL); - handshaker_args *args = gpr_zalloc(sizeof(*args)); + handshaker_args *args = + static_cast<handshaker_args *>(gpr_zalloc(sizeof(*args))); args->fixture = fixture; args->handshake_buffer_size = fixture->handshake_buffer_size; - args->handshake_buffer = gpr_zalloc(args->handshake_buffer_size); + args->handshake_buffer = + static_cast<unsigned char *>(gpr_zalloc(args->handshake_buffer_size)); args->is_client = is_client; args->error = GRPC_ERROR_NONE; return args; @@ -181,7 +183,8 @@ static void send_message_to_peer(tsi_test_fixture *fixture, GPR_ASSERT(fixture->config != NULL); GPR_ASSERT(protector != NULL); tsi_test_frame_protector_config *config = fixture->config; - unsigned char *protected_buffer = gpr_zalloc(config->protected_buffer_size); + unsigned char *protected_buffer = + static_cast<unsigned char *>(gpr_zalloc(config->protected_buffer_size)); size_t message_size = is_client ? config->client_message_size : config->server_message_size; uint8_t *message = @@ -238,9 +241,10 @@ static void receive_message_from_peer(tsi_test_fixture *fixture, size_t read_from_peer_size = 0; tsi_result result = TSI_OK; bool done = false; - unsigned char *read_buffer = gpr_zalloc(config->read_buffer_allocated_size); - unsigned char *message_buffer = - gpr_zalloc(config->message_buffer_allocated_size); + unsigned char *read_buffer = static_cast<unsigned char *>( + gpr_zalloc(config->read_buffer_allocated_size)); + unsigned char *message_buffer = static_cast<unsigned char *>( + gpr_zalloc(config->message_buffer_allocated_size)); /* Do unprotect on data received from peer. */ while (!done && result == TSI_OK) { /* Receive data from peer. */ @@ -429,7 +433,7 @@ void tsi_test_do_round_trip(tsi_test_fixture *fixture) { /* Client sends a message to server. */ send_message_to_peer(fixture, client_frame_protector, true /* is_client */); unsigned char *server_received_message = - gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE); + static_cast<unsigned char *>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE)); size_t server_received_message_size = 0; receive_message_from_peer( fixture, server_frame_protector, server_received_message, @@ -440,7 +444,7 @@ void tsi_test_do_round_trip(tsi_test_fixture *fixture) { /* Server sends a message to client. */ send_message_to_peer(fixture, server_frame_protector, false /* is_client */); unsigned char *client_received_message = - gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE); + static_cast<unsigned char *>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE)); size_t client_received_message_size = 0; receive_message_from_peer( fixture, client_frame_protector, client_received_message, @@ -458,7 +462,8 @@ void tsi_test_do_round_trip(tsi_test_fixture *fixture) { static unsigned char *generate_random_message(size_t size) { size_t i; unsigned char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890"; - unsigned char *output = gpr_zalloc(sizeof(unsigned char) * size); + unsigned char *output = + static_cast<unsigned char *>(gpr_zalloc(sizeof(unsigned char) * size)); for (i = 0; i < size - 1; ++i) { output[i] = chars[rand() % (int)(sizeof(chars) - 1)]; } @@ -473,7 +478,9 @@ tsi_test_frame_protector_config *tsi_test_frame_protector_config_create( bool use_default_client_max_output_protected_frame_size, bool use_default_server_max_output_protected_frame_size, bool use_default_handshake_buffer_size) { - tsi_test_frame_protector_config *config = gpr_zalloc(sizeof(*config)); + tsi_test_frame_protector_config *config = + static_cast<tsi_test_frame_protector_config *>( + gpr_zalloc(sizeof(*config))); /* Set the value for read_buffer_allocated_size. */ config->read_buffer_allocated_size = use_default_read_buffer_allocated_size @@ -548,8 +555,10 @@ void tsi_test_fixture_init(tsi_test_fixture *fixture) { fixture->config = tsi_test_frame_protector_config_create( true, true, true, true, true, true, true, true); fixture->handshake_buffer_size = TSI_TEST_DEFAULT_BUFFER_SIZE; - fixture->client_channel = gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE); - fixture->server_channel = gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE); + fixture->client_channel = + static_cast<uint8_t *>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE)); + fixture->server_channel = + static_cast<uint8_t *>(gpr_zalloc(TSI_TEST_DEFAULT_CHANNEL_SIZE)); fixture->bytes_written_to_client_channel = 0; fixture->bytes_written_to_server_channel = 0; fixture->bytes_read_from_client_channel = 0; diff --git a/test/core/util/grpc_profiler.c b/test/core/util/grpc_profiler.cc index 47b0270e29..47b0270e29 100644 --- a/test/core/util/grpc_profiler.c +++ b/test/core/util/grpc_profiler.cc diff --git a/test/core/util/memory_counters.c b/test/core/util/memory_counters.cc index 9fb3ffe095..9fb3ffe095 100644 --- a/test/core/util/memory_counters.c +++ b/test/core/util/memory_counters.cc diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.cc index bd386b2148..bd386b2148 100644 --- a/test/core/util/mock_endpoint.c +++ b/test/core/util/mock_endpoint.cc diff --git a/test/core/util/one_corpus_entry_fuzzer.c b/test/core/util/one_corpus_entry_fuzzer.cc index 42467390f2..42467390f2 100644 --- a/test/core/util/one_corpus_entry_fuzzer.c +++ b/test/core/util/one_corpus_entry_fuzzer.cc diff --git a/test/core/util/parse_hexstring.c b/test/core/util/parse_hexstring.cc index 346b871b67..346b871b67 100644 --- a/test/core/util/parse_hexstring.c +++ b/test/core/util/parse_hexstring.cc diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.cc index 38a47584d5..38a47584d5 100644 --- a/test/core/util/passthru_endpoint.c +++ b/test/core/util/passthru_endpoint.cc diff --git a/test/core/util/port.c b/test/core/util/port.cc index 61f2e5018f..61f2e5018f 100644 --- a/test/core/util/port.c +++ b/test/core/util/port.cc diff --git a/test/core/util/port_server_client.c b/test/core/util/port_server_client.cc index 7b94ac4ada..2c7301d058 100644 --- a/test/core/util/port_server_client.c +++ b/test/core/util/port_server_client.cc @@ -80,7 +80,7 @@ void grpc_free_port_using_server(int port) { shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops, grpc_schedule_on_exec_ctx); - req.host = GRPC_PORT_SERVER_ADDRESS; + req.host = const_cast<char *>(GRPC_PORT_SERVER_ADDRESS); gpr_asprintf(&path, "/drop/%d", port); req.http.path = path; @@ -167,7 +167,7 @@ static void got_port_from_server(grpc_exec_ctx *exec_ctx, void *arg, GPR_TIMESPAN))); pr->retries++; req.host = pr->server; - req.http.path = "/get"; + req.http.path = const_cast<char *>("/get"); grpc_http_response_destroy(&pr->response); memset(&pr->response, 0, sizeof(pr->response)); grpc_resource_quota *resource_quota = @@ -213,11 +213,11 @@ int grpc_pick_port_using_server(void) { shutdown_closure = GRPC_CLOSURE_CREATE(destroy_pops_and_shutdown, &pr.pops, grpc_schedule_on_exec_ctx); pr.port = -1; - pr.server = GRPC_PORT_SERVER_ADDRESS; + pr.server = const_cast<char *>(GRPC_PORT_SERVER_ADDRESS); pr.ctx = &context; - req.host = GRPC_PORT_SERVER_ADDRESS; - req.http.path = "/get"; + req.host = const_cast<char *>(GRPC_PORT_SERVER_ADDRESS); + req.http.path = const_cast<char *>("/get"); grpc_httpcli_context_init(&context); grpc_resource_quota *resource_quota = diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.cc index 9c56e02e8e..883c02e51c 100644 --- a/test/core/util/reconnect_server.c +++ b/test/core/util/reconnect_server.cc @@ -82,7 +82,7 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp, gpr_free(peer); } } - new_tail = gpr_malloc(sizeof(timestamp_list)); + new_tail = static_cast<timestamp_list *>(gpr_malloc(sizeof(timestamp_list))); new_tail->timestamp = now; new_tail->next = NULL; if (server->tail == NULL) { diff --git a/test/core/util/slice_splitter.c b/test/core/util/slice_splitter.cc index 6fcef9acce..6fcef9acce 100644 --- a/test/core/util/slice_splitter.c +++ b/test/core/util/slice_splitter.cc diff --git a/test/core/util/test_config.c b/test/core/util/test_config.cc index 536045e1c3..536045e1c3 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.cc diff --git a/test/core/util/test_tcp_server.c b/test/core/util/test_tcp_server.cc index 611ecb330c..e2d1562aca 100644 --- a/test/core/util/test_tcp_server.c +++ b/test/core/util/test_tcp_server.cc @@ -35,7 +35,7 @@ static void on_server_destroyed(grpc_exec_ctx *exec_ctx, void *data, grpc_error *error) { - test_tcp_server *server = data; + test_tcp_server *server = static_cast<test_tcp_server *>(data); server->shutdown = 1; } @@ -46,7 +46,8 @@ void test_tcp_server_init(test_tcp_server *server, GRPC_CLOSURE_INIT(&server->shutdown_complete, on_server_destroyed, server, grpc_schedule_on_exec_ctx); server->shutdown = 0; - server->pollset = gpr_zalloc(grpc_pollset_size()); + server->pollset = + static_cast<grpc_pollset *>(gpr_zalloc(grpc_pollset_size())); grpc_pollset_init(server->pollset, &server->mu); server->on_connect = on_connect; server->cb_data = user_data; @@ -93,7 +94,7 @@ void test_tcp_server_poll(test_tcp_server *server, int seconds) { static void do_nothing(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {} static void finish_pollset(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) { - grpc_pollset_destroy(exec_ctx, arg); + grpc_pollset_destroy(exec_ctx, static_cast<grpc_pollset *>(arg)); } void test_tcp_server_destroy(test_tcp_server *server) { diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.cc index fc066f9d80..fc066f9d80 100644 --- a/test/core/util/trickle_endpoint.c +++ b/test/core/util/trickle_endpoint.cc |