[PATCH 1/7] winhttp: Get rid of session_t.

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


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/winhttp/cookie.c          | 10 +++++-----
 dlls/winhttp/request.c         |  4 ++--
 dlls/winhttp/session.c         | 28 ++++++++++++++--------------
 dlls/winhttp/winhttp_private.h | 18 +++++++++---------
 4 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/dlls/winhttp/cookie.c b/dlls/winhttp/cookie.c
index 88365f5949..143091bcbc 100644
--- a/dlls/winhttp/cookie.c
+++ b/dlls/winhttp/cookie.c
@@ -45,7 +45,7 @@ struct domain
     struct list cookies;
 };
 
-static struct domain *add_domain( session_t *session, WCHAR *name )
+static struct domain *add_domain( struct session *session, WCHAR *name )
 {
     struct domain *domain;
 
@@ -117,7 +117,7 @@ static void delete_domain( struct domain *domain )
     heap_free( domain );
 }
 
-void destroy_cookies( session_t *session )
+void destroy_cookies( struct session *session )
 {
     struct list *item, *next;
     struct domain *domain;
@@ -129,7 +129,7 @@ void destroy_cookies( session_t *session )
     }
 }
 
-static BOOL add_cookie( session_t *session, struct cookie *cookie, WCHAR *domain_name, WCHAR *path )
+static BOOL add_cookie( struct session *session, struct cookie *cookie, WCHAR *domain_name, WCHAR *path )
 {
     struct domain *domain = NULL;
     struct cookie *old_cookie;
@@ -268,7 +268,7 @@ BOOL set_cookies( request_t *request, const WCHAR *cookies )
     WCHAR *buffer, *p;
     WCHAR *cookie_domain = NULL, *cookie_path = NULL;
     struct attr *attr, *domain = NULL, *path = NULL;
-    session_t *session = request->connect->session;
+    struct session *session = request->connect->session;
     struct cookie *cookie;
     int len, used;
 
@@ -324,7 +324,7 @@ end:
 BOOL add_cookie_headers( request_t *request )
 {
     struct list *domain_cursor;
-    session_t *session = request->connect->session;
+    struct session *session = request->connect->session;
 
     EnterCriticalSection( &session->cs );
 
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 7f3ef4c50d..8add6c973a 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -1538,7 +1538,7 @@ static DWORD map_secure_protocols( DWORD mask )
     return ret;
 }
 
-static BOOL ensure_cred_handle( session_t *session )
+static BOOL ensure_cred_handle( struct session *session )
 {
     SECURITY_STATUS status = SEC_E_OK;
 
@@ -2176,7 +2176,7 @@ static BOOL send_request( request_t *request, LPCWSTR headers, DWORD headers_len
 
     BOOL ret = FALSE;
     connect_t *connect = request->connect;
-    session_t *session = connect->session;
+    struct session *session = connect->session;
     char *wire_req;
     int bytes_sent;
     DWORD len, i, flags;
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 88043462af..76074d3032 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -88,7 +88,7 @@ BOOL WINAPI WinHttpCheckPlatform( void )
  */
 static void session_destroy( struct object_header *hdr )
 {
-    session_t *session = (session_t *)hdr;
+    struct session *session = (struct session *)hdr;
 
     TRACE("%p\n", session);
 
@@ -108,7 +108,7 @@ static void session_destroy( struct object_header *hdr )
 
 static BOOL session_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
 {
-    session_t *session = (session_t *)hdr;
+    struct session *session = (struct session *)hdr;
 
     switch (option)
     {
@@ -159,7 +159,7 @@ static BOOL session_query_option( struct object_header *hdr, DWORD option, void
 
 static BOOL session_set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
 {
-    session_t *session = (session_t *)hdr;
+    struct session *session = (struct session *)hdr;
 
     switch (option)
     {
@@ -258,12 +258,12 @@ static const struct object_vtbl session_vtbl =
  */
 HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWSTR bypass, DWORD flags )
 {
-    session_t *session;
+    struct session *session;
     HINTERNET handle = NULL;
 
     TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);
 
-    if (!(session = heap_alloc_zero( sizeof(session_t) ))) return NULL;
+    if (!(session = heap_alloc_zero( sizeof(struct session) ))) return NULL;
 
     session->hdr.type = WINHTTP_HANDLE_TYPE_SESSION;
     session->hdr.vtbl = &session_vtbl;
@@ -447,7 +447,7 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
 /* Matches INTERNET_MAX_HOST_NAME_LENGTH in wininet.h, also RFC 1035 */
 #define MAX_HOST_NAME_LENGTH 256
 
-static BOOL should_bypass_proxy(session_t *session, LPCWSTR server)
+static BOOL should_bypass_proxy(struct session *session, LPCWSTR server)
 {
     LPCWSTR ptr;
     BOOL ret = FALSE;
@@ -480,7 +480,7 @@ static BOOL should_bypass_proxy(session_t *session, LPCWSTR server)
 
 BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port )
 {
-    session_t *session = connect->session;
+    struct session *session = connect->session;
     BOOL ret = TRUE;
 
     if (session->proxy_server && !should_bypass_proxy(session, server))
@@ -546,7 +546,7 @@ end:
 HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PORT port, DWORD reserved )
 {
     connect_t *connect;
-    session_t *session;
+    struct session *session;
     HINTERNET hconnect = NULL;
 
     TRACE("%p, %s, %u, %x\n", hsession, debugstr_w(server), port, reserved);
@@ -556,7 +556,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
         set_last_error( ERROR_INVALID_PARAMETER );
         return NULL;
     }
-    if (!(session = (session_t *)grab_object( hsession )))
+    if (!(session = (struct session *)grab_object( hsession )))
     {
         set_last_error( ERROR_INVALID_HANDLE );
         return NULL;
@@ -1003,7 +1003,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b
     }
     case WINHTTP_OPTION_PROXY_USERNAME:
     {
-        session_t *session = request->connect->session;
+        struct session *session = request->connect->session;
 
         heap_free( session->proxy_username );
         if (!(session->proxy_username = buffer_to_str( buffer, buflen ))) return FALSE;
@@ -1011,7 +1011,7 @@ static BOOL request_set_option( struct object_header *hdr, DWORD option, void *b
     }
     case WINHTTP_OPTION_PROXY_PASSWORD:
     {
-        session_t *session = request->connect->session;
+        struct session *session = request->connect->session;
 
         heap_free( session->proxy_password );
         if (!(session->proxy_password = buffer_to_str( buffer, buflen ))) return FALSE;
@@ -1886,14 +1886,14 @@ BOOL WINAPI WinHttpGetProxyForUrl( HINTERNET hsession, LPCWSTR url, WINHTTP_AUTO
 {
     WCHAR *detected_pac_url = NULL;
     const WCHAR *pac_url;
-    session_t *session;
+    struct session *session;
     char *script;
     DWORD size;
     BOOL ret = FALSE;
 
     TRACE("%p, %s, %p, %p\n", hsession, debugstr_w(url), options, info);
 
-    if (!(session = (session_t *)grab_object( hsession )))
+    if (!(session = (struct session *)grab_object( hsession )))
     {
         set_last_error( ERROR_INVALID_HANDLE );
         return FALSE;
@@ -2114,7 +2114,7 @@ BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int
     }
     case WINHTTP_HANDLE_TYPE_SESSION:
     {
-        session_t *session = (session_t *)hdr;
+        struct session *session = (struct session *)hdr;
         session->connect_timeout = connect;
 
         if (resolve < 0) resolve = 0;
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 999f3d7484..9e838eea40 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -75,32 +75,32 @@ struct hostdata
     struct list connections;
 };
 
-typedef struct
+struct session
 {
     struct object_header hdr;
     CRITICAL_SECTION cs;
-    LPWSTR agent;
+    WCHAR *agent;
     DWORD access;
     int resolve_timeout;
     int connect_timeout;
     int send_timeout;
     int receive_timeout;
     int receive_response_timeout;
-    LPWSTR proxy_server;
-    LPWSTR proxy_bypass;
-    LPWSTR proxy_username;
-    LPWSTR proxy_password;
+    WCHAR *proxy_server;
+    WCHAR *proxy_bypass;
+    WCHAR *proxy_username;
+    WCHAR *proxy_password;
     struct list cookie_cache;
     HANDLE unload_event;
     CredHandle cred_handle;
     BOOL cred_handle_initialized;
     DWORD secure_protocols;
-} session_t;
+};
 
 typedef struct
 {
     struct object_header hdr;
-    session_t *session;
+    struct session *session;
     LPWSTR hostname;    /* final destination of the request */
     LPWSTR servername;  /* name of the server we directly connect to */
     LPWSTR username;
@@ -286,7 +286,7 @@ int netconn_get_cipher_strength( netconn_t * ) DECLSPEC_HIDDEN;
 BOOL set_cookies( request_t *, const WCHAR * ) DECLSPEC_HIDDEN;
 BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN;
 BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ) DECLSPEC_HIDDEN;
-void destroy_cookies( session_t * ) DECLSPEC_HIDDEN;
+void destroy_cookies( struct session * ) DECLSPEC_HIDDEN;
 BOOL set_server_for_hostname( connect_t *, LPCWSTR, INTERNET_PORT ) DECLSPEC_HIDDEN;
 void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
 
-- 
2.11.0




More information about the wine-devel mailing list