winhttp: Make strings in WINHTTP_PROXY_INFO non-const.

This commit is contained in:
Heiko Hund 2012-07-19 08:22:59 +00:00 committed by Alexandre Julliard
parent 24a690e90e
commit 1ba968821a
5 changed files with 22 additions and 22 deletions

View File

@ -2238,8 +2238,8 @@ static void free_request( struct winhttp_request *request )
CloseHandle( request->thread ); CloseHandle( request->thread );
CloseHandle( request->wait ); CloseHandle( request->wait );
CloseHandle( request->cancel ); CloseHandle( request->cancel );
heap_free( (WCHAR *)request->proxy.lpszProxy ); heap_free( request->proxy.lpszProxy );
heap_free( (WCHAR *)request->proxy.lpszProxyBypass ); heap_free( request->proxy.lpszProxyBypass );
heap_free( request->buffer ); heap_free( request->buffer );
heap_free( request->verb ); heap_free( request->verb );
VariantClear( &request->data ); VariantClear( &request->data );
@ -2430,16 +2430,16 @@ static HRESULT WINAPI winhttp_request_SetProxy(
{ {
case HTTPREQUEST_PROXYSETTING_DEFAULT: case HTTPREQUEST_PROXYSETTING_DEFAULT:
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY; request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
heap_free( (WCHAR *)request->proxy.lpszProxy ); heap_free( request->proxy.lpszProxy );
heap_free( (WCHAR *)request->proxy.lpszProxyBypass ); heap_free( request->proxy.lpszProxyBypass );
request->proxy.lpszProxy = NULL; request->proxy.lpszProxy = NULL;
request->proxy.lpszProxyBypass = NULL; request->proxy.lpszProxyBypass = NULL;
break; break;
case HTTPREQUEST_PROXYSETTING_DIRECT: case HTTPREQUEST_PROXYSETTING_DIRECT:
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY; request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
heap_free( (WCHAR *)request->proxy.lpszProxy ); heap_free( request->proxy.lpszProxy );
heap_free( (WCHAR *)request->proxy.lpszProxyBypass ); heap_free( request->proxy.lpszProxyBypass );
request->proxy.lpszProxy = NULL; request->proxy.lpszProxy = NULL;
request->proxy.lpszProxyBypass = NULL; request->proxy.lpszProxyBypass = NULL;
break; break;
@ -2448,12 +2448,12 @@ static HRESULT WINAPI winhttp_request_SetProxy(
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY; request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
if (V_VT( &proxy_server ) == VT_BSTR) if (V_VT( &proxy_server ) == VT_BSTR)
{ {
heap_free( (WCHAR *)request->proxy.lpszProxy ); heap_free( request->proxy.lpszProxy );
request->proxy.lpszProxy = strdupW( V_BSTR( &proxy_server ) ); request->proxy.lpszProxy = strdupW( V_BSTR( &proxy_server ) );
} }
if (V_VT( &bypass_list ) == VT_BSTR) if (V_VT( &bypass_list ) == VT_BSTR)
{ {
heap_free( (WCHAR *)request->proxy.lpszProxyBypass ); heap_free( request->proxy.lpszProxyBypass );
request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) ); request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) );
} }
break; break;

View File

@ -229,14 +229,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST
session->access = info.dwAccessType; session->access = info.dwAccessType;
if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy ))) if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy )))
{ {
GlobalFree( (LPWSTR)info.lpszProxy ); GlobalFree( info.lpszProxy );
GlobalFree( (LPWSTR)info.lpszProxyBypass ); GlobalFree( info.lpszProxyBypass );
goto end; goto end;
} }
if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass ))) if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass )))
{ {
GlobalFree( (LPWSTR)info.lpszProxy ); GlobalFree( info.lpszProxy );
GlobalFree( (LPWSTR)info.lpszProxyBypass ); GlobalFree( info.lpszProxyBypass );
goto end; goto end;
} }
} }

View File

@ -68,9 +68,9 @@ static BOOL proxy_active(void)
{ {
active = (proxy_info.lpszProxy != NULL); active = (proxy_info.lpszProxy != NULL);
if (active) if (active)
GlobalFree((HGLOBAL) proxy_info.lpszProxy); GlobalFree(proxy_info.lpszProxy);
if (proxy_info.lpszProxyBypass != NULL) if (proxy_info.lpszProxyBypass != NULL)
GlobalFree((HGLOBAL) proxy_info.lpszProxyBypass); GlobalFree(proxy_info.lpszProxyBypass);
} }
else else
active = FALSE; active = FALSE;

View File

@ -46,9 +46,9 @@ static BOOL proxy_active(void)
{ {
active = (proxy_info.lpszProxy != NULL); active = (proxy_info.lpszProxy != NULL);
if (active) if (active)
GlobalFree((HGLOBAL) proxy_info.lpszProxy); GlobalFree(proxy_info.lpszProxy);
if (proxy_info.lpszProxyBypass != NULL) if (proxy_info.lpszProxyBypass != NULL)
GlobalFree((HGLOBAL) proxy_info.lpszProxyBypass); GlobalFree(proxy_info.lpszProxyBypass);
} }
else else
active = FALSE; active = FALSE;
@ -1005,8 +1005,8 @@ static void set_default_proxy_reg_value( BYTE *buf, DWORD len, DWORD type )
static void test_set_default_proxy_config(void) static void test_set_default_proxy_config(void)
{ {
static const WCHAR wideString[] = { 0x226f, 0x575b, 0 }; static WCHAR wideString[] = { 0x226f, 0x575b, 0 };
static const WCHAR normalString[] = { 'f','o','o',0 }; static WCHAR normalString[] = { 'f','o','o',0 };
DWORD type, len; DWORD type, len;
BYTE *saved_proxy_settings = NULL; BYTE *saved_proxy_settings = NULL;
WINHTTP_PROXY_INFO info; WINHTTP_PROXY_INFO info;
@ -2699,8 +2699,8 @@ static void test_WinHttpGetProxyForUrl(void)
trace("%u\n", info.dwAccessType); trace("%u\n", info.dwAccessType);
trace("%s\n", wine_dbgstr_w(info.lpszProxy)); trace("%s\n", wine_dbgstr_w(info.lpszProxy));
trace("%s\n", wine_dbgstr_w(info.lpszProxyBypass)); trace("%s\n", wine_dbgstr_w(info.lpszProxyBypass));
GlobalFree( (WCHAR *)info.lpszProxy ); GlobalFree( info.lpszProxy );
GlobalFree( (WCHAR *)info.lpszProxyBypass ); GlobalFree( info.lpszProxyBypass );
} }
WinHttpCloseHandle( session ); WinHttpCloseHandle( session );
} }

View File

@ -487,8 +487,8 @@ typedef struct
typedef struct typedef struct
{ {
DWORD dwAccessType; DWORD dwAccessType;
LPCWSTR lpszProxy; LPWSTR lpszProxy;
LPCWSTR lpszProxyBypass; LPWSTR lpszProxyBypass;
} WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO; } WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO;
typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW; typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW; typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;