From 8ef78d068f7d6b41fde4824d693b2af042bf7098 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 11 Mar 2015 16:52:51 +0100 Subject: [PATCH] wininet: Get rid of no longer needed sock_get_error. --- dlls/wininet/ftp.c | 4 ++-- dlls/wininet/internet.h | 1 - dlls/wininet/netconnection.c | 24 +++++++++--------------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 9be3096112a..8944c5c10f7 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -1222,7 +1222,7 @@ static DWORD FTPFILE_WriteFile(object_header_t *hdr, const void *buffer, DWORD s res = sock_send(lpwh->nDataSocket, buffer, size, 0); *written = res>0 ? res : 0; - return res >= 0 ? ERROR_SUCCESS : sock_get_error(); + return res >= 0 ? ERROR_SUCCESS : WSAGetLastError(); } static void FTP_ReceiveRequestData(ftp_file_t *file, BOOL first_notif) @@ -2564,7 +2564,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, if (connect(nsocket, (struct sockaddr *)&socketAddr, sock_namelen) < 0) { - ERR("Unable to connect (%d)\n", sock_get_error()); + ERR("Unable to connect (%d)\n", WSAGetLastError()); INTERNET_SetLastError(ERROR_INTERNET_CANNOT_CONNECT); closesocket(nsocket); } diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index e0baf2af5f1..3f1da71a7be 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -434,7 +434,6 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN; LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN; int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN; DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN; -int sock_get_error(void) DECLSPEC_HIDDEN; int sock_send(int fd, const void *msg, size_t len, int flags) DECLSPEC_HIDDEN; int sock_recv(int fd, void *msg, size_t len, int flags) DECLSPEC_HIDDEN; diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index ca668f22d19..a268aa7a356 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -301,7 +301,7 @@ static DWORD create_netconn_socket(server_t *server, netconn_t *netconn, DWORD t result = connect(netconn->socket, (struct sockaddr*)&server->addr, server->addr_len); if(result == -1) { - res = sock_get_error(); + res = WSAGetLastError(); if (res == WSAEINPROGRESS || res == WSAEWOULDBLOCK) { FD_SET set; int res; @@ -410,12 +410,6 @@ void NETCON_unload(void) WSACleanup(); } -/* translate a unix error code into a winsock one */ -int sock_get_error(void) -{ - return WSAGetLastError(); -} - int sock_send(int fd, const void *msg, size_t len, int flags) { int ret; @@ -423,7 +417,7 @@ int sock_send(int fd, const void *msg, size_t len, int flags) { ret = send(fd, msg, len, flags); } - while(ret == -1 && sock_get_error() == WSAEINTR); + while(ret == -1 && WSAGetLastError() == WSAEINTR); return ret; } @@ -434,7 +428,7 @@ int sock_recv(int fd, void *msg, size_t len, int flags) { ret = recv(fd, msg, len, flags); } - while(ret == -1 && sock_get_error() == WSAEINTR); + while(ret == -1 && WSAGetLastError() == WSAEINTR); return ret; } @@ -671,7 +665,7 @@ DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags, if(!connection->secure) { *sent = sock_send(connection->socket, msg, len, flags); - return *sent == -1 ? sock_get_error() : ERROR_SUCCESS; + return *sent == -1 ? WSAGetLastError() : ERROR_SUCCESS; } else { @@ -723,7 +717,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, blocking size = sock_recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len, 0); if(size < 0) { if(!buf_len) { - if(sock_get_error() == WSAEWOULDBLOCK) { + if(WSAGetLastError() == WSAEWOULDBLOCK) { TRACE("would block\n"); return WSAEWOULDBLOCK; } @@ -763,7 +757,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, blocking set_socket_blocking(conn->socket, mode); size = sock_recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len, 0); if(size < 1) { - if(size < 0 && sock_get_error() == WSAEWOULDBLOCK) { + if(size < 0 && WSAGetLastError() == WSAEWOULDBLOCK) { TRACE("would block\n"); /* FIXME: Optimize extra_buf usage. */ @@ -838,7 +832,7 @@ DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, blocking_mode_t set_socket_blocking(connection->socket, mode); *recvd = sock_recv(connection->socket, buf, len, flags); - return *recvd == -1 ? sock_get_error() : ERROR_SUCCESS; + return *recvd == -1 ? WSAGetLastError() : ERROR_SUCCESS; } else { @@ -926,7 +920,7 @@ BOOL NETCON_is_alive(netconn_t *netconn) len = sock_recv(netconn->socket, &b, 1, MSG_PEEK); set_socket_blocking(netconn->socket, BLOCKING_ALLOW); - return len == 1 || (len == -1 && sock_get_error() == WSAEWOULDBLOCK); + return len == 1 || (len == -1 && WSAGetLastError() == WSAEWOULDBLOCK); } LPCVOID NETCON_GetCert(netconn_t *connection) @@ -974,7 +968,7 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) if (result == -1) { WARN("setsockopt failed\n"); - return sock_get_error(); + return WSAGetLastError(); } return ERROR_SUCCESS; }