String staticification and constification (take 2)
Francois Gouget
fgouget at free.fr
Wed Apr 28 05:07:55 CDT 2004
Now that the Unicode strings have been constified and staticified, it's
the turn of our regular ascii strings.
In this version I keep the 'static const char buf[]' form throughout as
this is the preferred form.
Changelog:
* dlls/comctl32/header.c
dlls/gdi/printdrv.c
dlls/iphlpapi/ipstats.c
dlls/kernel/tests/mailslot.c
dlls/kernel/tests/pipe.c
dlls/msvcrt/tests/file.c
dlls/msvcrt/tests/scanf.c
dlls/msvcrt/tests/string.c
dlls/ntdll/tests/rtlstr.c
dlls/ole32/storage32.c
dlls/shlwapi/reg.c
dlls/urlmon/umon.c
dlls/user/tests/resource.c
dlls/wineps/download.c
dlls/wineps/pen.c
dlls/wineps/ps.c
dlls/wineps/psdrv.h
dlls/wineps/type42.c
dlls/x11drv/wineclipsrv.c
dlls/x11drv/xrender.c
programs/clock/main.c
programs/cmdlgtst/cmdlgtst.c
programs/wcmd/batch.c
programs/wcmd/builtins.c
programs/wcmd/directory.c
programs/wcmd/wcmd.h
programs/wcmd/wcmdmain.c
programs/winetest/main.c
programs/winetest/send.c
programs/winhelp/string.c
programs/winhelp/winhelp.h
tools/widl/widl.c
tools/wmc/mcl.c
tools/wmc/mcy.y
tools/wmc/utils.c
tools/wrc/readres.c
tools/wrc/wrc.c
Make our ascii strings static const.
Remove a couple string variables that were used only once and use the
string literal directly.
Index: dlls/comctl32/header.c
===================================================================
RCS file: /var/cvs/wine/dlls/comctl32/header.c,v
retrieving revision 1.62
diff -u -r1.62 header.c
--- a/dlls/comctl32/header.c 20 Nov 2003 22:04:14 -0000 1.62
+++ b/dlls/comctl32/header.c 26 Apr 2004 21:36:12 -0000
@@ -924,9 +924,8 @@
lpItem->cxy = phdi->cxy;
if (phdi->mask & HDI_TEXT) {
- static char empty[] = "";
if (!phdi->pszText) /* null pointer check */
- phdi->pszText = empty;
+ phdi->pszText = "";
if (phdi->pszText != LPSTR_TEXTCALLBACKA) {
len = MultiByteToWideChar(CP_ACP, 0, phdi->pszText, -1, NULL, 0);
lpItem->pszText = Alloc( len*sizeof(WCHAR) );
Index: dlls/gdi/printdrv.c
===================================================================
RCS file: /var/cvs/wine/dlls/gdi/printdrv.c,v
retrieving revision 1.38
diff -u -r1.38 printdrv.c
--- a/dlls/gdi/printdrv.c 14 Apr 2004 19:40:54 -0000 1.38
+++ b/dlls/gdi/printdrv.c 26 Apr 2004 23:20:26 -0000
@@ -54,10 +54,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(print);
-static char PrinterModel[] = "Printer Model";
-static char DefaultDevMode[] = "Default DevMode";
-static char PrinterDriverData[] = "PrinterDriverData";
-static char Printers[] = "System\\CurrentControlSet\\Control\\Print\\Printers\\";
+static const char PrinterModel[] = "Printer Model";
+static const char DefaultDevMode[] = "Default DevMode";
+static const char PrinterDriverData[] = "PrinterDriverData";
+static const char Printers[] = "System\\CurrentControlSet\\Control\\Print\\Printers\\";
/******************************************************************
Index: dlls/iphlpapi/ipstats.c
===================================================================
RCS file: /var/cvs/wine/dlls/iphlpapi/ipstats.c,v
retrieving revision 1.9
diff -u -r1.9 ipstats.c
--- a/dlls/iphlpapi/ipstats.c 1 Mar 2004 21:32:02 -0000 1.9
+++ b/dlls/iphlpapi/ipstats.c 26 Apr 2004 21:36:12 -0000
@@ -162,7 +162,7 @@
/* get most of these stats from /proc/net/snmp, no error if can't */
fp = fopen("/proc/net/snmp", "r");
if (fp) {
- const char hdr[] = "Icmp:";
+ static const char hdr[] = "Icmp:";
char buf[512] = { 0 }, *ptr;
do {
@@ -292,7 +292,7 @@
/* get most of these stats from /proc/net/snmp, no error if can't */
fp = fopen("/proc/net/snmp", "r");
if (fp) {
- const char hdr[] = "Ip:";
+ static const char hdr[] = "Ip:";
char buf[512] = { 0 }, *ptr;
do {
@@ -401,7 +401,7 @@
/* get from /proc/net/snmp, no error if can't */
fp = fopen("/proc/net/snmp", "r");
if (fp) {
- const char hdr[] = "Tcp:";
+ static const char hdr[] = "Tcp:";
char buf[512] = { 0 }, *ptr;
@@ -491,7 +491,7 @@
/* get from /proc/net/snmp, no error if can't */
fp = fopen("/proc/net/snmp", "r");
if (fp) {
- const char hdr[] = "Udp:";
+ static const char hdr[] = "Udp:";
char buf[512] = { 0 }, *ptr;
Index: dlls/kernel/tests/mailslot.c
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/tests/mailslot.c,v
retrieving revision 1.2
diff -u -r1.2 mailslot.c
--- a/dlls/kernel/tests/mailslot.c 6 Feb 2004 05:24:34 -0000 1.2
+++ b/dlls/kernel/tests/mailslot.c 26 Apr 2004 21:36:12 -0000
@@ -35,9 +35,9 @@
#endif
-const char szmspath[] = "\\\\.\\mailslot\\wine_mailslot_test";
+static const char szmspath[] = "\\\\.\\mailslot\\wine_mailslot_test";
-int mailslot_test()
+static int mailslot_test()
{
HANDLE hSlot, hSlot2, hWriter, hWriter2;
unsigned char buffer[16];
Index: dlls/kernel/tests/pipe.c
===================================================================
RCS file: /var/cvs/wine/dlls/kernel/tests/pipe.c,v
retrieving revision 1.10
diff -u -r1.10 pipe.c
--- a/dlls/kernel/tests/pipe.c 26 Apr 2004 23:30:51 -0000 1.10
+++ b/dlls/kernel/tests/pipe.c 26 Apr 2004 23:51:00 -0000
@@ -50,12 +50,12 @@
#define PIPENAME "\\\\.\\PiPe\\tests_" __FILE__
-void test_CreateNamedPipe(pipemode)
+static void test_CreateNamedPipe(pipemode)
{
HANDLE hnp;
HANDLE hFile;
- const char obuf[] = "Bit Bucket";
- const char obuf2[] = "More bits";
+ static const char obuf[] = "Bit Bucket";
+ static const char obuf2[] = "More bits";
char ibuf[32], *pbuf;
DWORD written;
DWORD readden;
@@ -608,7 +608,7 @@
trace("exercizeServer starting\n");
for (i = 0; i < 8; i++) {
HANDLE hFile=INVALID_HANDLE_VALUE;
- const char obuf[] = "Bit Bucket";
+ static const char obuf[] = "Bit Bucket";
char ibuf[32];
DWORD written;
DWORD readden;
@@ -651,7 +651,7 @@
trace("exercizeServer returning\n");
}
-void test_NamedPipe_2(void)
+static void test_NamedPipe_2(void)
{
HANDLE serverThread;
DWORD serverThreadId;
@@ -689,11 +689,11 @@
trace("test_NamedPipe_2 returning\n");
}
-void test_DisconnectNamedPipe(void)
+static void test_DisconnectNamedPipe(void)
{
HANDLE hnp;
HANDLE hFile;
- const char obuf[] = "Bit Bucket";
+ static const char obuf[] = "Bit Bucket";
char ibuf[32];
DWORD written;
DWORD readden;
Index: dlls/msvcrt/tests/file.c
===================================================================
RCS file: /var/cvs/wine/dlls/msvcrt/tests/file.c,v
retrieving revision 1.8
diff -u -r1.8 file.c
--- a/dlls/msvcrt/tests/file.c 27 Jan 2004 04:01:10 -0000 1.8
+++ b/dlls/msvcrt/tests/file.c 26 Apr 2004 21:36:12 -0000
@@ -31,7 +31,8 @@
static void test_fdopen( void )
{
- static char buffer[] = {0,1,2,3,4,5,6,7,8,9};
+ static const char buffer[] = {0,1,2,3,4,5,6,7,8,9};
+ char ibuf[10];
int fd;
FILE *file;
@@ -42,15 +43,15 @@
fd = open ("fdopen.tst", O_RDONLY | O_BINARY);
lseek (fd, 5, SEEK_SET);
file = fdopen (fd, "rb");
- ok (fread (buffer, 1, sizeof (buffer), file) == 5, "read wrong byte count\n");
- ok (memcmp (buffer, buffer + 5, 5) == 0, "read wrong bytes\n");
+ ok (fread (ibuf, 1, sizeof (buffer), file) == 5, "read wrong byte count\n");
+ ok (memcmp (ibuf, buffer + 5, 5) == 0, "read wrong bytes\n");
fclose (file);
unlink ("fdopen.tst");
}
static void test_fileops( void )
{
- static char outbuffer[] = "0,1,2,3,4,5,6,7,8,9";
+ static const char outbuffer[] = "0,1,2,3,4,5,6,7,8,9";
char buffer[256];
WCHAR wbuffer[256];
int fd;
@@ -85,7 +86,7 @@
ok(lstrlenW(wbuffer) == 1,"fgets dropped chars\n");
fclose (file);
unlink ("fdopen.tst");
-}
+}
static WCHAR* AtoW( char* p )
{
@@ -102,12 +103,12 @@
char* tempf;
FILE *tempfh;
- const char mytext[]= "This is test_fgetwc\n";
+ static const char mytext[]= "This is test_fgetwc\n";
WCHAR wtextW[LLEN+1];
WCHAR *mytextW = NULL, *aptr, *wptr;
BOOL diff_found = FALSE;
unsigned int i;
-
+
tempf=_tempnam(".","wne");
tempfh = fopen(tempf,"wt"); /* open in TEXT mode */
fputs(mytext,tempfh);
@@ -127,13 +128,13 @@
fclose(tempfh);
unlink(tempf);
}
-
+
static void test_file_put_get( void )
{
char* tempf;
FILE *tempfh;
- const char mytext[]= "This is a test_file_put_get\n";
- const char dostext[]= "This is a test_file_put_get\r\n";
+ static const char mytext[]= "This is a test_file_put_get\n";
+ static const char dostext[]= "This is a test_file_put_get\r\n";
char btext[LLEN];
WCHAR wtextW[LLEN+1];
WCHAR *mytextW = NULL, *aptr, *wptr;
@@ -176,12 +177,13 @@
fclose(tempfh);
unlink(tempf);
}
+
static void test_file_write_read( void )
{
char* tempf;
int tempfd;
- const char mytext[]= "This is test_file_write_read\nsecond line\n";
- const char dostext[]= "This is test_file_write_read\r\nsecond line\r\n";
+ static const char mytext[]= "This is test_file_write_read\nsecond line\n";
+ static const char dostext[]= "This is test_file_write_read\r\nsecond line\r\n";
char btext[LLEN];
tempf=_tempnam(".","wne");
Index: dlls/msvcrt/tests/scanf.c
===================================================================
RCS file: /var/cvs/wine/dlls/msvcrt/tests/scanf.c,v
retrieving revision 1.13
diff -u -r1.13 scanf.c
--- a/dlls/msvcrt/tests/scanf.c 27 Jan 2004 04:01:10 -0000 1.13
+++ b/dlls/msvcrt/tests/scanf.c 26 Apr 2004 23:21:23 -0000
@@ -28,16 +28,16 @@
char format[20];
int result, ret;
float res1= -82.6267f, res2= 27.76f, res11, res12;
- char pname[]=" St. Petersburg, Florida\n";
+ static const char pname[]=" St. Petersburg, Florida\n";
int hour=21,min=59,sec=20;
int number,number_so_far;
-
+
/* check EOF */
strcpy(buffer,"");
ret = sscanf(buffer, "%d", &result);
ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF );
-
+
/* check %x */
strcpy(buffer,"0x519");
ok( sscanf(buffer, "%x", &result) == 1, "sscanf failed\n" );
Index: dlls/msvcrt/tests/string.c
===================================================================
RCS file: /var/cvs/wine/dlls/msvcrt/tests/string.c,v
retrieving revision 1.1
diff -u -r1.1 string.c
--- a/dlls/msvcrt/tests/string.c 19 Mar 2004 01:53:11 -0000 1.1
+++ b/dlls/msvcrt/tests/string.c 26 Apr 2004 23:21:57 -0000
@@ -33,7 +33,7 @@
START_TEST(string)
{
void *mem;
- char xilstring[]="c:/xilinx";
+ static const char xilstring[]="c:/xilinx";
int nLen=strlen(xilstring);
HMODULE hMsvcrt = LoadLibraryA("msvcrt.dll");
ok(hMsvcrt != 0, "LoadLibraryA failed\n");
Index: dlls/ntdll/tests/rtlstr.c
===================================================================
RCS file: /var/cvs/wine/dlls/ntdll/tests/rtlstr.c,v
retrieving revision 1.16
diff -u -r1.16 rtlstr.c
--- a/dlls/ntdll/tests/rtlstr.c 20 Apr 2004 01:12:17 -0000 1.16
+++ b/dlls/ntdll/tests/rtlstr.c 26 Apr 2004 23:22:29 -0000
@@ -479,7 +479,7 @@
static void test_RtlCopyString(void)
{
static const char teststring[] = "Some Wild String";
- static char deststring[] = " ";
+ static const char deststring[] = " ";
STRING str;
STRING deststr;
Index: dlls/ole32/storage32.c
===================================================================
RCS file: /var/cvs/wine/dlls/ole32/storage32.c,v
retrieving revision 1.49
diff -u -r1.49 storage32.c
--- a/dlls/ole32/storage32.c 20 Apr 2004 02:14:00 -0000 1.49
+++ b/dlls/ole32/storage32.c 26 Apr 2004 23:23:00 -0000
@@ -7228,7 +7228,7 @@
{
LARGE_INTEGER iSeekPos;
METAFILEPICT16 MetaFilePict;
- char strMetafilePictName[] = "METAFILEPICT";
+ static const char strMetafilePictName[] = "METAFILEPICT";
/* Set the TypeID for a Metafile */
pOleStreamData[1].dwTypeID = 5;
Index: dlls/shlwapi/reg.c
===================================================================
RCS file: /var/cvs/wine/dlls/shlwapi/reg.c,v
retrieving revision 1.48
diff -u -r1.48 reg.c
--- a/dlls/shlwapi/reg.c 20 Apr 2004 01:12:17 -0000 1.48
+++ b/dlls/shlwapi/reg.c 26 Apr 2004 21:36:13 -0000
@@ -1047,7 +1047,7 @@
{
DWORD dwRet = ERROR_SUCCESS, dwDummy;
HKEY hSubKey;
- char szEmpty[] = "";
+ static const char szEmpty[] = { '\0' };
TRACE("(hkey=%p,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_a(lpszSubKey),
debugstr_a(lpszValue), dwType, pvData, cbData);
Index: dlls/urlmon/umon.c
===================================================================
RCS file: /var/cvs/wine/dlls/urlmon/umon.c,v
retrieving revision 1.32
diff -u -r1.32 umon.c
--- a/dlls/urlmon/umon.c 20 Apr 2004 02:14:00 -0000 1.32
+++ b/dlls/urlmon/umon.c 26 Apr 2004 21:36:13 -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/resource.c
===================================================================
RCS file: /var/cvs/wine/dlls/user/tests/resource.c,v
retrieving revision 1.2
diff -u -r1.2 resource.c
--- a/dlls/user/tests/resource.c 23 Jan 2004 20:50:35 -0000 1.2
+++ b/dlls/user/tests/resource.c 26 Apr 2004 21:36:13 -0000
@@ -26,7 +26,7 @@
test_LoadStringA (void)
{
HINSTANCE hInst = GetModuleHandle (NULL);
- const char str[] = "String resource"; /* same in resource.rc */
+ static const char str[] = "String resource"; /* same in resource.rc */
char buf[128];
struct string_test {
int bufsiz;
Index: dlls/wineps/download.c
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/download.c,v
retrieving revision 1.10
diff -u -r1.10 download.c
--- a/dlls/wineps/download.c 12 Feb 2004 20:04:48 -0000 1.10
+++ b/dlls/wineps/download.c 26 Apr 2004 21:36:13 -0000
@@ -268,7 +268,7 @@
BOOL PSDRV_EmptyDownloadList(PSDRV_PDEVICE *physDev, BOOL write_undef)
{
DOWNLOAD *pdl, *old;
- char undef[] = "/%s findfont 40 scalefont setfont /%s undefinefont\n";
+ static const char undef[] = "/%s findfont 40 scalefont setfont /%s undefinefont\n";
char buf[sizeof(undef) + 200];
char *default_font = physDev->pi->ppd->DefaultFont ?
physDev->pi->ppd->DefaultFont : "Courier";
Index: dlls/wineps/pen.c
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/pen.c,v
retrieving revision 1.13
diff -u -r1.13 pen.c
--- a/dlls/wineps/pen.c 20 Jan 2004 22:48:57 -0000 1.13
+++ b/dlls/wineps/pen.c 26 Apr 2004 23:25:25 -0000
@@ -28,11 +28,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
-static char PEN_dash[] = "50 30"; /* ----- ----- ----- */
-static char PEN_dot[] = "20"; /* -- -- -- -- -- -- */
-static char PEN_dashdot[] = "40 30 20 30"; /* ---- -- ---- -- */
-static char PEN_dashdotdot[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */
-static char PEN_alternate[] = "1";
+static const char PEN_dash[] = "50 30"; /* ----- ----- ----- */
+static const char PEN_dot[] = "20"; /* -- -- -- -- -- -- */
+static const char PEN_dashdot[] = "40 30 20 30"; /* ---- -- ---- -- */
+static const char PEN_dashdotdot[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */
+static const char PEN_alternate[] = "1";
/***********************************************************************
* SelectPen (WINEPS.@)
Index: dlls/wineps/ps.c
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/ps.c,v
retrieving revision 1.26
diff -u -r1.26 ps.c
--- a/dlls/wineps/ps.c 12 Feb 2004 20:05:22 -0000 1.26
+++ b/dlls/wineps/ps.c 26 Apr 2004 21:36:13 -0000
@@ -617,7 +617,7 @@
BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev)
{
- char buf[] = ">\n] setcolorspace\n";
+ static const char buf[] = ">\n] setcolorspace\n";
return PSDRV_WriteSpool(physDev, buf, sizeof(buf) - 1);
}
@@ -643,17 +643,17 @@
INT widthDst, INT heightDst, INT widthSrc,
INT heightSrc, char *bits, BOOL mask)
{
- const char start[] = "%d %d translate\n%d %d scale\n<<\n"
+ static const char start[] = "%d %d translate\n%d %d scale\n<<\n"
" /ImageType 1\n /Width %d\n /Height %d\n /BitsPerComponent %d\n"
" /ImageMatrix [%d 0 0 %d 0 %d]\n";
- const char decode1[] = " /Decode [0 %d]\n";
- const char decode3[] = " /Decode [0 1 0 1 0 1]\n";
+ static const char decode1[] = " /Decode [0 %d]\n";
+ static const char decode3[] = " /Decode [0 1 0 1 0 1]\n";
- const char end[] = " /DataSource currentfile /ASCII85Decode filter /RunLengthDecode filter\n>> image\n";
- const char endmask[] = " /DataSource currentfile /ASCII85Decode filter /RunLengthDecode filter\n>> imagemask\n";
+ static const char end[] = " /DataSource currentfile /ASCII85Decode filter /RunLengthDecode filter\n>> image\n";
+ static const char endmask[] = " /DataSource currentfile /ASCII85Decode filter /RunLengthDecode filter\n>> imagemask\n";
- const char endbits[] = " /DataSource <%s>\n>> image\n";
+ static const char endbits[] = " /DataSource <%s>\n>> image\n";
char *buf = HeapAlloc(PSDRV_Heap, 0, 1000);
@@ -775,10 +775,10 @@
BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits)
{
- const char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n "
+ static const char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n "
"/BBox [0 0 %d %d]\n /XStep %d\n /YStep %d\n /PaintProc {\n begin\n";
- const char end[] = " end\n }\n>>\n matrix makepattern setpattern\n";
+ static const char end[] = " end\n }\n>>\n matrix makepattern setpattern\n";
char *buf, *ptr;
INT w, h, x, y;
COLORREF map[2];
@@ -809,10 +809,10 @@
BOOL PSDRV_WriteDIBPatternDict(PSDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage)
{
- const char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n "
+ static const char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n "
"/BBox [0 0 %d %d]\n /XStep %d\n /YStep %d\n /PaintProc {\n begin\n";
- const char end[] = " end\n }\n>>\n matrix makepattern setpattern\n";
+ static const char end[] = " end\n }\n>>\n matrix makepattern setpattern\n";
char *buf, *ptr;
BYTE *bits;
INT w, h, x, y, colours;
Index: dlls/wineps/psdrv.h
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/psdrv.h,v
retrieving revision 1.51
diff -u -r1.51 psdrv.h
--- a/dlls/wineps/psdrv.h 4 Mar 2004 06:26:11 -0000 1.51
+++ b/dlls/wineps/psdrv.h 26 Apr 2004 21:36:13 -0000
@@ -308,7 +308,7 @@
typedef struct {
INT style;
INT width;
- char *dash;
+ const char* dash;
PSCOLOR color;
BOOL set;
} PSPEN;
Index: dlls/wineps/type42.c
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/type42.c,v
retrieving revision 1.9
diff -u -r1.9 type42.c
--- a/dlls/wineps/type42.c 7 Apr 2004 03:59:41 -0000 1.9
+++ b/dlls/wineps/type42.c 26 Apr 2004 21:36:13 -0000
@@ -142,7 +142,7 @@
WORD num_of_tables = sizeof(tables_templ) / sizeof(tables_templ[0]) - 1;
char *buf;
TYPE42 *t42;
- const char start[] = /* name, fontbbox */
+ static const char start[] = /* name, fontbbox */
"25 dict begin\n"
" /FontName /%s def\n"
" /Encoding 256 array 0 1 255{1 index exch /.notdef put} for\n"
@@ -155,10 +155,10 @@
" /.notdef 0 def\n"
" currentdict end def\n"
" /sfnts [\n";
- const char TT_offset_table[] = "<00010000%04x%04x%04x%04x\n";
- const char TT_table_dir_entry[] = "%08lx%08lx%08lx%08lx\n";
- const char storage[] ="]\nhavetype42gdir{pop}{{string} forall}ifelse\n";
- const char end[] = "] def\n"
+ static const char TT_offset_table[] = "<00010000%04x%04x%04x%04x\n";
+ static const char TT_table_dir_entry[] = "%08lx%08lx%08lx%08lx\n";
+ static const char storage[] ="]\nhavetype42gdir{pop}{{string} forall}ifelse\n";
+ static const char end[] = "] def\n"
"havetype42gdir{/GlyphDirectory 256 dict def\n"
" sfnts 0 get dup %ld (locx) putinterval %ld (glfx) putinterval}if\n"
"currentdict end dup /FontName get exch definefont pop\n";
Index: dlls/x11drv/wineclipsrv.c
===================================================================
RCS file: /var/cvs/wine/dlls/x11drv/wineclipsrv.c,v
retrieving revision 1.5
diff -u -r1.5 wineclipsrv.c
--- a/dlls/x11drv/wineclipsrv.c 28 Oct 2003 21:09:47 -0000 1.5
+++ b/dlls/x11drv/wineclipsrv.c 26 Apr 2004 23:26:53 -0000
@@ -151,10 +151,10 @@
static Window g_win = 0; /* the hidden clipboard server window */
static GC g_gc = 0;
-static char *g_szOutOfMemory = "Insufficient memory!\n";
+static const char g_szOutOfMemory[] = "Insufficient memory!\n";
/* X selection context info */
-static char _CLIPBOARD[] = "CLIPBOARD"; /* CLIPBOARD atom name */
+static const char _CLIPBOARD[] = "CLIPBOARD"; /* CLIPBOARD atom name */
static int g_selectionToAcquire = 0; /* Masks for the selection to be acquired */
static int g_selectionAcquired = 0; /* Contains the current selection masks */
static int g_clearAllSelections = 0; /* If TRUE *all* selections are lost on SelectionClear */
Index: dlls/x11drv/xrender.c
===================================================================
RCS file: /var/cvs/wine/dlls/x11drv/xrender.c,v
retrieving revision 1.36
diff -u -r1.36 xrender.c
--- a/dlls/x11drv/xrender.c 4 Mar 2004 03:55:52 -0000 1.36
+++ b/dlls/x11drv/xrender.c 26 Apr 2004 23:27:44 -0000
@@ -634,7 +634,7 @@
TRACE(output);
}
} else {
- char blks[] = " .:;!o*#";
+ static const char blks[] = " .:;!o*#";
char str[2];
str[1] = '\0';
Index: programs/clock/main.c
===================================================================
RCS file: /var/cvs/wine/programs/clock/main.c,v
retrieving revision 1.21
diff -u -r1.21 main.c
--- a/programs/clock/main.c 8 Dec 2003 22:23:03 -0000 1.21
+++ b/programs/clock/main.c 26 Apr 2004 23:28:26 -0000
@@ -384,10 +384,10 @@
{
MSG msg;
WNDCLASS class;
-
- char szClassName[] = "CLClass"; /* To make sure className >= 0x10000 */
- char szWinName[] = "Clock";
-
+
+ static const char szClassName[] = "CLClass"; /* To make sure className >= 0x10000 */
+ static const char szWinName[] = "Clock";
+
/* Setup Globals */
memset(&Globals.hFont, 0, sizeof (Globals.hFont));
Globals.bAnalog = TRUE;
Index: programs/cmdlgtst/cmdlgtst.c
===================================================================
RCS file: /var/cvs/wine/programs/cmdlgtst/cmdlgtst.c,v
retrieving revision 1.12
diff -u -r1.12 cmdlgtst.c
--- a/programs/cmdlgtst/cmdlgtst.c 27 Aug 2003 02:07:02 -0000 1.12
+++ b/programs/cmdlgtst/cmdlgtst.c 26 Apr 2004 23:29:08 -0000
@@ -58,9 +58,9 @@
#define EXPORT
-static char menuName[] = "CmdlgtstMenu";
-static char className[] = "CmdlgtstClass";
-static char windowName[] = "Cmdlgtst Window";
+static const char menuName[] = "CmdlgtstMenu";
+static const char className[] = "CmdlgtstClass";
+static const char windowName[] = "Cmdlgtst Window";
/*
* global hInstance variable. This makes the code non-threadable,
@@ -80,7 +80,7 @@
static CHOOSECOLOR cc;
static LOGFONT cf_lf;
static CHOOSEFONT cf;
-static char ofn_filepat[] = "All Files (*.*)\0*.*\0Only Text Files (*.txt)\0*.txt\0";
+static const char ofn_filepat[] = "All Files (*.*)\0*.*\0Only Text Files (*.txt)\0*.txt\0";
static char ofn_result[1024];
static char ofn_titleresult[128];
static OPENFILENAME ofn;
@@ -196,7 +196,7 @@
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWnd;
ofn.hInstance = g_hInstance;
- ofn.lpstrFilter = (LPSTR) ofn_filepat;
+ ofn.lpstrFilter = ofn_filepat;
ofn.lpstrCustomFilter = 0;
ofn.nMaxCustFilter = 0;
ofn.nFilterIndex = 0;
Index: programs/wcmd/batch.c
===================================================================
RCS file: /var/cvs/wine/programs/wcmd/batch.c,v
retrieving revision 1.11
diff -u -r1.11 batch.c
--- a/programs/wcmd/batch.c 25 Mar 2003 00:33:56 -0000 1.11
+++ b/programs/wcmd/batch.c 26 Apr 2004 21:36:15 -0000
@@ -22,9 +22,6 @@
void WCMD_batch_command (char *line);
-extern char nyi[];
-extern char newline[];
-extern char version_string[];
extern int echo_mode;
extern char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
extern BATCH_CONTEXT *context;
Index: programs/wcmd/builtins.c
===================================================================
RCS file: /var/cvs/wine/programs/wcmd/builtins.c,v
retrieving revision 1.23
diff -u -r1.23 builtins.c
--- a/programs/wcmd/builtins.c 22 Mar 2004 22:56:58 -0000 1.23
+++ b/programs/wcmd/builtins.c 26 Apr 2004 21:36:15 -0000
@@ -46,10 +46,6 @@
extern HINSTANCE hinst;
extern char *inbuilt[];
-extern char nyi[];
-extern char newline[];
-extern char version_string[];
-extern char anykey[];
extern int echo_mode, verify_mode;
extern char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
extern BATCH_CONTEXT *context;
@@ -1027,7 +1023,6 @@
DWORD count, serial;
char string[MAX_PATH], label[MAX_PATH], curdir[MAX_PATH];
BOOL status;
-static char syntax[] = "Syntax Error\n\n";
if (lstrlen(path) == 0) {
status = GetCurrentDirectory (sizeof(curdir), curdir);
@@ -1040,7 +1035,7 @@
}
else {
if ((path[1] != ':') || (lstrlen(path) != 2)) {
- WCMD_output_asis(syntax);
+ WCMD_output_asis("Syntax Error\n\n");
return 0;
}
wsprintf (curdir, "%s\\", path);
Index: programs/wcmd/directory.c
===================================================================
RCS file: /var/cvs/wine/programs/wcmd/directory.c,v
retrieving revision 1.19
diff -u -r1.19 directory.c
--- a/programs/wcmd/directory.c 23 Jan 2004 01:51:33 -0000 1.19
+++ b/programs/wcmd/directory.c 26 Apr 2004 21:36:15 -0000
@@ -35,10 +35,6 @@
char * WCMD_strrev (char *buff);
-extern char nyi[];
-extern char newline[];
-extern char version_string[];
-extern char anykey[];
extern int echo_mode;
extern char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
extern DWORD errorlevel;
@@ -131,7 +127,6 @@
void WCMD_list_directory (char *search_path, int level) {
char string[1024], datestring[32], timestring[32];
-char mem_err[] = "Memory Allocation Error";
char *p;
char real_path[MAX_PATH];
WIN32_FIND_DATA *fd;
@@ -193,7 +188,7 @@
fd = realloc (fd, (entry_count+1)*sizeof(WIN32_FIND_DATA));
if (fd == NULL) {
FindClose (hff);
- WCMD_output (mem_err);
+ WCMD_output ("Memory Allocation Error");
return;
}
} while (FindNextFile(hff, (fd+entry_count)) != 0);
Index: programs/wcmd/wcmd.h
===================================================================
RCS file: /var/cvs/wine/programs/wcmd/wcmd.h,v
retrieving revision 1.14
diff -u -r1.14 wcmd.h
--- a/programs/wcmd/wcmd.h 22 Mar 2004 22:56:58 -0000 1.14
+++ b/programs/wcmd/wcmd.h 26 Apr 2004 23:31:11 -0000
@@ -137,3 +137,9 @@
/* Must be last in list */
#define WCMD_EXIT 38
+
+/* Some standard messages */
+extern const char nyi[];
+extern const char newline[];
+extern const char version_string[];
+extern const char anykey[];
Index: programs/wcmd/wcmdmain.c
===================================================================
RCS file: /var/cvs/wine/programs/wcmd/wcmdmain.c,v
retrieving revision 1.41
diff -u -r1.41 wcmdmain.c
--- a/programs/wcmd/wcmdmain.c 22 Mar 2004 22:56:58 -0000 1.41
+++ b/programs/wcmd/wcmdmain.c 26 Apr 2004 23:29:53 -0000
@@ -37,10 +37,10 @@
HINSTANCE hinst;
DWORD errorlevel;
int echo_mode = 1, verify_mode = 0;
-char nyi[] = "Not Yet Implemented\n\n";
-char newline[] = "\n";
-char version_string[] = "WCMD Version 0.17\n\n";
-char anykey[] = "Press Return key to continue: ";
+const char nyi[] = "Not Yet Implemented\n\n";
+const char newline[] = "\n";
+const char version_string[] = "WCMD Version 0.17\n\n";
+const char anykey[] = "Press Return key to continue: ";
char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
BATCH_CONTEXT *context = NULL;
Index: programs/winetest/main.c
===================================================================
RCS file: /var/cvs/wine/programs/winetest/main.c,v
retrieving revision 1.16
diff -u -r1.16 main.c
--- a/programs/winetest/main.c 23 Apr 2004 23:30:11 -0000 1.16
+++ b/programs/winetest/main.c 26 Apr 2004 21:36:15 -0000
@@ -321,7 +321,8 @@
FILE *subfile;
size_t total;
char buffer[8192], *index;
- const char header[] = "Valid test names:", seps[] = " \r\n";
+ static const char header[] = "Valid test names:";
+ static const char seps[] = " \r\n";
int allocated;
test->subtest_count = 0;
Index: programs/winetest/send.c
===================================================================
RCS file: /var/cvs/wine/programs/winetest/send.c,v
retrieving revision 1.9
diff -u -r1.9 send.c
--- a/programs/winetest/send.c 20 Apr 2004 20:15:43 -0000 1.9
+++ b/programs/winetest/send.c 26 Apr 2004 21:36:15 -0000
@@ -113,15 +113,15 @@
/* RFC 2068 */
#define SEP "-"
- const char head[] = "POST /submit HTTP/1.0\r\n"
+ static const char head[] = "POST /submit HTTP/1.0\r\n"
"Host: test.winehq.org\r\n"
"User-Agent: Winetest Shell\r\n"
"Content-Type: multipart/form-data; boundary=" SEP "\r\n"
"Content-Length: %u\r\n\r\n";
- const char body1[] = "--" SEP "\r\n"
+ static const char body1[] = "--" SEP "\r\n"
"Content-Disposition: form-data; name=reportfile; filename=\"%s\"\r\n"
"Content-Type: application/octet-stream\r\n\r\n";
- const char body2[] = "\r\n--" SEP "\r\n"
+ static const char body2[] = "\r\n--" SEP "\r\n"
"Content-Disposition: form-data; name=submit\r\n\r\n"
"Upload File\r\n"
"--" SEP "--\r\n";
Index: programs/winhelp/string.c
===================================================================
RCS file: /var/cvs/wine/programs/winhelp/string.c,v
retrieving revision 1.5
diff -u -r1.5 string.c
--- a/programs/winhelp/string.c 20 Nov 2002 19:46:18 -0000 1.5
+++ b/programs/winhelp/string.c 26 Apr 2004 23:30:29 -0000
@@ -20,15 +20,15 @@
/* Class names */
-char MAIN_WIN_CLASS_NAME[] = "MS_WINHELP";
-char BUTTON_BOX_WIN_CLASS_NAME[] = "WHButtonBox";
-char TEXT_WIN_CLASS_NAME[] = "WHText";
-char SHADOW_WIN_CLASS_NAME[] = "WHShadow";
-char HISTORY_WIN_CLASS_NAME[] = "WHHistory";
-char STRING_BUTTON[] = "BUTTON";
+const char MAIN_WIN_CLASS_NAME[] = "MS_WINHELP";
+const char BUTTON_BOX_WIN_CLASS_NAME[] = "WHButtonBox";
+const char TEXT_WIN_CLASS_NAME[] = "WHText";
+const char SHADOW_WIN_CLASS_NAME[] = "WHShadow";
+const char HISTORY_WIN_CLASS_NAME[] = "WHHistory";
+const char STRING_BUTTON[] = "BUTTON";
/* Resource names */
-char STRING_DIALOG_TEST[] = "DIALOG_TEST";
+const char STRING_DIALOG_TEST[] = "DIALOG_TEST";
/* Local Variables: */
/* c-file-style: "GNU" */
Index: programs/winhelp/winhelp.h
===================================================================
RCS file: /var/cvs/wine/programs/winhelp/winhelp.h,v
retrieving revision 1.11
diff -u -r1.11 winhelp.h
--- a/programs/winhelp/winhelp.h 5 Sep 2003 23:15:41 -0000 1.11
+++ b/programs/winhelp/winhelp.h 26 Apr 2004 23:30:53 -0000
@@ -142,14 +142,14 @@
HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
-extern char MAIN_WIN_CLASS_NAME[];
-extern char BUTTON_BOX_WIN_CLASS_NAME[];
-extern char TEXT_WIN_CLASS_NAME[];
-extern char SHADOW_WIN_CLASS_NAME[];
-extern char HISTORY_WIN_CLASS_NAME[];
-extern char STRING_BUTTON[];
-extern char STRING_MENU_Xx[];
-extern char STRING_DIALOG_TEST[];
+extern const char MAIN_WIN_CLASS_NAME[];
+extern const char BUTTON_BOX_WIN_CLASS_NAME[];
+extern const char TEXT_WIN_CLASS_NAME[];
+extern const char SHADOW_WIN_CLASS_NAME[];
+extern const char HISTORY_WIN_CLASS_NAME[];
+extern const char STRING_BUTTON[];
+extern const char STRING_MENU_Xx[];
+extern const char STRING_DIALOG_TEST[];
#endif
/* Buttons */
Index: tools/widl/widl.c
===================================================================
RCS file: /var/cvs/wine/tools/widl/widl.c,v
retrieving revision 1.15
diff -u -r1.15 widl.c
--- a/tools/widl/widl.c 7 Jan 2004 04:21:27 -0000 1.15
+++ b/tools/widl/widl.c 26 Apr 2004 23:31:55 -0000
@@ -77,7 +77,7 @@
" * 0x20 Preprocessor yacc trace\n"
;
-char version_string[] = "Wine IDL Compiler Version " WIDL_FULLVERSION "\n"
+static const char version_string[] = "Wine IDL Compiler Version " WIDL_FULLVERSION "\n"
"Copyright 2002 Ove Kaaven\n";
int win32 = 1;
Index: tools/wmc/mcl.c
===================================================================
RCS file: /var/cvs/wine/tools/wmc/mcl.c,v
retrieving revision 1.7
diff -u -r1.7 mcl.c
--- a/tools/wmc/mcl.c 20 Apr 2004 00:34:52 -0000 1.7
+++ b/tools/wmc/mcl.c 26 Apr 2004 23:32:15 -0000
@@ -182,7 +182,7 @@
static int fill_inputbuffer(void)
{
int n;
- static char err_fatalread[] = "Fatal: reading input failed";
+ static const char err_fatalread[] = "Fatal: reading input failed";
static int endian = -1;
if(!inputbuffer)
Index: tools/wmc/mcy.y
===================================================================
RCS file: /var/cvs/wine/tools/wmc/mcy.y,v
retrieving revision 1.6
diff -u -r1.6 mcy.y
--- a/tools/wmc/mcy.y 19 Dec 2002 04:20:23 -0000 1.6
+++ b/tools/wmc/mcy.y 26 Apr 2004 23:32:40 -0000
@@ -519,7 +519,7 @@
static int check_languages(node_t *head)
{
- static char err_missing[] = "Missing definition for language 0x%x; MessageID %d, facility 0x%x, severity 0x%x";
+ static const char err_missing[] = "Missing definition for language 0x%x; MessageID %d, facility 0x%x, severity 0x%x";
node_t *ndp;
int nm = 0;
msg_t *msg = NULL;
Index: tools/wmc/utils.c
===================================================================
RCS file: /var/cvs/wine/tools/wmc/utils.c,v
retrieving revision 1.3
diff -u -r1.3 utils.c
--- a/tools/wmc/utils.c 26 Apr 2002 19:05:18 -0000 1.3
+++ b/tools/wmc/utils.c 26 Apr 2004 23:32:59 -0000
@@ -211,7 +211,7 @@
{
int i;
int once = 0;
- static char warn[] = "Don't know the uppercase equivalent of non acsii characters;"
+ static const char warn[] = "Don't know the uppercase equivalent of non acsii characters;"
"comparison might yield wrong results";
while(*s1 && *s2)
{
Index: tools/wrc/readres.c
===================================================================
RCS file: /var/cvs/wine/tools/wrc/readres.c,v
retrieving revision 1.8
diff -u -r1.8 readres.c
--- a/tools/wrc/readres.c 14 Oct 2003 01:19:27 -0000 1.8
+++ b/tools/wrc/readres.c 26 Apr 2004 21:36:15 -0000
@@ -152,7 +152,7 @@
static resource_t *read_res32(FILE *fp)
{
- static char wrong_format[] = "Wrong resfile format (32bit)";
+ static const char wrong_format[] = "Wrong resfile format (32bit)";
DWORD ressize;
DWORD hdrsize;
DWORD totsize;
Index: tools/wrc/wrc.c
===================================================================
RCS file: /var/cvs/wine/tools/wrc/wrc.c,v
retrieving revision 1.38
diff -u -r1.38 wrc.c
--- a/tools/wrc/wrc.c 12 Apr 2004 22:04:13 -0000 1.38
+++ b/tools/wrc/wrc.c 26 Apr 2004 23:33:21 -0000
@@ -103,7 +103,7 @@
"with -o, then the output is written to \"wrc.tab.res\"\n"
;
-char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
+static const char version_string[] = "Wine Resource Compiler Version " WRC_FULLVERSION "\n"
"Copyright 1998-2000 Bertho A. Stultiens\n"
" 1994 Martin von Loewis\n";
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
Computers are like airconditioners
They stop working properly if you open WINDOWS
More information about the wine-patches
mailing list