From 3121fd4d757991e7ef95a7b6b370b83c23ba61b6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Sep 2015 09:56:20 -0700 Subject: Sign conversion fixes --- Makefile | 2 +- src/core/channel/channel_args.c | 8 ++-- src/core/channel/channel_stack.c | 2 +- src/core/channel/compress_filter.c | 3 +- src/core/client_config/connector.h | 2 +- src/core/client_config/resolvers/dns_resolver.c | 2 +- .../client_config/resolvers/sockaddr_resolver.c | 15 ++++--- src/core/client_config/uri_parser.c | 34 ++++++++------- src/core/debug/trace.c | 10 +++-- src/core/httpcli/parser.c | 8 ++-- src/core/iomgr/alarm.c | 2 +- src/core/iomgr/alarm_heap.c | 20 ++++----- src/core/iomgr/alarm_heap.h | 4 +- src/core/iomgr/pollset_posix.c | 2 +- src/core/iomgr/resolve_address.h | 2 +- src/core/iomgr/tcp_client.h | 2 +- src/core/iomgr/tcp_client_posix.c | 2 +- src/core/security/base64.c | 10 +++-- src/core/security/jwt_verifier.c | 4 +- src/core/surface/secure_channel_create.c | 2 +- src/core/tsi/fake_transport_security.c | 9 ++-- src/core/tsi/ssl_transport_security.c | 51 +++++++++++++--------- templates/Makefile.template | 2 +- test/core/end2end/tests/bad_hostname.c | 2 +- test/core/end2end/tests/cancel_after_accept.c | 4 +- .../tests/cancel_after_accept_and_writes_closed.c | 4 +- test/core/end2end/tests/cancel_after_invoke.c | 2 +- test/core/end2end/tests/cancel_before_invoke.c | 4 +- test/core/end2end/tests/census_simple_request.c | 4 +- test/core/end2end/tests/default_host.c | 4 +- test/core/end2end/tests/disappearing_server.c | 4 +- ...early_server_shutdown_finishes_inflight_calls.c | 4 +- test/core/end2end/tests/graceful_server_shutdown.c | 4 +- test/core/end2end/tests/invoke_large_request.c | 6 +-- test/core/end2end/tests/max_concurrent_streams.c | 16 +++---- test/core/end2end/tests/max_message_length.c | 4 +- test/core/end2end/tests/ping_pong_streaming.c | 14 +++--- test/core/end2end/tests/registered_call.c | 4 +- ...est_response_with_binary_metadata_and_payload.c | 6 +-- .../request_response_with_metadata_and_payload.c | 6 +-- .../end2end/tests/request_response_with_payload.c | 6 +-- .../request_response_with_payload_and_call_creds.c | 8 ++-- ...t_response_with_trailing_metadata_and_payload.c | 6 +-- .../tests/request_with_compressed_payload.c | 6 +-- test/core/end2end/tests/request_with_flags.c | 2 +- .../end2end/tests/request_with_large_metadata.c | 8 ++-- test/core/end2end/tests/request_with_payload.c | 6 +-- test/core/end2end/tests/server_finishes_request.c | 4 +- test/core/end2end/tests/simple_delayed_request.c | 4 +- test/core/end2end/tests/simple_request.c | 4 +- ...ple_request_with_high_initial_sequence_number.c | 4 +- test/core/util/parse_hexstring.c | 2 +- test/core/util/reconnect_server.c | 3 +- test/core/util/test_config.c | 4 +- 54 files changed, 193 insertions(+), 164 deletions(-) diff --git a/Makefile b/Makefile index f902cfcfb7..b8a4af2fe6 100644 --- a/Makefile +++ b/Makefile @@ -251,7 +251,7 @@ CXXFLAGS += -std=c++11 else CXXFLAGS += -std=c++0x endif -CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter +CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -Wsign-conversion LDFLAGS += -g CPPFLAGS += $(CPPFLAGS_$(CONFIG)) diff --git a/src/core/channel/channel_args.c b/src/core/channel/channel_args.c index 54ee75af28..31ce3a83fd 100644 --- a/src/core/channel/channel_args.c +++ b/src/core/channel/channel_args.c @@ -177,9 +177,9 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( if (states_arg_found) { if (state != 0) { - GPR_BITSET(states_arg, algorithm); + GPR_BITSET((unsigned *)states_arg, algorithm); } else { - GPR_BITCLEAR(states_arg, algorithm); + GPR_BITCLEAR((unsigned *)states_arg, algorithm); } } else { /* create a new arg */ @@ -189,9 +189,9 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( /* all enabled by default */ tmp.value.integer = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; if (state != 0) { - GPR_BITSET(&tmp.value.integer, algorithm); + GPR_BITSET((unsigned *)&tmp.value.integer, algorithm); } else { - GPR_BITCLEAR(&tmp.value.integer, algorithm); + GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm); } result = grpc_channel_args_copy_and_add(*a, &tmp, 1); grpc_channel_args_destroy(*a); diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c index cd7c182ef2..4eb5df5de3 100644 --- a/src/core/channel/channel_stack.c +++ b/src/core/channel/channel_stack.c @@ -57,7 +57,7 @@ int grpc_trace_channel = 0; /* Given a size, round up to the next multiple of sizeof(void*) */ #define ROUND_UP_TO_ALIGNMENT_SIZE(x) \ - (((x) + GPR_MAX_ALIGNMENT - 1) & ~(GPR_MAX_ALIGNMENT - 1)) + (((x) + GPR_MAX_ALIGNMENT - 1u) & ~(GPR_MAX_ALIGNMENT - 1u)) size_t grpc_channel_stack_size(const grpc_channel_filter **filters, size_t filter_count) { diff --git a/src/core/channel/compress_filter.c b/src/core/channel/compress_filter.c index 762a4edc73..0b85c7b4fa 100644 --- a/src/core/channel/compress_filter.c +++ b/src/core/channel/compress_filter.c @@ -48,7 +48,8 @@ typedef struct call_data { gpr_slice_buffer slices; /**< Buffers up input slices to be compressed */ grpc_linked_mdelem compression_algorithm_storage; grpc_linked_mdelem accept_encoding_storage; - int remaining_slice_bytes; /**< Input data to be read, as per BEGIN_MESSAGE */ + gpr_uint32 + remaining_slice_bytes; /**< Input data to be read, as per BEGIN_MESSAGE */ int written_initial_metadata; /**< Already processed initial md? */ /** Compression algorithm we'll try to use. It may be given by incoming * metadata, or by the channel's default compression settings. */ diff --git a/src/core/client_config/connector.h b/src/core/client_config/connector.h index edcb10a36e..39f3467990 100644 --- a/src/core/client_config/connector.h +++ b/src/core/client_config/connector.h @@ -50,7 +50,7 @@ typedef struct { grpc_pollset_set *interested_parties; /** address to connect to */ const struct sockaddr *addr; - int addr_len; + size_t addr_len; /** deadline for connection */ gpr_timespec deadline; /** channel arguments (to be passed to transport) */ diff --git a/src/core/client_config/resolvers/dns_resolver.c b/src/core/client_config/resolvers/dns_resolver.c index 84643c464a..5124c4476a 100644 --- a/src/core/client_config/resolvers/dns_resolver.c +++ b/src/core/client_config/resolvers/dns_resolver.c @@ -140,7 +140,7 @@ static void dns_on_resolved(void *arg, grpc_resolved_addresses *addresses) { for (i = 0; i < addresses->naddrs; i++) { memset(&args, 0, sizeof(args)); args.addr = (struct sockaddr *)(addresses->addrs[i].addr); - args.addr_len = addresses->addrs[i].len; + args.addr_len = (size_t)addresses->addrs[i].len; subchannels[i] = grpc_subchannel_factory_create_subchannel( r->subchannel_factory, &args); } diff --git a/src/core/client_config/resolvers/sockaddr_resolver.c b/src/core/client_config/resolvers/sockaddr_resolver.c index 0d8540a566..4a3c14545a 100644 --- a/src/core/client_config/resolvers/sockaddr_resolver.c +++ b/src/core/client_config/resolvers/sockaddr_resolver.c @@ -63,7 +63,7 @@ typedef struct { /** the addresses that we've 'resolved' */ struct sockaddr_storage *addrs; /** the corresponding length of the addresses */ - int *addrs_len; + size_t *addrs_len; /** how many elements in \a addrs */ size_t num_addrs; @@ -157,7 +157,8 @@ static void sockaddr_destroy(grpc_resolver *gr) { } #ifdef GPR_POSIX_SOCKET -static int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, int *len) { +static int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, + size_t *len) { struct sockaddr_un *un = (struct sockaddr_un *)addr; un->sun_family = AF_UNIX; @@ -189,7 +190,8 @@ static char *ipv6_get_default_authority(grpc_resolver_factory *factory, return ip_get_default_authority(uri); } -static int parse_ipv4(grpc_uri *uri, struct sockaddr_storage *addr, int *len) { +static int parse_ipv4(grpc_uri *uri, struct sockaddr_storage *addr, + size_t *len) { const char *host_port = uri->path; char *host; char *port; @@ -229,7 +231,8 @@ done: return result; } -static int parse_ipv6(grpc_uri *uri, struct sockaddr_storage *addr, int *len) { +static int parse_ipv6(grpc_uri *uri, struct sockaddr_storage *addr, + size_t *len) { const char *host_port = uri->path; char *host; char *port; @@ -275,7 +278,7 @@ static grpc_resolver *sockaddr_create( grpc_lb_policy *(*lb_policy_factory)(grpc_subchannel **subchannels, size_t num_subchannels), grpc_subchannel_factory *subchannel_factory, - int parse(grpc_uri *uri, struct sockaddr_storage *dst, int *len)) { + int parse(grpc_uri *uri, struct sockaddr_storage *dst, size_t *len)) { size_t i; int errors_found = 0; /* GPR_FALSE */ sockaddr_resolver *r; @@ -296,7 +299,7 @@ static grpc_resolver *sockaddr_create( gpr_slice_split(path_slice, ",", &path_parts); r->num_addrs = path_parts.count; r->addrs = gpr_malloc(sizeof(struct sockaddr_storage) * r->num_addrs); - r->addrs_len = gpr_malloc(sizeof(int) * r->num_addrs); + r->addrs_len = gpr_malloc(sizeof(*r->addrs_len) * r->num_addrs); for(i = 0; i < r->num_addrs; i++) { grpc_uri ith_uri = *uri; diff --git a/src/core/client_config/uri_parser.c b/src/core/client_config/uri_parser.c index 410a61c8cf..5c2aa46e53 100644 --- a/src/core/client_config/uri_parser.c +++ b/src/core/client_config/uri_parser.c @@ -39,10 +39,10 @@ #include #include -static grpc_uri *bad_uri(const char *uri_text, int pos, const char *section, +static grpc_uri *bad_uri(const char *uri_text, size_t pos, const char *section, int suppress_errors) { char *line_prefix; - int pfx_len; + size_t pfx_len; if (!suppress_errors) { gpr_asprintf(&line_prefix, "bad uri.%s: '", section); @@ -60,8 +60,10 @@ static grpc_uri *bad_uri(const char *uri_text, int pos, const char *section, return NULL; } -static char *copy_fragment(const char *src, int begin, int end) { - char *out = gpr_malloc(end - begin + 1); +static char *copy_fragment(const char *src, size_t begin, size_t end) { + char *out; + GPR_ASSERT(end >= begin); + out = gpr_malloc(end - begin + 1); memcpy(out, src + begin, end - begin); out[end - begin] = 0; return out; @@ -69,13 +71,14 @@ static char *copy_fragment(const char *src, int begin, int end) { grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors) { grpc_uri *uri; - int scheme_begin = 0; - int scheme_end = -1; - int authority_begin = -1; - int authority_end = -1; - int path_begin = -1; - int path_end = -1; - int i; + size_t scheme_begin = 0; +#define NOT_SET (~(size_t)0) + size_t scheme_end = NOT_SET; + size_t authority_begin = NOT_SET; + size_t authority_end = NOT_SET; + size_t path_begin = NOT_SET; + size_t path_end = NOT_SET; + size_t i; for (i = scheme_begin; uri_text[i] != 0; i++) { if (uri_text[i] == ':') { @@ -92,13 +95,14 @@ grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors) { } break; } - if (scheme_end == -1) { + if (scheme_end == NOT_SET) { return bad_uri(uri_text, i, "scheme", suppress_errors); } if (uri_text[scheme_end + 1] == '/' && uri_text[scheme_end + 2] == '/') { authority_begin = scheme_end + 3; - for (i = authority_begin; uri_text[i] != 0 && authority_end == -1; i++) { + for (i = authority_begin; uri_text[i] != 0 && authority_end == NOT_SET; + i++) { if (uri_text[i] == '/') { authority_end = i; } @@ -109,10 +113,10 @@ grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors) { return bad_uri(uri_text, i, "fragment_not_supported", suppress_errors); } } - if (authority_end == -1 && uri_text[i] == 0) { + if (authority_end == NOT_SET && uri_text[i] == 0) { authority_end = i; } - if (authority_end == -1) { + if (authority_end == NOT_SET) { return bad_uri(uri_text, i, "authority", suppress_errors); } /* TODO(ctiller): parse the authority correctly */ diff --git a/src/core/debug/trace.c b/src/core/debug/trace.c index 1014b1f4db..3b35d81cd8 100644 --- a/src/core/debug/trace.c +++ b/src/core/debug/trace.c @@ -59,9 +59,13 @@ void grpc_register_tracer(const char *name, int *flag) { static void add(const char *beg, const char *end, char ***ss, size_t *ns) { size_t n = *ns; size_t np = n + 1; - char *s = gpr_malloc(end - beg + 1); - memcpy(s, beg, end - beg); - s[end - beg] = 0; + char *s; + size_t len; + GPR_ASSERT(end >= beg); + len = (size_t)(end - beg); + s = gpr_malloc(len + 1); + memcpy(s, beg, len); + s[len] = 0; *ss = gpr_realloc(*ss, sizeof(char **) * np); (*ss)[n] = s; *ns = np; diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c index 7b2a62060c..404906d5ae 100644 --- a/src/core/httpcli/parser.c +++ b/src/core/httpcli/parser.c @@ -96,13 +96,15 @@ static int add_header(grpc_httpcli_parser *parser) { gpr_log(GPR_ERROR, "Didn't find ':' in header string"); goto error; } - hdr.key = buf2str(beg, cur - beg); + GPR_ASSERT(cur >= beg); + hdr.key = buf2str(beg, (size_t)(cur - beg)); cur++; /* skip : */ while (cur != end && (*cur == ' ' || *cur == '\t')) { cur++; } - hdr.value = buf2str(cur, end - cur - 2); + GPR_ASSERT(end - cur >= 2); + hdr.value = buf2str(cur, (size_t)(end - cur) - 2); if (parser->r.hdr_count == parser->hdr_capacity) { parser->hdr_capacity = @@ -171,7 +173,7 @@ static int addbyte(grpc_httpcli_parser *parser, gpr_uint8 byte) { parser->r.body = gpr_realloc((void *)parser->r.body, parser->body_capacity); } - ((char *)parser->r.body)[parser->r.body_length] = byte; + parser->r.body[parser->r.body_length] = (char)byte; parser->r.body_length++; return 1; } diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c index ddb30dc4bb..e31793475f 100644 --- a/src/core/iomgr/alarm.c +++ b/src/core/iomgr/alarm.c @@ -83,7 +83,7 @@ static gpr_timespec compute_min_deadline(shard_type *shard) { } void grpc_alarm_list_init(gpr_timespec now) { - int i; + gpr_uint32 i; gpr_mu_init(&g_mu); gpr_mu_init(&g_checker_mu); diff --git a/src/core/iomgr/alarm_heap.c b/src/core/iomgr/alarm_heap.c index daed251982..7bafdffcef 100644 --- a/src/core/iomgr/alarm_heap.c +++ b/src/core/iomgr/alarm_heap.c @@ -43,9 +43,9 @@ position. This functor is called each time immediately after modifying a value in the underlying container, with the offset of the modified element as its argument. */ -static void adjust_upwards(grpc_alarm **first, int i, grpc_alarm *t) { +static void adjust_upwards(grpc_alarm **first, gpr_uint32 i, grpc_alarm *t) { while (i > 0) { - int parent = (i - 1) / 2; + gpr_uint32 parent = (i - 1u) / 2u; if (gpr_time_cmp(first[parent]->deadline, t->deadline) >= 0) break; first[i] = first[parent]; first[i]->heap_index = i; @@ -58,12 +58,12 @@ static void adjust_upwards(grpc_alarm **first, int i, grpc_alarm *t) { /* Adjusts a heap so as to move a hole at position i farther away from the root, until a suitable position is found for element t. Then, copies t into that position. */ -static void adjust_downwards(grpc_alarm **first, int i, int length, - grpc_alarm *t) { +static void adjust_downwards(grpc_alarm **first, gpr_uint32 i, + gpr_uint32 length, grpc_alarm *t) { for (;;) { - int left_child = 1 + 2 * i; - int right_child; - int next_i; + gpr_uint32 left_child = 1u + 2u * i; + gpr_uint32 right_child; + gpr_uint32 next_i; if (left_child >= length) break; right_child = left_child + 1; next_i = right_child < length && @@ -93,8 +93,8 @@ static void maybe_shrink(grpc_alarm_heap *heap) { } static void note_changed_priority(grpc_alarm_heap *heap, grpc_alarm *alarm) { - int i = alarm->heap_index; - int parent = (i - 1) / 2; + gpr_uint32 i = alarm->heap_index; + gpr_uint32 parent = (i - 1u) / 2u; if (gpr_time_cmp(heap->alarms[parent]->deadline, alarm->deadline) < 0) { adjust_upwards(heap->alarms, i, alarm); } else { @@ -122,7 +122,7 @@ int grpc_alarm_heap_add(grpc_alarm_heap *heap, grpc_alarm *alarm) { } void grpc_alarm_heap_remove(grpc_alarm_heap *heap, grpc_alarm *alarm) { - int i = alarm->heap_index; + gpr_uint32 i = alarm->heap_index; if (i == heap->alarm_count - 1) { heap->alarm_count--; maybe_shrink(heap); diff --git a/src/core/iomgr/alarm_heap.h b/src/core/iomgr/alarm_heap.h index 60db6c991b..91d6ee3ca2 100644 --- a/src/core/iomgr/alarm_heap.h +++ b/src/core/iomgr/alarm_heap.h @@ -38,8 +38,8 @@ typedef struct { grpc_alarm **alarms; - int alarm_count; - int alarm_capacity; + gpr_uint32 alarm_count; + gpr_uint32 alarm_capacity; } grpc_alarm_heap; /* return 1 if the new alarm is the first alarm in the heap */ diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index 6bd1b61f24..93aa3ad662 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -420,7 +420,7 @@ static void basic_pollset_maybe_work(grpc_pollset *pollset, grpc_fd_watcher fd_watcher; int timeout; int r; - int nfds; + nfds_t nfds; if (pollset->in_flight_cbs) { /* Give do_promote priority so we don't starve it out */ diff --git a/src/core/iomgr/resolve_address.h b/src/core/iomgr/resolve_address.h index cc1bd428b0..9f361cb892 100644 --- a/src/core/iomgr/resolve_address.h +++ b/src/core/iomgr/resolve_address.h @@ -40,7 +40,7 @@ typedef struct { char addr[GRPC_MAX_SOCKADDR_SIZE]; - int len; + size_t len; } grpc_resolved_address; typedef struct { diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h index 8ad9b818e1..12296bd55b 100644 --- a/src/core/iomgr/tcp_client.h +++ b/src/core/iomgr/tcp_client.h @@ -46,7 +46,7 @@ in this connection being established (in order to continue their work) */ void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *tcp), void *arg, grpc_pollset_set *interested_parties, - const struct sockaddr *addr, int addr_len, + const struct sockaddr *addr, size_t addr_len, gpr_timespec deadline); #endif /* GRPC_INTERNAL_CORE_IOMGR_TCP_CLIENT_H */ diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c index 66027f87a0..7ca0a60c31 100644 --- a/src/core/iomgr/tcp_client_posix.c +++ b/src/core/iomgr/tcp_client_posix.c @@ -195,7 +195,7 @@ finish: void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *ep), void *arg, grpc_pollset_set *interested_parties, - const struct sockaddr *addr, int addr_len, + const struct sockaddr *addr, size_t addr_len, gpr_timespec deadline) { int fd; grpc_dualstack_mode dsmode; diff --git a/src/core/security/base64.c b/src/core/security/base64.c index 8dfaef846f..5226d2c578 100644 --- a/src/core/security/base64.c +++ b/src/core/security/base64.c @@ -125,13 +125,14 @@ gpr_slice grpc_base64_decode(const char *b64, int url_safe) { static void decode_one_char(const unsigned char *codes, unsigned char *result, size_t *result_offset) { - gpr_uint32 packed = (codes[0] << 2) | (codes[1] >> 4); + gpr_uint32 packed = ((gpr_uint32)codes[0] << 2) | ((gpr_uint32)codes[1] >> 4); result[(*result_offset)++] = (unsigned char)packed; } static void decode_two_chars(const unsigned char *codes, unsigned char *result, size_t *result_offset) { - gpr_uint32 packed = (codes[0] << 10) | (codes[1] << 4) | (codes[2] >> 2); + gpr_uint32 packed = ((gpr_uint32)codes[0] << 10) | + ((gpr_uint32)codes[1] << 4) | ((gpr_uint32)codes[2] >> 2); result[(*result_offset)++] = (unsigned char)(packed >> 8); result[(*result_offset)++] = (unsigned char)(packed); } @@ -171,8 +172,9 @@ static int decode_group(const unsigned char *codes, size_t num_codes, decode_two_chars(codes, result, result_offset); } else { /* No padding. */ - gpr_uint32 packed = - (codes[0] << 18) | (codes[1] << 12) | (codes[2] << 6) | codes[3]; + gpr_uint32 packed = ((gpr_uint32)codes[0] << 18) | + ((gpr_uint32)codes[1] << 12) | + ((gpr_uint32)codes[2] << 6) | codes[3]; result[(*result_offset)++] = (unsigned char)(packed >> 16); result[(*result_offset)++] = (unsigned char)(packed >> 8); result[(*result_offset)++] = (unsigned char)(packed); diff --git a/src/core/security/jwt_verifier.c b/src/core/security/jwt_verifier.c index 38ad134a6a..03f8c3783e 100644 --- a/src/core/security/jwt_verifier.c +++ b/src/core/security/jwt_verifier.c @@ -769,7 +769,7 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier *verifier, GPR_ASSERT(verifier != NULL && jwt != NULL && audience != NULL && cb != NULL); dot = strchr(cur, '.'); if (dot == NULL) goto error; - json = parse_json_part_from_jwt(cur, dot - cur, &header_buffer); + json = parse_json_part_from_jwt(cur, (size_t)(dot - cur), &header_buffer); if (json == NULL) goto error; header = jose_header_from_json(json, header_buffer); if (header == NULL) goto error; @@ -777,7 +777,7 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier *verifier, cur = dot + 1; dot = strchr(cur, '.'); if (dot == NULL) goto error; - json = parse_json_part_from_jwt(cur, dot - cur, &claims_buffer); + json = parse_json_part_from_jwt(cur, (size_t)(dot - cur), &claims_buffer); if (json == NULL) goto error; claims = grpc_jwt_claims_from_json(json, claims_buffer); if (claims == NULL) goto error; diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c index eccee24698..c68ba0e44b 100644 --- a/src/core/surface/secure_channel_create.c +++ b/src/core/surface/secure_channel_create.c @@ -196,7 +196,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, subchannel_factory *f; #define MAX_FILTERS 3 const grpc_channel_filter *filters[MAX_FILTERS]; - int n = 0; + size_t n = 0; if (grpc_find_security_connector_in_args(args) != NULL) { gpr_log(GPR_ERROR, "Cannot set security context in channel args."); diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c index 29127c4269..a813c30221 100644 --- a/src/core/tsi/fake_transport_security.c +++ b/src/core/tsi/fake_transport_security.c @@ -171,7 +171,7 @@ static tsi_result fill_frame_from_bytes(const unsigned char* incoming_bytes, memcpy(frame->data + frame->offset, bytes_cursor, available_size); bytes_cursor += available_size; frame->offset += available_size; - *incoming_bytes_size = bytes_cursor - incoming_bytes; + *incoming_bytes_size = (size_t)(bytes_cursor - incoming_bytes); return TSI_INCOMPLETE_DATA; } memcpy(frame->data + frame->offset, bytes_cursor, to_read_size); @@ -187,12 +187,12 @@ static tsi_result fill_frame_from_bytes(const unsigned char* incoming_bytes, memcpy(frame->data + frame->offset, bytes_cursor, available_size); frame->offset += available_size; bytes_cursor += available_size; - *incoming_bytes_size = bytes_cursor - incoming_bytes; + *incoming_bytes_size = (size_t)(bytes_cursor - incoming_bytes); return TSI_INCOMPLETE_DATA; } memcpy(frame->data + frame->offset, bytes_cursor, to_read_size); bytes_cursor += to_read_size; - *incoming_bytes_size = bytes_cursor - incoming_bytes; + *incoming_bytes_size = (size_t)(bytes_cursor - incoming_bytes); tsi_fake_frame_reset(frame, 1 /* needs_draining */); return TSI_OK; } @@ -384,7 +384,8 @@ static tsi_result fake_handshaker_get_bytes_to_send_to_peer( return TSI_OK; } if (!impl->outgoing.needs_draining) { - int next_message_to_send = impl->next_message_to_send + 2; + tsi_fake_handshake_message next_message_to_send = + impl->next_message_to_send + 2; const char* msg_string = tsi_fake_handshake_message_to_string(impl->next_message_to_send); result = bytes_to_frame((unsigned char*)msg_string, strlen(msg_string), diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index 0b416f6c9d..6add492865 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -131,10 +131,13 @@ static unsigned long openssl_thread_id_cb(void) { static void init_openssl(void) { int i; + int num_locks; SSL_library_init(); SSL_load_error_strings(); OpenSSL_add_all_algorithms(); - openssl_mutexes = malloc(CRYPTO_num_locks() * sizeof(gpr_mu)); + num_locks = CRYPTO_num_locks(); + GPR_ASSERT(num_locks > 0); + openssl_mutexes = malloc((size_t)num_locks * sizeof(gpr_mu)); GPR_ASSERT(openssl_mutexes != NULL); for (i = 0; i < CRYPTO_num_locks(); i++) { gpr_mu_init(&openssl_mutexes[i]); @@ -249,7 +252,7 @@ static tsi_result ssl_get_x509_common_name(X509* cert, unsigned char** utf8, gpr_log(GPR_ERROR, "Could not extract utf8 from asn1 string."); return TSI_OUT_OF_RESOURCES; } - *utf8_size = utf8_returned_size; + *utf8_size = (size_t)utf8_returned_size; return TSI_OK; } @@ -279,8 +282,8 @@ static tsi_result peer_property_from_x509_common_name( /* Gets the subject SANs from an X509 cert as a tsi_peer_property. */ static tsi_result add_subject_alt_names_properties_to_peer( tsi_peer* peer, GENERAL_NAMES* subject_alt_names, - int subject_alt_name_count) { - int i; + size_t subject_alt_name_count) { + size_t i; tsi_result result = TSI_OK; /* Reset for DNS entries filtering. */ @@ -301,7 +304,7 @@ static tsi_result add_subject_alt_names_properties_to_peer( } result = tsi_construct_string_peer_property( TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, - (const char*)dns_name, dns_name_size, + (const char*)dns_name, (size_t)dns_name_size, &peer->properties[peer->property_count++]); OPENSSL_free(dns_name); if (result != TSI_OK) break; @@ -318,9 +321,12 @@ static tsi_result peer_from_x509(X509* cert, int include_certificate_type, X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0); int subject_alt_name_count = (subject_alt_names != NULL) ? sk_GENERAL_NAME_num(subject_alt_names) : 0; - size_t property_count = (include_certificate_type ? 1 : 0) + - 1 /* common name */ + subject_alt_name_count; - tsi_result result = tsi_construct_peer(property_count, peer); + size_t property_count; + tsi_result result; + GPR_ASSERT(subject_alt_name_count >= 0); + property_count = (include_certificate_type ? (size_t)1 : 0) + + 1 /* common name */ + (size_t)subject_alt_name_count; + result = tsi_construct_peer(property_count, peer); if (result != TSI_OK) return result; do { if (include_certificate_type) { @@ -334,8 +340,8 @@ static tsi_result peer_from_x509(X509* cert, int include_certificate_type, if (result != TSI_OK) break; if (subject_alt_name_count != 0) { - result = add_subject_alt_names_properties_to_peer(peer, subject_alt_names, - subject_alt_name_count); + result = add_subject_alt_names_properties_to_peer( + peer, subject_alt_names, (size_t)subject_alt_name_count); if (result != TSI_OK) break; } } while (0); @@ -387,7 +393,7 @@ static tsi_result do_ssl_read(SSL* ssl, unsigned char* unprotected_bytes, return TSI_PROTOCOL_FAILURE; } } - *unprotected_bytes_size = read_from_ssl; + *unprotected_bytes_size = (size_t)read_from_ssl; return TSI_OK; } @@ -616,7 +622,7 @@ static tsi_result build_alpn_protocol_name_list( gpr_log(GPR_ERROR, "Invalid 0-length protocol name."); return TSI_INVALID_ARGUMENT; } - *protocol_name_list_length += alpn_protocols_lengths[i] + 1; + *protocol_name_list_length += (size_t)alpn_protocols_lengths[i] + 1; } *protocol_name_list = malloc(*protocol_name_list_length); if (*protocol_name_list == NULL) return TSI_OUT_OF_RESOURCES; @@ -648,7 +654,7 @@ static tsi_result ssl_protector_protect(tsi_frame_protector* self, tsi_result result = TSI_OK; /* First see if we have some pending data in the SSL BIO. */ - size_t pending_in_ssl = BIO_pending(impl->from_ssl); + int pending_in_ssl = BIO_pending(impl->from_ssl); if (pending_in_ssl > 0) { *unprotected_bytes_size = 0; read_from_ssl = BIO_read(impl->from_ssl, protected_output_frames, @@ -658,7 +664,7 @@ static tsi_result ssl_protector_protect(tsi_frame_protector* self, "Could not read from BIO even though some data is pending"); return TSI_INTERNAL_ERROR; } - *protected_output_frames_size = read_from_ssl; + *protected_output_frames_size = (size_t)read_from_ssl; return TSI_OK; } @@ -684,7 +690,7 @@ static tsi_result ssl_protector_protect(tsi_frame_protector* self, gpr_log(GPR_ERROR, "Could not read from BIO after SSL_write."); return TSI_INTERNAL_ERROR; } - *protected_output_frames_size = read_from_ssl; + *protected_output_frames_size = (size_t)read_from_ssl; *unprotected_bytes_size = available; impl->buffer_offset = 0; return TSI_OK; @@ -696,6 +702,7 @@ static tsi_result ssl_protector_protect_flush( tsi_result result = TSI_OK; tsi_ssl_frame_protector* impl = (tsi_ssl_frame_protector*)self; int read_from_ssl = 0; + int pending; if (impl->buffer_offset != 0) { result = do_ssl_write(impl->ssl, impl->buffer, impl->buffer_offset); @@ -703,7 +710,9 @@ static tsi_result ssl_protector_protect_flush( impl->buffer_offset = 0; } - *still_pending_size = BIO_pending(impl->from_ssl); + pending = BIO_pending(impl->from_ssl); + GPR_ASSERT(pending >= 0); + *still_pending_size = (size_t)pending; if (*still_pending_size == 0) return TSI_OK; read_from_ssl = BIO_read(impl->from_ssl, protected_output_frames, @@ -712,8 +721,10 @@ static tsi_result ssl_protector_protect_flush( gpr_log(GPR_ERROR, "Could not read from BIO after SSL_write."); return TSI_INTERNAL_ERROR; } - *protected_output_frames_size = read_from_ssl; - *still_pending_size = BIO_pending(impl->from_ssl); + *protected_output_frames_size = (size_t)read_from_ssl; + pending = BIO_pending(impl->from_ssl); + GPR_ASSERT(pending >= 0); + *still_pending_size = (size_t)pending; return TSI_OK; } @@ -747,7 +758,7 @@ static tsi_result ssl_protector_unprotect( written_into_ssl); return TSI_INTERNAL_ERROR; } - *protected_frames_bytes_size = written_into_ssl; + *protected_frames_bytes_size = (size_t)written_into_ssl; /* Now try to read some data again. */ result = do_ssl_read(impl->ssl, unprotected_bytes, unprotected_bytes_size); @@ -817,7 +828,7 @@ static tsi_result ssl_handshaker_process_bytes_from_peer( impl->result = TSI_INTERNAL_ERROR; return impl->result; } - *bytes_size = bytes_written_into_ssl_size; + *bytes_size = (size_t)bytes_written_into_ssl_size; if (!tsi_handshaker_is_in_progress(self)) { impl->result = TSI_OK; diff --git a/templates/Makefile.template b/templates/Makefile.template index 797f0ab57f..5be4eedfee 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -265,7 +265,7 @@ CXXFLAGS += -std=c++11 else CXXFLAGS += -std=c++0x endif -CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter +CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -Wsign-conversion LDFLAGS += -g CPPFLAGS += $(CPPFLAGS_$(CONFIG)) diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index 8f28fa1e63..93e2df1e43 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -146,7 +146,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 313e0b05bd..10e62275ab 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -165,7 +165,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = grpc_server_request_call(f.server, &s, &call_details, @@ -195,7 +195,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), NULL); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c index 2430a6d218..4fed5be5f7 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c @@ -169,7 +169,7 @@ static void test_cancel_after_accept_and_writes_closed( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = grpc_server_request_call(f.server, &s, &call_details, @@ -199,7 +199,7 @@ static void test_cancel_after_accept_and_writes_closed( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(3), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), NULL); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 9991ee02f0..40595e4c7b 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -101,7 +101,7 @@ static void end_test(grpc_end2end_test_fixture *f) { /* Cancel after invoke, no payload */ static void test_cancel_after_invoke(grpc_end2end_test_config config, - cancellation_mode mode, int test_ops) { + cancellation_mode mode, size_t test_ops) { grpc_op ops[6]; grpc_op *op; grpc_call *c; diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 8b582e0c42..c049e0c2d6 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -99,7 +99,7 @@ static void end_test(grpc_end2end_test_fixture *f) { /* Cancel before invoke */ static void test_cancel_before_invoke(grpc_end2end_test_config config, - int test_ops) { + size_t test_ops) { grpc_op ops[6]; grpc_op *op; grpc_call *c; @@ -189,7 +189,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, } void grpc_end2end_tests(grpc_end2end_test_config config) { - int i; + size_t i; for (i = 1; i <= 6; i++) { test_cancel_before_invoke(config, i); } diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index 36b9e92884..adf855ca60 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -145,7 +145,7 @@ static void test_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -173,7 +173,7 @@ static void test_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c index 57f65b834b..7b62505a9a 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.c @@ -154,7 +154,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(error == GRPC_CALL_OK); error = @@ -191,7 +191,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(error == GRPC_CALL_OK); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 09762705e3..de3ea16f66 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -131,7 +131,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -163,7 +163,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_fixture *f, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c index 233bc9bee2..ad7def09a9 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c @@ -139,7 +139,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -155,7 +155,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); /* shutdown and destroy the server */ diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index d4e7a1ac6d..df420a9846 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -146,7 +146,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -178,7 +178,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 7677084511..f79d146da1 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -171,7 +171,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -192,7 +192,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -216,7 +216,7 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 0ba620b851..87eb4dd451 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -147,7 +147,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -175,7 +175,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -280,7 +280,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c1, ops, op - ops, tag(301), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), NULL); GPR_ASSERT(GRPC_CALL_OK == error); op = ops; @@ -297,7 +297,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c1, ops, op - ops, tag(302), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), NULL); GPR_ASSERT(GRPC_CALL_OK == error); op = ops; @@ -310,7 +310,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c2, ops, op - ops, tag(401), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), NULL); GPR_ASSERT(GRPC_CALL_OK == error); op = ops; @@ -327,7 +327,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c2, ops, op - ops, tag(402), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), NULL); GPR_ASSERT(GRPC_CALL_OK == error); got_client_start = 0; @@ -372,7 +372,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s1, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s1, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -406,7 +406,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s2, ops, op - ops, tag(202), NULL); + error = grpc_call_start_batch(s2, ops, (size_t)(op - ops), tag(202), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(live_call + 2), 1); diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index 2b9560716f..782b9d0f26 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -167,7 +167,7 @@ static void test_max_message_length(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -183,7 +183,7 @@ static void test_max_message_length(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 43abda4d7f..39682d8bc5 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -154,7 +154,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -175,7 +175,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(101), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); GPR_ASSERT(GRPC_CALL_OK == error); for (i = 0; i < messages; i++) { @@ -193,7 +193,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); GPR_ASSERT(GRPC_CALL_OK == error); op = ops; @@ -202,7 +202,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); cq_verify(cqv); @@ -213,7 +213,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); cq_expect_completion(cqv, tag(2), 1); @@ -233,7 +233,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); GPR_ASSERT(GRPC_CALL_OK == error); op = ops; @@ -244,7 +244,7 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index eddce6ded4..b3156e0248 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -148,7 +148,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -176,7 +176,7 @@ static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index 2345f94044..21e0bbcc49 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -191,7 +191,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -213,7 +213,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -237,7 +237,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index a4cc27896c..d0604cc6b6 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -175,7 +175,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -197,7 +197,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -221,7 +221,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index ff00ae6d9d..0b303268fc 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -164,7 +164,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -185,7 +185,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -209,7 +209,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/request_response_with_payload_and_call_creds.c b/test/core/end2end/tests/request_response_with_payload_and_call_creds.c index d862274fe3..08bba06f40 100644 --- a/test/core/end2end/tests/request_response_with_payload_and_call_creds.c +++ b/test/core/end2end/tests/request_response_with_payload_and_call_creds.c @@ -247,7 +247,7 @@ static void request_response_with_payload_and_call_creds( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -280,7 +280,7 @@ static void request_response_with_payload_and_call_creds( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -304,7 +304,7 @@ static void request_response_with_payload_and_call_creds( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); @@ -464,7 +464,7 @@ static void test_request_with_server_rejecting_client_creds( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(error == GRPC_CALL_OK); cq_expect_completion(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 8b764751f6..c040b9fac1 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -178,7 +178,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -200,7 +200,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -225,7 +225,7 @@ static void test_request_response_with_metadata_and_payload( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/request_with_compressed_payload.c b/test/core/end2end/tests/request_with_compressed_payload.c index 299943c548..c50eaba8b2 100644 --- a/test/core/end2end/tests/request_with_compressed_payload.c +++ b/test/core/end2end/tests/request_with_compressed_payload.c @@ -186,7 +186,7 @@ static void request_with_payload_template( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -215,7 +215,7 @@ static void request_with_payload_template( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -234,7 +234,7 @@ static void request_with_payload_template( op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index eb2e5dc7e8..b9cdf5168c 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -160,7 +160,7 @@ static void test_invoke_request_with_flags( op->reserved = NULL; op++; expectation = call_start_batch_expected_result; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(expectation == error); if (expectation == GRPC_CALL_OK) { diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index 98e47aaf98..87529639a7 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -121,7 +121,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { char *details = NULL; size_t details_capacity = 0; int was_cancelled = 2; - const int large_size = 64 * 1024; + const size_t large_size = 64 * 1024; c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo", "foo.test.google.fr", deadline, NULL); @@ -167,7 +167,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -188,7 +188,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -207,7 +207,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 149dbaeb00..a323b43ab0 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -158,7 +158,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -178,7 +178,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); @@ -197,7 +197,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index 8bacc6c730..bdc18a5e38 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -145,7 +145,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -173,7 +173,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 9133aacc35..14e0ac8f66 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -140,7 +140,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); config.init_server(f, server_args); @@ -170,7 +170,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 0f62d958ae..a874640837 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -155,7 +155,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -192,7 +192,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c b/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c index 0067bb4bef..44d6a60c10 100644 --- a/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c +++ b/test/core/end2end/tests/simple_request_with_high_initial_sequence_number.c @@ -149,7 +149,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(c, ops, op - ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -177,7 +177,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op->flags = 0; op->reserved = NULL; op++; - error = grpc_call_start_batch(s, ops, op - ops, tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); GPR_ASSERT(GRPC_CALL_OK == error); cq_expect_completion(cqv, tag(102), 1); diff --git a/test/core/util/parse_hexstring.c b/test/core/util/parse_hexstring.c index bf5bc84b48..0bac8fef32 100644 --- a/test/core/util/parse_hexstring.c +++ b/test/core/util/parse_hexstring.c @@ -35,7 +35,7 @@ #include gpr_slice parse_hexstring(const char *hexstring) { - int nibbles = 0; + size_t nibbles = 0; const char *p = 0; gpr_uint8 *out; gpr_uint8 temp; diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c index a06cb50b3a..35d84d0f3d 100644 --- a/test/core/util/reconnect_server.c +++ b/test/core/util/reconnect_server.c @@ -81,7 +81,8 @@ static void on_connect(void *arg, grpc_endpoint *tcp) { } else { if (last_colon == NULL) { gpr_log(GPR_ERROR, "peer does not contain a ':'"); - } else if (strncmp(server->peer, peer, last_colon - peer) != 0) { + } else if (strncmp(server->peer, peer, (size_t)(last_colon - peer)) != + 0) { gpr_log(GPR_ERROR, "mismatched peer! %s vs %s", server->peer, peer); } gpr_free(peer); diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index 685bdff530..f5d5cdb57c 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -42,12 +42,12 @@ double g_fixture_slowdown_factor = 1.0; #if GPR_GETPID_IN_UNISTD_H #include -static int seed(void) { return getpid(); } +static unsigned seed(void) { return (unsigned)getpid(); } #endif #if GPR_GETPID_IN_PROCESS_H #include -static int seed(void) { return _getpid(); } +static unsigned seed(void) { return _getpid(); } #endif #if GPR_WINDOWS_CRASH_HANDLER -- cgit v1.2.3