[janitor] dlls/shell32 -Wwrite-strings cleanup

Daniel Marmier d.marmier at bluewin.ch
Sun Oct 5 15:31:15 CDT 2003


Fixed warnings with gcc option "-Wwrite-strings".

-------------- next part --------------
Index: dlls/shell32/debughlp.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/debughlp.c,v
retrieving revision 1.9
diff -u -r1.9 debughlp.c
--- dlls/shell32/debughlp.c	5 Sep 2003 23:08:31 -0000	1.9
+++ dlls/shell32/debughlp.c	5 Oct 2003 20:16:20 -0000
@@ -276,8 +276,8 @@
 static char * shdebugstr_buf = shdebugstr_buf1;
 
 static struct {
-	REFIID	riid;
-	char 	*name;
+	REFIID		riid;
+	const char	*name;
 } InterfaceDesc[] = {
 	{&IID_IUnknown,			"IID_IUnknown"},
 	{&IID_IClassFactory,		"IID_IClassFactory"},
@@ -302,7 +302,7 @@
 const char * shdebugstr_guid( const struct _GUID *id )
 {
 	int i;
-	char* name = NULL;
+	const char* name = NULL;
 	char clsidbuf[100];
 
 	shdebugstr_buf = (shdebugstr_buf == shdebugstr_buf1) ? shdebugstr_buf2 : shdebugstr_buf1;
Index: dlls/shell32/dialogs.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/dialogs.c,v
retrieving revision 1.17
diff -u -r1.17 dialogs.c
--- dlls/shell32/dialogs.c	10 Sep 2003 03:56:48 -0000	1.17
+++ dlls/shell32/dialogs.c	5 Oct 2003 20:16:22 -0000
@@ -257,6 +257,7 @@
 /* This grabs the MRU list from the registry and fills the combo for the "Run" dialog above */
 void FillList (HWND hCb, char *pszLatest)
     {
+    char class[] = "";
     HKEY hkey ;
 /*    char szDbgMsg[256] = "" ; */
     char *pszList = NULL, *pszCmd = NULL, cMatch = 0, cMax = 0x60, szIndex[2] = "-" ;
@@ -267,7 +268,7 @@
 
     if (ERROR_SUCCESS != RegCreateKeyExA (
         HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
-        0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL))
+        0, class, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL))
         MessageBoxA (hCb, "Unable to open registry key !", "Nix", MB_OK) ;
 
     RegQueryValueExA (hkey, "MRUList", NULL, NULL, NULL, &icList) ;
Index: dlls/shell32/shellord.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellord.c,v
retrieving revision 1.117
diff -u -r1.117 shellord.c
--- dlls/shell32/shellord.c	15 Sep 2003 22:13:40 -0000	1.117
+++ dlls/shell32/shellord.c	5 Oct 2003 20:16:29 -0000
@@ -503,7 +503,7 @@
  * RETURNS
  *   result of the SHQueryValueEx call
  */
-static INT SHADD_get_policy(LPSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
+static INT SHADD_get_policy(LPCSTR policy, LPDWORD type, LPVOID buffer, LPDWORD len)
 {
     HKEY Policy_basekey;
     INT ret;
Index: dlls/shell32/shfldr_fs.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shfldr_fs.c,v
retrieving revision 1.16
diff -u -r1.16 shfldr_fs.c
--- dlls/shell32/shfldr_fs.c	17 Sep 2003 04:17:33 -0000	1.16
+++ dlls/shell32/shfldr_fs.c	5 Oct 2003 20:16:35 -0000
@@ -885,7 +885,7 @@
     IEnumIDList *penum;
     HRESULT hr;
     char szText[MAX_PATH];
-    char *szNewFolder = "New Folder";
+    const char *szNewFolder = "New Folder";
 
     TRACE ("(%p)(%s %u)\n", This, lpName, uLen);
 
Index: dlls/shell32/shlview.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlview.c,v
retrieving revision 1.87
diff -u -r1.87 shlview.c
--- dlls/shell32/shlview.c	22 Sep 2003 19:24:13 -0000	1.87
+++ dlls/shell32/shlview.c	5 Oct 2003 20:16:45 -0000
@@ -719,12 +719,13 @@
 * ShellView_MergeFileMenu()
 */
 static void ShellView_MergeFileMenu(IShellViewImpl * This, HMENU hSubMenu)
-{	TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu);
+{	char dummy[] = "dummy45";
+	TRACE("(%p)->(submenu=%p) stub\n",This,hSubMenu);
 
 	if(hSubMenu)
 	{ /*insert This item at the beginning of the menu */
 	  _InsertMenuItem(hSubMenu, 0, TRUE, 0, MFT_SEPARATOR, NULL, MFS_ENABLED);
-	  _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, "dummy45", MFS_ENABLED);
+	  _InsertMenuItem(hSubMenu, 0, TRUE, IDM_MYFILEITEM, MFT_STRING, dummy, MFS_ENABLED);
 
 	}
 	TRACE("--\n");
@@ -736,6 +737,7 @@
 
 static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu)
 {	MENUITEMINFOA	mii;
+	char		view[] = "View";
 
 	TRACE("(%p)->(submenu=%p)\n",This,hSubMenu);
 
@@ -747,7 +749,7 @@
 	  mii.cbSize = sizeof(mii);
 	  mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA;
 	  mii.fType = MFT_STRING;
-	  mii.dwTypeData = "View";
+	  mii.dwTypeData = view;
 	  mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001");
 	  InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii);
 	}
Index: dlls/shell32/shv_item_cmenu.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shv_item_cmenu.c,v
retrieving revision 1.20
diff -u -r1.20 shv_item_cmenu.c
--- dlls/shell32/shv_item_cmenu.c	9 Sep 2003 19:32:36 -0000	1.20
+++ dlls/shell32/shv_item_cmenu.c	5 Oct 2003 20:16:47 -0000
@@ -217,6 +217,13 @@
 	UINT uFlags)
 {
 	ICOM_THIS(ItemCmImpl, iface);
+	char tdOpen[] = "&Open";
+	char tdExplore[] = "&Explore";
+	char tdSelect[] = "&Select";
+	char tdCopy[] = "&Copy";
+	char tdCut[] = "&Cut";
+	char tdDelete[] = "&Delete";
+	char tdRename[] = "&Rename";
 
 	TRACE("(%p)->(hmenu=%p indexmenu=%x cmdfirst=%x cmdlast=%x flags=%x )\n",This, hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
 
@@ -226,28 +233,28 @@
 	  {
 	    if(This->bAllValues)
 	    {
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT);
+	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, tdOpen, MFS_ENABLED);
+	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, tdExplore, MFS_ENABLED|MFS_DEFAULT);
 	    }
 	    else
 	    {
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, "&Explore", MFS_ENABLED|MFS_DEFAULT);
-	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Open", MFS_ENABLED);
+	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_EXPLORE, MFT_STRING, tdExplore, MFS_ENABLED|MFS_DEFAULT);
+	      _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, tdOpen, MFS_ENABLED);
 	    }
 	  }
 	  else
 	  {
-	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, "&Select", MFS_ENABLED|MFS_DEFAULT);
+	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_OPEN, MFT_STRING, tdSelect, MFS_ENABLED|MFS_DEFAULT);
 	  }
 	  _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
