diff options
author | Andy Polyakov <appro@openssl.org> | 2015-09-30 10:15:03 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2015-10-05 09:22:54 +0200 |
commit | b13fdc4860b5e1bf615b113950788a138e68ae7f (patch) | |
tree | 231723cef2d8432fa559e011d5c7eed93a2482c5 /crypto/bio/bss_acpt.c | |
parent | f93ad22f6adb00e722c130e792799467f3927b56 (diff) |
Explicitly cast INVALID_SOCKET to (int) to address warnings on Windows.
Even though SOCKET is effectively declared as (void *) on Windows, it's
not actually a pointer, but an index within per-process table of
kernel objects. The table size is actually limited and its upper limit
is far below upper limit for signed 32-bit integer. This is what makes
cast in question possible.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/bio/bss_acpt.c')
-rw-r--r-- | crypto/bio/bss_acpt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index eba6e25714..c549c87c3c 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -123,7 +123,7 @@ static int acpt_new(BIO *bi) BIO_ACCEPT *ba; bi->init = 0; - bi->num = INVALID_SOCKET; + bi->num = (int)INVALID_SOCKET; bi->flags = 0; if ((ba = BIO_ACCEPT_new()) == NULL) return (0); @@ -139,7 +139,7 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void) if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) return (NULL); - ret->accept_sock = INVALID_SOCKET; + ret->accept_sock = (int)INVALID_SOCKET; ret->bind_mode = BIO_BIND_NORMAL; return (ret); } @@ -160,11 +160,11 @@ static void acpt_close_socket(BIO *bio) BIO_ACCEPT *c; c = (BIO_ACCEPT *)bio->ptr; - if (c->accept_sock != INVALID_SOCKET) { + if (c->accept_sock != (int)INVALID_SOCKET) { shutdown(c->accept_sock, 2); closesocket(c->accept_sock); - c->accept_sock = INVALID_SOCKET; - bio->num = INVALID_SOCKET; + c->accept_sock = (int)INVALID_SOCKET; + bio->num = (int)INVALID_SOCKET; } } @@ -200,7 +200,7 @@ static int acpt_state(BIO *b, BIO_ACCEPT *c) return (-1); } s = BIO_get_accept_socket(c->param_addr, c->bind_mode); - if (s == INVALID_SOCKET) + if (s == (int)INVALID_SOCKET) return (-1); if (c->accept_nbio) { |