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_conn.c | |
parent | Free up ASN.1 structures at top level only. (diff) | |
download | openssl-b13fdc4860b5e1bf615b113950788a138e68ae7f.tar.xz openssl-b13fdc4860b5e1bf615b113950788a138e68ae7f.zip |
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_conn.c')
-rw-r--r-- | crypto/bio/bss_conn.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 0733a29675..49b0f69c1a 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -189,7 +189,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) c->state = BIO_CONN_S_CREATE_SOCKET; ret = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (ret == INVALID_SOCKET) { + if (ret == (int)INVALID_SOCKET) { SYSerr(SYS_F_SOCKET, get_last_socket_error()); ERR_add_error_data(4, "host=", c->param_hostname, ":", c->param_port); @@ -313,7 +313,7 @@ BIO_METHOD *BIO_s_connect(void) static int conn_new(BIO *bi) { bi->init = 0; - bi->num = INVALID_SOCKET; + bi->num = (int)INVALID_SOCKET; bi->flags = 0; if ((bi->ptr = (char *)BIO_CONNECT_new()) == NULL) return (0); @@ -326,12 +326,12 @@ static void conn_close_socket(BIO *bio) BIO_CONNECT *c; c = (BIO_CONNECT *)bio->ptr; - if (bio->num != INVALID_SOCKET) { + if (bio->num != (int)INVALID_SOCKET) { /* Only do a shutdown if things were established */ if (c->state == BIO_CONN_S_OK) shutdown(bio->num, 2); closesocket(bio->num); - bio->num = INVALID_SOCKET; + bio->num = (int)INVALID_SOCKET; } } |