Fixed warnings with gcc option "-Wwrite-strings".
diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 9942700..6510d51 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c
@@ -393,20 +393,24 @@ if (version > 1) { /* It seems that enumerating the reference IID on Direct3D 1 games (AvP / Motoracer2) breaks them */ + char interface_name[] = "WINE Reference Direct3DX using OpenGL"; TRACE(" enumerating OpenGL D3DDevice interface using reference IID (IID %s).\n", debugstr_guid(&IID_IDirect3DRefDevice)); d1 = dref; d2 = dref; - ret_value = cb((LPIID) &IID_IDirect3DRefDevice, "WINE Reference Direct3DX using OpenGL", device_name, &d1, &d2, context); + ret_value = cb((LPIID) &IID_IDirect3DRefDevice, interface_name, device_name, &d1, &d2, context); if (ret_value != D3DENUMRET_OK) return ret_value; } - - TRACE(" enumerating OpenGL D3DDevice interface (IID %s).\n", debugstr_guid(&IID_D3DDEVICE_OpenGL)); - d1 = dref; - d2 = dref; - ret_value = cb((LPIID) &IID_D3DDEVICE_OpenGL, "WINE Direct3DX using OpenGL", device_name, &d1, &d2, context); - if (ret_value != D3DENUMRET_OK) - return ret_value; + + { + char interface_name[] = "WINE Direct3DX using OpenGL"; + TRACE(" enumerating OpenGL D3DDevice interface (IID %s).\n", debugstr_guid(&IID_D3DDEVICE_OpenGL)); + d1 = dref; + d2 = dref; + ret_value = cb((LPIID) &IID_D3DDEVICE_OpenGL, interface_name, device_name, &d1, &d2, context); + if (ret_value != D3DENUMRET_OK) + return ret_value; + } return D3DENUMRET_OK; } @@ -414,12 +418,14 @@ HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) { D3DDEVICEDESC7 ddesc; + char interface_name[] = "WINE Direct3D7 using OpenGL"; + char device_name[] = "Wine D3D7 device"; fill_opengl_caps_7(&ddesc); TRACE(" enumerating OpenGL D3DDevice7 interface.\n"); - return cb("WINE Direct3D7 using OpenGL", "Wine D3D7 device", &ddesc, context); + return cb(interface_name, device_name, &ddesc, context); } ULONG WINAPI
diff --git a/dlls/ddraw/helper.c b/dlls/ddraw/helper.c index e20359e..e748ab4 100644 --- a/dlls/ddraw/helper.c +++ b/dlls/ddraw/helper.c
@@ -270,7 +270,7 @@ ); } if (pf->dwFlags & DDPF_RGB) { - char *cmd; + const char *cmd; DPRINTF(", RGB bits: %ld, ", pf->u1.dwRGBBitCount); switch (pf->u1.dwRGBBitCount) { case 4: cmd = "%1lx"; break;
diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index 7bdcb14..eb1b655 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c
@@ -85,7 +85,7 @@ static BOOL DDRAW_bind_to_opengl( void ) { - char *glname = SONAME_LIBGL; + const char *glname = SONAME_LIBGL; BOOL ret_value; gl_handle = wine_dlopen(glname, RTLD_NOW, NULL, 0);
diff --git a/dlls/ntdll/tests/path.c b/dlls/ntdll/tests/path.c index de913f0..fec515e 100644 --- a/dlls/ntdll/tests/path.c +++ b/dlls/ntdll/tests/path.c
@@ -157,7 +157,7 @@ { struct test { - char *path; + const char *path; BOOLEAN result; BOOLEAN spaces; }; @@ -199,7 +199,9 @@ ustr.Buffer = buffer; for (test = tests; test->path; test++) { - oem.Buffer = test->path; + char path[100]; + strcpy(path, test->path); + oem.Buffer = path; oem.Length = strlen(test->path); oem.MaximumLength = oem.Length + 1; pRtlOemStringToUnicodeString( &ustr, &oem, FALSE );
diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c index 26f3117..cd2ec9c 100644 --- a/dlls/ntdll/tests/rtlstr.c +++ b/dlls/ntdll/tests/rtlstr.c
@@ -41,7 +41,7 @@ static NTSTATUS (WINAPI *pRtlAppendStringToString)(STRING *, const STRING *); static NTSTATUS (WINAPI *pRtlAppendUnicodeStringToString)(UNICODE_STRING *, const UNICODE_STRING *); static NTSTATUS (WINAPI *pRtlAppendUnicodeToString)(UNICODE_STRING *, LPCWSTR); -static NTSTATUS (WINAPI *pRtlCharToInteger)(char *, ULONG, int *); +static NTSTATUS (WINAPI *pRtlCharToInteger)(PCSZ, ULONG, int *); static VOID (WINAPI *pRtlCopyString)(STRING *, const STRING *); static BOOLEAN (WINAPI *pRtlCreateUnicodeString)(PUNICODE_STRING, LPCWSTR); static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, LPCSTR); @@ -1211,7 +1211,7 @@ typedef struct { int base; - char *str; + const char *str; int value; NTSTATUS result; } str2int_t;
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 3a36301..49af979 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c
@@ -506,7 +506,7 @@ LPCSTR idstr, /* [in] string representation of guid */ CLSID *id) /* [out] GUID converted from string */ { - BYTE *s = (BYTE *) idstr; + const BYTE *s = (BYTE *) idstr; int i; BYTE table[256];
diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 2082256..0269ae9 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c
@@ -117,7 +117,7 @@ return buffer; } -static OLECHAR* AtoW( char* p ) +static OLECHAR* AtoW( const char* p ) { OLECHAR *buffer; DWORD len = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 ); @@ -381,7 +381,7 @@ /* These are the strings we use for the XxxFromStr tests. * The arrays that follow define the expected results for each type. */ -static char* _pTestStrA[] = { +static const char* _pTestStrA[] = { "-2", "-1", "-0.51",
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index d43bd83..63c1e3d 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c
@@ -927,7 +927,7 @@ MESSAGE("\t\twIdlflags: %d\n",idl->wIDLFlags); } -static char * typekind_desc[] = +static const char * typekind_desc[] = { "TKIND_ENUM", "TKIND_RECORD", @@ -1924,7 +1924,7 @@ } else { /* FIXME: This is a really bad hack to add IDispatch */ - char* szStdOle = "stdole2.tlb\0"; + const char* szStdOle = "stdole2.tlb\0"; int nStdOleLen = strlen(szStdOle); TLBRefType **ppRef = &ptiRet->reflist;
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index a636c8a..9f1375d 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c
@@ -143,10 +143,10 @@ #define TOK_AMPM 0x2e typedef struct tagFORMATTOKEN { - char *str; - BYTE tokenSize; - BYTE tokenId; - int varTypeRequired; + const char *str; + BYTE tokenSize; + BYTE tokenId; + int varTypeRequired; } FORMATTOKEN; typedef struct tagFORMATHDR {
diff --git a/dlls/user/tests/sysparams.c b/dlls/user/tests/sysparams.c index f232e18..d68f57c 100644 --- a/dlls/user/tests/sysparams.c +++ b/dlls/user/tests/sysparams.c
@@ -149,7 +149,7 @@ * lpsRegName - registry entry name * lpsTestValue - value to test */ -static void _test_reg_key( LPSTR subKey1, LPSTR subKey2, LPSTR valName, LPSTR testValue ) +static void _test_reg_key( LPCSTR subKey1, LPCSTR subKey2, LPCSTR valName, LPCSTR testValue ) { CHAR value[MAX_PATH]; DWORD valueLen; @@ -256,7 +256,7 @@ ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); } -static char *setmouse_valuenames[3] = { +static const char *setmouse_valuenames[3] = { SPI_SETMOUSE_VALNAME1, SPI_SETMOUSE_VALNAME2, SPI_SETMOUSE_VALNAME3
diff --git a/dlls/winmm/lolvldrv.c b/dlls/winmm/lolvldrv.c index ae02a73..30481d8 100644 --- a/dlls/winmm/lolvldrv.c +++ b/dlls/winmm/lolvldrv.c
@@ -39,7 +39,7 @@ /* each known type of driver has an instance of this structure */ typedef struct tagWINE_LLTYPE { /* those attributes depend on the specification of the type */ - LPSTR typestr; /* name (for debugging) */ + LPCSTR typestr; /* name (for debugging) */ BOOL bSupportMapper; /* if type is allowed to support mapper */ MMDRV_MAPFUNC Map16To32A; /* those are function pointers to handle */ MMDRV_UNMAPFUNC UnMap16To32A; /* the parameter conversion (16 vs 32 bit) */
diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c index 0aa8104..f3c5f18 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c
@@ -291,7 +291,7 @@ { UINT uTbl; char buf[32]; - LPSTR str = NULL; + LPCSTR str = NULL; /* first look up existing for existing devType */ for (uTbl = 0; uTbl < MAX_MCICMDTABLE; uTbl++) {
diff --git a/windows/dialog.c b/windows/dialog.c index e0a1607..434644d 100644 --- a/windows/dialog.c +++ b/windows/dialog.c
@@ -155,7 +155,7 @@ BOOL DIALOG_GetCharSize( HDC hDC, HFONT hFont, SIZE * pSize ) { HFONT hFontPrev = 0; - char *alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + const char *alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; SIZE sz; TEXTMETRICA tm; @@ -1553,6 +1553,7 @@ { HWND hwnd; LPSTR orig_spec = spec; + char any[] = "*.*"; #define SENDMSG(msg,wparam,lparam) \ ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \ @@ -1562,7 +1563,7 @@ hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib ); /* If the path exists and is a directory, chdir to it */ - if (!spec || !spec[0] || SetCurrentDirectoryA( spec )) spec = "*.*"; + if (!spec || !spec[0] || SetCurrentDirectoryA( spec )) spec = any; else { char *p, *p2;
diff --git a/windows/spy.c b/windows/spy.c index 30f2cf8..7c5ae73 100644 --- a/windows/spy.c +++ b/windows/spy.c
@@ -2045,7 +2045,7 @@ /*********************************************************************** * SPY_DumpMem */ -void SPY_DumpMem (LPSTR header, UINT *q, INT len) +void SPY_DumpMem (LPCSTR header, UINT *q, INT len) { int i;
diff --git a/windows/sysparams.c b/windows/sysparams.c index 4078be6..2c18f62 100644 --- a/windows/sysparams.c +++ b/windows/sysparams.c
@@ -373,7 +373,7 @@ /*********************************************************************** * Loads system parameter from user profile. */ -BOOL SYSPARAMS_Load( LPSTR lpRegKey, LPSTR lpValName, LPSTR lpBuf, DWORD count ) +static BOOL SYSPARAMS_Load( LPCSTR lpRegKey, LPCSTR lpValName, LPSTR lpBuf, DWORD count ) { BOOL ret = FALSE; DWORD type; @@ -391,8 +391,8 @@ /*********************************************************************** * Saves system parameter to user profile. */ -BOOL SYSPARAMS_Save( LPSTR lpRegKey, LPSTR lpValName, LPSTR lpValue, - UINT fWinIni ) +static BOOL SYSPARAMS_Save( LPCSTR lpRegKey, LPCSTR lpValName, LPCSTR lpValue, + UINT fWinIni ) { HKEY hKey; HKEY hBaseKey;
diff --git a/windows/winpos.c b/windows/winpos.c index 7e5ae7b..cadedf4 100644 --- a/windows/winpos.c +++ b/windows/winpos.c
@@ -79,7 +79,7 @@ */ BOOL WINPOS_CreateInternalPosAtom() { - LPSTR str = "SysIP"; + LPCSTR str = "SysIP"; atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str); return (atomInternalPos) ? TRUE : FALSE; }