From: Alex Henrie alexhenrie24@gmail.com
--- dlls/winhttp/cookie.c | 8 ++++---- dlls/winhttp/net.c | 2 +- dlls/winhttp/request.c | 26 +++++++++++++------------- dlls/winhttp/session.c | 20 ++++++++++---------- dlls/winhttp/winhttp_private.h | 10 ---------- 5 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/dlls/winhttp/cookie.c b/dlls/winhttp/cookie.c index ebcd1b4d17e..e1f75639ff8 100644 --- a/dlls/winhttp/cookie.c +++ b/dlls/winhttp/cookie.c @@ -54,7 +54,7 @@ static struct domain *add_domain( struct session *session, WCHAR *name ) list_init( &domain->entry ); list_init( &domain->cookies );
- domain->name = strdupW( name ); + domain->name = wcsdup( name ); list_add_tail( &session->cookie_cache, &domain->entry );
TRACE("%s\n", debugstr_w(domain->name)); @@ -135,7 +135,7 @@ static BOOL add_cookie( struct session *session, struct cookie *cookie, WCHAR *d struct cookie *old_cookie; struct list *item;
- if (!(cookie->path = strdupW( path ))) return FALSE; + if (!(cookie->path = wcsdup( path ))) return FALSE;
EnterCriticalSection( &session->cs );
@@ -303,8 +303,8 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies ) len -= used; p += used; } - if (!cookie_domain && !(cookie_domain = strdupW( request->connect->servername ))) goto end; - if (!cookie_path && !(cookie_path = strdupW( request->path ))) goto end; + if (!cookie_domain && !(cookie_domain = wcsdup( request->connect->servername ))) goto end; + if (!cookie_path && !(cookie_path = wcsdup( request->path ))) goto end;
if ((p = wcsrchr( cookie_path, '/' )) && p != cookie_path) *p = 0; ret = add_cookie( session, cookie, cookie_domain, cookie_path ); diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index ab94b5bfd1d..a3ccf40cb65 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -770,7 +770,7 @@ static struct async_resolve *create_async_resolve( const WCHAR *hostname, INTERN return NULL; } ret->ref = 1; - ret->hostname = strdupW( hostname ); + ret->hostname = wcsdup( hostname ); ret->port = port; if (!(ret->done = CreateEventW( NULL, FALSE, FALSE, NULL ))) { diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index e046b05581c..e977070e87c 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -371,8 +371,8 @@ static DWORD insert_header( struct request *request, struct header *header ) if (!hdrs) return ERROR_OUTOFMEMORY;
request->headers = hdrs; - request->headers[count - 1].field = strdupW( header->field ); - request->headers[count - 1].value = strdupW( header->value ); + request->headers[count - 1].field = wcsdup( header->field ); + request->headers[count - 1].value = wcsdup( header->value ); request->headers[count - 1].is_request = header->is_request; request->num_headers = count; return ERROR_SUCCESS; @@ -1562,7 +1562,7 @@ static DWORD open_connection( struct request *request ) host->secure = is_secure; host->port = port; list_init( &host->connections ); - if ((host->hostname = strdupW( connect->servername ))) + if ((host->hostname = wcsdup( connect->servername ))) { list_add_head( &connection_pool, &host->entry ); } @@ -2309,7 +2309,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNET hrequest, const WCHAR *headers, DWORD SetLastError( ERROR_OUTOFMEMORY ); return FALSE; } - s->headers = strdupW( headers ); + s->headers = wcsdup( headers ); s->headers_len = headers_len; s->optional = optional; s->optional_len = optional_len; @@ -2344,22 +2344,22 @@ static DWORD set_credentials( struct request *request, DWORD target, DWORD schem { free( request->creds[TARGET_SERVER][scheme].username ); if (!username) request->creds[TARGET_SERVER][scheme].username = NULL; - else if (!(request->creds[TARGET_SERVER][scheme].username = strdupW( username ))) return ERROR_OUTOFMEMORY; + else if (!(request->creds[TARGET_SERVER][scheme].username = wcsdup( username ))) return ERROR_OUTOFMEMORY;
free( request->creds[TARGET_SERVER][scheme].password ); if (!password) request->creds[TARGET_SERVER][scheme].password = NULL; - else if (!(request->creds[TARGET_SERVER][scheme].password = strdupW( password ))) return ERROR_OUTOFMEMORY; + else if (!(request->creds[TARGET_SERVER][scheme].password = wcsdup( password ))) return ERROR_OUTOFMEMORY; break; } case WINHTTP_AUTH_TARGET_PROXY: { free( request->creds[TARGET_PROXY][scheme].username ); if (!username) request->creds[TARGET_PROXY][scheme].username = NULL; - else if (!(request->creds[TARGET_PROXY][scheme].username = strdupW( username ))) return ERROR_OUTOFMEMORY; + else if (!(request->creds[TARGET_PROXY][scheme].username = wcsdup( username ))) return ERROR_OUTOFMEMORY;
free( request->creds[TARGET_PROXY][scheme].password ); if (!password) request->creds[TARGET_PROXY][scheme].password = NULL; - else if (!(request->creds[TARGET_PROXY][scheme].password = strdupW( password ))) return ERROR_OUTOFMEMORY; + else if (!(request->creds[TARGET_PROXY][scheme].password = wcsdup( password ))) return ERROR_OUTOFMEMORY; break; } default: @@ -2735,13 +2735,13 @@ static DWORD handle_redirect( struct request *request, DWORD status ) memcpy( request->path, uc.lpszUrlPath, (len + 1) * sizeof(WCHAR) ); request->path[len] = 0; } - else request->path = strdupW( L"/" ); + else request->path = wcsdup( L"/" ); }
if (status != HTTP_STATUS_REDIRECT_KEEP_VERB && !wcscmp( request->verb, L"POST" )) { free( request->verb ); - request->verb = strdupW( L"GET" ); + request->verb = wcsdup( L"GET" ); request->optional = NULL; request->optional_len = 0; } @@ -4659,12 +4659,12 @@ static HRESULT WINAPI winhttp_request_SetProxy( if (V_VT( &proxy_server ) == VT_BSTR) { free( request->proxy.lpszProxy ); - request->proxy.lpszProxy = strdupW( V_BSTR( &proxy_server ) ); + request->proxy.lpszProxy = wcsdup( V_BSTR( &proxy_server ) ); } if (V_VT( &bypass_list ) == VT_BSTR) { free( request->proxy.lpszProxyBypass ); - request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) ); + request->proxy.lpszProxyBypass = wcsdup( V_BSTR( &bypass_list ) ); } break;
@@ -4796,7 +4796,7 @@ static HRESULT WINAPI winhttp_request_Open( memcpy( path, uc.lpszUrlPath, (uc.dwUrlPathLength + uc.dwExtraInfoLength) * sizeof(WCHAR) ); path[uc.dwUrlPathLength + uc.dwExtraInfoLength] = 0;
- if (!(verb = strdupW( method ))) goto error; + if (!(verb = wcsdup( method ))) goto error; if (SUCCEEDED( VariantChangeType( &async, &async, 0, VT_BOOL )) && V_BOOL( &async )) request->async = TRUE; else request->async = FALSE;
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c index e95d24c1901..fa8ccd7a9de 100644 --- a/dlls/winhttp/session.c +++ b/dlls/winhttp/session.c @@ -322,20 +322,20 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST InitializeCriticalSection( &session->cs ); session->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": session.cs");
- if (agent && !(session->agent = strdupW( agent ))) goto end; + if (agent && !(session->agent = wcsdup( agent ))) goto end; if (access == WINHTTP_ACCESS_TYPE_DEFAULT_PROXY) { WINHTTP_PROXY_INFO info;
WinHttpGetDefaultProxyConfiguration( &info ); session->access = info.dwAccessType; - if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy ))) + if (info.lpszProxy && !(session->proxy_server = wcsdup( info.lpszProxy ))) { GlobalFree( info.lpszProxy ); GlobalFree( info.lpszProxyBypass ); goto end; } - if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass ))) + if (info.lpszProxyBypass && !(session->proxy_bypass = wcsdup( info.lpszProxyBypass ))) { GlobalFree( info.lpszProxy ); GlobalFree( info.lpszProxyBypass ); @@ -345,8 +345,8 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST else if (access == WINHTTP_ACCESS_TYPE_NAMED_PROXY) { session->access = access; - if (proxy && !(session->proxy_server = strdupW( proxy ))) goto end; - if (bypass && !(session->proxy_bypass = strdupW( bypass ))) goto end; + if (proxy && !(session->proxy_server = wcsdup( proxy ))) goto end; + if (bypass && !(session->proxy_bypass = wcsdup( bypass ))) goto end; }
handle = alloc_handle( &session->hdr ); @@ -556,7 +556,7 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE { free( connect->servername ); connect->resolved = FALSE; - if (!(connect->servername = strdupW( session->proxy_server ))) + if (!(connect->servername = wcsdup( session->proxy_server ))) { ret = FALSE; goto end; @@ -569,7 +569,7 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE { free( connect->servername ); connect->resolved = FALSE; - if (!(connect->servername = strdupW( server ))) + if (!(connect->servername = wcsdup( server ))) { ret = FALSE; goto end; @@ -624,7 +624,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, const WCHAR *server, INTERN addref_object( &session->hdr ); connect->session = session;
- if (!(connect->hostname = strdupW( server ))) goto end; + if (!(connect->hostname = wcsdup( server ))) goto end; connect->hostport = port; if (!set_server_for_hostname( connect, server, port )) goto end;
@@ -1273,11 +1273,11 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, const WCHAR *verb, cons request->websocket_set_send_buffer_size = request->websocket_send_buffer_size;
if (!verb || !verb[0]) verb = L"GET"; - if (!(request->verb = strdupW( verb ))) goto end; + if (!(request->verb = wcsdup( verb ))) goto end; if (!(request->path = get_request_path( object ))) goto end;
if (!version || !version[0]) version = L"HTTP/1.1"; - if (!(request->version = strdupW( version ))) goto end; + if (!(request->version = wcsdup( version ))) goto end; if (!(add_accept_types_header( request, types ))) goto end;
if ((hrequest = alloc_handle( &request->hdr ))) diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h index 53947f73351..a6946d5e366 100644 --- a/dlls/winhttp/winhttp_private.h +++ b/dlls/winhttp/winhttp_private.h @@ -398,16 +398,6 @@ DWORD process_header( struct request *, const WCHAR *, const WCHAR *, DWORD, BOO extern HRESULT WinHttpRequest_create( void ** ) DECLSPEC_HIDDEN; void release_typelib( void ) DECLSPEC_HIDDEN;
-static inline WCHAR *strdupW( const WCHAR *src ) -{ - WCHAR *dst; - - if (!src) return NULL; - dst = malloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ); - if (dst) lstrcpyW( dst, src ); - return dst; -} - static inline WCHAR *strdupAW( const char *src ) { WCHAR *dst = NULL;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126530
Your paranoid android.
=== debian11 (32 bit report) ===
d3d8: stateblock: Timeout visual: Timeout
d3d9: d3d9ex: Timeout device: Timeout stateblock: Timeout visual: Timeout
d3dcompiler_43: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3dcompiler_46: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3dcompiler_47: asm: Timeout blob: Timeout hlsl_d3d11: Timeout hlsl_d3d9: Timeout reflection: Timeout
d3drm: d3drm: Timeout vector: Timeout
Report validation errors: d3dx10: Timeout
=== debian11 (build log) ===
WineRunWineTest.pl:error: The task timed out
This merge request was approved by Hans Leidekker.