Make Unicode strings 'static const' (part 3)

Francois Gouget fgouget at free.fr
Mon Apr 19 09:04:31 CDT 2004


And finally, this part makes tht basic 'WCHAR xxx[]={...};' Unicode
strings declarations by making them both static and const.

As for the previous patch it's important to check that the function does
not actually try to write to these strings. And indeed there are a few
cases where the function modifies the string, typically to change the
drive letter in strings like 'A:\'.


Changelog:

 * dlls/advapi32/security.c
   dlls/comctl32/comboex.c
   dlls/comctl32/comctl32undoc.c
   dlls/comctl32/ipaddress.c
   dlls/comctl32/listview.c
   dlls/comctl32/trackbar.c
   dlls/comctl32/treeview.c
   dlls/commdlg/filedlg.c
   dlls/dxerr8/dxerr8.c
   dlls/dxerr9/dxerr9.c
   dlls/gdi/freetype.c
   dlls/kernel/tests/file.c
   dlls/kernel/tests/format_msg.c
   dlls/ntdll/tests/rtlstr.c
   dlls/ole32/antimoniker.c
   dlls/ole32/filemoniker.c
   dlls/ole32/storage32.c
   dlls/oleaut32/olefont.c
   dlls/oleaut32/typelib.c
   dlls/quartz/filesource.c
   dlls/setupapi/diskspace.c
   dlls/shell32/shell32_main.c
   dlls/shell32/shlfileop.c
   dlls/shlwapi/reg.c
   dlls/shlwapi/string.c
   dlls/shlwapi/url.c
   dlls/urlmon/umon.c
   dlls/user/tests/class.c
   dlls/uxtheme/msstyles.c
   dlls/uxtheme/system.c
   windows/dialog.c

   Make Unicode strings static const.