-	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, "&Copy", MFS_ENABLED);
-	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, "&Cut", MFS_ENABLED);
+	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_COPY, MFT_STRING, tdCopy, MFS_ENABLED);
+	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_CUT, MFT_STRING, tdCut, MFS_ENABLED);
 
 	  _InsertMenuItem(hmenu, indexMenu++, TRUE, 0, MFT_SEPARATOR, NULL, 0);
-	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_DELETE, MFT_STRING, "&Delete", MFS_ENABLED);
+	  _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_DELETE, MFT_STRING, tdDelete, MFS_ENABLED);
 
 	  if(uFlags & CMF_CANRENAME)
-	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_RENAME, MFT_STRING, "&Rename", ISvItemCm_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED);
+	    _InsertMenuItem(hmenu, indexMenu++, TRUE, FCIDM_SHVIEW_RENAME, MFT_STRING, tdRename, ISvItemCm_CanRenameItems(This) ? MFS_ENABLED : MFS_DISABLED);
 
 	  return MAKE_HRESULT(SEVERITY_SUCCESS, 0, (FCIDM_SHVIEWLAST));
 	}
Index: dlls/shell32/systray.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/systray.c,v
retrieving revision 1.23
diff -u -r1.23 systray.c
--- dlls/shell32/systray.c	10 Sep 2003 03:56:47 -0000	1.23
+++ dlls/shell32/systray.c	5 Oct 2003 20:16:49 -0000
@@ -279,6 +279,7 @@
 static BOOL SYSTRAY_Add(PNOTIFYICONDATAA pnid)
 {
   SystrayItem **ptrayItem = &systray;
+  char tip[] = "";
 
   /* Find last element. */
   while( *ptrayItem ) {
@@ -295,7 +296,7 @@
   (*ptrayItem)->notifyIcon.hWnd = pnid->hWnd; /* only needed for callback message */
   SYSTRAY_ItemSetIcon   (*ptrayItem, (pnid->uFlags&NIF_ICON)   ?pnid->hIcon           :0);
   SYSTRAY_ItemSetMessage(*ptrayItem, (pnid->uFlags&NIF_MESSAGE)?pnid->uCallbackMessage:0);
-  SYSTRAY_ItemSetTip    (*ptrayItem, (pnid->uFlags&NIF_TIP)    ?pnid->szTip           :"", FALSE);
+  SYSTRAY_ItemSetTip    (*ptrayItem, (pnid->uFlags&NIF_TIP)    ?pnid->szTip           :tip, FALSE);
 
   TRACE("%p: %p %s\n",  (*ptrayItem), (*ptrayItem)->notifyIcon.hWnd,
                                           (*ptrayItem)->notifyIcon.szTip);
Index: dlls/shell32/tests/shlfileop.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/tests/shlfileop.c,v
retrieving revision 1.10
diff -u -r1.10 shlfileop.c
--- dlls/shell32/tests/shlfileop.c	27 Sep 2003 03:47:35 -0000	1.10
+++ dlls/shell32/tests/shlfileop.c	5 Oct 2003 20:16:51 -0000
@@ -32,7 +32,7 @@
 CHAR CURR_DIR[MAX_PATH];
 
 /* creates a file with the specified name for tests */
-void createTestFile(CHAR *name)
+void createTestFile(const CHAR *name)
 {
     HANDLE file;
     DWORD written;
@@ -46,7 +46,7 @@
     CloseHandle(file);
 }
 
-BOOL file_exists(CHAR *name)
+BOOL file_exists(const CHAR *name)
 {
     return GetFileAttributesA(name) != 0xFFFFFFFF;
 }
@@ -85,7 +85,7 @@
  files - string with file names, separated by null characters. Ends on a double
  null characters
 */
-void set_curr_dir_path(CHAR *buf, CHAR* files)
+void set_curr_dir_path(CHAR *buf, const CHAR* files)
 {
     buf[0] = 0;
     while (files[0])


More information about the wine-patches mailing list