Use C99 for size_t loops. This was done just by grepping for 'size_t i;' and 'size_t j;'. I left everything in crypto/x509 and friends alone. There's some instances in gcm.c that are non-trivial and pulled into a separate CL for ease of review. Change-Id: I6515804e3097f7e90855f1e7610868ee87117223 Reviewed-on: https://boringssl-review.googlesource.com/10801 Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
diff --git a/crypto/modes/gcm_test.c b/crypto/modes/gcm_test.c index 19c295b..6f9d528 100644 --- a/crypto/modes/gcm_test.c +++ b/crypto/modes/gcm_test.c
@@ -257,9 +257,6 @@ static int decode_hex(uint8_t **out, size_t *out_len, const char *in, unsigned test_num, const char *description) { - uint8_t *buf = NULL; - size_t i; - if (in == NULL) { *out = NULL; *out_len = 0; @@ -269,16 +266,16 @@ size_t len = strlen(in); if (len & 1) { fprintf(stderr, "%u: Odd-length %s input.\n", test_num, description); - goto err; + return 0; } - buf = OPENSSL_malloc(len / 2); + uint8_t *buf = OPENSSL_malloc(len / 2); if (buf == NULL) { fprintf(stderr, "%u: malloc failure.\n", test_num); goto err; } - for (i = 0; i < len; i += 2) { + for (size_t i = 0; i < len; i += 2) { uint8_t v, v2; if (!from_hex(&v, in[i]) || !from_hex(&v2, in[i+1])) {