libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit e15abfd99c9a1c892b68b17f9a8d65c949658adb
parent 066f70ea6830a65b092b41365a050d681fae44ed
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sat,  8 Aug 2015 12:30:06 +0000

daemon.c: recv_param_adapter(): fix VS compiler warning for send()/recv()

Diffstat:
Msrc/include/platform_interface.h | 10++++++++++
Msrc/microhttpd/daemon.c | 6+++---
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/include/platform_interface.h b/src/include/platform_interface.h @@ -81,6 +81,16 @@ /** + * _MHD_socket_funcs_size is type used to specify size for send and recv + * functions + */ +#if !defined(MHD_WINSOCK_SOCKETS) +typedef size_t _MHD_socket_funcs_size; +#else +typedef int _MHD_socket_funcs_size; +#endif + +/** * MHD_socket_close_(fd) close any FDs (non-W32) / close only socket * FDs (W32). Note that on HP-UNIX, this function may leak the FD if * errno is set to EINTR. Do not use HP-UNIX. diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c @@ -1061,7 +1061,7 @@ recv_param_adapter (struct MHD_Connection *connection, i = INT_MAX; /* return value limit */ #endif /* MHD_WINSOCK_SOCKETS */ - ret = recv(connection->socket_fd, other, i, MSG_NOSIGNAL); + ret = (ssize_t)recv (connection->socket_fd, other, (_MHD_socket_funcs_size)i, MSG_NOSIGNAL); #if EPOLL_SUPPORT if ( (0 > ret) || (requested_size > (size_t) ret)) { @@ -1109,7 +1109,7 @@ send_param_adapter (struct MHD_Connection *connection, #endif /* MHD_WINSOCK_SOCKETS */ if (0 != (connection->daemon->options & MHD_USE_SSL)) - return send (connection->socket_fd, other, i, MSG_NOSIGNAL); + return (ssize_t)send (connection->socket_fd, other, (_MHD_socket_funcs_size)i, MSG_NOSIGNAL); #if LINUX if ( (connection->write_buffer_append_offset == connection->write_buffer_send_offset) && @@ -1156,7 +1156,7 @@ send_param_adapter (struct MHD_Connection *connection, http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */ } #endif - ret = send (connection->socket_fd, other, i, MSG_NOSIGNAL); + ret = (ssize_t)send (connection->socket_fd, other, (_MHD_socket_funcs_size)i, MSG_NOSIGNAL); #if EPOLL_SUPPORT if ( (0 > ret) || (requested_size > (size_t) ret) ) {