More pointer conversion required after making build changes

reviewable/pr12692/r4
Yash Tibrewal 8 years ago
parent 9c15cb9329
commit 71f217c503
  1. 2
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
  2. 10
      src/core/ext/transport/cronet/transport/cronet_transport.c
  3. 6
      src/core/lib/http/httpcli_security_connector.c
  4. 4
      src/core/lib/security/context/security_context.c
  5. 8
      src/core/lib/security/credentials/composite/composite_credentials.c
  6. 2
      src/core/lib/security/credentials/credentials_metadata.c
  7. 4
      src/core/lib/security/credentials/fake/fake_credentials.c
  8. 2
      src/core/lib/security/credentials/google_default/google_default_credentials.c
  9. 2
      src/core/lib/security/credentials/iam/iam_credentials.c
  10. 4
      src/core/lib/security/credentials/jwt/json_token.c
  11. 2
      src/core/lib/security/credentials/jwt/jwt_credentials.c
  12. 10
      src/core/lib/security/credentials/jwt/jwt_verifier.c
  13. 4
      src/core/lib/security/credentials/oauth2/oauth2_credentials.c
  14. 2
      src/core/lib/security/credentials/plugin/plugin_credentials.c
  15. 2
      src/core/lib/security/credentials/ssl/ssl_credentials.c
  16. 8
      src/core/lib/security/transport/security_connector.c
  17. 18
      src/core/tsi/fake_transport_security.c
  18. 16
      src/core/tsi/ssl_transport_security.c
  19. 4
      src/core/tsi/transport_security.c
  20. 8
      src/core/tsi/transport_security_adapter.c

@ -127,7 +127,7 @@ 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 = 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;

@ -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 = 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,7 @@ 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 = 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 +685,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 = 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 */
@ -1452,13 +1452,13 @@ 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 = 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 = gpr_malloc(strlen(target) + 1);
ct->host = (char*) gpr_malloc(strlen(target) + 1);
if (!ct->host) {
goto error;
}

@ -106,7 +106,7 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
return GRPC_SECURITY_ERROR;
}
c = 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 +137,7 @@ typedef struct {
static void on_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
grpc_handshaker_args *args = arg;
grpc_handshaker_args *args = (grpc_handshaker_args*) arg;
on_done_closure *c = args->user_data;
if (error != GRPC_ERROR_NONE) {
const char *msg = grpc_error_string(error);
@ -159,7 +159,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 = 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.");

@ -117,7 +117,7 @@ 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 = 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");
@ -275,7 +275,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 = 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;

@ -79,7 +79,7 @@ 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 = 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 +146,7 @@ grpc_call_credentials *grpc_composite_call_credentials_create(
GPR_ASSERT(reserved == NULL);
GPR_ASSERT(creds1 != NULL);
GPR_ASSERT(creds2 != NULL);
c = 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 +154,7 @@ 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 = 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 +248,7 @@ 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 = 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, "

@ -33,7 +33,7 @@ static void mdelem_list_ensure_capacity(grpc_credentials_mdelem_array *list,
while (new_size < target_size) {
new_size *= 2;
}
list->md = 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,

@ -60,7 +60,7 @@ static grpc_server_credentials_vtable
grpc_channel_credentials *grpc_fake_transport_security_credentials_create(
void) {
grpc_channel_credentials *c = 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 +69,7 @@ grpc_channel_credentials *grpc_fake_transport_security_credentials_create(
grpc_server_credentials *grpc_fake_transport_security_server_credentials_create(
void) {
grpc_server_credentials *c = 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);

@ -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 = 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;

@ -64,7 +64,7 @@ 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 = 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);

@ -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 = 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 = 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;

@ -125,7 +125,7 @@ grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
gpr_log(GPR_ERROR, "Invalid input for jwt credentials creation");
return NULL;
}
c = 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;

@ -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 = 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,7 @@ 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 = 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 +347,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 = 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;
@ -901,12 +901,12 @@ 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 = 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 = 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. */

@ -130,7 +130,7 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
}
if (response->body_length > 0) {
null_terminated_body = 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);
}
@ -447,7 +447,7 @@ grpc_refresh_token_credentials_create_from_auth_refresh_token(
gpr_log(GPR_ERROR, "Invalid input for refresh token credentials creation");
return NULL;
}
c = 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;

@ -258,7 +258,7 @@ 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 = 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);

@ -94,7 +94,7 @@ 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 = 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, "

@ -424,7 +424,7 @@ 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 = 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;
@ -658,7 +658,7 @@ 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 = 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) {
@ -829,7 +829,7 @@ grpc_security_status grpc_ssl_channel_security_connector_create(
pem_root_certs = config->pem_root_certs;
}
c = 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;
@ -885,7 +885,7 @@ 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 = 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;

@ -155,9 +155,9 @@ 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 = 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 = 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 +176,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 = gpr_malloc(frame->allocated_size);
frame->data = (unsigned char*) gpr_malloc(frame->allocated_size);
}
if (frame->offset < TSI_FAKE_FRAME_HEADER_SIZE) {
@ -538,10 +538,10 @@ static tsi_result fake_handshaker_result_create(
handshaker_result == NULL) {
return TSI_INVALID_ARGUMENT;
}
fake_handshaker_result *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 = 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;
@ -723,13 +723,13 @@ static const tsi_handshaker_vtable handshaker_vtable = {
};
tsi_handshaker *tsi_create_fake_handshaker(int is_client) {
tsi_fake_handshaker *impl = 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 = 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 +742,7 @@ 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 = 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 +752,7 @@ 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 = 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)

@ -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_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]);
}
@ -684,7 +684,7 @@ static tsi_result build_alpn_protocol_name_list(
}
*protocol_name_list_length += length + 1;
}
*protocol_name_list = 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++) {
@ -1023,7 +1023,7 @@ 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 = 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 +1039,7 @@ 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 = 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 +1130,7 @@ static tsi_result create_tsi_ssl_handshaker(SSL_CTX *ctx, int is_client,
SSL_set_accept_state(ssl);
}
impl = 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 +1359,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
return TSI_INVALID_ARGUMENT;
}
impl = 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,11 +1444,11 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
return TSI_INVALID_ARGUMENT;
}
impl = 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 = 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));
if (impl->ssl_contexts == NULL ||

@ -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 = gpr_zalloc(value_length);
property->value.data = (char*) gpr_zalloc(value_length);
property->value.length = value_length;
}
return TSI_OK;
@ -310,7 +310,7 @@ 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 = 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;

@ -80,12 +80,12 @@ 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 = 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 = 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;
@ -209,11 +209,11 @@ static const tsi_handshaker_vtable handshaker_vtable = {
tsi_handshaker *tsi_create_adapter_handshaker(tsi_handshaker *wrapped) {
GPR_ASSERT(wrapped != NULL);
tsi_adapter_handshaker *impl = 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 = gpr_malloc(impl->adapter_buffer_size);
impl->adapter_buffer = (unsigned char*) gpr_malloc(impl->adapter_buffer_size);
return &impl->base;
}

Loading…
Cancel
Save