WININET: convert unicode strings to const

Mike McCormack mike at codeweavers.com
Mon Apr 12 10:18:46 CDT 2004


ChangeLog:
* convert unicode strings to const
-------------- next part --------------
Index: dlls/wininet/cookie.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/cookie.c,v
retrieving revision 1.5
diff -u -r1.5 cookie.c
--- dlls/wininet/cookie.c	30 Mar 2004 20:38:08 -0000	1.5
+++ dlls/wininet/cookie.c	12 Apr 2004 14:22:29 -0000
@@ -343,11 +343,11 @@
      * It'd be nice to know what exactly is going on, M$ tracking users? Does this need
      * to be unique? Should I generate a random number here? etc.
      */
-    WCHAR TrackingString[] = {
+    const WCHAR TrackingString[] = {
         'M','t','r','x','T','r','a','c','k','i','n','g','I','D','=',
         '0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5',
         '6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1', 0 };
-    WCHAR szps[] = { '%','s',0 };
+    const WCHAR szps[] = { '%','s',0 };
 
     TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName),
 	  lpCookieData, lpdwSize);
@@ -377,8 +377,8 @@
 	}
 	while (thisCookie)
 	{
-            WCHAR szsc[] = { ';',' ',0 };
-            WCHAR szpseq[] = { '%','s','=','%','s',0 };
+            const WCHAR szsc[] = { ';',' ',0 };
+            const WCHAR szpseq[] = { '%','s','=','%','s',0 };
             cnt += snprintfW(lpCookieData + cnt, *lpdwSize - cnt, szsc);
 	    cnt += snprintfW(lpCookieData + cnt, *lpdwSize - cnt, szpseq,
                             thisCookie->lpCookieName,
Index: dlls/wininet/dialogs.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/dialogs.c,v
retrieving revision 1.4
diff -u -r1.4 dialogs.c
--- dlls/wininet/dialogs.c	30 Mar 2004 04:36:09 -0000	1.4
+++ dlls/wininet/dialogs.c	12 Apr 2004 14:22:29 -0000
@@ -93,7 +93,7 @@
 {
     LPWSTR p, q;
     DWORD index;
-    WCHAR szRealm[] = { 'r','e','a','l','m','=',0 };
+    const WCHAR szRealm[] = { 'r','e','a','l','m','=',0 };
 
     /* extract the Realm from the proxy response and show it */
     index = 0;
@@ -136,7 +136,7 @@
     DWORD r, dwMagic = 19;
     UINT r_len, u_len;
     WORD sz;
-    WCHAR szColon[] = { ':',0 }, szbs[] = { '/', 0 };
+    const WCHAR szColon[] = { ':',0 }, szbs[] = { '/', 0 };
 
     hUserItem = GetDlgItem( hdlg, IDC_USERNAME );
     hPassItem = GetDlgItem( hdlg, IDC_PASSWORD );
Index: dlls/wininet/internet.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/internet.c,v
retrieving revision 1.80
diff -u -r1.80 internet.c
--- dlls/wininet/internet.c	30 Mar 2004 04:36:09 -0000	1.80
+++ dlls/wininet/internet.c	12 Apr 2004 14:22:30 -0000
@@ -342,7 +342,7 @@
     DWORD r, keytype, len, enabled;
     LPSTR lpszInternetSettings =
         "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
-    WCHAR szProxyServer[] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 };
+    const WCHAR szProxyServer[] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 };
 
     r = RegOpenKeyA(HKEY_CURRENT_USER, lpszInternetSettings, &key);
     if ( r != ERROR_SUCCESS )
@@ -361,7 +361,7 @@
         if( (r == ERROR_SUCCESS) && len && (keytype == REG_SZ) )
         {
             LPWSTR szProxy, p;
-            WCHAR szHttp[] = {'h','t','t','p','=',0};
+            const WCHAR szHttp[] = {'h','t','t','p','=',0};
 
             szProxy=HeapAlloc( GetProcessHeap(), 0, len );
             RegQueryValueExW( key, szProxyServer, NULL, &keytype,
@@ -1070,14 +1070,14 @@
 INTERNET_SCHEME GetInternetSchemeW(LPCWSTR lpszScheme, INT nMaxCmp)
 {
     INTERNET_SCHEME iScheme=INTERNET_SCHEME_UNKNOWN;
-    WCHAR lpszFtp[]={'f','t','p',0};
-    WCHAR lpszGopher[]={'g','o','p','h','e','r',0};
-    WCHAR lpszHttp[]={'h','t','t','p',0};
-    WCHAR lpszHttps[]={'h','t','t','p','s',0};
-    WCHAR lpszFile[]={'f','i','l','e',0};
-    WCHAR lpszNews[]={'n','e','w','s',0};
-    WCHAR lpszMailto[]={'m','a','i','l','t','o',0};
-    WCHAR lpszRes[]={'r','e','s',0};
+    const WCHAR lpszFtp[]={'f','t','p',0};
+    const WCHAR lpszGopher[]={'g','o','p','h','e','r',0};
+    const WCHAR lpszHttp[]={'h','t','t','p',0};
+    const WCHAR lpszHttps[]={'h','t','t','p','s',0};
+    const WCHAR lpszFile[]={'f','i','l','e',0};
+    const WCHAR lpszNews[]={'n','e','w','s',0};
+    const WCHAR lpszMailto[]={'m','a','i','l','t','o',0};
+    const WCHAR lpszRes[]={'r','e','s',0};
     WCHAR* tempBuffer=NULL;
     TRACE("\n");
     if(lpszScheme==NULL)
@@ -1155,8 +1155,8 @@
     BOOL  bIsAbsolute = FALSE;
     LPWSTR lpszap = (WCHAR*)lpszUrl;
     LPWSTR lpszcp = NULL;
-    WCHAR lpszSeparators[3]={';','?',0};
-    WCHAR lpszSlash[2]={'/',0};
+    const WCHAR lpszSeparators[3]={';','?',0};
+    const WCHAR lpszSlash[2]={'/',0};
     if(dwUrlLength==0)
         dwUrlLength=strlenW(lpszUrl);
 
@@ -1197,7 +1197,7 @@
     if (bIsAbsolute) /* Parse <protocol>:[//<net_loc>] */
     {
         LPWSTR lpszNetLoc;
-        WCHAR wszAbout[]={'a','b','o','u','t',':',0};
+        const WCHAR wszAbout[]={'a','b','o','u','t',':',0};
 
         /* Get scheme first. */
         lpUC->nScheme = GetInternetSchemeW(lpszUrl, lpszcp - lpszUrl);
@@ -1680,7 +1680,7 @@
             {
                 LPWININETHTTPREQW lpreq = (LPWININETHTTPREQW) lpwhh;
                 WCHAR url[1023];
-                WCHAR szFmt[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
+                const WCHAR szFmt[] = {'h','t','t','p',':','/','/','%','s','%','s',0};
 
                 sprintfW(url,szFmt,lpreq->lpszHostName,lpreq->lpszPath);
                 TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
@@ -2076,7 +2076,7 @@
 	
     case INTERNET_SCHEME_HTTP:
     case INTERNET_SCHEME_HTTPS: {
-	WCHAR szStars[] = { '*','/','*', 0 };
+	const WCHAR szStars[] = { '*','/','*', 0 };
 	LPCWSTR accept[2] = { szStars, NULL };
 	if(urlComponents.nPort == 0) {
 	    if(urlComponents.nScheme == INTERNET_SCHEME_HTTP)
-------------- next part --------------
Index: dlls/wininet/http.c
===================================================================
RCS file: /home/wine/wine/dlls/wininet/http.c,v
retrieving revision 1.56
diff -u -r1.56 http.c
--- dlls/wininet/http.c	31 Mar 2004 20:09:54 -0000	1.56
+++ dlls/wininet/http.c	12 Apr 2004 14:12:48 -0000
@@ -470,8 +470,8 @@
 {
     UINT len;
     LPWSTR in, out;
-    WCHAR szBasic[] = {'B','a','s','i','c',' ',0};
-    WCHAR szColon[] = {':',0};
+    const WCHAR szBasic[] = {'B','a','s','i','c',' ',0};
+    const WCHAR szColon[] = {':',0};
 
     len = lstrlenW( username ) + 1 + lstrlenW ( password ) + 1;
     in = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
@@ -504,7 +504,7 @@
 {
     HTTPHEADERW hdr;
     INT index;
-    WCHAR szProxyAuthorization[] = {
+    const WCHAR szProxyAuthorization[] = {
         'P','r','o','x','y','-','A','u','t','h','o','r','i','z','a','t','i','o','n',0 };
 
     hdr.lpszValue = HTTP_EncodeBasicAuth( username, password );
@@ -538,10 +538,9 @@
     WCHAR proxy[MAXHOSTNAME + 15]; /* 15 == "http://" + sizeof(port#) + ":/\0" */
     WCHAR* url, szNul[] = { 0 };
     URL_COMPONENTSW UrlComponents;
-    WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 }, szSlash[] = { '/',0 } ;
-    /*WCHAR szColon[] = { ':',0 }; */
-    WCHAR szFormat1[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 };
-    WCHAR szFormat2[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 };
+    const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 }, szSlash[] = { '/',0 } ;
+    const WCHAR szFormat1[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 };
+    const WCHAR szFormat2[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 };
     int len;
 
     memset( &UrlComponents, 0, sizeof UrlComponents );
@@ -607,7 +606,7 @@
     LPWSTR lpszUrl = NULL;
     DWORD nCookieSize;
     HINTERNET handle;
-    WCHAR szUrlForm[] = {'h','t','t','p',':','/','/','%','s',0};
+    const WCHAR szUrlForm[] = {'h','t','t','p',':','/','/','%','s',0};
     DWORD len;
 
     TRACE("--> \n");
@@ -670,7 +669,7 @@
 
     if (NULL == lpszVerb)
     {
-        WCHAR szGet[] = {'G','E','T',0};
+        const WCHAR szGet[] = {'G','E','T',0};
         lpwhr->lpszVerb = WININET_strdupW(szGet);
     }
     else if (strlenW(lpszVerb))
@@ -698,7 +697,7 @@
     if (hIC->lpszAgent)
     {
         WCHAR *agent_header;
-        WCHAR user_agent[] = {'U','s','e','r','-','A','g','e','n','t',':',' ','%','s','\r','\n',0 };
+        const WCHAR user_agent[] = {'U','s','e','r','-','A','g','e','n','t',':',' ','%','s','\r','\n',0 };
 
         len = strlenW(hIC->lpszAgent) + strlenW(user_agent);
         agent_header = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
@@ -716,8 +715,8 @@
     if (InternetGetCookieW(lpszUrl, NULL, NULL, &nCookieSize))
     {
         int cnt = 0;
-        WCHAR szCookie[] = {'C','o','o','k','i','e',':',' ',0};
-        WCHAR szcrlf[] = {'\r','\n',0};
+        const WCHAR szCookie[] = {'C','o','o','k','i','e',':',' ',0};
+        const WCHAR szcrlf[] = {'\r','\n',0};
 
         lpszCookies = HeapAlloc(GetProcessHeap(), 0, (nCookieSize + 1 + 8)*sizeof(WCHAR));
 
@@ -789,9 +788,9 @@
     LPHTTPHEADERW lphttpHdr = NULL;
     BOOL bSuccess = FALSE;
     LPWININETHTTPREQW lpwhr;
-    WCHAR szFmt[] = { '%','s',':',' ','%','s','%','s',0 };
-    WCHAR szcrlf[] = { '\r','\n',0 };
-    WCHAR sznul[] = { 0 };
+    const WCHAR szFmt[] = { '%','s',':',' ','%','s','%','s',0 };
+    const WCHAR szcrlf[] = { '\r','\n',0 };
+    const WCHAR sznul[] = { 0 };
 
     if (TRACE_ON(wininet)) {
 #define FE(x) { x, #x }
@@ -1419,12 +1418,12 @@
 
     do
     {
-        WCHAR szSlash[] = { '/',0 };
-        WCHAR szSpace[] = { ' ',0 };
-        WCHAR szHttp[] = { 'h','t','t','p',':','/','/', 0 };
-	WCHAR szcrlf[] = {'\r','\n', 0};
-	WCHAR sztwocrlf[] = {'\r','\n','\r','\n', 0};
-        WCHAR szSetCookie[] = {'S','e','t','-','C','o','o','k','i','e',0 };
+        const WCHAR szSlash[] = { '/',0 };
+        const WCHAR szSpace[] = { ' ',0 };
+        const WCHAR szHttp[] = { 'h','t','t','p',':','/','/', 0 };
+	const WCHAR szcrlf[] = {'\r','\n', 0};
+	const WCHAR sztwocrlf[] = {'\r','\n','\r','\n', 0};
+        const WCHAR szSetCookie[] = {'S','e','t','-','C','o','o','k','i','e',0 };
 
         TRACE("Going to url %s %s\n", debugstr_w(lpwhr->lpszHostName), debugstr_w(lpwhr->lpszPath));
         loop_next = FALSE;
@@ -1540,7 +1539,7 @@
         {
             if (lpwhr->StdHeaders[i].wFlags & HDR_ISREQUEST)
             {
-                WCHAR szFmt[] = { '\r','\n','%','s',':',' ','%','s', 0};
+                const WCHAR szFmt[] = { '\r','\n','%','s',':',' ','%','s', 0};
                 cnt += sprintfW(requestString + cnt, szFmt,
                                lpwhr->StdHeaders[i].lpszField, lpwhr->StdHeaders[i].lpszValue);
                 TRACE("Adding header %s (%s)\n",
@@ -1554,7 +1553,7 @@
         {
             if (lpwhr->pCustHeaders[i].wFlags & HDR_ISREQUEST)
             {
-                WCHAR szFmt[] = { '\r','\n','%','s',':',' ','%','s', 0};
+                const WCHAR szFmt[] = { '\r','\n','%','s',':',' ','%','s', 0};
                 cnt += sprintfW(requestString + cnt, szFmt,
                                lpwhr->pCustHeaders[i].lpszField, lpwhr->pCustHeaders[i].lpszValue);
                 TRACE("Adding custom header %s (%s)\n",
@@ -1565,7 +1564,7 @@
 
         if (lpwhr->lpszHostName)
         {
-            WCHAR szFmt[] = { '%','s','%','s',0 };
+            const WCHAR szFmt[] = { '%','s','%','s',0 };
             cnt += sprintfW(requestString + cnt, szFmt, HTTPHOSTHEADER, lpwhr->lpszHostName);
         }
 
@@ -1658,7 +1657,7 @@
         {
             LPHTTPHEADERW setCookieHeader;
             int nPosStart = 0, nPosEnd = 0, len;
-            WCHAR szFmt[] = { 'h','t','t','p',':','/','/','%','s','/',0};
+            const WCHAR szFmt[] = { 'h','t','t','p',':','/','/','%','s','/',0};
 
             setCookieHeader = &lpwhr->pCustHeaders[CustHeaderIndex];
 
@@ -1678,7 +1677,7 @@
                     /* fixme: not case sensitive, strcasestr is gnu only */
                     int nDomainPosEnd = 0;
                     int nDomainPosStart = 0, nDomainLength = 0;
-                    WCHAR szDomain[] = {'d','o','m','a','i','n','=',0};
+                    const WCHAR szDomain[] = {'d','o','m','a','i','n','=',0};
                     LPWSTR lpszDomain = strstrW(&setCookieHeader->lpszValue[nPosEnd], szDomain);
                     if (lpszDomain)
                     { /* they have specified their own domain, lets use it */
@@ -1952,8 +1951,8 @@
     BOOL bSuccess = FALSE;
     INT  rc = 0;
     WCHAR value[MAX_FIELD_VALUE_LEN], field[MAX_FIELD_LEN];
-    WCHAR szStatus[] = {'S','t','a','t','u','s',0};
-    WCHAR szHttp[] = { 'H','T','T','P',0 };
+    const WCHAR szStatus[] = {'S','t','a','t','u','s',0};
+    const WCHAR szHttp[] = { 'H','T','T','P',0 };
     char bufferA[MAX_REPLY_LEN];
 
     TRACE("-->\n");
@@ -2087,32 +2086,32 @@
 INT HTTP_GetStdHeaderIndex(LPCWSTR lpszField)
 {
     INT index = -1;
-    WCHAR szContentLength[] = {
+    const WCHAR szContentLength[] = {
        'C','o','n','t','e','n','t','-','L','e','n','g','t','h',0};
-    WCHAR szStatus[] = {'S','t','a','t','u','s',0};
-    WCHAR szContentType[] = {
+    const WCHAR szStatus[] = {'S','t','a','t','u','s',0};
+    const WCHAR szContentType[] = {
        'C','o','n','t','e','n','t','-','T','y','p','e',0};
-    WCHAR szLastModified[] = {
+    const WCHAR szLastModified[] = {
        'L','a','s','t','-','M','o','d','i','f','i','e','d',0};
-    WCHAR szLocation[] = {'L','o','c','a','t','i','o','n',0};
-    WCHAR szAccept[] = {'A','c','c','e','p','t',0};
-    WCHAR szReferer[] = { 'R','e','f','e','r','e','r',0};
-    WCHAR szContentTrans[] = { 'C','o','n','t','e','n','t','-',
+    const WCHAR szLocation[] = {'L','o','c','a','t','i','o','n',0};
+    const WCHAR szAccept[] = {'A','c','c','e','p','t',0};
+    const WCHAR szReferer[] = { 'R','e','f','e','r','e','r',0};
+    const WCHAR szContentTrans[] = { 'C','o','n','t','e','n','t','-',
        'T','r','a','n','s','f','e','r','-','E','n','c','o','d','i','n','g',0};
-    WCHAR szDate[] = { 'D','a','t','e',0};
-    WCHAR szServer[] = { 'S','e','r','v','e','r',0};
-    WCHAR szConnection[] = { 'C','o','n','n','e','c','t','i','o','n',0};
-    WCHAR szETag[] = { 'E','T','a','g',0};
-    WCHAR szAcceptRanges[] = {
+    const WCHAR szDate[] = { 'D','a','t','e',0};
+    const WCHAR szServer[] = { 'S','e','r','v','e','r',0};
+    const WCHAR szConnection[] = { 'C','o','n','n','e','c','t','i','o','n',0};
+    const WCHAR szETag[] = { 'E','T','a','g',0};
+    const WCHAR szAcceptRanges[] = {
        'A','c','c','e','p','t','-','R','a','n','g','e','s',0 };
-    WCHAR szExpires[] = { 'E','x','p','i','r','e','s',0 };
-    WCHAR szMimeVersion[] = {
+    const WCHAR szExpires[] = { 'E','x','p','i','r','e','s',0 };
+    const WCHAR szMimeVersion[] = {
        'M','i','m','e','-','V','e','r','s','i','o','n', 0};
-    WCHAR szPragma[] = { 'P','r','a','g','m','a', 0};
-    WCHAR szCacheControl[] = {
+    const WCHAR szPragma[] = { 'P','r','a','g','m','a', 0};
+    const WCHAR szCacheControl[] = {
        'C','a','c','h','e','-','C','o','n','t','r','o','l',0};
-    WCHAR szUserAgent[] = { 'U','s','e','r','-','A','g','e','n','t',0};
-    WCHAR szProxyAuth[] = {
+    const WCHAR szUserAgent[] = { 'U','s','e','r','-','A','g','e','n','t',0};
+    const WCHAR szProxyAuth[] = {
        'P','r','o','x','y','-',
        'A','u','t','h','e','n','t','i','c','a','t','e', 0};
 


More information about the wine-patches mailing list