From f4bd5de54459cc5f873807c7ed1f1b04b6e8d7e3 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 5 Oct 2015 15:23:37 +0200 Subject: [PATCH] Address more Windows warnings illuminated by mingw. Reviewed-by: Rich Salz --- include/openssl/e_os2.h | 8 ++++++-- ssl/record/rec_layer_s3.c | 16 ++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h index 6ef1f396d6..23602a5266 100644 --- a/include/openssl/e_os2.h +++ b/include/openssl/e_os2.h @@ -262,8 +262,12 @@ extern "C" { # define OPENSSL_GLOBAL_REF(name) _shadow_##name # endif -# ifdef OPENSSL_SYS_MSDOS -# define ossl_ssize_t long +# ifdef _WIN32 +# ifdef _WIN64 +# define ossl_ssize_t __int64 +# else +# define ossl_ssize_t int +# endif # endif # if defined(__ultrix) && !defined(ssize_t) diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c index 6beb8ce35c..f5dd27aa7c 100644 --- a/ssl/record/rec_layer_s3.c +++ b/ssl/record/rec_layer_s3.c @@ -293,7 +293,7 @@ int ssl3_read_n(SSL *s, int n, int max, int extend) * s->packet_length bytes if extend == 1].) */ int i, len, left; - long align = 0; + size_t align = 0; unsigned char *pkt; SSL3_BUFFER *rb; @@ -307,8 +307,8 @@ int ssl3_read_n(SSL *s, int n, int max, int extend) left = rb->left; #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 - align = (long)rb->buf + SSL3_RT_HEADER_LENGTH; - align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); + align = (size_t)rb->buf + SSL3_RT_HEADER_LENGTH; + align = (0-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif if (!extend) { @@ -673,7 +673,7 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf, int i, mac_size, clear = 0; int prefix_len = 0; int eivlen; - long align = 0; + size_t align = 0; SSL3_RECORD *wr; SSL3_BUFFER *wb = &s->rlayer.wbuf; SSL_SESSION *sess; @@ -753,8 +753,8 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf, * multiple of SSL3_ALIGN_PAYLOAD, so if we want to align the real * payload, then we can just pretent we simply have two headers. */ - align = (long)SSL3_BUFFER_get_buf(wb) + 2 * SSL3_RT_HEADER_LENGTH; - align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); + align = (size_t)SSL3_BUFFER_get_buf(wb) + 2 * SSL3_RT_HEADER_LENGTH; + align = (0-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif p = SSL3_BUFFER_get_buf(wb) + align; SSL3_BUFFER_set_offset(wb, align); @@ -762,8 +762,8 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf, p = SSL3_BUFFER_get_buf(wb) + SSL3_BUFFER_get_offset(wb) + prefix_len; } else { #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0 - align = (long)SSL3_BUFFER_get_buf(wb) + SSL3_RT_HEADER_LENGTH; - align = (-align) & (SSL3_ALIGN_PAYLOAD - 1); + align = (size_t)SSL3_BUFFER_get_buf(wb) + SSL3_RT_HEADER_LENGTH; + align = (0-align) & (SSL3_ALIGN_PAYLOAD - 1); #endif p = SSL3_BUFFER_get_buf(wb) + align; SSL3_BUFFER_set_offset(wb, align);