summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2017-11-11 22:23:12 +0100
committerAndy Polyakov <appro@openssl.org>2017-11-13 10:58:57 +0100
commit3a63c0edab842af3e84ef1cad2b4eb701eece3e1 (patch)
treec45bf7fb2f69874b2779b33e5597a59bbc92e648 /crypto/bio
parent802127e8fc07cbef499b645e7e1ae48ce3ed981c (diff)
Resolve warnings in VC-WIN32 build, which allows to add /WX.
It's argued that /WX allows to keep better focus on new code, which motivates its comeback... Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4721)
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/b_addr.c2
-rw-r--r--crypto/bio/b_print.c2
-rw-r--r--crypto/bio/b_sock2.c23
3 files changed, 17 insertions, 10 deletions
diff --git a/crypto/bio/b_addr.c b/crypto/bio/b_addr.c
index 47e4fc20fb..d6d70a1ae9 100644
--- a/crypto/bio/b_addr.c
+++ b/crypto/bio/b_addr.c
@@ -821,7 +821,7 @@ int BIO_lookup_ex(const char *host, const char *service, int lookup_type,
if (endp != service && *endp == '\0'
&& portnum > 0 && portnum < 65536) {
- se_fallback.s_port = htons(portnum);
+ se_fallback.s_port = htons((unsigned short)portnum);
se_fallback.s_proto = proto;
se = &se_fallback;
} else if (endp == service) {
diff --git a/crypto/bio/b_print.c b/crypto/bio/b_print.c
index 2180fd51a9..de017b6c5f 100644
--- a/crypto/bio/b_print.c
+++ b/crypto/bio/b_print.c
@@ -9,9 +9,9 @@
#include <stdio.h>
#include <string.h>
+#include "internal/cryptlib.h"
#include "internal/ctype.h"
#include "internal/numbers.h"
-#include "internal/cryptlib.h"
#include <openssl/bio.h>
/*
diff --git a/crypto/bio/b_sock2.c b/crypto/bio/b_sock2.c
index 7f4d89e551..a28e1b4e1e 100644
--- a/crypto/bio/b_sock2.c
+++ b/crypto/bio/b_sock2.c
@@ -76,7 +76,7 @@ int BIO_socket(int domain, int socktype, int protocol, int options)
*/
int BIO_connect(int sock, const BIO_ADDR *addr, int options)
{
- int on = 1;
+ const int on = 1;
if (sock == -1) {
BIOerr(BIO_F_BIO_CONNECT, BIO_R_INVALID_SOCKET);
@@ -87,7 +87,8 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
return 0;
if (options & BIO_SOCK_KEEPALIVE) {
- if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_KEEPALIVE);
return 0;
@@ -95,7 +96,8 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
}
if (options & BIO_SOCK_NODELAY) {
- if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_CONNECT, BIO_R_UNABLE_TO_NODELAY);
return 0;
@@ -161,7 +163,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
return 0;
}
- if (getsockopt(sock, SOL_SOCKET, SO_TYPE, &socktype, &socktype_len) != 0
+ if (getsockopt(sock, SOL_SOCKET, SO_TYPE,
+ (void *)&socktype, &socktype_len) != 0
|| socktype_len != sizeof(socktype)) {
SYSerr(SYS_F_GETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_GETTING_SOCKTYPE);
@@ -175,7 +178,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
/* SO_REUSEADDR has different behavior on Windows than on
* other operating systems, don't set it there. */
if (options & BIO_SOCK_REUSEADDR) {
- if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_REUSEADDR);
return 0;
@@ -184,7 +188,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
# endif
if (options & BIO_SOCK_KEEPALIVE) {
- if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_KEEPALIVE);
return 0;
@@ -192,7 +197,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
}
if (options & BIO_SOCK_NODELAY) {
- if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_UNABLE_TO_NODELAY);
return 0;
@@ -201,7 +207,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
# ifdef IPV6_V6ONLY
if ((options & BIO_SOCK_V6_ONLY) && BIO_ADDR_family(addr) == AF_INET6) {
- if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) != 0) {
+ if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY,
+ (const void *)&on, sizeof(on)) != 0) {
SYSerr(SYS_F_SETSOCKOPT, get_last_socket_error());
BIOerr(BIO_F_BIO_LISTEN, BIO_R_LISTEN_V6_ONLY);
return 0;