From bbc1007c507d770843f95012586a03e7c0f039db Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Mon, 14 Oct 2013 16:33:24 +0200
Subject: [PATCH] Convert SOCKET to int to prevent compiler warnings under
MSVC.
From kernel objects at msdn:
Kernel object handles are process specific. That is, a process must either create the object or open an existing object to obtain a kernel object handle. The per-process limit on kernel handles is 2^24.
Windows Internals by Russinovich and Solomon as well says that the high bits are zero.
---
library/net.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/library/net.c b/library/net.c
index 2b21c57f1..8eeabb9fd 100644
--- a/library/net.c
+++ b/library/net.c
@@ -137,7 +137,7 @@ int net_connect( int *fd, const char *host, int port )
if( ( server_host = gethostbyname( host ) ) == NULL )
return( POLARSSL_ERR_NET_UNKNOWN_HOST );
- if( ( *fd = socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
+ if( ( *fd = (int) socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
return( POLARSSL_ERR_NET_SOCKET_FAILED );
memcpy( (void *) &server_addr.sin_addr,
@@ -179,7 +179,7 @@ int net_bind( int *fd, const char *bind_ip, int port )
signal( SIGPIPE, SIG_IGN );
#endif
- if( ( *fd = socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
+ if( ( *fd = (int) socket( AF_INET, SOCK_STREAM, IPPROTO_IP ) ) < 0 )
return( POLARSSL_ERR_NET_SOCKET_FAILED );
n = 1;
@@ -259,8 +259,8 @@ int net_accept( int bind_fd, int *client_fd, void *client_ip )
int n = (int) sizeof( client_addr );
#endif
- *client_fd = accept( bind_fd, (struct sockaddr *)
- &client_addr, &n );
+ *client_fd = (int) accept( bind_fd, (struct sockaddr *)
+ &client_addr, &n );
if( *client_fd < 0 )
{