Index: dlls/advapi32/security.c
===================================================================
RCS file: /var/cvs/wine/dlls/advapi32/security.c,v
retrieving revision 1.64
diff -u -r1.64 security.c
--- a/dlls/advapi32/security.c	27 Jan 2004 00:01:44 -0000	1.64
+++ b/dlls/advapi32/security.c	18 Apr 2004 12:48:58 -0000
@@ -1193,7 +1193,7 @@
                KEY_READ, &key)) == ERROR_SUCCESS)
               {
                   DWORD size = 0;
-                  WCHAR wg[] = { 'W','o','r','k','g','r','o','u','p',0 };
+                  static const WCHAR wg[] = { 'W','o','r','k','g','r','o','u','p',0 };

                   ret = RegQueryValueExW(key, wg, NULL, NULL, NULL, &size);
                   if (ret == ERROR_MORE_DATA || ret == ERROR_SUCCESS)
Index: dlls/comctl32/comboex.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/comboex.c,v
retrieving revision 1.69
diff -u -r1.69 comboex.c
--- a/dlls/comctl32/comboex.c	11 Mar 2004 00:39:53 -0000	1.69
+++ b/dlls/comctl32/comboex.c	18 Apr 2004 12:49:31 -0000
@@ -915,9 +915,9 @@

 static LRESULT COMBOEX_Create (HWND hwnd, LPCREATESTRUCTA cs)
 {
-    WCHAR COMBOBOX[] = { 'C', 'o', 'm', 'b', 'o', 'B', 'o', 'x', 0 };
-    WCHAR EDIT[] = { 'E', 'D', 'I', 'T', 0 };
-    WCHAR NIL[] = { 0 };
+    static const WCHAR COMBOBOX[] = { 'C', 'o', 'm', 'b', 'o', 'B', 'o', 'x', 0 };
+    static const WCHAR EDIT[] = { 'E', 'D', 'I', 'T', 0 };
+    static const WCHAR NIL[] = { 0 };
     COMBOEX_INFO *infoPtr;
     LOGFONTW mylogfont;
     RECT wnrc1, clrc1, cmbwrc;
@@ -1281,7 +1281,7 @@

 static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
 {
-    WCHAR nil[] = { 0 };
+    static const WCHAR nil[] = { 0 };
     CBE_ITEMDATA *item = 0;
     SIZE txtsize;
     RECT rect;
Index: dlls/comctl32/comctl32undoc.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/comctl32undoc.c,v
retrieving revision 1.91
diff -u -r1.91 comctl32undoc.c
--- a/dlls/comctl32/comctl32undoc.c	17 Feb 2004 22:47:21 -0000	1.91
+++ b/dlls/comctl32/comctl32undoc.c	18 Apr 2004 12:49:59 -0000
@@ -523,7 +523,7 @@
     HKEY newkey;
     WCHAR realname[2];
     LPWINEMRUITEM witem;
-    WCHAR emptyW[] = {'\0'};
+    static const WCHAR emptyW[] = {'\0'};

     /* or should we do the following instead of RegOpenKeyEx:
      */
@@ -859,7 +859,7 @@
     WCHAR realname[2];
     LPWINEMRUITEM witem;
     DWORD type;
-    WCHAR emptyW[] = {'\0'};
+    static const WCHAR emptyW[] = {'\0'};

     /* get space to save indices that will turn into names
      * but in order of most to least recently used
Index: dlls/comctl32/ipaddress.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/ipaddress.c,v
retrieving revision 1.36
diff -u -r1.36 ipaddress.c
--- a/dlls/comctl32/ipaddress.c	11 Mar 2004 00:39:53 -0000	1.36
+++ b/dlls/comctl32/ipaddress.c	17 Apr 2004 21:15:38 -0000
@@ -155,7 +155,7 @@
     IPADDRESS_INFO *infoPtr;
     RECT rcClient, edit;
     int i, fieldsize;
-    WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };
+    static const WCHAR EDIT[] = { 'E', 'd', 'i', 't', 0 };

     TRACE("\n");

@@ -291,7 +291,8 @@

 static LRESULT IPADDRESS_SetAddress (IPADDRESS_INFO *infoPtr, DWORD ip_address)
 {
-    WCHAR buf[20], fmt[] = { '%', 'd', 0 };
+    WCHAR buf[20];
+    static const WCHAR fmt[] = { '%', 'd', 0 };
     int i;

     TRACE("\n");
@@ -328,7 +329,8 @@
 static BOOL IPADDRESS_ConstrainField (IPADDRESS_INFO *infoPtr, int currentfield)
 {
     IPPART_INFO *part = &infoPtr->Part[currentfield];
-    WCHAR field[10], fmt[] = { '%', 'd', 0 };
+    WCHAR field[10];
+    static const WCHAR fmt[] = { '%', 'd', 0 };
     int curValue, newValue;

     TRACE("(currentfield=%d)\n", currentfield);
Index: dlls/comctl32/listview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/listview.c,v
retrieving revision 1.385
diff -u -r1.385 listview.c
--- a/dlls/comctl32/listview.c	11 Mar 2004 00:39:53 -0000	1.385
+++ b/dlls/comctl32/listview.c	17 Apr 2004 21:15:38 -0000
@@ -3552,7 +3552,7 @@
 {
     UINT uFormat, uView = infoPtr->dwStyle & LVS_TYPEMASK;
     WCHAR szDispText[DISP_TEXT_SIZE] = { '\0' };
-    WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
+    static const WCHAR szCallback[] = { '(', 'c', 'a', 'l', 'l', 'b', 'a', 'c', 'k', ')', 0 };
     DWORD cdsubitemmode = CDRF_DODEFAULT;
     RECT* lprcFocus, rcSelect, rcBox, rcState, rcIcon, rcLabel;
     NMLVCUSTOMDRAW nmlvcd;
Index: dlls/comctl32/trackbar.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/trackbar.c,v
retrieving revision 1.58
diff -u -r1.58 trackbar.c
--- a/dlls/comctl32/trackbar.c	30 Dec 2003 19:10:15 -0000	1.58
+++ b/dlls/comctl32/trackbar.c	17 Apr 2004 21:15:38 -0000
@@ -728,7 +728,8 @@
 TRACKBAR_UpdateToolTip (TRACKBAR_INFO *infoPtr)
 {
     DWORD dwStyle = GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE);
-    WCHAR buf[80], fmt[] = { '%', 'l', 'd', 0 };
+    WCHAR buf[80];
+    static const WCHAR fmt[] = { '%', 'l', 'd', 0 };
     TTTOOLINFOW ti;
     POINT pt;
     RECT rcClient;
Index: dlls/comctl32/treeview.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/treeview.c,v
retrieving revision 1.146
diff -u -r1.146 treeview.c
--- a/dlls/comctl32/treeview.c	14 Apr 2004 04:27:59 -0000	1.146
+++ b/dlls/comctl32/treeview.c	17 Apr 2004 21:15:38 -0000
@@ -3467,7 +3467,7 @@
     HDC hdc;
     HFONT hOldFont=0;
     TEXTMETRICW textMetric;
-    WCHAR EditW[] = {'E','d','i','t',0};
+    static const WCHAR EditW[] = {'E','d','i','t',0};

     TRACE("%x %p\n", (unsigned)hwnd, hItem);
     if (!TREEVIEW_ValidItem(infoPtr, editItem))
Index: dlls/commdlg/filedlg.c
===================================================================
RCS file: /var/cvs/wine/dlls/commdlg/filedlg.c,v
retrieving revision 1.76
diff -u -r1.76 filedlg.c
--- a/dlls/commdlg/filedlg.c	12 Apr 2004 22:03:55 -0000	1.76
+++ b/dlls/commdlg/filedlg.c	18 Apr 2004 14:08:26 -0000
@@ -1016,8 +1016,8 @@
   int win98plus   = 0;
   int handledPath = FALSE;
   OSVERSIONINFOA osVi;
-  const WCHAR szwSlash[] = { '\\', 0 };
-  const WCHAR szwStar[] = { '*',0 };
+  static const WCHAR szwSlash[] = { '\\', 0 };
+  static const WCHAR szwStar[] = { '*',0 };

   TBBUTTON tbb[] =
   {
@@ -1539,7 +1539,7 @@
         WCHAR lpstrNotFound[100];
         WCHAR lpstrMsg[100];
         WCHAR tmp[400];
-        WCHAR nl[] = {'\n',0};
+        static const WCHAR nl[] = {'\n',0};

         LoadStringW(COMDLG32_hInstance, IDS_FILENOTFOUND, lpstrNotFound, 100);
         LoadStringW(COMDLG32_hInstance, IDS_VERIFYFILE, lpstrMsg, 100);
@@ -1717,7 +1717,7 @@
   {
     LPWSTR lpszTemp, lpszTemp1;
     LPITEMIDLIST pidl = NULL;
-    WCHAR szwInvalid[] = { '/',':','<','>','|', 0};
+    static const WCHAR szwInvalid[] = { '/',':','<','>','|', 0};

     /* check for invalid chars */
     if((strpbrkW(lpstrPathAndFile+3, szwInvalid) != NULL) && !(fodInfos->ofnInfos->Flags & OFN_NOVALIDATE))
@@ -1747,7 +1747,7 @@

       if(*lpszTemp==0)
       {
-        WCHAR wszWild[] = { '*', '?', 0 };
+        static const WCHAR wszWild[] = { '*', '?', 0 };
 	/* if the last element is a wildcard do a search */
         if(strpbrkW(lpszTemp1, wszWild) != NULL)
         {
@@ -1886,7 +1886,7 @@
 	    /* only add "." in case a default extension does exist */
 	    if (*fodInfos->defext != '\0')
 	    {
-                const WCHAR szwDot[] = {'.',0};
+                static const WCHAR szwDot[] = {'.',0};
 		int PathLength = strlenW(lpstrPathAndFile);

 	        strcatW(lpstrPathAndFile, szwDot);
@@ -3188,7 +3188,7 @@
           if ( FAILED( IShellBrowser_BrowseObject( fodInfos->Shell.FOIShellBrowser,
                          pidlSelection, SBSP_RELATIVE ) ) )
           {
-               WCHAR notexist[] = {'P','a','t','h',' ','d','o','e','s',
+               static const WCHAR notexist[] = {'P','a','t','h',' ','d','o','e','s',
                                    ' ','n','o','t',' ','e','x','i','s','t',0};
                MessageBoxW( hwnd, notexist, fodInfos->title, MB_OK | MB_ICONEXCLAMATION );
           }
Index: dlls/dxerr8/dxerr8.c
===================================================================
RCS file: /var/cvs/wine/dlls/dxerr8/dxerr8.c,v
retrieving revision 1.1
diff -u -r1.1 dxerr8.c
--- a/dlls/dxerr8/dxerr8.c	9 Mar 2004 23:25:57 -0000	1.1
+++ b/dlls/dxerr8/dxerr8.c	18 Apr 2004 13:56:53 -0000
@@ -133,22 +133,22 @@
     TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox);

     if (bPopMsgBox) {
-        WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n',
+        static const WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n',
             'e',':',' ','%','l','d','\\','n','E','r','r','o','r',' ','C','o',
             'd','e',':',' ','%','s',' ','(','0','x','%','0','8','l','x',')',
             '\\','n','C','a','l','l','i','n','g',':',' ','%','s',0 };
-        WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r',
-            'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 };
+        static const WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r',
+            'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 };
         /* FIXME: should use wsnprintf */
-        wsprintfW(msg, format, strFile, dwLine,
+        wsprintfW(msg, format, strFile, dwLine,
                   DXGetErrorString8W(hr), hr, strMsg);
         MessageBoxW(0, msg, caption, MB_OK|MB_ICONERROR);
     } else {
-        WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(',
+        static const WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(',
             'h','r','=','%','s',' ','(','0','x','%','0','8','l','x',')',')',' ',
             0 };
         /* FIXME: should use wsnprintf */
-        wsprintfW(msg, format, strFile, dwLine, strMsg,
+        wsprintfW(msg, format, strFile, dwLine, strMsg,
                   DXGetErrorString8W(hr), hr);
         OutputDebugStringW(msg);
     }
Index: dlls/dxerr9/dxerr9.c
===================================================================
RCS file: /var/cvs/wine/dlls/dxerr9/dxerr9.c,v
retrieving revision 1.1
diff -u -r1.1 dxerr9.c
--- a/dlls/dxerr9/dxerr9.c	9 Mar 2004 23:25:57 -0000	1.1
+++ b/dlls/dxerr9/dxerr9.c	18 Apr 2004 13:56:47 -0000
@@ -133,22 +133,22 @@
     TRACE("(%p,%ld,0x%08lx,%p,%d)\n", strFile, dwLine, hr, strMsg, bPopMsgBox);

     if (bPopMsgBox) {
-        WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n',
+        static const WCHAR format[] = { 'F','i','l','e',':',' ','%','s','\\','n','L','i','n',
             'e',':',' ','%','l','d','\\','n','E','r','r','o','r',' ','C','o',
             'd','e',':',' ','%','s',' ','(','0','x','%','0','8','l','x',')',
             '\\','n','C','a','l','l','i','n','g',':',' ','%','s',0 };
-        WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r',
-            'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 };
+        static const WCHAR caption[] = { 'U','n','e','x','p','e','c','t','e','d',' ','e','r',
+            'r','o','r',' ','e','n','c','o','u','n','t','e','r','e','d',0 };
         /* FIXME: should use wsnprintf */
-        wsprintfW(msg, format, strFile, dwLine,
+        wsprintfW(msg, format, strFile, dwLine,
                   DXGetErrorString9W(hr), hr, strMsg);
         MessageBoxW(0, msg, caption, MB_OK|MB_ICONERROR);
     } else {
-        WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(',
+        static const WCHAR format[] = { '%','s','(','%','l','d',')',':',' ','%','s',' ','(',
             'h','r','=','%','s',' ','(','0','x','%','0','8','l','x',')',')',' ',
             0 };
         /* FIXME: should use wsnprintf */
-        wsprintfW(msg, format, strFile, dwLine, strMsg,
+        wsprintfW(msg, format, strFile, dwLine, strMsg,
                   DXGetErrorString9W(hr), hr);
         OutputDebugStringW(msg);
     }
Index: dlls/gdi/freetype.c
===================================================================
RCS file: /var/cvs/wine/dlls/gdi/freetype.c,v
retrieving revision 1.58
diff -u -r1.58 freetype.c
--- a/dlls/gdi/freetype.c	14 Apr 2004 19:40:54 -0000	1.58
+++ b/dlls/gdi/freetype.c	18 Apr 2004 13:38:54 -0000
@@ -2270,7 +2270,7 @@
     TT_Postscript *pPost;
     FT_Fixed x_scale, y_scale;
     WCHAR *family_nameW, *style_nameW;
-    WCHAR spaceW[] = {' ', '\0'};
+    static const WCHAR spaceW[] = {' ', '\0'};
     char *cp;
     INT ascent, descent;

Index: dlls/kernel/tests/file.c
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/tests/file.c,v
retrieving revision 1.34
diff -u -r1.34 file.c
--- a/dlls/kernel/tests/file.c	8 Apr 2004 04:39:59 -0000	1.34
+++ b/dlls/kernel/tests/file.c	18 Apr 2004 13:41:12 -0000
@@ -596,7 +596,7 @@
     HANDLE hFile;
     WCHAR temp_path[MAX_PATH];
     WCHAR filename[MAX_PATH];
-    WCHAR emptyW[]={'\0'};
+    static const WCHAR emptyW[]={'\0'};
     static const WCHAR prefix[] = {'p','f','x',0};
     DWORD ret;

@@ -668,7 +668,7 @@
 static void test_DeleteFileW( void )
 {
     BOOL ret;
-    WCHAR emptyW[]={'\0'};
+    static const WCHAR emptyW[]={'\0'};

     ret = DeleteFileW(NULL);
     if (ret==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
Index: dlls/kernel/tests/format_msg.c
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/tests/format_msg.c,v
retrieving revision 1.7
diff -u -r1.7 format_msg.c
--- a/dlls/kernel/tests/format_msg.c	27 Jan 2004 20:13:03 -0000	1.7
+++ b/dlls/kernel/tests/format_msg.c	18 Apr 2004 13:42:31 -0000
@@ -42,7 +42,7 @@
 {
     CHAR out[0x100] = {0};
     DWORD r;
-    WCHAR szwTest[] = { 't','e','s','t',0};
+    static const WCHAR szwTest[] = { 't','e','s','t',0};

     /* the basics */
     r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING, "test", 0,
Index: dlls/ntdll/tests/rtlstr.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/rtlstr.c,v
retrieving revision 1.15
diff -u -r1.15 rtlstr.c
--- a/dlls/ntdll/tests/rtlstr.c	7 Feb 2004 01:03:17 -0000	1.15
+++ b/dlls/ntdll/tests/rtlstr.c	17 Apr 2004 21:15:38 -0000
@@ -191,7 +191,7 @@

 static void test_RtlInitUnicodeStringEx(void)
 {
-    WCHAR teststring[] = {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0};
+    static const WCHAR teststring[] = {'S','o','m','e',' ','W','i','l','d',' ','S','t','r','i','n','g',0};
     WCHAR *teststring2;
     UNICODE_STRING uni;
     NTSTATUS result;
Index: dlls/ole32/antimoniker.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/antimoniker.c,v
retrieving revision 1.17
diff -u -r1.17 antimoniker.c
--- a/dlls/ole32/antimoniker.c	23 Jan 2004 01:51:34 -0000	1.17
+++ b/dlls/ole32/antimoniker.c	18 Apr 2004 12:51:38 -0000
@@ -539,7 +539,7 @@
                                               IMoniker* pmkToLeft,
                                               LPOLESTR *ppszDisplayName)
 {
-    WCHAR back[]={'\\','.','.',0};
+    static const WCHAR back[]={'\\','.','.',0};

     TRACE("(%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,ppszDisplayName);

Index: dlls/ole32/filemoniker.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/filemoniker.c,v
retrieving revision 1.31
diff -u -r1.31 filemoniker.c
--- a/dlls/ole32/filemoniker.c	12 Apr 2004 22:02:37 -0000	1.31
+++ b/dlls/ole32/filemoniker.c	18 Apr 2004 14:02:05 -0000
@@ -473,8 +473,8 @@
     int nb=0,i;
     int sizeStr=lstrlenW(lpszPathName);
     LPOLESTR *tabStr=0;
-    WCHAR twoPoint[]={'.','.',0};
-    WCHAR bkSlash[]={'\\',0};
+    static const WCHAR twoPoint[]={'.','.',0};
+    static const WCHAR bkSlash[]={'\\',0};
     BYTE addBkSlash;

     TRACE("(%p,%p)\n",This,lpszPathName);
@@ -751,8 +751,8 @@
 {
     HRESULT res;
     LPOLESTR str1=0,str2=0,*strDec1=0,*strDec2=0,newStr=0;
-    WCHAR twoPoint[]={'.','.',0};
-    WCHAR bkSlash[]={'\\',0};
+    static const WCHAR twoPoint[]={'.','.',0};
+    static const WCHAR bkSlash[]={'\\',0};
     IBindCtx *bind=0;
     int i=0,j=0,lastIdx1=0,lastIdx2=0;
     DWORD mkSys;
@@ -1098,7 +1098,7 @@
  ******************************************************************************/
 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable)
 {
-    WCHAR bSlash[] = {'\\',0};
+    static const WCHAR bSlash[] = {'\\',0};
     WCHAR word[MAX_PATH];
     int i=0,j,tabIndex=0;
     LPOLESTR *strgtable ;
@@ -1157,7 +1157,7 @@
     HRESULT res;
     LPOLESTR str1=0,str2=0,*tabStr1=0,*tabStr2=0,relPath=0;
     DWORD len1=0,len2=0,sameIdx=0,j=0;
-    WCHAR back[] ={'.','.','\\',0};
+    static const WCHAR back[] ={'.','.','\\',0};

     TRACE("(%p,%p,%p)\n",iface,pmOther,ppmkRelPath);

Index: dlls/ole32/storage32.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/storage32.c,v
retrieving revision 1.47
diff -u -r1.47 storage32.c
--- a/dlls/ole32/storage32.c	23 Jan 2004 22:51:42 -0000	1.47
+++ b/dlls/ole32/storage32.c	18 Apr 2004 14:12:04 -0000
@@ -5445,7 +5445,7 @@
   if (pwcsName == 0)
   {
     WCHAR tempPath[MAX_PATH];
-    WCHAR prefix[] = { 'S', 'T', 'O', 0 };
+    static const WCHAR prefix[] = { 'S', 'T', 'O', 0 };

     if (!(grfMode & STGM_SHARE_EXCLUSIVE))
       return STG_E_INVALIDFLAG;
@@ -6424,7 +6424,7 @@
     IStorage *pTempStorage;
     DWORD dwNumOfBytesWritten;
     WCHAR wstrTempDir[MAX_PATH], wstrTempFile[MAX_PATH];
-    WCHAR wstrPrefix[] = {'s', 'i', 's', 0};
+    static const WCHAR wstrPrefix[] = {'s', 'i', 's', 0};

     /* Create a temp File */
     GetTempPathW(MAX_PATH, wstrTempDir);
@@ -6474,7 +6474,7 @@
     DWORD nDataLength = 0;
     IStorage *pTempStorage;
     WCHAR wstrTempDir[MAX_PATH], wstrTempFile[MAX_PATH];
-    WCHAR wstrPrefix[] = {'s', 'i', 's', 0};
+    static const WCHAR wstrPrefix[] = {'s', 'i', 's', 0};

     *pData = NULL;

@@ -6527,7 +6527,7 @@
 {
     HRESULT hRes;
     IStream *pStream;
-    WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0};
+    static const WCHAR wstrStreamName[] = {1,'O', 'l', 'e', 0};
     BYTE pOleStreamHeader [] =
     {
         0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
@@ -6616,7 +6616,7 @@
 {
     IStream *pstm;
     HRESULT r = S_OK;
-    WCHAR szwStreamName[] = {1, 'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};
+    static const WCHAR szwStreamName[] = {1, 'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};

     static const BYTE unknown1[12] =
        { 0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00,
@@ -6855,7 +6855,7 @@
     IStream *pStream;
     HRESULT hStorageRes, hRes = S_OK;
     OLECONVERT_ISTORAGE_COMPOBJ IStorageCompObj;
-    WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};
+    static const WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};
     WCHAR bufferW[OLESTREAM_MAX_STR_LEN];

     BYTE pCompObjUnknown1[] = {0x01, 0x00, 0xFE, 0xFF, 0x03, 0x0A, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF};
@@ -6956,7 +6956,7 @@
 {
     HRESULT hRes;
     IStream *pStream;
-    WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
+    static const WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
     BYTE pOlePresStreamHeader [] =
     {
         0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00,
@@ -7040,7 +7040,7 @@
 {
     HRESULT hRes;
     IStream *pStream;
-    WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
+    static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};

     /* Create the Ole10Native Stream */
     hRes = IStorage_CreateStream(pStorage, wstrStreamName,
@@ -7081,7 +7081,7 @@
     IStream *pStream;
     LARGE_INTEGER iSeekPos;
     OLECONVERT_ISTORAGE_COMPOBJ CompObj;
-    WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};
+    static const WCHAR wstrStreamName[] = {1,'C', 'o', 'm', 'p', 'O', 'b', 'j', 0};

     /* Open the CompObj Stream */
     hRes = IStorage_OpenStream(pStorage, wstrStreamName, NULL,
@@ -7150,7 +7150,7 @@

     HRESULT hRes;
     IStream *pStream;
-    WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
+    static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};

     /* Initialize Default data for OLESTREAM */
     pOleStreamData[0].dwOleID = OLESTREAM_ID;
@@ -7203,7 +7203,7 @@
     HRESULT hRes;
     IStream *pStream;
     OLECONVERT_ISTORAGE_OLEPRES olePress;
-    WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};
+    static const WCHAR wstrStreamName[] = {2, 'O', 'l', 'e', 'P', 'r', 'e', 's', '0', '0', '0', 0};

     /* Initialize Default data for OLESTREAM */
     pOleStreamData[0].dwOleID = OLESTREAM_ID;
@@ -7384,7 +7384,7 @@
     HRESULT hRes = S_OK;
     IStream *pStream;
     OLECONVERT_OLESTREAM_DATA pOleStreamData[2];
-    WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
+    static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};


     memset(pOleStreamData, 0, sizeof(pOleStreamData));
Index: dlls/oleaut32/olefont.c
===================================================================
RCS file: /var/cvs/wine/dlls/oleaut32/olefont.c,v
retrieving revision 1.24
diff -u -r1.24 olefont.c
--- a/dlls/oleaut32/olefont.c	23 Jan 2004 01:51:34 -0000	1.24
+++ b/dlls/oleaut32/olefont.c	18 Apr 2004 16:41:08 -0000
@@ -1214,7 +1214,7 @@
   LCID        lcid,
   ITypeInfo** ppTInfo)
 {
-  WCHAR stdole32tlb[] = {'s','t','d','o','l','e','3','2','.','t','l','b',0};
+  static const WCHAR stdole32tlb[] = {'s','t','d','o','l','e','3','2','.','t','l','b',0};
   ITypeLib *tl;
   HRESULT hres;

Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /var/cvs/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.111
diff -u -r1.111 typelib.c
--- a/dlls/oleaut32/typelib.c	22 Mar 2004 22:57:51 -0000	1.111
+++ b/dlls/oleaut32/typelib.c	18 Apr 2004 14:12:29 -0000
@@ -308,7 +308,7 @@
 		return TYPE_E_CANTLOADLIBRARY;
 	} else {
 	    WCHAR tstpath[260];
-	    WCHAR stdole32tlb[] = { 's','t','d','o','l','e','3','2','.','t','l','b',0 };
+	    static const WCHAR stdole32tlb[] = { 's','t','d','o','l','e','3','2','.','t','l','b',0 };
 	    int i;

 	    lstrcpyW(tstpath,szFile);
Index: dlls/quartz/filesource.c
===================================================================
RCS file: /var/cvs/wine/dlls/quartz/filesource.c,v
retrieving revision 1.3
diff -u -r1.3 filesource.c
--- a/dlls/quartz/filesource.c	25 Sep 2003 23:50:06 -0000	1.3
+++ b/dlls/quartz/filesource.c	18 Apr 2004 15:55:02 -0000
@@ -193,7 +193,7 @@
     HKEY hkeyMediaType = NULL;
     HRESULT hr = S_OK;
     BOOL bFound = FALSE;
-    WCHAR wszMediaType[] = {'M','e','d','i','a',' ','T','y','p','e',0};
+    static const WCHAR wszMediaType[] = {'M','e','d','i','a',' ','T','y','p','e',0};

     CopyMemory(majorType, &GUID_NULL, sizeof(*majorType));
     CopyMemory(minorType, &GUID_NULL, sizeof(*minorType));
Index: dlls/setupapi/diskspace.c
===================================================================
RCS file: /var/cvs/wine/dlls/setupapi/diskspace.c,v
retrieving revision 1.1
diff -u -r1.1 diskspace.c
--- a/dlls/setupapi/diskspace.c	17 Mar 2004 01:46:00 -0000	1.1
+++ b/dlls/setupapi/diskspace.c	18 Apr 2004 13:44:05 -0000
@@ -120,7 +120,7 @@
     int i;
     LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace;
     BOOL rc = FALSE;
-    WCHAR bkslsh[]= {'\\',0};
+    static const WCHAR bkslsh[]= {'\\',0};

     MultiByteToWideChar(CP_ACP,0,DriveSpec,-1,driveW,20);

Index: dlls/shell32/shell32_main.c
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/shell32_main.c,v
retrieving revision 1.131
diff -u -r1.131 shell32_main.c
--- a/dlls/shell32/shell32_main.c	13 Apr 2004 21:15:33 -0000	1.131
+++ b/dlls/shell32/shell32_main.c	18 Apr 2004 14:02:23 -0000
@@ -356,8 +356,8 @@
 	/* get the type name */
 	if (SUCCEEDED(hr) && (flags & SHGFI_TYPENAME))
         {
-            WCHAR szFile[] = { 'F','i','l','e',0 };
-            WCHAR szDashFile[] = { '-','f','i','l','e',0 };
+            static const WCHAR szFile[] = { 'F','i','l','e',0 };
+            static const WCHAR szDashFile[] = { '-','f','i','l','e',0 };
             if (!(flags & SHGFI_USEFILEATTRIBUTES))
             {
                 char ftype[80];
@@ -428,7 +428,7 @@
                psfi->iIcon = 2;
             else
             {
-               WCHAR p1W[] = {'%','1',0};
+               static const WCHAR p1W[] = {'%','1',0};
                psfi->iIcon = 0;
                szExt = (LPWSTR) PathFindExtensionW(sTemp);
                if ( szExt && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE)
Index: dlls/shell32/shlfileop.c
===================================================================
RCS file: /var/cvs/wine/dlls/shell32/shlfileop.c,v
retrieving revision 1.37
diff -u -r1.37 shlfileop.c
--- a/dlls/shell32/shlfileop.c	20 Feb 2004 20:19:23 -0000	1.37
+++ b/dlls/shell32/shlfileop.c	18 Apr 2004 13:04:52 -0000
@@ -53,9 +53,9 @@
 #define FO_MASK         0xF

 CHAR aWildcardFile[] = {'*','.','*',0};
-WCHAR wWildcardFile[] = {'*','.','*',0};
-WCHAR wWildcardChars[] = {'*','?',0};
-WCHAR wBackslash[] = {'\\',0};
+static const WCHAR wWildcardFile[] = {'*','.','*',0};
+static const WCHAR wWildcardChars[] = {'*','?',0};
+static const WCHAR wBackslash[] = {'\\',0};

 static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec);
 static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec);
Index: dlls/shlwapi/reg.c
===================================================================
RCS file: /var/cvs/wine/dlls/shlwapi/reg.c,v
retrieving revision 1.47
diff -u -r1.47 reg.c
--- a/dlls/shlwapi/reg.c	17 Mar 2004 20:48:03 -0000	1.47
+++ b/dlls/shlwapi/reg.c	18 Apr 2004 15:53:30 -0000
@@ -1076,7 +1076,7 @@
 {
   DWORD dwRet = ERROR_SUCCESS, dwDummy;
   HKEY  hSubKey;
-  WCHAR szEmpty[] = { '\0' };
+  static const WCHAR szEmpty[] = { '\0' };

   TRACE("(hkey=%p,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_w(lpszSubKey),
         debugstr_w(lpszValue), dwType, pvData, cbData);
Index: dlls/shlwapi/string.c
===================================================================
RCS file: /var/cvs/wine/dlls/shlwapi/string.c,v
retrieving revision 1.45
diff -u -r1.45 string.c
--- a/dlls/shlwapi/string.c	18 Mar 2004 02:11:23 -0000	1.45
+++ b/dlls/shlwapi/string.c	18 Apr 2004 13:49:35 -0000
@@ -2530,7 +2530,7 @@
 INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
                              LPINT lpiLen)
 {
-  WCHAR emptyW[] = { '\0' };
+  static const WCHAR emptyW[] = { '\0' };
   int len , reqLen;
   LPSTR mem;

Index: dlls/shlwapi/url.c
===================================================================
RCS file: /var/cvs/wine/dlls/shlwapi/url.c,v
retrieving revision 1.30
diff -u -r1.30 url.c
--- a/dlls/shlwapi/url.c	16 Mar 2004 01:07:28 -0000	1.30
+++ b/dlls/shlwapi/url.c	18 Apr 2004 13:50:17 -0000
@@ -687,8 +687,8 @@
     DWORD myflags, sizeloc = 0;
     DWORD len, res1, res2, process_case = 0;
     LPWSTR work, preliminary, mbase, mrelative;
-    WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'};
-    WCHAR single_slash[] = {'/','\0'};
+    static const WCHAR myfilestr[] = {'f','i','l','e',':','/','/','/','\0'};
+    static const WCHAR single_slash[] = {'/','\0'};
     HRESULT ret;

     TRACE("(base %s, Relative %s, Combine size %ld, flags %08lx)\n",
Index: dlls/urlmon/umon.c
===================================================================
RCS file: /var/cvs/wine/dlls/urlmon/umon.c,v
retrieving revision 1.29
diff -u -r1.29 umon.c
--- a/dlls/urlmon/umon.c	31 Mar 2004 19:58:09 -0000	1.29
+++ b/dlls/urlmon/umon.c	18 Apr 2004 15:11:29 -0000
@@ -1283,7 +1283,7 @@
     URL_COMPONENTSW url;
     WCHAR host[0x80], path[0x100];
     HANDLE hfile;
-    WCHAR wszAppName[]={'u','r','l','m','o','n','.','d','l','l',0};
+    static const WCHAR wszAppName[]={'u','r','l','m','o','n','.','d','l','l',0};

     /* Note: all error codes would need to be checked agains real Windows behaviour... */
     TRACE("(%p,%s,%s,%08lx,%p) stub!\n", pCaller, debugstr_w(szURL), debugstr_w(szFileName), dwReserved, lpfnCB);
Index: dlls/user/tests/class.c
===================================================================
RCS file: /var/cvs/wine/dlls/user/tests/class.c,v
retrieving revision 1.12
diff -u -r1.12 class.c
--- a/dlls/user/tests/class.c	23 Jan 2004 20:50:35 -0000	1.12
+++ b/dlls/user/tests/class.c	18 Apr 2004 13:39:22 -0000
@@ -45,8 +45,8 @@
 static void ClassTest(HINSTANCE hInstance, BOOL global)
 {
     WNDCLASSW cls, wc;
-    WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0};
-    WCHAR winName[]   = {'W','i','n','C','l','a','s','s','T','e','s','t',0};
+    static const WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0};
+    static const WCHAR winName[]   = {'W','i','n','C','l','a','s','s','T','e','s','t',0};
     ATOM test_atom;
     HWND hTestWnd;
     DWORD i;
Index: dlls/uxtheme/msstyles.c
===================================================================
RCS file: /var/cvs/wine/dlls/uxtheme/msstyles.c,v
retrieving revision 1.10
diff -u -r1.10 msstyles.c
--- a/dlls/uxtheme/msstyles.c	20 Feb 2004 05:12:21 -0000	1.10
+++ b/dlls/uxtheme/msstyles.c	18 Apr 2004 16:02:07 -0000
@@ -78,13 +78,13 @@
     HMODULE hTheme;
     HRSRC hrsc;
     HRESULT hr = S_OK;
-    WCHAR szPackThemVersionResource[] = {
+    static const WCHAR szPackThemVersionResource[] = {
         'P','A','C','K','T','H','E','M','_','V','E','R','S','I','O','N', '\0'
     };
-    WCHAR szColorNamesResource[] = {
+    static const WCHAR szColorNamesResource[] = {
         'C','O','L','O','R','N','A','M','E','S','\0'
     };
-    WCHAR szSizeNamesResource[] = {
+    static const WCHAR szSizeNamesResource[] = {
         'S','I','Z','E','N','A','M','E','S','\0'
     };

@@ -250,7 +250,7 @@
  */
 PUXINI_FILE MSSTYLES_GetActiveThemeIni(PTHEME_FILE tf)
 {
-    WCHAR szFileResNamesResource[] = {
+    static const WCHAR szFileResNamesResource[] = {
         'F','I','L','E','R','E','S','N','A','M','E','S','\0'
     };
     DWORD dwColorCount = 0;
@@ -661,8 +661,8 @@
  */
 void MSSTYLES_ParseThemeIni(PTHEME_FILE tf)
 {
-    WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'};
-    WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'};
+    static const WCHAR szSysMetrics[] = {'S','y','s','M','e','t','r','i','c','s','\0'};
+    static const WCHAR szGlobals[] = {'g','l','o','b','a','l','s','\0'};
     PTHEME_CLASS cls;
     PTHEME_CLASS globals;
     PTHEME_PARTSTATE ps;
Index: dlls/uxtheme/system.c
===================================================================
RCS file: /var/cvs/wine/dlls/uxtheme/system.c,v
retrieving revision 1.10
diff -u -r1.10 system.c
--- a/dlls/uxtheme/system.c	7 Apr 2004 18:59:23 -0000	1.10
+++ b/dlls/uxtheme/system.c	18 Apr 2004 16:01:30 -0000
@@ -602,10 +602,10 @@
 {
     WCHAR szDir[MAX_PATH];
     WCHAR szPath[MAX_PATH];
-    WCHAR szStar[] = {'*','.','*','\0'};
-    WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
-    WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
-    WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'};
+    static const WCHAR szStar[] = {'*','.','*','\0'};
+    static const WCHAR szFormat[] = {'%','s','%','s','\\','%','s','.','m','s','s','t','y','l','e','s','\0'};
+    static const WCHAR szDisplayName[] = {'d','i','s','p','l','a','y','n','a','m','e','\0'};
+    static const WCHAR szTooltip[] = {'t','o','o','l','t','i','p','\0'};
     WCHAR szName[60];
     WCHAR szTip[60];
     HANDLE hFind;
Index: windows/dialog.c
===================================================================
RCS file: /var/cvs/wine/windows/dialog.c,v
retrieving revision 1.128
diff -u -r1.128 dialog.c
--- a/windows/dialog.c	20 Mar 2004 19:25:12 -0000	1.128
+++ b/windows/dialog.c	17 Apr 2004 21:15:38 -0000
@@ -1719,7 +1719,7 @@
 {
     HWND hwnd;
     LPWSTR orig_spec = spec;
-    WCHAR any[] = {'*','.','*',0};
+    static const WCHAR any[] = {'*','.','*',0};

 #define SENDMSG(msg,wparam,lparam) \
     ((attrib & DDL_POSTMSGS) ? PostMessageW( hwnd, msg, wparam, lparam ) \


-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
May your Tongue stick to the Roof of your Mouth with the Force of a Thousand Caramels.



More information about the wine-patches mailing list