Fix for mixed usage of SOCKET and int.

This commit is contained in:
Stefan Sommerfeld
2010-11-07 13:35:48 -02:00
committed by Marcelo Roberto Jimenez
parent a5fb5edfc9
commit 4b47e6a51d
4 changed files with 23 additions and 23 deletions

View File

@@ -179,7 +179,7 @@ static UPNP_INLINE int notify_send_and_recv(
http_parser_t *response) http_parser_t *response)
{ {
uri_type url; uri_type url;
int conn_fd; SOCKET conn_fd;
membuffer start_msg; membuffer start_msg;
int ret_code; int ret_code;
int err_code; int err_code;

View File

@@ -74,7 +74,7 @@
struct mserv_request_t { struct mserv_request_t {
/*! Connection handle. */ /*! Connection handle. */
int connfd; SOCKET connfd;
/*! . */ /*! . */
struct sockaddr_storage foreign_sockaddr; struct sockaddr_storage foreign_sockaddr;
}; };
@@ -218,7 +218,7 @@ static void handle_request(
http_message_t *hmsg = NULL; http_message_t *hmsg = NULL;
int timeout = HTTP_DEFAULT_TIMEOUT; int timeout = HTTP_DEFAULT_TIMEOUT;
struct mserv_request_t *request = (struct mserv_request_t *)args; struct mserv_request_t *request = (struct mserv_request_t *)args;
int connfd = request->connfd; SOCKET connfd = request->connfd;
UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__, UpnpPrintf( UPNP_INFO, MSERV, __FILE__, __LINE__,
"miniserver %d: READING\n", connfd ); "miniserver %d: READING\n", connfd );
@@ -269,7 +269,7 @@ error_handler:
*/ */
static UPNP_INLINE void schedule_request_job( static UPNP_INLINE void schedule_request_job(
/*! [in] Socket Descriptor on which connection is accepted. */ /*! [in] Socket Descriptor on which connection is accepted. */
int connfd, SOCKET connfd,
/*! [in] Clients Address information. */ /*! [in] Clients Address information. */
struct sockaddr *clientAddr) struct sockaddr *clientAddr)
{ {
@@ -301,17 +301,17 @@ static UPNP_INLINE void schedule_request_job(
} }
#endif #endif
static inline void fdset_if_valid(int sock, fd_set *set) static UPNP_INLINE void fdset_if_valid(SOCKET sock, fd_set *set)
{ {
if (sock != -1) { if (sock != -1) {
FD_SET(sock, set); FD_SET(sock, set);
} }
} }
static void web_server_accept(int lsock, fd_set *set) static void web_server_accept(SOCKET lsock, fd_set *set)
{ {
#ifdef INTERNAL_WEB_SERVER #ifdef INTERNAL_WEB_SERVER
int asock; SOCKET asock;
socklen_t clientLen; socklen_t clientLen;
struct sockaddr_storage clientAddr; struct sockaddr_storage clientAddr;
char errorBuffer[ERROR_BUFFER_LEN]; char errorBuffer[ERROR_BUFFER_LEN];
@@ -333,14 +333,14 @@ static void web_server_accept(int lsock, fd_set *set)
#endif /* INTERNAL_WEB_SERVER */ #endif /* INTERNAL_WEB_SERVER */
} }
static void ssdp_read(int rsock, fd_set *set) static void ssdp_read(SOCKET rsock, fd_set *set)
{ {
if (rsock != -1 && FD_ISSET(rsock, set)) { if (rsock != -1 && FD_ISSET(rsock, set)) {
readFromSSDPSocket(rsock); readFromSSDPSocket(rsock);
} }
} }
static int receive_from_stopSock(int ssock, fd_set *set) static int receive_from_stopSock(SOCKET ssock, fd_set *set)
{ {
int byteReceived; int byteReceived;
socklen_t clientLen; socklen_t clientLen;
@@ -387,9 +387,9 @@ static void RunMiniServer(
char errorBuffer[ERROR_BUFFER_LEN]; char errorBuffer[ERROR_BUFFER_LEN];
fd_set expSet; fd_set expSet;
fd_set rdSet; fd_set rdSet;
int maxMiniSock; SOCKET maxMiniSock;
int ret = 0; int ret = 0;
int stopSock = 0; SOCKET stopSock = 0;
maxMiniSock = 0; maxMiniSock = 0;
maxMiniSock = max(maxMiniSock, miniSock->miniServerSock4); maxMiniSock = max(maxMiniSock, miniSock->miniServerSock4);
@@ -464,7 +464,7 @@ static void RunMiniServer(
*/ */
static int get_port( static int get_port(
/*! [in] Socket descriptor. */ /*! [in] Socket descriptor. */
int sockfd) SOCKET sockfd)
{ {
struct sockaddr_storage sockinfo; struct sockaddr_storage sockinfo;
socklen_t len; socklen_t len;
@@ -779,7 +779,7 @@ static int get_miniserver_stopsock(
{ {
char errorBuffer[ERROR_BUFFER_LEN]; char errorBuffer[ERROR_BUFFER_LEN];
struct sockaddr_in stop_sockaddr; struct sockaddr_in stop_sockaddr;
int miniServerStopSock = 0; SOCKET miniServerStopSock = 0;
int ret = 0; int ret = 0;
miniServerStopSock = socket(AF_INET, SOCK_DGRAM, 0); miniServerStopSock = socket(AF_INET, SOCK_DGRAM, 0);

View File

@@ -108,7 +108,7 @@ const int CHUNK_TAIL_SIZE = 10;
* Returns: int * Returns: int
* 0 if successful else -1 * 0 if successful else -1
***************************************************************************/ ***************************************************************************/
static int Make_Socket_NoBlocking(int sock) static int Make_Socket_NoBlocking(SOCKET sock)
{ {
#ifdef WIN32 #ifdef WIN32
u_long val = 1; u_long val = 1;
@@ -219,7 +219,7 @@ static int Check_Connect_And_Wait_Connection(int sock, int connect_res)
#endif /* UPNP_BLOCKING_CONNECT */ #endif /* UPNP_BLOCKING_CONNECT */
static int private_connect( static int private_connect(
int sockfd, SOCKET sockfd,
const struct sockaddr *serv_addr, const struct sockaddr *serv_addr,
socklen_t addrlen) socklen_t addrlen)
{ {
@@ -316,15 +316,15 @@ int http_FixStrUrl(
* Gets destination address from URL and then connects to the remote end * Gets destination address from URL and then connects to the remote end
* *
* Returns: * Returns:
* socket descriptor on sucess * socket descriptor on success
* UPNP_E_OUTOF_SOCKET * UPNP_E_OUTOF_SOCKET
* UPNP_E_SOCKET_CONNECT on error * UPNP_E_SOCKET_CONNECT on error
************************************************************************/ ************************************************************************/
int http_Connect( SOCKET http_Connect(
IN uri_type *destination_url, IN uri_type *destination_url,
OUT uri_type *url) OUT uri_type *url)
{ {
int connfd; SOCKET connfd;
int sockaddr_len; int sockaddr_len;
int ret_connect; int ret_connect;
@@ -692,7 +692,7 @@ int http_RequestAndResponse(
IN int timeout_secs, IN int timeout_secs,
OUT http_parser_t *response) OUT http_parser_t *response)
{ {
int tcp_connection; SOCKET tcp_connection;
int ret_code; int ret_code;
int sockaddr_len; int sockaddr_len;
int http_error_code; int http_error_code;
@@ -1159,7 +1159,7 @@ int http_OpenHttpPost(
{ {
int ret_code; int ret_code;
int sockaddr_len; int sockaddr_len;
int tcp_connection; SOCKET tcp_connection;
membuffer request; membuffer request;
http_post_handle_t *handle = NULL; http_post_handle_t *handle = NULL;
uri_type url; uri_type url;
@@ -1724,7 +1724,7 @@ int http_OpenHttpGetProxy(
int sockaddr_len; int sockaddr_len;
int http_error_code; int http_error_code;
memptr ctype; memptr ctype;
int tcp_connection; SOCKET tcp_connection;
membuffer request; membuffer request;
http_get_handle_t *handle = NULL; http_get_handle_t *handle = NULL;
uri_type url; uri_type url;
@@ -2361,7 +2361,7 @@ int http_OpenHttpGetEx(
{ {
int http_error_code; int http_error_code;
memptr ctype; memptr ctype;
int tcp_connection; SOCKET tcp_connection;
int sockaddr_len; int sockaddr_len;
membuffer request; membuffer request;
http_get_handle_t *handle = NULL; http_get_handle_t *handle = NULL;

View File

@@ -156,7 +156,7 @@ int sock_destroy(
*/ */
static inline int sock_close( static inline int sock_close(
/*! Socket descriptor. */ /*! Socket descriptor. */
int sock) SOCKET sock)
{ {
int ret = -1; int ret = -1;