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

This commit is contained in:
Daniel Marmier 2003-10-06 21:03:32 +00:00 committed by Alexandre Julliard
parent 3ce7ed5c15
commit 0348649853
16 changed files with 44 additions and 35 deletions

View File

@ -393,20 +393,24 @@ HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD v
if (version > 1) { if (version > 1) {
/* It seems that enumerating the reference IID on Direct3D 1 games (AvP / Motoracer2) breaks them */ /* 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)); TRACE(" enumerating OpenGL D3DDevice interface using reference IID (IID %s).\n", debugstr_guid(&IID_IDirect3DRefDevice));
d1 = dref; d1 = dref;
d2 = 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;
}
{
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) if (ret_value != D3DENUMRET_OK)
return ret_value; 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;
return D3DENUMRET_OK; return D3DENUMRET_OK;
} }
@ -414,12 +418,14 @@ HRESULT d3ddevice_enumerate(LPD3DENUMDEVICESCALLBACK cb, LPVOID context, DWORD v
HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context) HRESULT d3ddevice_enumerate7(LPD3DENUMDEVICESCALLBACK7 cb, LPVOID context)
{ {
D3DDEVICEDESC7 ddesc; D3DDEVICEDESC7 ddesc;
char interface_name[] = "WINE Direct3D7 using OpenGL";
char device_name[] = "Wine D3D7 device";
fill_opengl_caps_7(&ddesc); fill_opengl_caps_7(&ddesc);
TRACE(" enumerating OpenGL D3DDevice7 interface.\n"); 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 ULONG WINAPI

View File

@ -270,7 +270,7 @@ void DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf) {
); );
} }
if (pf->dwFlags & DDPF_RGB) { if (pf->dwFlags & DDPF_RGB) {
char *cmd; const char *cmd;
DPRINTF(", RGB bits: %ld, ", pf->u1.dwRGBBitCount); DPRINTF(", RGB bits: %ld, ", pf->u1.dwRGBBitCount);
switch (pf->u1.dwRGBBitCount) { switch (pf->u1.dwRGBBitCount) {
case 4: cmd = "%1lx"; break; case 4: cmd = "%1lx"; break;

View File

@ -85,7 +85,7 @@ static void *gl_handle = NULL;
static BOOL DDRAW_bind_to_opengl( void ) static BOOL DDRAW_bind_to_opengl( void )
{ {
char *glname = SONAME_LIBGL; const char *glname = SONAME_LIBGL;
BOOL ret_value; BOOL ret_value;
gl_handle = wine_dlopen(glname, RTLD_NOW, NULL, 0); gl_handle = wine_dlopen(glname, RTLD_NOW, NULL, 0);

View File

@ -157,7 +157,7 @@ static void test_RtlIsNameLegalDOS8Dot3(void)
{ {
struct test struct test
{ {
char *path; const char *path;
BOOLEAN result; BOOLEAN result;
BOOLEAN spaces; BOOLEAN spaces;
}; };
@ -199,7 +199,9 @@ static void test_RtlIsNameLegalDOS8Dot3(void)
ustr.Buffer = buffer; ustr.Buffer = buffer;
for (test = tests; test->path; test++) 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.Length = strlen(test->path);
oem.MaximumLength = oem.Length + 1; oem.MaximumLength = oem.Length + 1;
pRtlOemStringToUnicodeString( &ustr, &oem, FALSE ); pRtlOemStringToUnicodeString( &ustr, &oem, FALSE );

View File

@ -41,7 +41,7 @@ static NTSTATUS (WINAPI *pRtlAppendAsciizToString)(STRING *, LPCSTR);
static NTSTATUS (WINAPI *pRtlAppendStringToString)(STRING *, const STRING *); static NTSTATUS (WINAPI *pRtlAppendStringToString)(STRING *, const STRING *);
static NTSTATUS (WINAPI *pRtlAppendUnicodeStringToString)(UNICODE_STRING *, const UNICODE_STRING *); static NTSTATUS (WINAPI *pRtlAppendUnicodeStringToString)(UNICODE_STRING *, const UNICODE_STRING *);
static NTSTATUS (WINAPI *pRtlAppendUnicodeToString)(UNICODE_STRING *, LPCWSTR); 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 VOID (WINAPI *pRtlCopyString)(STRING *, const STRING *);
static BOOLEAN (WINAPI *pRtlCreateUnicodeString)(PUNICODE_STRING, LPCWSTR); static BOOLEAN (WINAPI *pRtlCreateUnicodeString)(PUNICODE_STRING, LPCWSTR);
static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, LPCSTR); static BOOLEAN (WINAPI *pRtlCreateUnicodeStringFromAsciiz)(PUNICODE_STRING, LPCSTR);
@ -1211,7 +1211,7 @@ static void test_RtlFindCharInUnicodeString(void)
typedef struct { typedef struct {
int base; int base;
char *str; const char *str;
int value; int value;
NTSTATUS result; NTSTATUS result;
} str2int_t; } str2int_t;

View File

@ -506,7 +506,7 @@ HRESULT WINAPI __CLSIDFromStringA(
LPCSTR idstr, /* [in] string representation of guid */ LPCSTR idstr, /* [in] string representation of guid */
CLSID *id) /* [out] GUID converted from string */ CLSID *id) /* [out] GUID converted from string */
{ {
BYTE *s = (BYTE *) idstr; const BYTE *s = (BYTE *) idstr;
int i; int i;
BYTE table[256]; BYTE table[256];

View File

@ -117,7 +117,7 @@ static char* WtoA( OLECHAR* p )
return buffer; return buffer;
} }
static OLECHAR* AtoW( char* p ) static OLECHAR* AtoW( const char* p )
{ {
OLECHAR *buffer; OLECHAR *buffer;
DWORD len = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 ); DWORD len = MultiByteToWideChar( CP_ACP, 0, p, -1, NULL, 0 );
@ -381,7 +381,7 @@ static const char *strfromr8[] = {
/* These are the strings we use for the XxxFromStr tests. /* These are the strings we use for the XxxFromStr tests.
* The arrays that follow define the expected results for each type. * The arrays that follow define the expected results for each type.
*/ */
static char* _pTestStrA[] = { static const char* _pTestStrA[] = {
"-2", "-2",
"-1", "-1",
"-0.51", "-0.51",

View File

@ -927,7 +927,7 @@ void dump_IDLDESC(IDLDESC *idl) {
MESSAGE("\t\twIdlflags: %d\n",idl->wIDLFlags); MESSAGE("\t\twIdlflags: %d\n",idl->wIDLFlags);
} }
static char * typekind_desc[] = static const char * typekind_desc[] =
{ {
"TKIND_ENUM", "TKIND_ENUM",
"TKIND_RECORD", "TKIND_RECORD",
@ -1924,7 +1924,7 @@ ITypeInfoImpl * MSFT_DoTypeInfo(
} }
else else
{ /* FIXME: This is a really bad hack to add IDispatch */ { /* 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); int nStdOleLen = strlen(szStdOle);
TLBRefType **ppRef = &ptiRet->reflist; TLBRefType **ppRef = &ptiRet->reflist;

View File

@ -143,10 +143,10 @@ static const double DAYS_IN_ONE_YEAR = 365.0;
#define TOK_AMPM 0x2e #define TOK_AMPM 0x2e
typedef struct tagFORMATTOKEN { typedef struct tagFORMATTOKEN {
char *str; const char *str;
BYTE tokenSize; BYTE tokenSize;
BYTE tokenId; BYTE tokenId;
int varTypeRequired; int varTypeRequired;
} FORMATTOKEN; } FORMATTOKEN;
typedef struct tagFORMATHDR { typedef struct tagFORMATHDR {

View File

@ -149,7 +149,7 @@ static void test_change_message( int action, int optional )
* lpsRegName - registry entry name * lpsRegName - registry entry name
* lpsTestValue - value to test * 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]; CHAR value[MAX_PATH];
DWORD valueLen; DWORD valueLen;
@ -256,7 +256,7 @@ static void test_SPI_SETBEEP( void ) /* 2 */
ok(rc!=0,"***warning*** failed to restore the original value: rc=%d err=%ld\n",rc,GetLastError()); 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_VALNAME1,
SPI_SETMOUSE_VALNAME2, SPI_SETMOUSE_VALNAME2,
SPI_SETMOUSE_VALNAME3 SPI_SETMOUSE_VALNAME3

View File

@ -39,7 +39,7 @@ unsigned (*pFnLoadMMDrvFunc16)(LPCSTR,LPWINE_DRIVER, LPWINE_MM_DRIVER) /*
/* each known type of driver has an instance of this structure */ /* each known type of driver has an instance of this structure */
typedef struct tagWINE_LLTYPE { typedef struct tagWINE_LLTYPE {
/* those attributes depend on the specification of the type */ /* 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 */ BOOL bSupportMapper; /* if type is allowed to support mapper */
MMDRV_MAPFUNC Map16To32A; /* those are function pointers to handle */ MMDRV_MAPFUNC Map16To32A; /* those are function pointers to handle */
MMDRV_UNMAPFUNC UnMap16To32A; /* the parameter conversion (16 vs 32 bit) */ MMDRV_UNMAPFUNC UnMap16To32A; /* the parameter conversion (16 vs 32 bit) */

View File

@ -291,7 +291,7 @@ static UINT MCI_GetCommandTable(UINT uDevType)
{ {
UINT uTbl; UINT uTbl;
char buf[32]; char buf[32];
LPSTR str = NULL; LPCSTR str = NULL;
/* first look up existing for existing devType */ /* first look up existing for existing devType */
for (uTbl = 0; uTbl < MAX_MCICMDTABLE; uTbl++) { for (uTbl = 0; uTbl < MAX_MCICMDTABLE; uTbl++) {

View File

@ -155,7 +155,7 @@ BOOL DIALOG_DisableOwner( HWND hOwner )
BOOL DIALOG_GetCharSize( HDC hDC, HFONT hFont, SIZE * pSize ) BOOL DIALOG_GetCharSize( HDC hDC, HFONT hFont, SIZE * pSize )
{ {
HFONT hFontPrev = 0; HFONT hFontPrev = 0;
char *alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; const char *alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
SIZE sz; SIZE sz;
TEXTMETRICA tm; TEXTMETRICA tm;
@ -1553,6 +1553,7 @@ static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox,
{ {
HWND hwnd; HWND hwnd;
LPSTR orig_spec = spec; LPSTR orig_spec = spec;
char any[] = "*.*";
#define SENDMSG(msg,wparam,lparam) \ #define SENDMSG(msg,wparam,lparam) \
((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \ ((attrib & DDL_POSTMSGS) ? PostMessageA( hwnd, msg, wparam, lparam ) \
@ -1562,7 +1563,7 @@ static INT DIALOG_DlgDirList( HWND hDlg, LPSTR spec, INT idLBox,
hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib ); hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib );
/* If the path exists and is a directory, chdir to it */ /* 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 else
{ {
char *p, *p2; char *p, *p2;

View File

@ -2045,7 +2045,7 @@ const SPY_NOTIFY *SPY_Bsearch_Notify( const SPY_NOTIFY *first, const SPY_NOTIFY
/*********************************************************************** /***********************************************************************
* SPY_DumpMem * SPY_DumpMem
*/ */
void SPY_DumpMem (LPSTR header, UINT *q, INT len) void SPY_DumpMem (LPCSTR header, UINT *q, INT len)
{ {
int i; int i;

View File

@ -373,7 +373,7 @@ void SYSPARAMS_NotifyChange( UINT uiAction, UINT fWinIni )
/*********************************************************************** /***********************************************************************
* Loads system parameter from user profile. * 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; BOOL ret = FALSE;
DWORD type; DWORD type;
@ -391,8 +391,8 @@ BOOL SYSPARAMS_Load( LPSTR lpRegKey, LPSTR lpValName, LPSTR lpBuf, DWORD count )
/*********************************************************************** /***********************************************************************
* Saves system parameter to user profile. * Saves system parameter to user profile.
*/ */
BOOL SYSPARAMS_Save( LPSTR lpRegKey, LPSTR lpValName, LPSTR lpValue, static BOOL SYSPARAMS_Save( LPCSTR lpRegKey, LPCSTR lpValName, LPCSTR lpValue,
UINT fWinIni ) UINT fWinIni )
{ {
HKEY hKey; HKEY hKey;
HKEY hBaseKey; HKEY hBaseKey;

View File

@ -79,7 +79,7 @@ static LPCSTR atomInternalPos;
*/ */
BOOL WINPOS_CreateInternalPosAtom() BOOL WINPOS_CreateInternalPosAtom()
{ {
LPSTR str = "SysIP"; LPCSTR str = "SysIP";
atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str); atomInternalPos = (LPCSTR)(DWORD)GlobalAddAtomA(str);
return (atomInternalPos) ? TRUE : FALSE; return (atomInternalPos) ? TRUE : FALSE;
} }