Heiko Hund : winhttp: Make strings in WINHTTP_PROXY_INFO non-const.

Alexandre Julliard julliard at winehq.org
Thu Jul 19 13:23:43 CDT 2012


Module: wine
Branch: master
Commit: 1ba968821a45fe1d590bd3bf8c6b97eb1f0c8a12
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1ba968821a45fe1d590bd3bf8c6b97eb1f0c8a12

Author: Heiko Hund <heiko.hund at sophos.com>
Date:   Thu Jul 19 08:22:59 2012 +0000

winhttp: Make strings in WINHTTP_PROXY_INFO non-const.

---

 dlls/winhttp/request.c            |   16 ++++++++--------
 dlls/winhttp/session.c            |    8 ++++----
 dlls/winhttp/tests/notification.c |    4 ++--
 dlls/winhttp/tests/winhttp.c      |   12 ++++++------
 include/winhttp.h                 |    4 ++--
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 8870e50..8109290 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -2238,8 +2238,8 @@ static void free_request( struct winhttp_request *request )
     CloseHandle( request->thread );
     CloseHandle( request->wait );
     CloseHandle( request->cancel );
-    heap_free( (WCHAR *)request->proxy.lpszProxy );
-    heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
+    heap_free( request->proxy.lpszProxy );
+    heap_free( request->proxy.lpszProxyBypass );
     heap_free( request->buffer );
     heap_free( request->verb );
     VariantClear( &request->data );
@@ -2430,16 +2430,16 @@ static HRESULT WINAPI winhttp_request_SetProxy(
     {
     case HTTPREQUEST_PROXYSETTING_DEFAULT:
         request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
-        heap_free( (WCHAR *)request->proxy.lpszProxy );
-        heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
+        heap_free( request->proxy.lpszProxy );
+        heap_free( request->proxy.lpszProxyBypass );
         request->proxy.lpszProxy = NULL;
         request->proxy.lpszProxyBypass = NULL;
         break;
 
     case HTTPREQUEST_PROXYSETTING_DIRECT:
         request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
-        heap_free( (WCHAR *)request->proxy.lpszProxy );
-        heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
+        heap_free( request->proxy.lpszProxy );
+        heap_free( request->proxy.lpszProxyBypass );
         request->proxy.lpszProxy = NULL;
         request->proxy.lpszProxyBypass = NULL;
         break;
@@ -2448,12 +2448,12 @@ static HRESULT WINAPI winhttp_request_SetProxy(
         request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
         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 ) );
         }
         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 ) );
         }
         break;
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index b4a46e0..e3e5e2b 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -229,14 +229,14 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST
         session->access = info.dwAccessType;
         if (info.lpszProxy && !(session->proxy_server = strdupW( info.lpszProxy )))
         {
-            GlobalFree( (LPWSTR)info.lpszProxy );
-            GlobalFree( (LPWSTR)info.lpszProxyBypass );
+            GlobalFree( info.lpszProxy );
+            GlobalFree( info.lpszProxyBypass );
             goto end;
         }
         if (info.lpszProxyBypass && !(session->proxy_bypass = strdupW( info.lpszProxyBypass )))
         {
-            GlobalFree( (LPWSTR)info.lpszProxy );
-            GlobalFree( (LPWSTR)info.lpszProxyBypass );
+            GlobalFree( info.lpszProxy );
+            GlobalFree( info.lpszProxyBypass );
             goto end;
         }
     }
diff --git a/dlls/winhttp/tests/notification.c b/dlls/winhttp/tests/notification.c
index 84a3569..8ef2115 100644
--- a/dlls/winhttp/tests/notification.c
+++ b/dlls/winhttp/tests/notification.c
@@ -68,9 +68,9 @@ static BOOL proxy_active(void)
     {
         active = (proxy_info.lpszProxy != NULL);
         if (active)
-            GlobalFree((HGLOBAL) proxy_info.lpszProxy);
+            GlobalFree(proxy_info.lpszProxy);
         if (proxy_info.lpszProxyBypass != NULL)
-            GlobalFree((HGLOBAL) proxy_info.lpszProxyBypass);
+            GlobalFree(proxy_info.lpszProxyBypass);
     }
     else
        active = FALSE;
diff --git a/dlls/winhttp/tests/winhttp.c b/dlls/winhttp/tests/winhttp.c
index 9d75dbf..3bc686f 100644
--- a/dlls/winhttp/tests/winhttp.c
+++ b/dlls/winhttp/tests/winhttp.c
@@ -46,9 +46,9 @@ static BOOL proxy_active(void)
     {
         active = (proxy_info.lpszProxy != NULL);
         if (active)
-            GlobalFree((HGLOBAL) proxy_info.lpszProxy);
+            GlobalFree(proxy_info.lpszProxy);
         if (proxy_info.lpszProxyBypass != NULL)
-            GlobalFree((HGLOBAL) proxy_info.lpszProxyBypass);
+            GlobalFree(proxy_info.lpszProxyBypass);
     }
     else
        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 const WCHAR wideString[] = { 0x226f, 0x575b, 0 };
-    static const WCHAR normalString[] = { 'f','o','o',0 };
+    static WCHAR wideString[] = { 0x226f, 0x575b, 0 };
+    static WCHAR normalString[] = { 'f','o','o',0 };
     DWORD type, len;
     BYTE *saved_proxy_settings = NULL;
     WINHTTP_PROXY_INFO info;
@@ -2699,8 +2699,8 @@ static void test_WinHttpGetProxyForUrl(void)
         trace("%u\n", info.dwAccessType);
         trace("%s\n", wine_dbgstr_w(info.lpszProxy));
         trace("%s\n", wine_dbgstr_w(info.lpszProxyBypass));
-        GlobalFree( (WCHAR *)info.lpszProxy );
-        GlobalFree( (WCHAR *)info.lpszProxyBypass );
+        GlobalFree( info.lpszProxy );
+        GlobalFree( info.lpszProxyBypass );
     }
     WinHttpCloseHandle( session );
 }
diff --git a/include/winhttp.h b/include/winhttp.h
index b54bd92..cf0da83 100644
--- a/include/winhttp.h
+++ b/include/winhttp.h
@@ -487,8 +487,8 @@ typedef struct
 typedef struct
 {
     DWORD dwAccessType;
-    LPCWSTR lpszProxy;
-    LPCWSTR lpszProxyBypass;
+    LPWSTR lpszProxy;
+    LPWSTR lpszProxyBypass;
 } WINHTTP_PROXY_INFO, *LPWINHTTP_PROXY_INFO;
 typedef WINHTTP_PROXY_INFO WINHTTP_PROXY_INFOW;
 typedef LPWINHTTP_PROXY_INFO LPWINHTTP_PROXY_INFOW;




More information about the wine-cvs mailing list