[PATCH 3/7] winhttp: Get rid of netconn_t.

Hans Leidekker hans at codeweavers.com
Thu Nov 22 14:15:53 CST 2018


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/winhttp/net.c             | 28 ++++++++++++++--------------
 dlls/winhttp/request.c         | 10 +++++-----
 dlls/winhttp/winhttp_private.h | 26 +++++++++++++-------------
 3 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c
index 1db3916650..004933ff81 100644
--- a/dlls/winhttp/net.c
+++ b/dlls/winhttp/net.c
@@ -173,15 +173,15 @@ static void winsock_init(void)
     InitOnceExecuteOnce( &once, winsock_startup, NULL, NULL );
 }
 
-static void set_blocking( netconn_t *conn, BOOL blocking )
+static void set_blocking( struct netconn *conn, BOOL blocking )
 {
     ULONG state = !blocking;
     ioctlsocket( conn->socket, FIONBIO, &state );
 }
 
-netconn_t *netconn_create( struct hostdata *host, const struct sockaddr_storage *sockaddr, int timeout )
+struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_storage *sockaddr, int timeout )
 {
-    netconn_t *conn;
+    struct netconn *conn;
     unsigned int addr_len;
     BOOL ret = FALSE;
 
@@ -241,7 +241,7 @@ netconn_t *netconn_create( struct hostdata *host, const struct sockaddr_storage
     return conn;
 }
 
-void netconn_close( netconn_t *conn )
+void netconn_close( struct netconn *conn )
 {
     if (conn->secure)
     {
@@ -255,7 +255,7 @@ void netconn_close( netconn_t *conn )
     heap_free(conn);
 }
 
-BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname, DWORD security_flags, CredHandle *cred_handle,
+BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD security_flags, CredHandle *cred_handle,
                              BOOL check_revocation)
 {
     SecBuffer out_buf = {0, SECBUFFER_TOKEN, NULL}, in_bufs[2] = {{0, SECBUFFER_TOKEN}, {0, SECBUFFER_EMPTY}};
@@ -389,7 +389,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname, DWORD security_fl
     return TRUE;
 }
 
-static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size)
+static BOOL send_ssl_chunk(struct netconn *conn, const void *msg, size_t size)
 {
     SecBuffer bufs[4] = {
         {conn->ssl_sizes.cbHeader, SECBUFFER_STREAM_HEADER, conn->ssl_buf},
@@ -415,7 +415,7 @@ static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size)
     return TRUE;
 }
 
-BOOL netconn_send( netconn_t *conn, const void *msg, size_t len, int *sent )
+BOOL netconn_send( struct netconn *conn, const void *msg, size_t len, int *sent )
 {
     if (conn->secure)
     {
@@ -439,7 +439,7 @@ BOOL netconn_send( netconn_t *conn, const void *msg, size_t len, int *sent )
     return ((*sent = sock_send( conn->socket, msg, len, 0 )) != -1);
 }
 
-static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *ret_size, BOOL *eof)
+static BOOL read_ssl_chunk(struct netconn *conn, void *buf, SIZE_T buf_size, SIZE_T *ret_size, BOOL *eof)
 {
     const SIZE_T ssl_buf_size = conn->ssl_sizes.cbHeader+conn->ssl_sizes.cbMaximumMessage+conn->ssl_sizes.cbTrailer;
     SecBuffer bufs[4];
@@ -530,7 +530,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
     return TRUE;
 }
 
-BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd )
+BOOL netconn_recv( struct netconn *conn, void *buf, size_t len, int flags, int *recvd )
 {
     *recvd = 0;
     if (!len) return TRUE;
@@ -582,12 +582,12 @@ BOOL netconn_recv( netconn_t *conn, void *buf, size_t len, int flags, int *recvd
     return ((*recvd = sock_recv( conn->socket, buf, len, flags )) != -1);
 }
 
-ULONG netconn_query_data_available( netconn_t *conn )
+ULONG netconn_query_data_available( struct netconn *conn )
 {
     return conn->secure ? conn->peek_len : 0;
 }
 
-DWORD netconn_set_timeout( netconn_t *netconn, BOOL send, int value )
+DWORD netconn_set_timeout( struct netconn *netconn, BOOL send, int value )
 {
     int opt = send ? SO_SNDTIMEO : SO_RCVTIMEO;
     if (setsockopt( netconn->socket, SOL_SOCKET, opt, (void *)&value, sizeof(value) ) == -1)
@@ -599,7 +599,7 @@ DWORD netconn_set_timeout( netconn_t *netconn, BOOL send, int value )
     return ERROR_SUCCESS;
 }
 
-BOOL netconn_is_alive( netconn_t *netconn )
+BOOL netconn_is_alive( struct netconn *netconn )
 {
     int len;
     char b;
@@ -696,7 +696,7 @@ BOOL netconn_resolve( WCHAR *hostname, INTERNET_PORT port, struct sockaddr_stora
     return TRUE;
 }
 
-const void *netconn_get_certificate( netconn_t *conn )
+const void *netconn_get_certificate( struct netconn *conn )
 {
     const CERT_CONTEXT *ret;
     SECURITY_STATUS res;
@@ -706,7 +706,7 @@ const void *netconn_get_certificate( netconn_t *conn )
     return res == SEC_E_OK ? ret : NULL;
 }
 
-int netconn_get_cipher_strength( netconn_t *conn )
+int netconn_get_cipher_strength( struct netconn *conn )
 {
     SecPkgContext_ConnectionInfo conn_info;
     SECURITY_STATUS res;
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 3e499ce8ed..f5fe769dfb 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -1458,7 +1458,7 @@ static BOOL connection_collector_running;
 static DWORD WINAPI connection_collector(void *arg)
 {
     unsigned int remaining_connections;
-    netconn_t *netconn, *next_netconn;
+    struct netconn *netconn, *next_netconn;
     struct hostdata *host, *next_host;
     ULONGLONG now;
 
@@ -1473,7 +1473,7 @@ static DWORD WINAPI connection_collector(void *arg)
 
         LIST_FOR_EACH_ENTRY_SAFE(host, next_host, &connection_pool, struct hostdata, entry)
         {
-            LIST_FOR_EACH_ENTRY_SAFE(netconn, next_netconn, &host->connections, netconn_t, entry)
+            LIST_FOR_EACH_ENTRY_SAFE(netconn, next_netconn, &host->connections, struct netconn, entry)
             {
                 if (netconn->keep_until < now)
                 {
@@ -1496,7 +1496,7 @@ static DWORD WINAPI connection_collector(void *arg)
     FreeLibraryAndExitThread( winhttp_instance, 0 );
 }
 
-static void cache_connection( netconn_t *netconn )
+static void cache_connection( struct netconn *netconn )
 {
     TRACE( "caching connection %p\n", netconn );
 
@@ -1570,7 +1570,7 @@ static BOOL open_connection( request_t *request )
 {
     BOOL is_secure = request->hdr.flags & WINHTTP_FLAG_SECURE;
     struct hostdata *host = NULL, *iter;
-    netconn_t *netconn = NULL;
+    struct netconn *netconn = NULL;
     struct connect *connect;
     WCHAR *addressW = NULL;
     INTERNET_PORT port;
@@ -1622,7 +1622,7 @@ static BOOL open_connection( request_t *request )
         EnterCriticalSection( &connection_pool_cs );
         if (!list_empty( &host->connections ))
         {
-            netconn = LIST_ENTRY( list_head( &host->connections ), netconn_t, entry );
+            netconn = LIST_ENTRY( list_head( &host->connections ), struct netconn, entry );
             list_remove( &netconn->entry );
         }
         LeaveCriticalSection( &connection_pool_cs );
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 78b1d15b1d..8bd7d0b0bf 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -111,7 +111,7 @@ struct connect
     BOOL resolved;
 };
 
-typedef struct
+struct netconn
 {
     struct list entry;
     int socket;
@@ -127,7 +127,7 @@ typedef struct
     char *peek_msg;
     char *peek_msg_mem;
     size_t peek_len;
-} netconn_t;
+};
 
 struct header
 {
@@ -178,7 +178,7 @@ typedef struct
     LPWSTR raw_headers;
     void *optional;
     DWORD optional_len;
-    netconn_t *netconn;
+    struct netconn *netconn;
     DWORD security_flags;
     BOOL check_revocation;
     const CERT_CONTEXT *server_cert;
@@ -270,18 +270,18 @@ DWORD get_last_error( void ) DECLSPEC_HIDDEN;
 void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
 void close_connection( request_t * ) DECLSPEC_HIDDEN;
 
-void netconn_close( netconn_t * ) DECLSPEC_HIDDEN;
-netconn_t *netconn_create( struct hostdata *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
+void netconn_close( struct netconn * ) DECLSPEC_HIDDEN;
+struct netconn *netconn_create( struct hostdata *, const struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
 void netconn_unload( void ) DECLSPEC_HIDDEN;
-ULONG netconn_query_data_available( netconn_t * ) DECLSPEC_HIDDEN;
-BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
+ULONG netconn_query_data_available( struct netconn * ) DECLSPEC_HIDDEN;
+BOOL netconn_recv( struct netconn *, void *, size_t, int, int * ) DECLSPEC_HIDDEN;
 BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr_storage *, int ) DECLSPEC_HIDDEN;
-BOOL netconn_secure_connect( netconn_t *, WCHAR *, DWORD, CredHandle *, BOOL ) DECLSPEC_HIDDEN;
-BOOL netconn_send( netconn_t *, const void *, size_t, int * ) DECLSPEC_HIDDEN;
-DWORD netconn_set_timeout( netconn_t *, BOOL, int ) DECLSPEC_HIDDEN;
-BOOL netconn_is_alive( netconn_t * ) DECLSPEC_HIDDEN;
-const void *netconn_get_certificate( netconn_t * ) DECLSPEC_HIDDEN;
-int netconn_get_cipher_strength( netconn_t * ) DECLSPEC_HIDDEN;
+BOOL netconn_secure_connect( struct netconn *, WCHAR *, DWORD, CredHandle *, BOOL ) DECLSPEC_HIDDEN;
+BOOL netconn_send( struct netconn *, const void *, size_t, int * ) DECLSPEC_HIDDEN;
+DWORD netconn_set_timeout( struct netconn *, BOOL, int ) DECLSPEC_HIDDEN;
+BOOL netconn_is_alive( struct netconn * ) DECLSPEC_HIDDEN;
+const void *netconn_get_certificate( struct netconn * ) DECLSPEC_HIDDEN;
+int netconn_get_cipher_strength( struct netconn * ) DECLSPEC_HIDDEN;
 
 BOOL set_cookies( request_t *, const WCHAR * ) DECLSPEC_HIDDEN;
 BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN;
-- 
2.11.0




More information about the wine-devel mailing list