diff --git a/source/arch/intel/encoding_avx2.c b/source/arch/intel/encoding_avx2.c index 439d6ddad..92c4abdfa 100644 --- a/source/arch/intel/encoding_avx2.c +++ b/source/arch/intel/encoding_avx2.c @@ -194,13 +194,13 @@ static inline bool decode(const unsigned char *in, unsigned char *out) { size_t aws_common_private_base64_decode_sse41(const unsigned char *in, unsigned char *out, size_t len) { if (len % 4) { - return (size_t)-1; + return SIZE_MAX; } size_t outlen = 0; while (len > 32) { if (!decode(in, out)) { - return (size_t)-1; + return SIZE_MAX; } len -= 32; in += 32; @@ -230,13 +230,13 @@ size_t aws_common_private_base64_decode_sse41(const unsigned char *in, unsigned } if (!decode(tmp_in, tmp_out)) { - return (size_t)-1; + return SIZE_MAX; } /* Check that there are no trailing ones bits */ for (size_t i = final_out; i < sizeof(tmp_out); i++) { if (tmp_out[i]) { - return (size_t)-1; + return SIZE_MAX; } } diff --git a/source/encoding.c b/source/encoding.c index bc860aa4b..97b99145d 100644 --- a/source/encoding.c +++ b/source/encoding.c @@ -23,7 +23,7 @@ static inline size_t aws_common_private_base64_decode_sse41(const unsigned char (void)out; (void)len; AWS_ASSERT(false); - return (size_t)-1; /* unreachable */ + return SIZE_MAX; /* unreachable */ } static inline void aws_common_private_base64_encode_sse41(const unsigned char *in, unsigned char *out, size_t len) { (void)in; @@ -361,7 +361,7 @@ int aws_base64_decode(const struct aws_byte_cursor *AWS_RESTRICT to_decode, stru if (aws_common_private_has_avx2()) { size_t result = aws_common_private_base64_decode_sse41(to_decode->ptr, output->buffer, to_decode->len); - if (result == -1) { + if (result == SIZE_MAX) { return aws_raise_error(AWS_ERROR_INVALID_BASE64_STR); } diff --git a/tests/atomics_test.c b/tests/atomics_test.c index f1cf15848..16590a794 100644 --- a/tests/atomics_test.c +++ b/tests/atomics_test.c @@ -272,7 +272,7 @@ static int run_races( int *participant_indexes = alloca(n_participants_local * sizeof(*participant_indexes)); struct aws_thread *threads = alloca(n_participants_local * sizeof(struct aws_thread)); - *last_race = (size_t)-1; + *last_race = SIZE_MAX; n_participants = n_participants_local; done_racing = false; aws_atomic_init_int(&last_race_index, 0); @@ -293,7 +293,7 @@ static int run_races( *last_race = n_races; } else { *last_race = (size_t)aws_atomic_load_int_explicit(&last_race_index, aws_memory_order_relaxed); - if (*last_race == (size_t)-1) { + if (*last_race == SIZE_MAX) { /* We didn't even see the first race complete */ *last_race = 0; }