aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2017-09-20 11:28:25 -0700
committerGravatar Yash Tibrewal <yashkt@google.com>2017-10-02 16:22:41 -0700
commitacd46e571c3dd4721a21c934c4ccb983ed2f687c (patch)
tree5d886d730d785318317cf161db4262fb52324507 /src
parent20987394e90298d410051852734afdc8cf6d2918 (diff)
More pointer conversions, deprecated string to char *, goto crossing initializations
Diffstat (limited to 'src')
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.c8
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.c16
-rw-r--r--src/core/lib/http/httpcli_security_connector.c7
-rw-r--r--src/core/lib/security/context/security_context.c28
-rw-r--r--src/core/lib/security/credentials/composite/composite_credentials.c12
-rw-r--r--src/core/lib/security/credentials/credentials.c22
-rw-r--r--src/core/lib/security/credentials/credentials_metadata.c3
-rw-r--r--src/core/lib/security/credentials/fake/fake_credentials.c13
-rw-r--r--src/core/lib/security/credentials/google_default/google_default_credentials.c8
-rw-r--r--src/core/lib/security/credentials/iam/iam_credentials.c3
-rw-r--r--src/core/lib/security/credentials/jwt/json_token.c6
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_credentials.c3
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_verifier.c27
-rw-r--r--src/core/lib/security/credentials/oauth2/oauth2_credentials.c25
-rw-r--r--src/core/lib/security/credentials/plugin/plugin_credentials.c3
-rw-r--r--src/core/lib/security/credentials/ssl/ssl_credentials.c13
-rw-r--r--src/core/lib/security/transport/client_auth_filter.c31
-rw-r--r--src/core/lib/security/transport/lb_targets_info.c13
-rw-r--r--src/core/lib/security/transport/security_connector.c37
-rw-r--r--src/core/lib/security/transport/server_auth_filter.c30
-rw-r--r--src/core/tsi/fake_transport_security.c36
-rw-r--r--src/core/tsi/ssl_transport_security.c38
-rw-r--r--src/core/tsi/transport_security.c5
-rw-r--r--src/core/tsi/transport_security_adapter.c14
24 files changed, 228 insertions, 173 deletions
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
index 0a36d12f09..fe296cf4ff 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
@@ -86,7 +86,8 @@ static grpc_subchannel_args *get_secure_naming_subchannel_args(
if (target_uri->path[0] != '\0') { // "path" may be empty
const grpc_slice key = grpc_slice_from_static_string(
target_uri->path[0] == '/' ? target_uri->path + 1 : target_uri->path);
- const char *value = grpc_slice_hash_table_get(targets_info, key);
+ const char *value =
+ (const char *)grpc_slice_hash_table_get(targets_info, key);
if (value != NULL) target_name_to_check = gpr_strdup(value);
grpc_slice_unref_internal(exec_ctx, key);
}
@@ -127,7 +128,8 @@ static grpc_subchannel_args *get_secure_naming_subchannel_args(
if (new_args_from_connector != NULL) {
grpc_channel_args_destroy(exec_ctx, new_args_from_connector);
}
- grpc_subchannel_args *final_sc_args = (grpc_subchannel_args*) gpr_malloc(sizeof(*final_sc_args));
+ grpc_subchannel_args *final_sc_args =
+ (grpc_subchannel_args *)gpr_malloc(sizeof(*final_sc_args));
memcpy(final_sc_args, args, sizeof(*args));
final_sc_args->args = new_args;
return final_sc_args;
@@ -164,7 +166,7 @@ static grpc_channel *client_channel_factory_create_channel(
}
// Add channel arg containing the server URI.
grpc_arg arg = grpc_channel_arg_string_create(
- GRPC_ARG_SERVER_URI,
+ (char *)GRPC_ARG_SERVER_URI,
grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target));
const char *to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args *new_args =
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c
index 08cc5a58be..90f81a8c90 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.c
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.c
@@ -288,7 +288,7 @@ static void maybe_flush_read(stream_obj *s) {
CRONET_LOG(GPR_DEBUG, "%p: Flush read", s);
s->state.flush_read = true;
null_and_maybe_free_read_buffer(s);
- s->state.rs.read_buffer = (char*) gpr_malloc(GRPC_FLUSH_READ_SIZE);
+ s->state.rs.read_buffer = (char *)gpr_malloc(GRPC_FLUSH_READ_SIZE);
if (!s->state.pending_read_from_cronet) {
CRONET_LOG(GPR_DEBUG, "bidirectional_stream_read(%p)", s->cbs);
bidirectional_stream_read(s->cbs, s->state.rs.read_buffer,
@@ -313,7 +313,8 @@ static void add_to_storage(struct stream_obj *s,
struct op_storage *storage = &s->storage;
/* add new op at the beginning of the linked list. The memory is freed
in remove_from_storage */
- struct op_and_state *new_op = (struct op_and_state*) gpr_malloc(sizeof(struct op_and_state));
+ struct op_and_state *new_op =
+ (struct op_and_state *)gpr_malloc(sizeof(struct op_and_state));
memcpy(&new_op->op, op, sizeof(grpc_transport_stream_op_batch));
memset(&new_op->state, 0, sizeof(new_op->state));
new_op->s = s;
@@ -685,7 +686,7 @@ static void create_grpc_frame(grpc_exec_ctx *exec_ctx,
size_t length = GRPC_SLICE_LENGTH(slice);
*p_write_buffer_size = length + GRPC_HEADER_SIZE_IN_BYTES;
/* This is freed in the on_write_completed callback */
- char *write_buffer = (char*) gpr_malloc(length + GRPC_HEADER_SIZE_IN_BYTES);
+ char *write_buffer = (char *)gpr_malloc(length + GRPC_HEADER_SIZE_IN_BYTES);
*pp_write_buffer = write_buffer;
uint8_t *p = (uint8_t *)write_buffer;
/* Append 5 byte header */
@@ -1182,7 +1183,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx,
stream_state->rs.length_field);
if (stream_state->rs.length_field > 0) {
stream_state->rs.read_buffer =
- gpr_malloc((size_t)stream_state->rs.length_field);
+ (char *)gpr_malloc((size_t)stream_state->rs.length_field);
GPR_ASSERT(stream_state->rs.read_buffer);
stream_state->rs.remaining_bytes = stream_state->rs.length_field;
stream_state->rs.received_bytes = 0;
@@ -1452,13 +1453,14 @@ static const grpc_transport_vtable grpc_cronet_vtable = {
grpc_transport *grpc_create_cronet_transport(void *engine, const char *target,
const grpc_channel_args *args,
void *reserved) {
- grpc_cronet_transport *ct = (grpc_cronet_transport*) gpr_malloc(sizeof(grpc_cronet_transport));
+ grpc_cronet_transport *ct =
+ (grpc_cronet_transport *)gpr_malloc(sizeof(grpc_cronet_transport));
if (!ct) {
goto error;
}
ct->base.vtable = &grpc_cronet_vtable;
- ct->engine = engine;
- ct->host = (char*) gpr_malloc(strlen(target) + 1);
+ ct->engine = (stream_engine *)engine;
+ ct->host = (char *)gpr_malloc(strlen(target) + 1);
if (!ct->host) {
goto error;
}
diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c
index 4112eca1fa..8a0f225ba2 100644
--- a/src/core/lib/http/httpcli_security_connector.c
+++ b/src/core/lib/http/httpcli_security_connector.c
@@ -106,7 +106,8 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
return GRPC_SECURITY_ERROR;
}
- c = (grpc_httpcli_ssl_channel_security_connector*) gpr_zalloc(sizeof(grpc_httpcli_ssl_channel_security_connector));
+ c = (grpc_httpcli_ssl_channel_security_connector *)gpr_zalloc(
+ sizeof(grpc_httpcli_ssl_channel_security_connector));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.vtable = &httpcli_ssl_vtable;
@@ -137,7 +138,7 @@ typedef struct {
static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
- grpc_handshaker_args *args = (grpc_handshaker_args*) arg;
+ grpc_handshaker_args *args = (grpc_handshaker_args *)arg;
on_done_closure *c = (on_done_closure *)args->user_data;
if (error != GRPC_ERROR_NONE) {
const char *msg = grpc_error_string(error);
@@ -159,7 +160,7 @@ static void ssl_handshake(grpc_exec_ctx *exec_ctx, void *arg,
gpr_timespec deadline,
void (*on_done)(grpc_exec_ctx *exec_ctx, void *arg,
grpc_endpoint *endpoint)) {
- on_done_closure *c = (on_done_closure*) gpr_malloc(sizeof(*c));
+ on_done_closure *c = (on_done_closure *)gpr_malloc(sizeof(*c));
const char *pem_root_certs = grpc_get_default_ssl_roots();
if (pem_root_certs == NULL) {
gpr_log(GPR_ERROR, "Could not get default pem root certs.");
diff --git a/src/core/lib/security/context/security_context.c b/src/core/lib/security/context/security_context.c
index 748e6faf2f..31d800b9b4 100644
--- a/src/core/lib/security/context/security_context.c
+++ b/src/core/lib/security/context/security_context.c
@@ -82,7 +82,8 @@ void grpc_auth_context_release(grpc_auth_context *context) {
/* --- grpc_client_security_context --- */
grpc_client_security_context *grpc_client_security_context_create(void) {
- return (grpc_client_security_context*)gpr_zalloc(sizeof(grpc_client_security_context));
+ return (grpc_client_security_context *)gpr_zalloc(
+ sizeof(grpc_client_security_context));
}
void grpc_client_security_context_destroy(void *ctx) {
@@ -100,7 +101,8 @@ void grpc_client_security_context_destroy(void *ctx) {
/* --- grpc_server_security_context --- */
grpc_server_security_context *grpc_server_security_context_create(void) {
- return (grpc_client_security_context*)gpr_zalloc(sizeof(grpc_server_security_context));
+ return (grpc_server_security_context *)gpr_zalloc(
+ sizeof(grpc_server_security_context));
}
void grpc_server_security_context_destroy(void *ctx) {
@@ -117,7 +119,8 @@ void grpc_server_security_context_destroy(void *ctx) {
static grpc_auth_property_iterator empty_iterator = {NULL, 0, NULL};
grpc_auth_context *grpc_auth_context_create(grpc_auth_context *chained) {
- grpc_auth_context *ctx = (grpc_auth_context*) gpr_zalloc(sizeof(grpc_auth_context));
+ grpc_auth_context *ctx =
+ (grpc_auth_context *)gpr_zalloc(sizeof(grpc_auth_context));
gpr_ref_init(&ctx->refcount, 1);
if (chained != NULL) {
ctx->chained = GRPC_AUTH_CONTEXT_REF(chained, "chained");
@@ -258,9 +261,9 @@ static void ensure_auth_context_capacity(grpc_auth_context *ctx) {
if (ctx->properties.count == ctx->properties.capacity) {
ctx->properties.capacity =
GPR_MAX(ctx->properties.capacity + 8, ctx->properties.capacity * 2);
- ctx->properties.array = (grpc_auth_property *)
- gpr_realloc(ctx->properties.array,
- ctx->properties.capacity * sizeof(grpc_auth_property));
+ ctx->properties.array = (grpc_auth_property *)gpr_realloc(
+ ctx->properties.array,
+ ctx->properties.capacity * sizeof(grpc_auth_property));
}
}
@@ -275,7 +278,7 @@ void grpc_auth_context_add_property(grpc_auth_context *ctx, const char *name,
ensure_auth_context_capacity(ctx);
prop = &ctx->properties.array[ctx->properties.count++];
prop->name = gpr_strdup(name);
- prop->value = (char*) gpr_malloc(value_length + 1);
+ prop->value = (char *)gpr_malloc(value_length + 1);
memcpy(prop->value, value, value_length);
prop->value[value_length] = '\0';
prop->value_length = value_length;
@@ -302,11 +305,12 @@ void grpc_auth_property_reset(grpc_auth_property *property) {
}
static void auth_context_pointer_arg_destroy(grpc_exec_ctx *exec_ctx, void *p) {
- GRPC_AUTH_CONTEXT_UNREF((grpc_auth_context*)p, "auth_context_pointer_arg");
+ GRPC_AUTH_CONTEXT_UNREF((grpc_auth_context *)p, "auth_context_pointer_arg");
}
static void *auth_context_pointer_arg_copy(void *p) {
- return GRPC_AUTH_CONTEXT_REF((grpc_auth_context*)p, "auth_context_pointer_arg");
+ return GRPC_AUTH_CONTEXT_REF((grpc_auth_context *)p,
+ "auth_context_pointer_arg");
}
static int auth_context_pointer_cmp(void *a, void *b) { return GPR_ICMP(a, b); }
@@ -316,8 +320,8 @@ static const grpc_arg_pointer_vtable auth_context_pointer_vtable = {
auth_context_pointer_cmp};
grpc_arg grpc_auth_context_to_arg(grpc_auth_context *p) {
- return grpc_channel_arg_pointer_create(GRPC_AUTH_CONTEXT_ARG, p,
- (char *)&auth_context_pointer_vtable);
+ return grpc_channel_arg_pointer_create((char *)GRPC_AUTH_CONTEXT_ARG, p,
+ &auth_context_pointer_vtable);
}
grpc_auth_context *grpc_auth_context_from_arg(const grpc_arg *arg) {
@@ -327,7 +331,7 @@ grpc_auth_context *grpc_auth_context_from_arg(const grpc_arg *arg) {
GRPC_AUTH_CONTEXT_ARG);
return NULL;
}
- return (grpc_auth_context*)arg->value.pointer.p;
+ return (grpc_auth_context *)arg->value.pointer.p;
}
grpc_auth_context *grpc_find_auth_context_in_args(
diff --git a/src/core/lib/security/credentials/composite/composite_credentials.c b/src/core/lib/security/credentials/composite/composite_credentials.c
index a3a7cbd18d..779300ac07 100644
--- a/src/core/lib/security/credentials/composite/composite_credentials.c
+++ b/src/core/lib/security/credentials/composite/composite_credentials.c
@@ -79,7 +79,8 @@ static bool composite_call_get_request_metadata(
grpc_error **error) {
grpc_composite_call_credentials *c = (grpc_composite_call_credentials *)creds;
grpc_composite_call_credentials_metadata_context *ctx;
- ctx = (grpc_composite_call_credentials_metadata_context*) gpr_zalloc(sizeof(grpc_composite_call_credentials_metadata_context));
+ ctx = (grpc_composite_call_credentials_metadata_context *)gpr_zalloc(
+ sizeof(grpc_composite_call_credentials_metadata_context));
ctx->composite_creds = c;
ctx->pollent = pollent;
ctx->auth_md_context = auth_md_context;
@@ -146,7 +147,8 @@ grpc_call_credentials *grpc_composite_call_credentials_create(
GPR_ASSERT(reserved == NULL);
GPR_ASSERT(creds1 != NULL);
GPR_ASSERT(creds2 != NULL);
- c = (grpc_composite_call_credentials*) gpr_zalloc(sizeof(grpc_composite_call_credentials));
+ c = (grpc_composite_call_credentials *)gpr_zalloc(
+ sizeof(grpc_composite_call_credentials));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE;
c->base.vtable = &composite_call_credentials_vtable;
gpr_ref_init(&c->base.refcount, 1);
@@ -154,7 +156,8 @@ grpc_call_credentials *grpc_composite_call_credentials_create(
creds2_array = get_creds_array(&creds2);
c->inner.num_creds = creds1_array.num_creds + creds2_array.num_creds;
creds_array_byte_size = c->inner.num_creds * sizeof(grpc_call_credentials *);
- c->inner.creds_array = (grpc_call_credentials**) gpr_zalloc(creds_array_byte_size);
+ c->inner.creds_array =
+ (grpc_call_credentials **)gpr_zalloc(creds_array_byte_size);
for (i = 0; i < creds1_array.num_creds; i++) {
grpc_call_credentials *cur_creds = creds1_array.creds_array[i];
c->inner.creds_array[i] = grpc_call_credentials_ref(cur_creds);
@@ -248,7 +251,8 @@ static grpc_channel_credentials_vtable composite_channel_credentials_vtable = {
grpc_channel_credentials *grpc_composite_channel_credentials_create(
grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds,
void *reserved) {
- grpc_composite_channel_credentials *c = (grpc_composite_channel_credentials*) gpr_zalloc(sizeof(*c));
+ grpc_composite_channel_credentials *c =
+ (grpc_composite_channel_credentials *)gpr_zalloc(sizeof(*c));
GPR_ASSERT(channel_creds != NULL && call_creds != NULL && reserved == NULL);
GRPC_API_TRACE(
"grpc_composite_channel_credentials_create(channel_creds=%p, "
diff --git a/src/core/lib/security/credentials/credentials.c b/src/core/lib/security/credentials/credentials.c
index 8a67c9865b..ebbf350865 100644
--- a/src/core/lib/security/credentials/credentials.c
+++ b/src/core/lib/security/credentials/credentials.c
@@ -40,7 +40,8 @@
grpc_credentials_metadata_request *grpc_credentials_metadata_request_create(
grpc_call_credentials *creds) {
grpc_credentials_metadata_request *r =
- gpr_zalloc(sizeof(grpc_credentials_metadata_request));
+ (grpc_credentials_metadata_request *)gpr_zalloc(
+ sizeof(grpc_credentials_metadata_request));
r->creds = grpc_call_credentials_ref(creds);
return r;
}
@@ -148,11 +149,11 @@ grpc_channel_credentials_duplicate_without_call_credentials(
}
static void credentials_pointer_arg_destroy(grpc_exec_ctx *exec_ctx, void *p) {
- grpc_channel_credentials_unref(exec_ctx, p);
+ grpc_channel_credentials_unref(exec_ctx, (grpc_channel_credentials *)p);
}
static void *credentials_pointer_arg_copy(void *p) {
- return grpc_channel_credentials_ref(p);
+ return grpc_channel_credentials_ref((grpc_channel_credentials *)p);
}
static int credentials_pointer_cmp(void *a, void *b) { return GPR_ICMP(a, b); }
@@ -163,8 +164,9 @@ static const grpc_arg_pointer_vtable credentials_pointer_vtable = {
grpc_arg grpc_channel_credentials_to_arg(
grpc_channel_credentials *credentials) {
- return grpc_channel_arg_pointer_create(
- GRPC_ARG_CHANNEL_CREDENTIALS, credentials, &credentials_pointer_vtable);
+ return grpc_channel_arg_pointer_create((char *)GRPC_ARG_CHANNEL_CREDENTIALS,
+ credentials,
+ &credentials_pointer_vtable);
}
grpc_channel_credentials *grpc_channel_credentials_from_arg(
@@ -175,7 +177,7 @@ grpc_channel_credentials *grpc_channel_credentials_from_arg(
GRPC_ARG_CHANNEL_CREDENTIALS);
return NULL;
}
- return arg->value.pointer.p;
+ return (grpc_channel_credentials *)arg->value.pointer.p;
}
grpc_channel_credentials *grpc_channel_credentials_find_in_args(
@@ -244,11 +246,11 @@ void grpc_server_credentials_set_auth_metadata_processor(
static void server_credentials_pointer_arg_destroy(grpc_exec_ctx *exec_ctx,
void *p) {
- grpc_server_credentials_unref(exec_ctx, p);
+ grpc_server_credentials_unref(exec_ctx, (grpc_server_credentials *)p);
}
static void *server_credentials_pointer_arg_copy(void *p) {
- return grpc_server_credentials_ref(p);
+ return grpc_server_credentials_ref((grpc_server_credentials *)p);
}
static int server_credentials_pointer_cmp(void *a, void *b) {
@@ -260,7 +262,7 @@ static const grpc_arg_pointer_vtable cred_ptr_vtable = {
server_credentials_pointer_cmp};
grpc_arg grpc_server_credentials_to_arg(grpc_server_credentials *p) {
- return grpc_channel_arg_pointer_create(GRPC_SERVER_CREDENTIALS_ARG, p,
+ return grpc_channel_arg_pointer_create((char *)GRPC_SERVER_CREDENTIALS_ARG, p,
&cred_ptr_vtable);
}
@@ -271,7 +273,7 @@ grpc_server_credentials *grpc_server_credentials_from_arg(const grpc_arg *arg) {
GRPC_SERVER_CREDENTIALS_ARG);
return NULL;
}
- return arg->value.pointer.p;
+ return (grpc_server_credentials *)arg->value.pointer.p;
}
grpc_server_credentials *grpc_find_server_credentials_in_args(
diff --git a/src/core/lib/security/credentials/credentials_metadata.c b/src/core/lib/security/credentials/credentials_metadata.c
index 03b84bd019..5ba98bda4e 100644
--- a/src/core/lib/security/credentials/credentials_metadata.c
+++ b/src/core/lib/security/credentials/credentials_metadata.c
@@ -33,7 +33,8 @@ static void mdelem_list_ensure_capacity(grpc_credentials_mdelem_array *list,
while (new_size < target_size) {
new_size *= 2;
}
- list->md = (grpc_mdelem*) gpr_realloc(list->md, sizeof(grpc_mdelem) * new_size);
+ list->md =
+ (grpc_mdelem *)gpr_realloc(list->md, sizeof(grpc_mdelem) * new_size);
}
void grpc_credentials_mdelem_array_add(grpc_credentials_mdelem_array *list,
diff --git a/src/core/lib/security/credentials/fake/fake_credentials.c b/src/core/lib/security/credentials/fake/fake_credentials.c
index 9ee7914c51..795ca0660a 100644
--- a/src/core/lib/security/credentials/fake/fake_credentials.c
+++ b/src/core/lib/security/credentials/fake/fake_credentials.c
@@ -60,7 +60,8 @@ static grpc_server_credentials_vtable
grpc_channel_credentials *grpc_fake_transport_security_credentials_create(
void) {
- grpc_channel_credentials *c = (grpc_channel_credentials*) gpr_zalloc(sizeof(grpc_channel_credentials));
+ grpc_channel_credentials *c =
+ (grpc_channel_credentials *)gpr_zalloc(sizeof(grpc_channel_credentials));
c->type = GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY;
c->vtable = &fake_transport_security_credentials_vtable;
gpr_ref_init(&c->refcount, 1);
@@ -69,7 +70,8 @@ grpc_channel_credentials *grpc_fake_transport_security_credentials_create(
grpc_server_credentials *grpc_fake_transport_security_server_credentials_create(
void) {
- grpc_server_credentials *c = (grpc_server_credentials*) gpr_malloc(sizeof(grpc_server_credentials));
+ grpc_server_credentials *c =
+ (grpc_server_credentials *)gpr_malloc(sizeof(grpc_server_credentials));
memset(c, 0, sizeof(grpc_server_credentials));
c->type = GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY;
gpr_ref_init(&c->refcount, 1);
@@ -78,8 +80,8 @@ grpc_server_credentials *grpc_fake_transport_security_server_credentials_create(
}
grpc_arg grpc_fake_transport_expected_targets_arg(char *expected_targets) {
- return grpc_channel_arg_string_create(GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS,
- expected_targets);
+ return grpc_channel_arg_string_create(
+ (char *)GRPC_ARG_FAKE_SECURITY_EXPECTED_TARGETS, expected_targets);
}
const char *grpc_fake_transport_get_expected_targets(
@@ -129,7 +131,8 @@ grpc_call_credentials *grpc_md_only_test_credentials_create(
grpc_exec_ctx *exec_ctx, const char *md_key, const char *md_value,
bool is_async) {
grpc_md_only_test_credentials *c =
- gpr_zalloc(sizeof(grpc_md_only_test_credentials));
+ (grpc_md_only_test_credentials *)gpr_zalloc(
+ sizeof(grpc_md_only_test_credentials));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_OAUTH2;
c->base.vtable = &md_only_test_vtable;
gpr_ref_init(&c->base.refcount, 1);
diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.c b/src/core/lib/security/credentials/google_default/google_default_credentials.c
index c040c445a6..11a06e994f 100644
--- a/src/core/lib/security/credentials/google_default/google_default_credentials.c
+++ b/src/core/lib/security/credentials/google_default/google_default_credentials.c
@@ -85,7 +85,7 @@ static void on_compute_engine_detection_http_response(grpc_exec_ctx *exec_ctx,
}
static void destroy_pollset(grpc_exec_ctx *exec_ctx, void *p, grpc_error *e) {
- grpc_pollset_destroy(exec_ctx, p);
+ grpc_pollset_destroy(exec_ctx, (grpc_pollset *)p);
}
static int is_stack_running_on_compute_engine(grpc_exec_ctx *exec_ctx) {
@@ -98,7 +98,7 @@ static int is_stack_running_on_compute_engine(grpc_exec_ctx *exec_ctx) {
on compute engine. */
gpr_timespec max_detection_delay = gpr_time_from_seconds(1, GPR_TIMESPAN);
- grpc_pollset *pollset = (grpc_pollset*) gpr_zalloc(grpc_pollset_size());
+ grpc_pollset *pollset = (grpc_pollset *)gpr_zalloc(grpc_pollset_size());
grpc_pollset_init(pollset, &g_polling_mu);
detector.pollent = grpc_polling_entity_create_from_pollset(pollset);
detector.is_done = 0;
@@ -106,8 +106,8 @@ static int is_stack_running_on_compute_engine(grpc_exec_ctx *exec_ctx) {
memset(&detector.response, 0, sizeof(detector.response));
memset(&request, 0, sizeof(grpc_httpcli_request));
- request.host = GRPC_COMPUTE_ENGINE_DETECTION_HOST;
- request.http.path = "/";
+ request.host = (char *)GRPC_COMPUTE_ENGINE_DETECTION_HOST;
+ request.http.path = (char *)"/";
grpc_httpcli_context_init(&context);
diff --git a/src/core/lib/security/credentials/iam/iam_credentials.c b/src/core/lib/security/credentials/iam/iam_credentials.c
index df9ca99bdc..e9cf208c16 100644
--- a/src/core/lib/security/credentials/iam/iam_credentials.c
+++ b/src/core/lib/security/credentials/iam/iam_credentials.c
@@ -64,7 +64,8 @@ grpc_call_credentials *grpc_google_iam_credentials_create(
GPR_ASSERT(reserved == NULL);
GPR_ASSERT(token != NULL);
GPR_ASSERT(authority_selector != NULL);
- grpc_google_iam_credentials *c = (grpc_google_iam_credentials*) gpr_zalloc(sizeof(*c));
+ grpc_google_iam_credentials *c =
+ (grpc_google_iam_credentials *)gpr_zalloc(sizeof(*c));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_IAM;
c->base.vtable = &iam_vtable;
gpr_ref_init(&c->base.refcount, 1);
diff --git a/src/core/lib/security/credentials/jwt/json_token.c b/src/core/lib/security/credentials/jwt/json_token.c
index 4f1456c384..e41667c22f 100644
--- a/src/core/lib/security/credentials/jwt/json_token.c
+++ b/src/core/lib/security/credentials/jwt/json_token.c
@@ -96,7 +96,7 @@ grpc_auth_json_key grpc_auth_json_key_create_from_json(const grpc_json *json) {
gpr_log(GPR_ERROR, "Could not write into openssl BIO.");
goto end;
}
- result.private_key = PEM_read_bio_RSAPrivateKey(bio, NULL, NULL, "");
+ result.private_key = PEM_read_bio_RSAPrivateKey(bio, NULL, NULL, (void *)"");
if (result.private_key == NULL) {
gpr_log(GPR_ERROR, "Could not deserialize private key.");
goto end;
@@ -214,7 +214,7 @@ static char *dot_concat_and_free_strings(char *str1, char *str2) {
size_t str1_len = strlen(str1);
size_t str2_len = strlen(str2);
size_t result_len = str1_len + 1 /* dot */ + str2_len;
- char *result = (char*) gpr_malloc(result_len + 1 /* NULL terminated */);
+ char *result = (char *)gpr_malloc(result_len + 1 /* NULL terminated */);
char *current = result;
memcpy(current, str1, str1_len);
current += str1_len;
@@ -266,7 +266,7 @@ char *compute_and_encode_signature(const grpc_auth_json_key *json_key,
gpr_log(GPR_ERROR, "DigestFinal (get signature length) failed.");
goto end;
}
- sig = (unsigned char*) gpr_malloc(sig_len);
+ sig = (unsigned char *)gpr_malloc(sig_len);
if (EVP_DigestSignFinal(md_ctx, sig, &sig_len) != 1) {
gpr_log(GPR_ERROR, "DigestFinal (signature compute) failed.");
goto end;
diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.c b/src/core/lib/security/credentials/jwt/jwt_credentials.c
index 58610a1b69..b361265a7b 100644
--- a/src/core/lib/security/credentials/jwt/jwt_credentials.c
+++ b/src/core/lib/security/credentials/jwt/jwt_credentials.c
@@ -125,7 +125,8 @@ grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
gpr_log(GPR_ERROR, "Invalid input for jwt credentials creation");
return NULL;
}
- c = (grpc_service_account_jwt_access_credentials*) gpr_zalloc(sizeof(grpc_service_account_jwt_access_credentials));
+ c = (grpc_service_account_jwt_access_credentials *)gpr_zalloc(
+ sizeof(grpc_service_account_jwt_access_credentials));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_JWT;
gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &jwt_vtable;
diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.c b/src/core/lib/security/credentials/jwt/jwt_verifier.c
index 1a8e1cf9ed..97574cfbd9 100644
--- a/src/core/lib/security/credentials/jwt/jwt_verifier.c
+++ b/src/core/lib/security/credentials/jwt/jwt_verifier.c
@@ -129,7 +129,7 @@ static void jose_header_destroy(grpc_exec_ctx *exec_ctx, jose_header *h) {
static jose_header *jose_header_from_json(grpc_exec_ctx *exec_ctx,
grpc_json *json, grpc_slice buffer) {
grpc_json *cur;
- jose_header *h = (jose_header*) gpr_zalloc(sizeof(jose_header));
+ jose_header *h = (jose_header *)gpr_zalloc(sizeof(jose_header));
h->buffer = buffer;
for (cur = json->child; cur != NULL; cur = cur->next) {
if (strcmp(cur->key, "alg") == 0) {
@@ -231,7 +231,8 @@ gpr_timespec grpc_jwt_claims_not_before(const grpc_jwt_claims *claims) {
grpc_jwt_claims *grpc_jwt_claims_from_json(grpc_exec_ctx *exec_ctx,
grpc_json *json, grpc_slice buffer) {
grpc_json *cur;
- grpc_jwt_claims *claims = (grpc_jwt_claims*) gpr_malloc(sizeof(grpc_jwt_claims));
+ grpc_jwt_claims *claims =
+ (grpc_jwt_claims *)gpr_malloc(sizeof(grpc_jwt_claims));
memset(claims, 0, sizeof(grpc_jwt_claims));
claims->json = json;
claims->buffer = buffer;
@@ -347,7 +348,7 @@ static verifier_cb_ctx *verifier_cb_ctx_create(
const char *signed_jwt, size_t signed_jwt_len, void *user_data,
grpc_jwt_verification_done_cb cb) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- verifier_cb_ctx *ctx = (verifier_cb_ctx*) gpr_zalloc(sizeof(verifier_cb_ctx));
+ verifier_cb_ctx *ctx = (verifier_cb_ctx *)gpr_zalloc(sizeof(verifier_cb_ctx));
ctx->verifier = verifier;
ctx->pollent = grpc_polling_entity_create_from_pollset(pollset);
ctx->header = header;
@@ -676,6 +677,7 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
grpc_json *json = json_from_http(response);
grpc_httpcli_request req;
const char *jwks_uri;
+ grpc_resource_quota *resource_quota = NULL;
/* TODO(jboeuf): Cache the jwks_uri in order to avoid this hop next time. */
if (json == NULL) goto error;
@@ -693,9 +695,9 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
jwks_uri += 8;
req.handshaker = &grpc_httpcli_ssl;
req.host = gpr_strdup(jwks_uri);
- req.http.path = strchr(jwks_uri, '/');
+ req.http.path = (char *)strchr(jwks_uri, '/');
if (req.http.path == NULL) {
- req.http.path = "";
+ req.http.path = (char *)"";
} else {
*(req.host + (req.http.path - jwks_uri)) = '\0';
}
@@ -703,8 +705,7 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
/* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
channel. This would allow us to cancel an authentication query when under
extreme memory pressure. */
- grpc_resource_quota *resource_quota =
- grpc_resource_quota_create("jwt_verifier");
+ resource_quota = grpc_resource_quota_create("jwt_verifier");
grpc_httpcli_get(
exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, resource_quota, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
@@ -760,7 +761,7 @@ const char *grpc_jwt_issuer_email_domain(const char *issuer) {
if (dot == NULL || dot == email_domain) return email_domain;
GPR_ASSERT(dot > email_domain);
/* There may be a subdomain, we just want the domain. */
- dot = gpr_memrchr(email_domain, '.', (size_t)(dot - email_domain));
+ dot = (const char *)gpr_memrchr((void *)email_domain, '.', (size_t)(dot - email_domain));
if (dot == NULL) return email_domain;
return dot + 1;
}
@@ -773,6 +774,7 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
char *path_prefix = NULL;
const char *iss;
grpc_httpcli_request req;
+ grpc_resource_quota *resource_quota = NULL;
memset(&req, 0, sizeof(grpc_httpcli_request));
req.handshaker = &grpc_httpcli_ssl;
http_response_index rsp_idx;
@@ -831,8 +833,7 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
/* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
channel. This would allow us to cancel an authentication query when under
extreme memory pressure. */
- grpc_resource_quota *resource_quota =
- grpc_resource_quota_create("jwt_verifier");
+ resource_quota = grpc_resource_quota_create("jwt_verifier");
grpc_httpcli_get(
exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, resource_quota, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
@@ -901,12 +902,14 @@ error:
grpc_jwt_verifier *grpc_jwt_verifier_create(
const grpc_jwt_verifier_email_domain_key_url_mapping *mappings,
size_t num_mappings) {
- grpc_jwt_verifier *v = (grpc_jwt_verifier*) gpr_zalloc(sizeof(grpc_jwt_verifier));
+ grpc_jwt_verifier *v =
+ (grpc_jwt_verifier *)gpr_zalloc(sizeof(grpc_jwt_verifier));
grpc_httpcli_context_init(&v->http_ctx);
/* We know at least of one mapping. */
v->allocated_mappings = 1 + num_mappings;
- v->mappings = (email_key_mapping*) gpr_malloc(v->allocated_mappings * sizeof(email_key_mapping));
+ v->mappings = (email_key_mapping *)gpr_malloc(v->allocated_mappings *
+ sizeof(email_key_mapping));
verifier_put_mapping(v, GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN,
GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX);
/* User-Provided mappings. */
diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c
index 3a7a335ad6..0a801bec82 100644
--- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c
+++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c
@@ -130,7 +130,7 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
}
if (response->body_length > 0) {
- null_terminated_body = (char*) gpr_malloc(response->body_length + 1);
+ null_terminated_body = (char *)gpr_malloc(response->body_length + 1);
null_terminated_body[response->body_length] = '\0';
memcpy(null_terminated_body, response->body, response->body_length);
}
@@ -359,11 +359,11 @@ static void compute_engine_fetch_oauth2(
grpc_exec_ctx *exec_ctx, grpc_credentials_metadata_request *metadata_req,
grpc_httpcli_context *httpcli_context, grpc_polling_entity *pollent,
grpc_iomgr_cb_func response_cb, gpr_timespec deadline) {
- grpc_http_header header = {"Metadata-Flavor", "Google"};
+ grpc_http_header header = {(char *)"Metadata-Flavor", (char *)"Google"};
grpc_httpcli_request request;
memset(&request, 0, sizeof(grpc_httpcli_request));
- request.host = GRPC_COMPUTE_ENGINE_METADATA_HOST;
- request.http.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
+ request.host = (char *)GRPC_COMPUTE_ENGINE_METADATA_HOST;
+ request.http.path = (char *)GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
request.http.hdr_count = 1;
request.http.hdrs = &header;
/* TODO(ctiller): Carry the resource_quota in ctx and share it with the host
@@ -381,7 +381,8 @@ static void compute_engine_fetch_oauth2(
grpc_call_credentials *grpc_google_compute_engine_credentials_create(
void *reserved) {
grpc_oauth2_token_fetcher_credentials *c =
- gpr_malloc(sizeof(grpc_oauth2_token_fetcher_credentials));
+ (grpc_oauth2_token_fetcher_credentials *)gpr_malloc(
+ sizeof(grpc_oauth2_token_fetcher_credentials));
GRPC_API_TRACE("grpc_compute_engine_credentials_create(reserved=%p)", 1,
(reserved));
GPR_ASSERT(reserved == NULL);
@@ -412,16 +413,16 @@ static void refresh_token_fetch_oauth2(
grpc_iomgr_cb_func response_cb, gpr_timespec deadline) {
grpc_google_refresh_token_credentials *c =
(grpc_google_refresh_token_credentials *)metadata_req->creds;
- grpc_http_header header = {"Content-Type",
- "application/x-www-form-urlencoded"};
+ grpc_http_header header = {(char *)"Content-Type",
+ (char *)"application/x-www-form-urlencoded"};
grpc_httpcli_request request;
char *body = NULL;
gpr_asprintf(&body, GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING,
c->refresh_token.client_id, c->refresh_token.client_secret,
c->refresh_token.refresh_token);
memset(&request, 0, sizeof(grpc_httpcli_request));
- request.host = GRPC_GOOGLE_OAUTH2_SERVICE_HOST;
- request.http.path = GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH;
+ request.host = (char *)GRPC_GOOGLE_OAUTH2_SERVICE_HOST;
+ request.http.path = (char *)GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH;
request.http.hdr_count = 1;
request.http.hdrs = &header;
request.handshaker = &grpc_httpcli_ssl;
@@ -447,7 +448,8 @@ grpc_refresh_token_credentials_create_from_auth_refresh_token(
gpr_log(GPR_ERROR, "Invalid input for refresh token credentials creation");
return NULL;
}
- c = (grpc_google_refresh_token_credentials*) gpr_zalloc(sizeof(grpc_google_refresh_token_credentials));
+ c = (grpc_google_refresh_token_credentials *)gpr_zalloc(
+ sizeof(grpc_google_refresh_token_credentials));
init_oauth2_token_fetcher(&c->base, refresh_token_fetch_oauth2);
c->base.base.vtable = &refresh_token_vtable;
c->refresh_token = refresh_token;
@@ -515,7 +517,8 @@ static grpc_call_credentials_vtable access_token_vtable = {
grpc_call_credentials *grpc_access_token_credentials_create(
const char *access_token, void *reserved) {
grpc_access_token_credentials *c =
- gpr_zalloc(sizeof(grpc_access_token_credentials));
+ (grpc_access_token_credentials *)gpr_zalloc(
+ sizeof(grpc_access_token_credentials));
GRPC_API_TRACE(
"grpc_access_token_credentials_create(access_token=<redacted>, "
"reserved=%p)",
diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.c b/src/core/lib/security/credentials/plugin/plugin_credentials.c
index 59ab9266b6..8106a730fe 100644
--- a/src/core/lib/security/credentials/plugin/plugin_credentials.c
+++ b/src/core/lib/security/credentials/plugin/plugin_credentials.c
@@ -258,7 +258,8 @@ static grpc_call_credentials_vtable plugin_vtable = {
grpc_call_credentials *grpc_metadata_credentials_create_from_plugin(
grpc_metadata_credentials_plugin plugin, void *reserved) {
- grpc_plugin_credentials *c = (grpc_plugin_credentials*) gpr_zalloc(sizeof(*c));
+ grpc_plugin_credentials *c =
+ (grpc_plugin_credentials *)gpr_zalloc(sizeof(*c));
GRPC_API_TRACE("grpc_metadata_credentials_create_from_plugin(reserved=%p)", 1,
(reserved));
GPR_ASSERT(reserved == NULL);
diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.c b/src/core/lib/security/credentials/ssl/ssl_credentials.c
index 5f6df9a3ef..eac081c60c 100644
--- a/src/core/lib/security/credentials/ssl/ssl_credentials.c
+++ b/src/core/lib/security/credentials/ssl/ssl_credentials.c
@@ -67,7 +67,7 @@ static grpc_security_status ssl_create_security_connector(
return status;
}
grpc_arg new_arg =
- grpc_channel_arg_string_create(GRPC_ARG_HTTP2_SCHEME, "https");
+ grpc_channel_arg_string_create((char *)GRPC_ARG_HTTP2_SCHEME, (char *)"https");
*new_args = grpc_channel_args_copy_and_add(args, &new_arg, 1);
return status;
}
@@ -94,7 +94,8 @@ static void ssl_build_config(const char *pem_root_certs,
grpc_channel_credentials *grpc_ssl_credentials_create(
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair,
void *reserved) {
- grpc_ssl_credentials *c = (grpc_ssl_credentials*) gpr_zalloc(sizeof(grpc_ssl_credentials));
+ grpc_ssl_credentials *c =
+ (grpc_ssl_credentials *)gpr_zalloc(sizeof(grpc_ssl_credentials));
GRPC_API_TRACE(
"grpc_ssl_credentials_create(pem_root_certs=%s, "
"pem_key_cert_pair=%p, "
@@ -145,8 +146,8 @@ static void ssl_build_server_config(
}
if (num_key_cert_pairs > 0) {
GPR_ASSERT(pem_key_cert_pairs != NULL);
- config->pem_key_cert_pairs =
- gpr_zalloc(num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair));
+ config->pem_key_cert_pairs = (tsi_ssl_pem_key_cert_pair *)gpr_zalloc(
+ num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair));
}
config->num_key_cert_pairs = num_key_cert_pairs;
for (i = 0; i < num_key_cert_pairs; i++) {
@@ -175,8 +176,8 @@ grpc_server_credentials *grpc_ssl_server_credentials_create_ex(
size_t num_key_cert_pairs,
grpc_ssl_client_certificate_request_type client_certificate_request,
void *reserved) {
- grpc_ssl_server_credentials *c =
- gpr_zalloc(sizeof(grpc_ssl_server_credentials));
+ grpc_ssl_server_credentials *c = (grpc_ssl_server_credentials *)gpr_zalloc(
+ sizeof(grpc_ssl_server_credentials));
GRPC_API_TRACE(
"grpc_ssl_server_credentials_create_ex("
"pem_root_certs=%s, pem_key_cert_pairs=%p, num_key_cert_pairs=%lu, "
diff --git a/src/core/lib/security/transport/client_auth_filter.c b/src/core/lib/security/transport/client_auth_filter.c
index dd7dd44e79..594da89d90 100644
--- a/src/core/lib/security/transport/client_auth_filter.c
+++ b/src/core/lib/security/transport/client_auth_filter.c
@@ -93,8 +93,9 @@ static void add_error(grpc_error **combined, grpc_error *error) {
static void on_credentials_metadata(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *input_error) {
grpc_transport_stream_op_batch *batch = (grpc_transport_stream_op_batch *)arg;
- grpc_call_element *elem = batch->handler_private.extra_arg;
- call_data *calld = elem->call_data;
+ grpc_call_element *elem =
+ (grpc_call_element *)batch->handler_private.extra_arg;
+ call_data *calld = (call_data *)elem->call_data;
reset_auth_metadata_context(&calld->auth_md_context);
grpc_error *error = GRPC_ERROR_REF(input_error);
if (error == GRPC_ERROR_NONE) {
@@ -163,8 +164,8 @@ static void cancel_get_request_metadata(grpc_exec_ctx *exec_ctx, void *arg,
static void send_security_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_transport_stream_op_batch *batch) {
- call_data *calld = elem->call_data;
- channel_data *chand = elem->channel_data;
+ call_data *calld = (call_data *)elem->call_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
grpc_client_security_context *ctx =
(grpc_client_security_context *)batch->payload
->context[GRPC_CONTEXT_SECURITY]
@@ -225,8 +226,8 @@ static void send_security_metadata(grpc_exec_ctx *exec_ctx,
static void on_host_checked(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
grpc_transport_stream_op_batch *batch = (grpc_transport_stream_op_batch *)arg;
- grpc_call_element *elem = batch->handler_private.extra_arg;
- call_data *calld = elem->call_data;
+ grpc_call_element *elem = (grpc_call_element *)batch->handler_private.extra_arg;
+ call_data *calld = (call_data *)elem->call_data;
if (error == GRPC_ERROR_NONE) {
send_security_metadata(exec_ctx, elem, batch);
} else {
@@ -264,8 +265,8 @@ static void auth_start_transport_stream_op_batch(
GPR_TIMER_BEGIN("auth_start_transport_stream_op_batch", 0);
/* grab pointers to our data from the call element */
- call_data *calld = elem->call_data;
- channel_data *chand = elem->channel_data;
+ call_data *calld = (call_data *)elem->call_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
if (!batch->cancel_stream) {
GPR_ASSERT(batch->payload->context != NULL);
@@ -276,7 +277,9 @@ static void auth_start_transport_stream_op_batch(
grpc_client_security_context_destroy;
}
grpc_client_security_context *sec_ctx =
- batch->payload->context[GRPC_CONTEXT_SECURITY].value;
+ (grpc_client_security_context *)batch->payload
+ ->context[GRPC_CONTEXT_SECURITY]
+ .value;
GRPC_AUTH_CONTEXT_UNREF(sec_ctx->auth_context, "client auth filter");
sec_ctx->auth_context =
GRPC_AUTH_CONTEXT_REF(chand->auth_context, "client_auth_filter");
@@ -339,7 +342,7 @@ static void auth_start_transport_stream_op_batch(
static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
const grpc_call_element_args *args) {
- call_data *calld = elem->call_data;
+ call_data *calld = (call_data *)elem->call_data;
calld->owning_call = args->call_stack;
calld->call_combiner = args->call_combiner;
return GRPC_ERROR_NONE;
@@ -348,7 +351,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_polling_entity *pollent) {
- call_data *calld = elem->call_data;
+ call_data *calld = (call_data *)elem->call_data;
calld->pollent = pollent;
}
@@ -356,7 +359,7 @@ static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
const grpc_call_final_info *final_info,
grpc_closure *ignored) {
- call_data *calld = elem->call_data;
+ call_data *calld = (call_data *)elem->call_data;
grpc_credentials_mdelem_array_destroy(exec_ctx, &calld->md_array);
grpc_call_credentials_unref(exec_ctx, calld->creds);
if (calld->have_host) {
@@ -386,7 +389,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
}
/* grab pointers to our data from the channel element */
- channel_data *chand = elem->channel_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
/* The first and the last filters tend to be implemented differently to
handle the case that there's no 'next' filter to call on the up or down
@@ -406,7 +409,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {
/* grab pointers to our data from the channel element */
- channel_data *chand = elem->channel_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
grpc_channel_security_connector *sc = chand->security_connector;
if (sc != NULL) {
GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &sc->base, "client_auth_filter");
diff --git a/src/core/lib/security/transport/lb_targets_info.c b/src/core/lib/security/transport/lb_targets_info.c
index 5583a4e0ff..947fc1addf 100644
--- a/src/core/lib/security/transport/lb_targets_info.c
+++ b/src/core/lib/security/transport/lb_targets_info.c
@@ -25,19 +25,22 @@
* secure naming purposes. */
#define GRPC_ARG_LB_SECURE_NAMING_MAP "grpc.lb_secure_naming_map"
-static void *targets_info_copy(void *p) { return grpc_slice_hash_table_ref(p); }
+static void *targets_info_copy(void *p) {
+ return grpc_slice_hash_table_ref((grpc_slice_hash_table *)p);
+}
static void targets_info_destroy(grpc_exec_ctx *exec_ctx, void *p) {
- grpc_slice_hash_table_unref(exec_ctx, p);
+ grpc_slice_hash_table_unref(exec_ctx, (grpc_slice_hash_table *)p);
}
static int targets_info_cmp(void *a, void *b) {
- return grpc_slice_hash_table_cmp(a, b);
+ return grpc_slice_hash_table_cmp((const grpc_slice_hash_table *)a,
+ (const grpc_slice_hash_table *)b);
}
static const grpc_arg_pointer_vtable server_to_balancer_names_vtable = {
targets_info_copy, targets_info_destroy, targets_info_cmp};
grpc_arg grpc_lb_targets_info_create_channel_arg(
grpc_slice_hash_table *targets_info) {
- return grpc_channel_arg_pointer_create(GRPC_ARG_LB_SECURE_NAMING_MAP,
+ return grpc_channel_arg_pointer_create((char *)GRPC_ARG_LB_SECURE_NAMING_MAP,
targets_info,
&server_to_balancer_names_vtable);
}
@@ -48,7 +51,7 @@ grpc_slice_hash_table *grpc_lb_targets_info_find_in_args(
grpc_channel_args_find(args, GRPC_ARG_LB_SECURE_NAMING_MAP);
if (targets_info_arg != NULL) {
GPR_ASSERT(targets_info_arg->type == GRPC_ARG_POINTER);
- return targets_info_arg->value.pointer.p;
+ return (grpc_slice_hash_table *)targets_info_arg->value.pointer.p;
}
return NULL;
}
diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c
index 8f60bf9e34..51844fb91f 100644
--- a/src/core/lib/security/transport/security_connector.c
+++ b/src/core/lib/security/transport/security_connector.c
@@ -200,11 +200,13 @@ void grpc_security_connector_unref(grpc_exec_ctx *exec_ctx,
}
static void connector_pointer_arg_destroy(grpc_exec_ctx *exec_ctx, void *p) {
- GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, p, "connector_pointer_arg_destroy");
+ GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, (grpc_security_connector *)p,
+ "connector_pointer_arg_destroy");
}
static void *connector_pointer_arg_copy(void *p) {
- return GRPC_SECURITY_CONNECTOR_REF(p, "connector_pointer_arg_copy");
+ return GRPC_SECURITY_CONNECTOR_REF((grpc_security_connector *)p,
+ "connector_pointer_arg_copy");
}
static int connector_pointer_cmp(void *a, void *b) { return GPR_ICMP(a, b); }
@@ -214,8 +216,8 @@ static const grpc_arg_pointer_vtable connector_pointer_vtable = {
connector_pointer_cmp};
grpc_arg grpc_security_connector_to_arg(grpc_security_connector *sc) {
- return grpc_channel_arg_pointer_create(GRPC_ARG_SECURITY_CONNECTOR, sc,
- &connector_pointer_vtable);
+ return grpc_channel_arg_pointer_create((char *)GRPC_ARG_SECURITY_CONNECTOR,
+ sc, &connector_pointer_vtable);
}
grpc_security_connector *grpc_security_connector_from_arg(const grpc_arg *arg) {
@@ -225,7 +227,7 @@ grpc_security_connector *grpc_security_connector_from_arg(const grpc_arg *arg) {
GRPC_ARG_SECURITY_CONNECTOR);
return NULL;
}
- return arg->value.pointer.p;
+ return (grpc_security_connector *)arg->value.pointer.p;
}
grpc_security_connector *grpc_security_connector_find_in_args(
@@ -424,7 +426,8 @@ static grpc_security_connector_vtable fake_server_vtable = {
grpc_channel_security_connector *grpc_fake_channel_security_connector_create(
grpc_call_credentials *request_metadata_creds, const char *target,
const grpc_channel_args *args) {
- grpc_fake_channel_security_connector *c = (grpc_fake_channel_security_connector*) gpr_zalloc(sizeof(*c));
+ grpc_fake_channel_security_connector *c =
+ (grpc_fake_channel_security_connector *)gpr_zalloc(sizeof(*c));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.url_scheme = GRPC_FAKE_SECURITY_URL_SCHEME;
c->base.base.vtable = &fake_channel_vtable;
@@ -443,7 +446,8 @@ grpc_channel_security_connector *grpc_fake_channel_security_connector_create(
grpc_server_security_connector *grpc_fake_server_security_connector_create(
void) {
grpc_server_security_connector *c =
- gpr_zalloc(sizeof(grpc_server_security_connector));
+ (grpc_server_security_connector *)gpr_zalloc(
+ sizeof(grpc_server_security_connector));
gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &fake_server_vtable;
c->base.url_scheme = GRPC_FAKE_SECURITY_URL_SCHEME;
@@ -658,7 +662,8 @@ tsi_peer tsi_shallow_peer_from_ssl_auth_context(
while (grpc_auth_property_iterator_next(&it) != NULL) max_num_props++;
if (max_num_props > 0) {
- peer.properties = (tsi_peer_property*) gpr_malloc(max_num_props * sizeof(tsi_peer_property));
+ peer.properties = (tsi_peer_property *)gpr_malloc(
+ max_num_props * sizeof(tsi_peer_property));
it = grpc_auth_context_property_iterator(auth_context);
while ((prop = grpc_auth_property_iterator_next(&it)) != NULL) {
if (strcmp(prop->name, GRPC_X509_SAN_PROPERTY_NAME) == 0) {
@@ -804,13 +809,13 @@ grpc_security_status grpc_ssl_channel_security_connector_create(
const char *overridden_target_name, grpc_channel_security_connector **sc) {
size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions();
const char **alpn_protocol_strings =
- gpr_malloc(sizeof(const char *) * num_alpn_protocols);
+ (const char **)gpr_malloc(sizeof(const char *) * num_alpn_protocols);
tsi_result result = TSI_OK;
grpc_ssl_channel_security_connector *c;
size_t i;
const char *pem_root_certs;
char *port;
-
+ bool has_key_cert_pair;
for (i = 0; i < num_alpn_protocols; i++) {
alpn_protocol_strings[i] = grpc_chttp2_get_alpn_version_index(i);
}
@@ -829,7 +834,8 @@ grpc_security_status grpc_ssl_channel_security_connector_create(
pem_root_certs = config->pem_root_certs;
}
- c = (grpc_ssl_channel_security_connector*) gpr_zalloc(sizeof(grpc_ssl_channel_security_connector));
+ c = (grpc_ssl_channel_security_connector *)gpr_zalloc(
+ sizeof(grpc_ssl_channel_security_connector));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.vtable = &ssl_channel_vtable;
@@ -845,8 +851,8 @@ grpc_security_status grpc_ssl_channel_security_connector_create(
c->overridden_target_name = gpr_strdup(overridden_target_name);
}
- bool has_key_cert_pair = config->pem_key_cert_pair.private_key != NULL &&
- config->pem_key_cert_pair.cert_chain != NULL;
+ has_key_cert_pair = config->pem_key_cert_pair.private_key != NULL &&
+ config->pem_key_cert_pair.cert_chain != NULL;
result = tsi_create_ssl_client_handshaker_factory(
has_key_cert_pair ? &config->pem_key_cert_pair : NULL, pem_root_certs,
ssl_cipher_suites(), alpn_protocol_strings, (uint16_t)num_alpn_protocols,
@@ -872,7 +878,7 @@ grpc_security_status grpc_ssl_server_security_connector_create(
grpc_server_security_connector **sc) {
size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions();
const char **alpn_protocol_strings =
- gpr_malloc(sizeof(const char *) * num_alpn_protocols);
+ (const char **)gpr_malloc(sizeof(const char *) * num_alpn_protocols);
tsi_result result = TSI_OK;
grpc_ssl_server_security_connector *c;
size_t i;
@@ -885,7 +891,8 @@ grpc_security_status grpc_ssl_server_security_connector_create(
gpr_log(GPR_ERROR, "An SSL server needs a key and a cert.");
goto error;
}
- c = (grpc_ssl_server_security_connector*) gpr_zalloc(sizeof(grpc_ssl_server_security_connector));
+ c = (grpc_ssl_server_security_connector *)gpr_zalloc(
+ sizeof(grpc_ssl_server_security_connector));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.url_scheme = GRPC_SSL_URL_SCHEME;
diff --git a/src/core/lib/security/transport/server_auth_filter.c b/src/core/lib/security/transport/server_auth_filter.c
index 7f523c0883..f5e02f42fe 100644
--- a/src/core/lib/security/transport/server_auth_filter.c
+++ b/src/core/lib/security/transport/server_auth_filter.c
@@ -63,8 +63,8 @@ static grpc_metadata_array metadata_batch_to_md_array(
grpc_slice value = GRPC_MDVALUE(md);
if (result.count == result.capacity) {
result.capacity = GPR_MAX(result.capacity + 8, result.capacity * 2);
- result.metadata =
- gpr_realloc(result.metadata, result.capacity * sizeof(grpc_metadata));
+ result.metadata = (grpc_metadata *)gpr_realloc(
+ result.metadata, result.capacity * sizeof(grpc_metadata));
}
usr_md = &result.metadata[result.count++];
usr_md->key = grpc_slice_ref_internal(key);
@@ -76,8 +76,8 @@ static grpc_metadata_array metadata_batch_to_md_array(
static grpc_filtered_mdelem remove_consumed_md(grpc_exec_ctx *exec_ctx,
void *user_data,
grpc_mdelem md) {
- grpc_call_element *elem = user_data;
- call_data *calld = elem->call_data;
+ grpc_call_element *elem = (grpc_call_element *)user_data;
+ call_data *calld = (call_data *)elem->call_data;
size_t i;
for (i = 0; i < calld->num_consumed_md; i++) {
const grpc_metadata *consumed_md = &calld->consumed_md[i];
@@ -95,7 +95,7 @@ static void on_md_processing_done_inner(grpc_exec_ctx *exec_ctx,
const grpc_metadata *response_md,
size_t num_response_md,
grpc_error *error) {
- call_data *calld = elem->call_data;
+ call_data *calld = (call_data *)elem->call_data;
grpc_transport_stream_op_batch *batch = calld->recv_initial_metadata_batch;
/* TODO(jboeuf): Implement support for response_md. */
if (response_md != NULL && num_response_md > 0) {
@@ -119,8 +119,8 @@ static void on_md_processing_done(
void *user_data, const grpc_metadata *consumed_md, size_t num_consumed_md,
const grpc_metadata *response_md, size_t num_response_md,
grpc_status_code status, const char *error_details) {
- grpc_call_element *elem = user_data;
- call_data *calld = elem->call_data;
+ grpc_call_element *elem = (grpc_call_element *)user_data;
+ call_data *calld = (call_data *)elem->call_data;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
// If the call was not cancelled while we were in flight, process the result.
if (gpr_atm_full_cas(&calld->state, (gpr_atm)STATE_INIT,
@@ -149,7 +149,7 @@ static void on_md_processing_done(
static void cancel_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
grpc_call_element *elem = (grpc_call_element *)arg;
- call_data *calld = elem->call_data;
+ call_data *calld = (call_data *)elem->call_data;
// If the result was not already processed, invoke the callback now.
if (error != GRPC_ERROR_NONE &&
gpr_atm_full_cas(&calld->state, (gpr_atm)STATE_INIT,
@@ -163,8 +163,8 @@ static void cancel_call(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
static void recv_initial_metadata_ready(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
grpc_call_element *elem = (grpc_call_element *)arg;
- channel_data *chand = elem->channel_data;
- call_data *calld = elem->call_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
+ call_data *calld = (call_data *)elem->call_data;
grpc_transport_stream_op_batch *batch = calld->recv_initial_metadata_batch;
if (error == GRPC_ERROR_NONE) {
if (chand->creds != NULL && chand->creds->processor.process != NULL) {
@@ -191,7 +191,7 @@ static void recv_initial_metadata_ready(grpc_exec_ctx *exec_ctx, void *arg,
static void auth_start_transport_stream_op_batch(
grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_transport_stream_op_batch *batch) {
- call_data *calld = elem->call_data;
+ call_data *calld = (call_data *)elem->call_data;
if (batch->recv_initial_metadata) {
// Inject our callback.
calld->recv_initial_metadata_batch = batch;
@@ -207,8 +207,8 @@ static void auth_start_transport_stream_op_batch(
static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
const grpc_call_element_args *args) {
- call_data *calld = elem->call_data;
- channel_data *chand = elem->channel_data;
+ call_data *calld = (call_data *)elem->call_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
calld->call_combiner = args->call_combiner;
calld->owning_call = args->call_stack;
GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready,
@@ -240,7 +240,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem,
grpc_channel_element_args *args) {
GPR_ASSERT(!args->is_last);
- channel_data *chand = elem->channel_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
grpc_auth_context *auth_context =
grpc_find_auth_context_in_args(args->channel_args);
GPR_ASSERT(auth_context != NULL);
@@ -255,7 +255,7 @@ static grpc_error *init_channel_elem(grpc_exec_ctx *exec_ctx,
/* Destructor for channel data */
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {
- channel_data *chand = elem->channel_data;
+ channel_data *chand = (channel_data *)elem->channel_data;
GRPC_AUTH_CONTEXT_UNREF(chand->auth_context, "server_auth_filter");
grpc_server_credentials_unref(exec_ctx, chand->creds);
}
diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c
index e85451ff24..94f17caed0 100644
--- a/src/core/tsi/fake_transport_security.c
+++ b/src/core/tsi/fake_transport_security.c
@@ -98,11 +98,11 @@ static const char *tsi_fake_handshake_message_to_string(int msg) {
static tsi_result tsi_fake_handshake_message_from_string(
const char *msg_string, tsi_fake_handshake_message *msg) {
- tsi_fake_handshake_message i;
+ int i;
for (i = 0; i < TSI_FAKE_HANDSHAKE_MESSAGE_MAX; i++) {
if (strncmp(msg_string, tsi_fake_handshake_message_strings[i],
strlen(tsi_fake_handshake_message_strings[i])) == 0) {
- *msg = i;
+ *msg = (tsi_fake_handshake_message) i;
return TSI_OK;
}
}
@@ -155,9 +155,10 @@ static void tsi_fake_frame_reset(tsi_fake_frame *frame, int needs_draining) {
static void tsi_fake_frame_ensure_size(tsi_fake_frame *frame) {
if (frame->data == NULL) {
frame->allocated_size = frame->size;
- frame->data = (unsigned char*) gpr_malloc(frame->allocated_size);
+ frame->data = (unsigned char *)gpr_malloc(frame->allocated_size);
} else if (frame->size > frame->allocated_size) {
- unsigned char *new_data = (unsigned char*) gpr_realloc(frame->data, frame->size);
+ unsigned char *new_data =
+ (unsigned char *)gpr_realloc(frame->data, frame->size);
frame->data = new_data;
frame->allocated_size = frame->size;
}
@@ -176,7 +177,7 @@ static tsi_result tsi_fake_frame_decode(const unsigned char *incoming_bytes,
if (frame->needs_draining) return TSI_INTERNAL_ERROR;
if (frame->data == NULL) {
frame->allocated_size = TSI_FAKE_FRAME_INITIAL_ALLOCATED_SIZE;
- frame->data = (unsigned char*) gpr_malloc(frame->allocated_size);
+ frame->data = (unsigned char *)gpr_malloc(frame->allocated_size);
}
if (frame->offset < TSI_FAKE_FRAME_HEADER_SIZE) {
@@ -538,10 +539,11 @@ static tsi_result fake_handshaker_result_create(
handshaker_result == NULL) {
return TSI_INVALID_ARGUMENT;
}
- fake_handshaker_result *result = (fake_handshaker_result*) gpr_zalloc(sizeof(*result));
+ fake_handshaker_result *result =
+ (fake_handshaker_result *)gpr_zalloc(sizeof(*result));
result->base.vtable = &handshaker_result_vtable;
if (unused_bytes_size > 0) {
- result->unused_bytes = (unsigned char*) gpr_malloc(unused_bytes_size);
+ result->unused_bytes = (unsigned char *)gpr_malloc(unused_bytes_size);
memcpy(result->unused_bytes, unused_bytes, unused_bytes_size);
}
result->unused_bytes_size = unused_bytes_size;
@@ -561,7 +563,7 @@ static tsi_result fake_handshaker_get_bytes_to_send_to_peer(
}
if (!impl->outgoing_frame.needs_draining) {
tsi_fake_handshake_message next_message_to_send =
- impl->next_message_to_send + 2;
+ (tsi_fake_handshake_message)(impl->next_message_to_send + 2);
const char *msg_string =
tsi_fake_handshake_message_to_string(impl->next_message_to_send);
result = tsi_fake_frame_set_data((unsigned char *)msg_string,
@@ -596,7 +598,8 @@ static tsi_result fake_handshaker_process_bytes_from_peer(
tsi_handshaker *self, const unsigned char *bytes, size_t *bytes_size) {
tsi_result result = TSI_OK;
tsi_fake_handshaker *impl = (tsi_fake_handshaker *)self;
- tsi_fake_handshake_message expected_msg = impl->next_message_to_send - 1;
+ tsi_fake_handshake_message expected_msg =
+ (tsi_fake_handshake_message)(impl->next_message_to_send - 1);
tsi_fake_handshake_message received_msg;
if (!impl->needs_incoming_message || impl->result == TSI_OK) {
@@ -681,8 +684,8 @@ static tsi_result fake_handshaker_next(
if (result == TSI_INCOMPLETE_DATA) {
handshaker->outgoing_bytes_buffer_size *= 2;
handshaker->outgoing_bytes_buffer =
- gpr_realloc(handshaker->outgoing_bytes_buffer,
- handshaker->outgoing_bytes_buffer_size);
+ (unsigned char *)gpr_realloc(handshaker->outgoing_bytes_buffer,
+ handshaker->outgoing_bytes_buffer_size);
}
} while (result == TSI_INCOMPLETE_DATA);
if (result != TSI_OK) return result;
@@ -723,13 +726,14 @@ static const tsi_handshaker_vtable handshaker_vtable = {
};
tsi_handshaker *tsi_create_fake_handshaker(int is_client) {
- tsi_fake_handshaker *impl = (tsi_fake_handshaker*) gpr_zalloc(sizeof(*impl));
+ tsi_fake_handshaker *impl = (tsi_fake_handshaker *)gpr_zalloc(sizeof(*impl));
impl->base.vtable = &handshaker_vtable;
impl->is_client = is_client;
impl->result = TSI_HANDSHAKE_IN_PROGRESS;
impl->outgoing_bytes_buffer_size =
TSI_FAKE_HANDSHAKER_OUTGOING_BUFFER_INITIAL_SIZE;
- impl->outgoing_bytes_buffer = (unsigned char*) gpr_malloc(impl->outgoing_bytes_buffer_size);
+ impl->outgoing_bytes_buffer =
+ (unsigned char *)gpr_malloc(impl->outgoing_bytes_buffer_size);
if (is_client) {
impl->needs_incoming_message = 0;
impl->next_message_to_send = TSI_FAKE_CLIENT_INIT;
@@ -742,7 +746,8 @@ tsi_handshaker *tsi_create_fake_handshaker(int is_client) {
tsi_frame_protector *tsi_create_fake_frame_protector(
size_t *max_protected_frame_size) {
- tsi_fake_frame_protector *impl = (tsi_fake_frame_protector*) gpr_zalloc(sizeof(*impl));
+ tsi_fake_frame_protector *impl =
+ (tsi_fake_frame_protector *)gpr_zalloc(sizeof(*impl));
impl->max_frame_size = (max_protected_frame_size == NULL)
? TSI_FAKE_DEFAULT_FRAME_SIZE
: *max_protected_frame_size;
@@ -752,7 +757,8 @@ tsi_frame_protector *tsi_create_fake_frame_protector(
tsi_zero_copy_grpc_protector *tsi_create_fake_zero_copy_grpc_protector(
size_t *max_protected_frame_size) {
- tsi_fake_zero_copy_grpc_protector *impl = (tsi_fake_zero_copy_grpc_protector*) gpr_zalloc(sizeof(*impl));
+ tsi_fake_zero_copy_grpc_protector *impl =
+ (tsi_fake_zero_copy_grpc_protector *)gpr_zalloc(sizeof(*impl));
grpc_slice_buffer_init(&impl->header_sb);
grpc_slice_buffer_init(&impl->protected_sb);
impl->max_frame_size = (max_protected_frame_size == NULL)
diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c
index 744825e7e0..dd59bccdae 100644
--- a/src/core/tsi/ssl_transport_security.c
+++ b/src/core/tsi/ssl_transport_security.c
@@ -135,7 +135,7 @@ static void init_openssl(void) {
OpenSSL_add_all_algorithms();
num_locks = CRYPTO_num_locks();
GPR_ASSERT(num_locks > 0);
- openssl_mutexes = (gpr_mu*) gpr_malloc((size_t)num_locks * sizeof(gpr_mu));
+ openssl_mutexes = (gpr_mu *)gpr_malloc((size_t)num_locks * sizeof(gpr_mu));
for (i = 0; i < CRYPTO_num_locks(); i++) {
gpr_mu_init(&openssl_mutexes[i]);
}
@@ -361,7 +361,7 @@ static tsi_result peer_from_x509(X509 *cert, int include_certificate_type,
tsi_peer *peer) {
/* TODO(jboeuf): Maybe add more properties. */
GENERAL_NAMES *subject_alt_names =
- X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0);
+ (GENERAL_NAMES *)X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0);
int subject_alt_name_count = (subject_alt_names != NULL)
? (int)sk_GENERAL_NAME_num(subject_alt_names)
: 0;
@@ -479,7 +479,7 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX *context,
if (pem == NULL) return TSI_OUT_OF_RESOURCES;
do {
- certificate = PEM_read_bio_X509_AUX(pem, NULL, NULL, "");
+ certificate = PEM_read_bio_X509_AUX(pem, NULL, NULL, (void *)"");
if (certificate == NULL) {
result = TSI_INVALID_ARGUMENT;
break;
@@ -489,7 +489,8 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX *context,
break;
}
while (1) {
- X509 *certificate_authority = PEM_read_bio_X509(pem, NULL, NULL, "");
+ X509 *certificate_authority =
+ PEM_read_bio_X509(pem, NULL, NULL, (void *)"");
if (certificate_authority == NULL) {
ERR_clear_error();
break; /* Done reading. */
@@ -520,7 +521,7 @@ static tsi_result ssl_ctx_use_private_key(SSL_CTX *context, const char *pem_key,
pem = BIO_new_mem_buf((void *)pem_key, (int)pem_key_size);
if (pem == NULL) return TSI_OUT_OF_RESOURCES;
do {
- private_key = PEM_read_bio_PrivateKey(pem, NULL, NULL, "");
+ private_key = PEM_read_bio_PrivateKey(pem, NULL, NULL, (void *)"");
if (private_key == NULL) {
result = TSI_INVALID_ARGUMENT;
break;
@@ -559,7 +560,7 @@ static tsi_result ssl_ctx_load_verification_certs(SSL_CTX *context,
}
while (1) {
- root = PEM_read_bio_X509_AUX(pem, NULL, NULL, "");
+ root = PEM_read_bio_X509_AUX(pem, NULL, NULL, (void *)"");
if (root == NULL) {
ERR_clear_error();
break; /* We're at the end of stream. */
@@ -655,7 +656,7 @@ static tsi_result extract_x509_subject_names_from_pem_cert(const char *pem_cert,
pem = BIO_new_mem_buf((void *)pem_cert, (int)strlen(pem_cert));
if (pem == NULL) return TSI_OUT_OF_RESOURCES;
- cert = PEM_read_bio_X509(pem, NULL, NULL, "");
+ cert = PEM_read_bio_X509(pem, NULL, NULL, (void *)"");
if (cert == NULL) {
gpr_log(GPR_ERROR, "Invalid certificate");
result = TSI_INVALID_ARGUMENT;
@@ -684,7 +685,7 @@ static tsi_result build_alpn_protocol_name_list(
}
*protocol_name_list_length += length + 1;
}
- *protocol_name_list = (unsigned char*) gpr_malloc(*protocol_name_list_length);
+ *protocol_name_list = (unsigned char *)gpr_malloc(*protocol_name_list_length);
if (*protocol_name_list == NULL) return TSI_OUT_OF_RESOURCES;
current = *protocol_name_list;
for (i = 0; i < num_alpn_protocols; i++) {
@@ -998,8 +999,8 @@ static tsi_result ssl_handshaker_extract_peer(tsi_handshaker *self,
}
if (alpn_selected != NULL) {
size_t i;
- tsi_peer_property *new_properties =
- gpr_zalloc(sizeof(*new_properties) * (peer->property_count + 1));
+ tsi_peer_property *new_properties = (tsi_peer_property *)gpr_zalloc(
+ sizeof(*new_properties) * (peer->property_count + 1));
for (i = 0; i < peer->property_count; i++) {
new_properties[i] = peer->properties[i];
}
@@ -1023,7 +1024,8 @@ static tsi_result ssl_handshaker_create_frame_protector(
size_t actual_max_output_protected_frame_size =
TSI_SSL_MAX_PROTECTED_FRAME_SIZE_UPPER_BOUND;
tsi_ssl_handshaker *impl = (tsi_ssl_handshaker *)self;
- tsi_ssl_frame_protector *protector_impl = (tsi_ssl_frame_protector*) gpr_zalloc(sizeof(*protector_impl));
+ tsi_ssl_frame_protector *protector_impl =
+ (tsi_ssl_frame_protector *)gpr_zalloc(sizeof(*protector_impl));
if (max_output_protected_frame_size != NULL) {
if (*max_output_protected_frame_size >
@@ -1039,7 +1041,8 @@ static tsi_result ssl_handshaker_create_frame_protector(
}
protector_impl->buffer_size =
actual_max_output_protected_frame_size - TSI_SSL_MAX_PROTECTION_OVERHEAD;
- protector_impl->buffer = (unsigned char*) gpr_malloc(protector_impl->buffer_size);
+ protector_impl->buffer =
+ (unsigned char *)gpr_malloc(protector_impl->buffer_size);
if (protector_impl->buffer == NULL) {
gpr_log(GPR_ERROR,
"Could not allocated buffer for tsi_ssl_frame_protector.");
@@ -1130,7 +1133,7 @@ static tsi_result create_tsi_ssl_handshaker(SSL_CTX *ctx, int is_client,
SSL_set_accept_state(ssl);
}
- impl = (tsi_ssl_handshaker*) gpr_zalloc(sizeof(*impl));
+ impl = (tsi_ssl_handshaker *)gpr_zalloc(sizeof(*impl));
impl->ssl = ssl;
impl->into_ssl = into_ssl;
impl->from_ssl = from_ssl;
@@ -1359,7 +1362,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
return TSI_INVALID_ARGUMENT;
}
- impl = (tsi_ssl_client_handshaker_factory*) gpr_zalloc(sizeof(*impl));
+ impl = (tsi_ssl_client_handshaker_factory *)gpr_zalloc(sizeof(*impl));
tsi_ssl_handshaker_factory_init(&impl->base);
impl->base.vtable = &client_handshaker_factory_vtable;
@@ -1444,13 +1447,14 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
return TSI_INVALID_ARGUMENT;
}
- impl = (tsi_ssl_server_handshaker_factory*) gpr_zalloc(sizeof(*impl));
+ impl = (tsi_ssl_server_handshaker_factory *)gpr_zalloc(sizeof(*impl));
tsi_ssl_handshaker_factory_init(&impl->base);
impl->base.vtable = &server_handshaker_factory_vtable;
- impl->ssl_contexts = (SSL_CTX**) gpr_zalloc(num_key_cert_pairs * sizeof(SSL_CTX *));
+ impl->ssl_contexts =
+ (SSL_CTX **)gpr_zalloc(num_key_cert_pairs * sizeof(SSL_CTX *));
impl->ssl_context_x509_subject_names =
- gpr_zalloc(num_key_cert_pairs * sizeof(tsi_peer));
+ (tsi_peer *)gpr_zalloc(num_key_cert_pairs * sizeof(tsi_peer));
if (impl->ssl_contexts == NULL ||
impl->ssl_context_x509_subject_names == NULL) {
tsi_ssl_handshaker_factory_unref(&impl->base);
diff --git a/src/core/tsi/transport_security.c b/src/core/tsi/transport_security.c
index 57d7be0978..21bd8eba78 100644
--- a/src/core/tsi/transport_security.c
+++ b/src/core/tsi/transport_security.c
@@ -282,7 +282,7 @@ tsi_result tsi_construct_allocated_string_peer_property(
*property = tsi_init_peer_property();
if (name != NULL) property->name = gpr_strdup(name);
if (value_length > 0) {
- property->value.data = (char*) gpr_zalloc(value_length);
+ property->value.data = (char *)gpr_zalloc(value_length);
property->value.length = value_length;
}
return TSI_OK;
@@ -310,7 +310,8 @@ tsi_result tsi_construct_string_peer_property(const char *name,
tsi_result tsi_construct_peer(size_t property_count, tsi_peer *peer) {
memset(peer, 0, sizeof(tsi_peer));
if (property_count > 0) {
- peer->properties = (tsi_peer_property*) gpr_zalloc(property_count * sizeof(tsi_peer_property));
+ peer->properties = (tsi_peer_property *)gpr_zalloc(
+ property_count * sizeof(tsi_peer_property));
peer->property_count = property_count;
}
return TSI_OK;
diff --git a/src/core/tsi/transport_security_adapter.c b/src/core/tsi/transport_security_adapter.c
index 12f339b7d0..e399e42758 100644
--- a/src/core/tsi/transport_security_adapter.c
+++ b/src/core/tsi/transport_security_adapter.c
@@ -80,12 +80,13 @@ static tsi_result tsi_adapter_create_handshaker_result(
if (wrapped == NULL || (unused_bytes_size > 0 && unused_bytes == NULL)) {
return TSI_INVALID_ARGUMENT;
}
- tsi_adapter_handshaker_result *impl = (tsi_adapter_handshaker_result*) gpr_zalloc(sizeof(*impl));
+ tsi_adapter_handshaker_result *impl =
+ (tsi_adapter_handshaker_result *)gpr_zalloc(sizeof(*impl));
impl->base.vtable = &result_vtable;
impl->wrapped = wrapped;
impl->unused_bytes_size = unused_bytes_size;
if (unused_bytes_size > 0) {
- impl->unused_bytes = (unsigned char*) gpr_malloc(unused_bytes_size);
+ impl->unused_bytes = (unsigned char *)gpr_malloc(unused_bytes_size);
memcpy(impl->unused_bytes, unused_bytes, unused_bytes_size);
} else {
impl->unused_bytes = NULL;
@@ -172,8 +173,8 @@ static tsi_result adapter_next(
offset += to_send_size;
if (status == TSI_INCOMPLETE_DATA) {
impl->adapter_buffer_size *= 2;
- impl->adapter_buffer =
- gpr_realloc(impl->adapter_buffer, impl->adapter_buffer_size);
+ impl->adapter_buffer = (unsigned char *)gpr_realloc(
+ impl->adapter_buffer, impl->adapter_buffer_size);
}
} while (status == TSI_INCOMPLETE_DATA);
if (status != TSI_OK) return status;
@@ -209,11 +210,12 @@ static const tsi_handshaker_vtable handshaker_vtable = {
tsi_handshaker *tsi_create_adapter_handshaker(tsi_handshaker *wrapped) {
GPR_ASSERT(wrapped != NULL);
- tsi_adapter_handshaker *impl = (tsi_adapter_handshaker*) gpr_zalloc(sizeof(*impl));
+ tsi_adapter_handshaker *impl =
+ (tsi_adapter_handshaker *)gpr_zalloc(sizeof(*impl));
impl->base.vtable = &handshaker_vtable;
impl->wrapped = wrapped;
impl->adapter_buffer_size = TSI_ADAPTER_INITIAL_BUFFER_SIZE;
- impl->adapter_buffer = (unsigned char*) gpr_malloc(impl->adapter_buffer_size);
+ impl->adapter_buffer = (unsigned char *)gpr_malloc(impl->adapter_buffer_size);
return &impl->base;
}