Make Unicode strings 'static const' (part 2) (take 2)
Francois Gouget
fgouget at free.fr
Mon Apr 19 08:54:13 CDT 2004
Use this patch instead of the previous one. The previous patch contained
some parts that are best done separately as simply adding a 'const'
would generate warnings.
This part makes static Unicode strings const too. Presumably the static
Unicode strings were already meant to be constant (otherwise the
function would only work on the first call).
Still, when making a string const it's important to check that the
function does try to do weird things with it. I did so and these look
ok.
Changelog:
* controls/icontitle.c
dlls/comctl32/propsheet.c
dlls/msacm/format.c
dlls/msacm/internal.c
dlls/msacm/imaadp32/imaadp32.c
dlls/msacm/msadp32/msadp32.c
dlls/msacm/msg711/msg711.c
dlls/msacm/winemp3/mpegl3.c
dlls/msvideo/msvideo_main.c
dlls/oleaut32/tests/vartest.c
dlls/secur32/secur32.c
dlls/shlwapi/path.c
dlls/urlmon/umon.c
dlls/uxtheme/msstyles.c
dlls/winmm/playsound.c
dlls/wsock32/protocol.c
programs/wineconsole/dialog.c
programs/wineconsole/user.c
tools/wmc/mcl.c
Make static Unicode strings const.
Index: controls/icontitle.c
===================================================================
RCS file: /var/cvs/wine/controls/icontitle.c,v
retrieving revision 1.30
diff -u -r1.30 icontitle.c
--- a/controls/icontitle.c 10 Dec 2003 04:14:35 -0000 1.30
+++ b/controls/icontitle.c 18 Apr 2004 12:47:28 -0000
@@ -86,7 +86,7 @@
*/
static BOOL ICONTITLE_SetTitlePos( HWND hwnd, HWND owner )
{
- static WCHAR emptyTitleText[] = {'<','.','.','.','>',0};
+ static const WCHAR emptyTitleText[] = {'<','.','.','.','>',0};
WCHAR str[80];
HDC hDC;
HFONT hPrevFont;
Index: dlls/comctl32/propsheet.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/propsheet.c,v
retrieving revision 1.97
diff -u -r1.97 propsheet.c
--- a/dlls/comctl32/propsheet.c 13 Mar 2004 19:24:04 -0000 1.97
+++ b/dlls/comctl32/propsheet.c 17 Apr 2004 21:15:38 -0000
@@ -524,7 +524,7 @@
{
WCHAR szTitle[256];
const WCHAR *pTitle;
- static WCHAR pszNull[] = { '(','n','u','l','l',')',0 };
+ static const WCHAR pszNull[] = { '(','n','u','l','l',')',0 };
int len;
if ( !HIWORD( lppsp->pszTitle ) )
Index: dlls/msacm/format.c
===================================================================
RCS file: /var/cvs/wine/dlls/msacm/format.c,v
retrieving revision 1.23
diff -u -r1.23 format.c
--- a/dlls/msacm/format.c 16 Jan 2004 23:03:08 -0000 1.23
+++ b/dlls/msacm/format.c 17 Apr 2004 21:15:38 -0000
@@ -317,8 +317,8 @@
MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD fdwDetails)
{
MMRESULT mmr;
- static WCHAR fmt1[] = {'%','d',' ','H','z',0};
- static WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};
+ static const WCHAR fmt1[] = {'%','d',' ','H','z',0};
+ static const WCHAR fmt2[] = {';',' ','%','d',' ','b','i','t','s',0};
ACMFORMATTAGDETAILSA aftd;
TRACE("(%p, %p, %ld)\n", had, pafd, fdwDetails);
Index: dlls/msacm/internal.c
===================================================================
RCS file: /var/cvs/wine/dlls/msacm/internal.c,v
retrieving revision 1.17
diff -u -r1.17 internal.c
--- a/dlls/msacm/internal.c 5 Sep 2003 23:08:36 -0000 1.17
+++ b/dlls/msacm/internal.c 17 Apr 2004 21:15:38 -0000
@@ -285,10 +285,10 @@
{
LPWSTR pszBuffer;
DWORD dwBufferLength;
- static WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
- static WCHAR msacmW[] = {'M','S','A','C','M','.'};
- static WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
- static WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
+ static const WCHAR msacm32[] = {'m','s','a','c','m','3','2','.','d','l','l','\0'};
+ static const WCHAR msacmW[] = {'M','S','A','C','M','.'};
+ static const WCHAR drv32[] = {'d','r','i','v','e','r','s','3','2','\0'};
+ static const WCHAR sys[] = {'s','y','s','t','e','m','.','i','n','i','\0'};
/* FIXME
* What if the user edits system.ini while the program is running?
Index: dlls/msacm/imaadp32/imaadp32.c
===================================================================
RCS file: /var/cvs/wine/dlls/msacm/imaadp32/imaadp32.c,v
retrieving revision 1.11
diff -u -r1.11 imaadp32.c
--- a/dlls/msacm/imaadp32/imaadp32.c 20 Jan 2004 21:55:29 -0000 1.11
+++ b/dlls/msacm/imaadp32/imaadp32.c 17 Apr 2004 21:15:38 -0000
@@ -499,8 +499,8 @@
*/
static LRESULT ADPCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
{
- static WCHAR szPcm[]={'P','C','M',0};
- static WCHAR szImaAdPcm[]={'I','M','A',' ','A','d','P','C','M',0};
+ static const WCHAR szPcm[]={'P','C','M',0};
+ static const WCHAR szImaAdPcm[]={'I','M','A',' ','A','d','P','C','M',0};
switch (dwQuery)
{
Index: dlls/msacm/msadp32/msadp32.c
===================================================================
RCS file: /var/cvs/wine/dlls/msacm/msadp32/msadp32.c,v
retrieving revision 1.7
diff -u -r1.7 msadp32.c
--- a/dlls/msacm/msadp32/msadp32.c 20 Jan 2004 21:55:29 -0000 1.7
+++ b/dlls/msacm/msadp32/msadp32.c 17 Apr 2004 21:15:38 -0000
@@ -345,8 +345,8 @@
*/
static LRESULT ADPCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
{
- static WCHAR szPcm[]={'P','C','M',0};
- static WCHAR szMsAdPcm[]={'M','S',' ','A','d','P','C','M',0};
+ static const WCHAR szPcm[]={'P','C','M',0};
+ static const WCHAR szMsAdPcm[]={'M','S',' ','A','d','P','C','M',0};
switch (dwQuery)
{
Index: dlls/msacm/msg711/msg711.c
===================================================================
RCS file: /var/cvs/wine/dlls/msacm/msg711/msg711.c,v
retrieving revision 1.9
diff -u -r1.9 msg711.c
--- a/dlls/msacm/msg711/msg711.c 20 Jan 2004 21:55:29 -0000 1.9
+++ b/dlls/msacm/msg711/msg711.c 17 Apr 2004 21:15:38 -0000
@@ -682,9 +682,9 @@
*/
static LRESULT G711_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
{
- static WCHAR szPcm[]={'P','C','M',0};
- static WCHAR szALaw[]={'A','-','L','a','w',0};
- static WCHAR szULaw[]={'U','-','L','a','w',0};
+ static const WCHAR szPcm[]={'P','C','M',0};
+ static const WCHAR szALaw[]={'A','-','L','a','w',0};
+ static const WCHAR szULaw[]={'U','-','L','a','w',0};
switch (dwQuery)
{
Index: dlls/msacm/winemp3/mpegl3.c
===================================================================
RCS file: /var/cvs/wine/dlls/msacm/winemp3/mpegl3.c,v
retrieving revision 1.6
diff -u -r1.6 mpegl3.c
--- a/dlls/msacm/winemp3/mpegl3.c 20 Jan 2004 21:55:29 -0000 1.6
+++ b/dlls/msacm/winemp3/mpegl3.c 17 Apr 2004 21:15:38 -0000
@@ -200,8 +200,8 @@
*/
static LRESULT MPEG3_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
{
- static WCHAR szPcm[]={'P','C','M',0};
- static WCHAR szMpeg3[]={'M','P','e','g','3',0};
+ static const WCHAR szPcm[]={'P','C','M',0};
+ static const WCHAR szMpeg3[]={'M','P','e','g','3',0};
switch (dwQuery)
{
Index: dlls/msvideo/msvideo_main.c
===================================================================
RCS file: /var/cvs/wine/dlls/msvideo/msvideo_main.c,v
retrieving revision 1.55
diff -u -r1.55 msvideo_main.c
--- a/dlls/msvideo/msvideo_main.c 16 Feb 2004 20:34:18 -0000 1.55
+++ b/dlls/msvideo/msvideo_main.c 17 Apr 2004 21:15:38 -0000
@@ -272,7 +272,7 @@
HDRVR hdrv;
WINE_HIC* whic;
BOOL bIs16;
- static WCHAR drv32W[] = {'d','r','i','v','e','r','s','3','2','\0'};
+ static const WCHAR drv32W[] = {'d','r','i','v','e','r','s','3','2','\0'};
reg_driver* driver;
TRACE("(%s,%s,0x%08x)\n", wine_dbgstr_fcc(fccType), wine_dbgstr_fcc(fccHandler), wMode);
Index: dlls/oleaut32/tests/vartest.c
===================================================================
RCS file: /var/cvs/wine/dlls/oleaut32/tests/vartest.c,v
retrieving revision 1.26
diff -u -r1.26 vartest.c
--- a/dlls/oleaut32/tests/vartest.c 22 Mar 2004 20:39:50 -0000 1.26
+++ b/dlls/oleaut32/tests/vartest.c 18 Apr 2004 12:59:39 -0000
@@ -1316,10 +1316,10 @@
static void test_VarFormatNumber(void)
{
- static WCHAR szSrc1[] = { '1','\0' };
- static WCHAR szResult1[] = { '1','.','0','0','\0' };
- static WCHAR szSrc2[] = { '-','1','\0' };
- static WCHAR szResult2[] = { '(','1','.','0','0',')','\0' };
+ static const WCHAR szSrc1[] = { '1','\0' };
+ static const WCHAR szResult1[] = { '1','.','0','0','\0' };
+ static const WCHAR szSrc2[] = { '-','1','\0' };
+ static const WCHAR szResult2[] = { '(','1','.','0','0',')','\0' };
char buff[8];
HRESULT hres;
VARIANT v;
Index: dlls/secur32/secur32.c
===================================================================
RCS file: /var/cvs/wine/dlls/secur32/secur32.c,v
retrieving revision 1.1
diff -u -r1.1 secur32.c
--- a/dlls/secur32/secur32.c 2 Mar 2004 04:57:35 -0000 1.1
+++ b/dlls/secur32/secur32.c 17 Apr 2004 21:15:38 -0000
@@ -546,7 +546,7 @@
WARN("failed to load %s\n", debugstr_w(moduleName));
}
-static WCHAR securityProvidersKeyW[] = {
+static const WCHAR securityProvidersKeyW[] = {
'S','Y','S','T','E','M','\\','C','u','r','r','e','n','t','C','o','n','t','r',
'o','l','S','e','t','\\','C','o','n','t','r','o','l','\\','S','e','c','u','r',
'i','t','y','P','r','o','v','i','d','e','r','s','\0'
Index: dlls/shlwapi/path.c
===================================================================
RCS file: /var/cvs/wine/dlls/shlwapi/path.c,v
retrieving revision 1.41
diff -u -r1.41 path.c
--- a/dlls/shlwapi/path.c 23 Jan 2004 22:45:25 -0000 1.41
+++ b/dlls/shlwapi/path.c 18 Apr 2004 13:48:48 -0000
@@ -1140,8 +1140,8 @@
*/
static BOOL WINAPI SHLWAPI_PathFindInOtherDirs(LPWSTR lpszFile, DWORD dwWhich)
{
- static WCHAR szSystem[] = { 'S','y','s','t','e','m','\0'};
- static WCHAR szPath[] = { 'P','A','T','H','\0'};
+ static const WCHAR szSystem[] = { 'S','y','s','t','e','m','\0'};
+ static const WCHAR szPath[] = { 'P','A','T','H','\0'};
DWORD dwLenPATH;
LPCWSTR lpszCurr;
WCHAR *lpszPATH;
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
@@ -960,10 +960,10 @@
*/
HRESULT MSSTYLES_GetPropertyFont(PTHEME_PROPERTY tp, HDC hdc, LOGFONTW *pFont)
{
- const WCHAR szBold[] = {'b','o','l','d','\0'};
- const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'};
- const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'};
- const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'};
+ static const WCHAR szBold[] = {'b','o','l','d','\0'};
+ static const WCHAR szItalic[] = {'i','t','a','l','i','c','\0'};
+ static const WCHAR szUnderline[] = {'u','n','d','e','r','l','i','n','e','\0'};
+ static const WCHAR szStrikeOut[] = {'s','t','r','i','k','e','o','u','t','\0'};
int pointSize;
WCHAR attr[32];
LPCWSTR lpCur = tp->lpValue;
Index: dlls/winmm/playsound.c
===================================================================
RCS file: /var/cvs/wine/dlls/winmm/playsound.c,v
retrieving revision 1.8
diff -u -r1.8 playsound.c
--- a/dlls/winmm/playsound.c 20 Jan 2004 01:45:05 -0000 1.8
+++ b/dlls/winmm/playsound.c 18 Apr 2004 14:02:48 -0000
@@ -62,13 +62,13 @@
HKEY hRegSnd, hRegApp, hScheme, hSnd;
DWORD err, type, count;
- static WCHAR wszSounds[] = {'S','o','u','n','d','s',0};
- static WCHAR wszDefault[] = {'D','e','f','a','u','l','t',0};
- static WCHAR wszKey[] = {'A','p','p','E','v','e','n','t','s','\\',
+ static const WCHAR wszSounds[] = {'S','o','u','n','d','s',0};
+ static const WCHAR wszDefault[] = {'D','e','f','a','u','l','t',0};
+ static const WCHAR wszKey[] = {'A','p','p','E','v','e','n','t','s','\\',
'S','c','h','e','m','e','s','\\',
'A','p','p','s',0};
- static WCHAR wszDotDefault[] = {'.','D','e','f','a','u','l','t',0};
- static WCHAR wszNull[] = {0};
+ static const WCHAR wszDotDefault[] = {'.','D','e','f','a','u','l','t',0};
+ static const WCHAR wszNull[] = {0};
TRACE("searching in SystemSound list for %s\n", debugstr_w(lpszName));
GetProfileStringW(wszSounds, (LPWSTR)lpszName, wszNull, str, sizeof(str)/sizeof(str[0]));
@@ -257,7 +257,7 @@
/* if resource, grab it */
if ((wps->fdwSound & SND_RESOURCE) == SND_RESOURCE) {
- static WCHAR wszWave[] = {'W','A','V','E',0};
+ static const WCHAR wszWave[] = {'W','A','V','E',0};
HRSRC hRes;
HGLOBAL hGlob;
Index: programs/wineconsole/dialog.c
===================================================================
RCS file: /var/cvs/wine/programs/wineconsole/dialog.c,v
retrieving revision 1.16
diff -u -r1.16 dialog.c
--- a/programs/wineconsole/dialog.c 5 Sep 2003 23:15:41 -0000 1.16
+++ b/programs/wineconsole/dialog.c 17 Apr 2004 21:15:38 -0000
@@ -608,8 +608,8 @@
SendDlgItemMessage(hDlg, IDC_CNF_CLOSE_EXIT, BM_SETCHECK,
(di->config.exit_on_die) ? BST_CHECKED : BST_UNCHECKED, 0L);
{
- static WCHAR s1[] = {'W','i','n','3','2',0};
- static WCHAR s2[] = {'E','m','a','c','s',0};
+ static const WCHAR s1[] = {'W','i','n','3','2',0};
+ static const WCHAR s2[] = {'E','m','a','c','s',0};
SendDlgItemMessage(hDlg, IDC_CNF_EDITION_MODE, CB_ADDSTRING,
0, (LPARAM)s1);
Index: programs/wineconsole/user.c
===================================================================
RCS file: /var/cvs/wine/programs/wineconsole/user.c,v
retrieving revision 1.20
diff -u -r1.20 user.c
--- a/programs/wineconsole/user.c 13 Jun 2003 16:32:52 -0000 1.20
+++ b/programs/wineconsole/user.c 17 Apr 2004 21:15:38 -0000
@@ -1355,7 +1355,7 @@
*/
enum init_return WCUSER_InitBackend(struct inner_data* data)
{
- static WCHAR wClassName[] = {'W','i','n','e','C','o','n','s','o','l','e','C','l','a','s','s',0};
+ static const WCHAR wClassName[] = {'W','i','n','e','C','o','n','s','o','l','e','C','l','a','s','s',0};
WNDCLASS wndclass;
Index: tools/wmc/mcl.c
===================================================================
RCS file: /var/cvs/wine/tools/wmc/mcl.c,v
retrieving revision 1.6
diff -u -r1.6 mcl.c
--- a/tools/wmc/mcl.c 21 Mar 2003 21:30:51 -0000 1.6
+++ b/tools/wmc/mcl.c 17 Apr 2004 21:15:38 -0000
@@ -588,8 +588,8 @@
*/
int yylex(void)
{
- static WCHAR ustr_dot1[] = { '.', '\n', 0 };
- static WCHAR ustr_dot2[] = { '.', '\r', '\n', 0 };
+ static const WCHAR ustr_dot1[] = { '.', '\n', 0 };
+ static const WCHAR ustr_dot2[] = { '.', '\r', '\n', 0 };
static int isinit = 0;
int ch;
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
Hiroshima '45 - Czernobyl '86 - Windows '95
More information about the wine-patches
mailing list