Shush warning in alignment code. MSVC doesn't like unary - on unsigned numbers. Also switch ssl3_read_n's version to uintptr_t to match the write half. This gets us closer to clearing through C4311 violations. (The remaining one is in asn1_add_error which can go after verifying that most of asn1_mac.h is safe to drop.) Change-Id: Idb33dda8863bf1a3408b14d5513a667338311b6b Reviewed-on: https://boringssl-review.googlesource.com/4255 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c index 436e830..80eb7bd 100644 --- a/ssl/s3_pkt.c +++ b/ssl/s3_pkt.c
@@ -133,7 +133,7 @@ * bytes may be stored in |rbuf| (plus |s->packet_length| bytes if |extend| * is one.) */ int i, len, left; - long align = 0; + uintptr_t align = 0; uint8_t *pkt; SSL3_BUFFER *rb; @@ -148,8 +148,8 @@ left = rb->left; - align = (long)rb->buf + SSL3_RT_HEADER_LENGTH; - align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); + align = (uintptr_t)rb->buf + SSL3_RT_HEADER_LENGTH; + align = (0 - align) & (SSL3_ALIGN_PAYLOAD - 1); if (!extend) { /* start with empty packet ... */ @@ -604,7 +604,7 @@ } else { align = (uintptr_t)wb->buf + SSL3_RT_HEADER_LENGTH; } - align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); + align = (0 - align) & (SSL3_ALIGN_PAYLOAD - 1); uint8_t *out = wb->buf + align; wb->offset = align; size_t max_out = wb->len - wb->offset;