From 7e0ddbc60f942c008401be44718c53381b9fe0d2 Mon Sep 17 00:00:00 2001 From: Daniel Marmier Date: Tue, 7 Oct 2003 22:54:17 +0000 Subject: [PATCH] Fixed warnings with gcc option "-Wwrite-strings". --- dlls/odbc32/proxyodbc.h | 2 +- dlls/quartz/main.c | 2 +- dlls/rpcrt4/rpc_binding.c | 10 +++++----- dlls/rpcrt4/rpc_binding.h | 2 +- dlls/shlwapi/reg.c | 2 +- dlls/shlwapi/tests/path.c | 2 +- dlls/shlwapi/tests/shreg.c | 8 ++++---- dlls/winmm/mcianim/mcianim.c | 2 +- dlls/winmm/mciavi/info.c | 4 ++-- dlls/winmm/mcicda/mcicda.c | 2 +- dlls/winmm/mciseq/mcimidi.c | 2 +- dlls/winmm/winealsa/audio.c | 3 ++- dlls/winmm/wineoss/mixer.c | 4 ++-- 13 files changed, 23 insertions(+), 22 deletions(-) diff --git a/dlls/odbc32/proxyodbc.h b/dlls/odbc32/proxyodbc.h index 5a750e269f3..e327e1b3ae5 100644 --- a/dlls/odbc32/proxyodbc.h +++ b/dlls/odbc32/proxyodbc.h @@ -30,7 +30,7 @@ typedef struct dm_func /* driver manager functions */ { int ordinal; - char *name; + const char *name; void *d_func; SQLRETURN (*func)(); } DM_FUNC; diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index eb3befe223a..80fd645ecd8 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -202,7 +202,7 @@ HRESULT WINAPI QUARTZ_DllCanUnloadNow() static struct { const GUID riid; - char *name; + const char *name; } InterfaceDesc[] = { #define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index b667b480e43..6ce3b20c04a 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -52,7 +52,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug = }; static CRITICAL_SECTION conn_cache_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; -LPSTR RPCRT4_strndupA(LPSTR src, INT slen) +LPSTR RPCRT4_strndupA(LPCSTR src, INT slen) { DWORD len; LPSTR s; @@ -195,7 +195,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) /* protseq=ncalrpc: supposed to use NT LPC ports, * but we'll implement it with named pipes for now */ if (strcmp(Connection->Protseq, "ncalrpc") == 0) { - static LPSTR prefix = "\\\\.\\pipe\\lrpc\\"; + static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\"; LPSTR pname; pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); strcat(strcpy(pname, prefix), Connection->Endpoint); @@ -216,7 +216,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) } /* protseq=ncacn_np: named pipes */ else if (strcmp(Connection->Protseq, "ncacn_np") == 0) { - static LPSTR prefix = "\\\\."; + static LPCSTR prefix = "\\\\."; LPSTR pname; pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1); strcat(strcpy(pname, prefix), Connection->Endpoint); @@ -244,7 +244,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) /* protseq=ncalrpc: supposed to use NT LPC ports, * but we'll implement it with named pipes for now */ if (strcmp(Connection->Protseq, "ncalrpc") == 0) { - static LPSTR prefix = "\\\\.\\pipe\\lrpc\\"; + static LPCSTR prefix = "\\\\.\\pipe\\lrpc\\"; LPSTR pname; HANDLE conn; DWORD err; @@ -278,7 +278,7 @@ RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection) } /* protseq=ncacn_np: named pipes */ else if (strcmp(Connection->Protseq, "ncacn_np") == 0) { - static LPSTR prefix = "\\\\."; + static LPCSTR prefix = "\\\\."; LPSTR pname; HANDLE conn; DWORD err; diff --git a/dlls/rpcrt4/rpc_binding.h b/dlls/rpcrt4/rpc_binding.h index c39feaf0910..54d514b1baf 100644 --- a/dlls/rpcrt4/rpc_binding.h +++ b/dlls/rpcrt4/rpc_binding.h @@ -51,7 +51,7 @@ typedef struct _RpcBinding RpcConnection* FromConn; } RpcBinding; -LPSTR RPCRT4_strndupA(LPSTR src, INT len); +LPSTR RPCRT4_strndupA(LPCSTR src, INT len); LPWSTR RPCRT4_strndupW(LPWSTR src, INT len); LPSTR RPCRT4_strdupWtoA(LPWSTR src); LPWSTR RPCRT4_strdupAtoW(LPSTR src); diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c index 77a16236f9a..75fca1c3da1 100644 --- a/dlls/shlwapi/reg.c +++ b/dlls/shlwapi/reg.c @@ -1048,7 +1048,7 @@ DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, { DWORD dwRet = ERROR_SUCCESS, dwDummy; HKEY hSubKey; - LPSTR szEmpty = ""; + char szEmpty[] = ""; TRACE("(hkey=%p,%s,%s,%ld,%p,%ld)\n", hKey, debugstr_a(lpszSubKey), debugstr_a(lpszValue), dwType, pvData, cbData); diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c index d6644a7caf7..33082e95fb0 100644 --- a/dlls/shlwapi/tests/path.c +++ b/dlls/shlwapi/tests/path.c @@ -71,7 +71,7 @@ static void test_UrlHash(void) hash_url(TEST_URL_3); } -static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, char* szExpected) +static void test_url_part(const char* szUrl, DWORD dwPart, DWORD dwFlags, const char* szExpected) { CHAR szPart[INTERNET_MAX_URL_LENGTH]; WCHAR wszPart[INTERNET_MAX_URL_LENGTH]; diff --git a/dlls/shlwapi/tests/shreg.c b/dlls/shlwapi/tests/shreg.c index 0f030834d5c..8d31fe6e094 100644 --- a/dlls/shlwapi/tests/shreg.c +++ b/dlls/shlwapi/tests/shreg.c @@ -40,15 +40,15 @@ static SHCopyKeyA_func pSHCopyKeyA; typedef DWORD (WINAPI *SHRegGetPathA_func)(HKEY,LPCSTR,LPCSTR,LPSTR,DWORD); static SHRegGetPathA_func pSHRegGetPathA; -static char * sTestpath1 = "%LONGSYSTEMVAR%\\subdir1"; -static char * sTestpath2 = "%FOO%\\subdir1"; +static const char * sTestpath1 = "%LONGSYSTEMVAR%\\subdir1"; +static const char * sTestpath2 = "%FOO%\\subdir1"; static char sExpTestpath1[MAX_PATH]; static char sExpTestpath2[MAX_PATH]; static unsigned sExpLen1; static unsigned sExpLen2; -static char * sEmptyBuffer ="0123456789"; +static const char * sEmptyBuffer ="0123456789"; /* delete key and all its subkeys */ static DWORD delete_key( HKEY hkey ) @@ -135,7 +135,7 @@ static void test_SHQUeryValueEx(void) DWORD dwType; char buf[MAX_PATH]; DWORD dwRet; - char * sTestedFunction = ""; + const char * sTestedFunction = ""; DWORD nUsedBuffer1,nUsedBuffer2; ok(! RegOpenKeyExA(HKEY_CURRENT_USER, REG_TEST_KEY, 0, KEY_QUERY_VALUE, &hKey), "test4 RegOpenKey"); diff --git a/dlls/winmm/mcianim/mcianim.c b/dlls/winmm/mcianim/mcianim.c index 3bc6c02e581..4d4bf518cf5 100644 --- a/dlls/winmm/mcianim/mcianim.c +++ b/dlls/winmm/mcianim/mcianim.c @@ -346,7 +346,7 @@ static DWORD MCIANIM_CalcFrame(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwTi static DWORD MCIANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms) { WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID); - LPSTR str = 0; + LPCSTR str = 0; DWORD ret = 0; TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms); diff --git a/dlls/winmm/mciavi/info.c b/dlls/winmm/mciavi/info.c index 6d5a582874c..955eaba4bfd 100644 --- a/dlls/winmm/mciavi/info.c +++ b/dlls/winmm/mciavi/info.c @@ -145,7 +145,7 @@ DWORD MCIAVI_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS l */ DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms) { - LPSTR str = 0; + LPCSTR str = 0; WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID); DWORD ret = 0; @@ -281,7 +281,7 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms) FIXME("%s\n", buffer); } if (dwFlags & MCI_DGV_SET_FILEFORMAT) { - LPSTR str = "save"; + LPCSTR str = "save"; if (dwFlags & MCI_DGV_SET_STILL) str = "capture"; diff --git a/dlls/winmm/mcicda/mcicda.c b/dlls/winmm/mcicda/mcicda.c index 2c983f31547..f0297d4c4c6 100644 --- a/dlls/winmm/mcicda/mcicda.c +++ b/dlls/winmm/mcicda/mcicda.c @@ -463,7 +463,7 @@ static DWORD CDROM_Audio_GetSerial(CDROM_TOC* toc) */ static DWORD MCICDA_Info(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms) { - LPSTR str = NULL; + LPCSTR str = NULL; WINE_MCICDAUDIO* wmcda = MCICDA_GetOpenDrv(wDevID); DWORD ret = 0; char buffer[16]; diff --git a/dlls/winmm/mciseq/mcimidi.c b/dlls/winmm/mciseq/mcimidi.c index a586773977d..e6184eaba1d 100644 --- a/dlls/winmm/mciseq/mcimidi.c +++ b/dlls/winmm/mciseq/mcimidi.c @@ -1042,7 +1042,7 @@ static DWORD MIDI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms) if (TRACE_ON(mcimidi)) { char buf[1024]; WORD len = mmt->wEventLength - HIWORD(mmt->dwEventData); - static char* info[8] = {"", "Text", "Copyright", "Seq/Trk name", + static const char* info[8] = {"", "Text", "Copyright", "Seq/Trk name", "Instrument", "Lyric", "Marker", "Cue-point"}; WORD idx = HIBYTE(LOWORD(mmt->dwEventData)); diff --git a/dlls/winmm/winealsa/audio.c b/dlls/winmm/winealsa/audio.c index e59d909e025..a016a8e19a3 100644 --- a/dlls/winmm/winealsa/audio.c +++ b/dlls/winmm/winealsa/audio.c @@ -408,11 +408,12 @@ LONG ALSA_WaveInit(void) snd_pcm_info_t * info; snd_pcm_hw_params_t * hw_params; WINE_WAVEOUT* wwo; + char device[] = "hw"; wwo = &WOutDev[0]; /* FIXME: use better values */ - wwo->device = "hw"; + wwo->device = device; wwo->caps.wMid = 0x0002; wwo->caps.wPid = 0x0104; strcpy(wwo->caps.szPname, "SB16 Wave Out"); diff --git a/dlls/winmm/wineoss/mixer.c b/dlls/winmm/wineoss/mixer.c index 39584ed8974..321542af126 100644 --- a/dlls/winmm/wineoss/mixer.c +++ b/dlls/winmm/wineoss/mixer.c @@ -70,8 +70,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmaux); /* FIXME: the two following string arrays should be moved to a resource file in a string table */ /* if it's done, better use a struct to hold labels, name, and muted channel volume cache */ -static char* MIX_Labels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS; -static char* MIX_Names [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; +static const char* MIX_Labels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS; +static const char* MIX_Names [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES; struct mixerCtrl {