Commit 8e5bb205 authored by Daniel Marmier's avatar Daniel Marmier Committed by Alexandre Julliard

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

parent b817a3c5
...@@ -101,7 +101,7 @@ DWORD count; ...@@ -101,7 +101,7 @@ DWORD count;
WIN32_FIND_DATA fd; WIN32_FIND_DATA fd;
HANDLE hff; HANDLE hff;
BOOL force, status; BOOL force, status;
static char *overwrite = "Overwrite file (Y/N)?"; static const char *overwrite = "Overwrite file (Y/N)?";
char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile; char string[8], outpath[MAX_PATH], inpath[MAX_PATH], *infile;
if ((strchr(param1,'*') != NULL) && (strchr(param1,'%') != NULL)) { if ((strchr(param1,'*') != NULL) && (strchr(param1,'%') != NULL)) {
...@@ -207,9 +207,9 @@ char *p; ...@@ -207,9 +207,9 @@ char *p;
* in DOS (try typing "ECHO ON AGAIN" for an example). * in DOS (try typing "ECHO ON AGAIN" for an example).
*/ */
void WCMD_echo (char *command) { void WCMD_echo (const char *command) {
static char *eon = "Echo is ON\n", *eoff = "Echo is OFF\n"; static const char *eon = "Echo is ON\n", *eoff = "Echo is OFF\n";
int count; int count;
count = strlen(command); count = strlen(command);
...@@ -805,7 +805,7 @@ DWORD count; ...@@ -805,7 +805,7 @@ DWORD count;
void WCMD_verify (char *command) { void WCMD_verify (char *command) {
static char *von = "Verify is ON\n", *voff = "Verify is OFF\n"; static const char *von = "Verify is ON\n", *voff = "Verify is OFF\n";
int count; int count;
count = strlen(command); count = strlen(command);
......
...@@ -40,7 +40,7 @@ void WCMD_copy (void); ...@@ -40,7 +40,7 @@ void WCMD_copy (void);
void WCMD_create_dir (void); void WCMD_create_dir (void);
void WCMD_delete (int recurse); void WCMD_delete (int recurse);
void WCMD_directory (void); void WCMD_directory (void);
void WCMD_echo (char *); void WCMD_echo (const char *);
void WCMD_enter_paged_mode(void); void WCMD_enter_paged_mode(void);
void WCMD_for (char *); void WCMD_for (char *);
void WCMD_give_help (char *command); void WCMD_give_help (char *command);
...@@ -48,8 +48,8 @@ void WCMD_goto (void); ...@@ -48,8 +48,8 @@ void WCMD_goto (void);
void WCMD_if (char *); void WCMD_if (char *);
void WCMD_leave_paged_mode(void); void WCMD_leave_paged_mode(void);
void WCMD_move (void); void WCMD_move (void);
void WCMD_output (char *format, ...); void WCMD_output (const char *format, ...);
void WCMD_output_asis (char *message); void WCMD_output_asis (const char *message);
void WCMD_parse (char *s, char *q, char *p1, char *p2); void WCMD_parse (char *s, char *q, char *p1, char *p2);
void WCMD_pause (void); void WCMD_pause (void);
void WCMD_pipe (char *command); void WCMD_pipe (char *command);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "ntstatus.h" #include "ntstatus.h"
#include "wcmd.h" #include "wcmd.h"
char *inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY", "CTTY", const char *inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY", "CTTY",
"DATE", "DEL", "DIR", "ECHO", "ERASE", "FOR", "GOTO", "DATE", "DEL", "DIR", "ECHO", "ERASE", "FOR", "GOTO",
"HELP", "IF", "LABEL", "MD", "MKDIR", "MOVE", "PATH", "PAUSE", "HELP", "IF", "LABEL", "MD", "MKDIR", "MOVE", "PATH", "PAUSE",
"PROMPT", "REM", "REN", "RENAME", "RD", "RMDIR", "SET", "SHIFT", "PROMPT", "REM", "REN", "RENAME", "RD", "RMDIR", "SET", "SHIFT",
...@@ -728,7 +728,7 @@ int p = 0; ...@@ -728,7 +728,7 @@ int p = 0;
* *
*/ */
void WCMD_output (char *format, ...) { void WCMD_output (const char *format, ...) {
va_list ap; va_list ap;
char string[1024]; char string[1024];
...@@ -766,7 +766,7 @@ void WCMD_leave_paged_mode(void) ...@@ -766,7 +766,7 @@ void WCMD_leave_paged_mode(void)
* without formatting eg. when message contains '%' * without formatting eg. when message contains '%'
*/ */
void WCMD_output_asis (char *message) { void WCMD_output_asis (const char *message) {
DWORD count; DWORD count;
char* ptr; char* ptr;
char string[1024]; char string[1024];
......
...@@ -47,7 +47,7 @@ static int lastSel = 0; /* the last drive selected in the property sheet */ ...@@ -47,7 +47,7 @@ static int lastSel = 0; /* the last drive selected in the property sheet */
/* returns NULL on failure. caller is responsible for freeing result */ /* returns NULL on failure. caller is responsible for freeing result */
char *getDriveValue(char letter, char *valueName) { char *getDriveValue(char letter, const char *valueName) {
HKEY hkDrive = 0; HKEY hkDrive = 0;
char *subKeyName; char *subKeyName;
char *result = NULL; char *result = NULL;
...@@ -76,7 +76,7 @@ end: ...@@ -76,7 +76,7 @@ end:
} }
/* call with newValue == NULL to remove a value */ /* call with newValue == NULL to remove a value */
void setDriveValue(char letter, char *valueName, char *newValue) { void setDriveValue(char letter, const char *valueName, const char *newValue) {
char *driveSection = malloc(strlen("Drive X")+1); char *driveSection = malloc(strlen("Drive X")+1);
sprintf(driveSection, "Drive %c", letter); sprintf(driveSection, "Drive %c", letter);
if (newValue) if (newValue)
...@@ -226,8 +226,8 @@ int refreshDriveDlg (HWND hDlg) ...@@ -226,8 +226,8 @@ int refreshDriveDlg (HWND hDlg)
#define DRIVE_MASK_BIT(B) 1<<(toupper(B)-'A') #define DRIVE_MASK_BIT(B) 1<<(toupper(B)-'A')
typedef struct { typedef struct {
char *sCode; const char *sCode;
char *sDesc; const char *sDesc;
} code_desc_pair; } code_desc_pair;
static code_desc_pair type_pairs[] = { static code_desc_pair type_pairs[] = {
......
...@@ -68,14 +68,14 @@ int initialize(void) { ...@@ -68,14 +68,14 @@ int initialize(void) {
/***************************************************************************** /*****************************************************************************
* getConfigValue: Retrieves a configuration value from the registry * getConfigValue: Retrieves a configuration value from the registry
* *
* char *subKey : the name of the config section * const char *subKey : the name of the config section
* char *valueName : the name of the config value * const char *valueName : the name of the config value
* char *defaultResult : if the key isn't found, return this value instead * const char *defaultResult : if the key isn't found, return this value instead
* *
* Returns a buffer holding the value if successful, NULL if not. Caller is responsible for freeing the result. * Returns a buffer holding the value if successful, NULL if not. Caller is responsible for freeing the result.
* *
*/ */
char *getConfigValue (char *subkey, char *valueName, char *defaultResult) char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult)
{ {
char *buffer = NULL; char *buffer = NULL;
DWORD dataLength; DWORD dataLength;
...@@ -129,14 +129,14 @@ end: ...@@ -129,14 +129,14 @@ end:
* setConfigValue : Sets a configuration key in the registry. Section will be created if it doesn't already exist * setConfigValue : Sets a configuration key in the registry. Section will be created if it doesn't already exist
* *
* HKEY hCurrent : the registry key that the configuration is rooted at * HKEY hCurrent : the registry key that the configuration is rooted at
* char *subKey : the name of the config section * const char *subKey : the name of the config section
* char *valueName : the name of the config value * const char *valueName : the name of the config value
* char *value : the value to set the configuration key to * const char *value : the value to set the configuration key to
* *
* Returns 0 on success, non-zero otherwise * Returns 0 on success, non-zero otherwise
* *
*/ */
int setConfigValue (char *subkey, char *valueName, const char *value) { int setConfigValue (const char *subkey, const char *valueName, const char *value) {
DWORD res = 1; DWORD res = 1;
HKEY key = NULL; HKEY key = NULL;
...@@ -160,7 +160,7 @@ end: ...@@ -160,7 +160,7 @@ end:
} }
/* returns 0 on success, an HRESULT from the registry funtions otherwise */ /* returns 0 on success, an HRESULT from the registry funtions otherwise */
HRESULT doesConfigValueExist(char *subkey, char *valueName) { HRESULT doesConfigValueExist(const char *subkey, const char *valueName) {
HRESULT hr; HRESULT hr;
HKEY key; HKEY key;
...@@ -184,7 +184,7 @@ HRESULT doesConfigValueExist(char *subkey, char *valueName) { ...@@ -184,7 +184,7 @@ HRESULT doesConfigValueExist(char *subkey, char *valueName) {
} }
/* removes the requested value from the registry, however, does not remove the section if empty. Returns S_OK (0) on success. */ /* removes the requested value from the registry, however, does not remove the section if empty. Returns S_OK (0) on success. */
HRESULT removeConfigValue(char *subkey, char *valueName) { HRESULT removeConfigValue(const char *subkey, const char *valueName) {
HRESULT hr; HRESULT hr;
HKEY key; HKEY key;
WINE_TRACE("subkey=%s, valueName=%s\n", subkey, valueName); WINE_TRACE("subkey=%s, valueName=%s\n", subkey, valueName);
...@@ -231,7 +231,7 @@ void destroyTransaction(struct transaction *trans) { ...@@ -231,7 +231,7 @@ void destroyTransaction(struct transaction *trans) {
free(trans); free(trans);
} }
void addTransaction(char *section, char *key, enum transaction_action action, char *newValue) { void addTransaction(const char *section, const char *key, enum transaction_action action, const char *newValue) {
struct transaction *trans = calloc(sizeof(struct transaction),1); struct transaction *trans = calloc(sizeof(struct transaction),1);
assert( section != NULL ); assert( section != NULL );
......
...@@ -82,7 +82,7 @@ void processTransQueue(); ...@@ -82,7 +82,7 @@ void processTransQueue();
* ACTION_SET -> this transaction will change a registry key, newValue is the replacement value * ACTION_SET -> this transaction will change a registry key, newValue is the replacement value
* ACTION_REMOVE -> this transaction will remove a registry key. In this case, newValue is ignored. * ACTION_REMOVE -> this transaction will remove a registry key. In this case, newValue is ignored.
*/ */
void addTransaction(char *section, char *key, enum transaction_action action, char *newValue); void addTransaction(const char *section, const char *key, enum transaction_action action, const char *newValue);
/* frees the transaction structure, all fields, and removes it from the queue if in it */ /* frees the transaction structure, all fields, and removes it from the queue if in it */
void destroyTransaction(struct transaction *trans); void destroyTransaction(struct transaction *trans);
...@@ -91,10 +91,10 @@ void destroyTransaction(struct transaction *trans); ...@@ -91,10 +91,10 @@ void destroyTransaction(struct transaction *trans);
int initialize(void); int initialize(void);
extern HKEY configKey; extern HKEY configKey;
int setConfigValue (char *subkey, char *valueName, const char *value); int setConfigValue (const char *subkey, const char *valueName, const char *value);
char *getConfigValue (char *subkey, char *valueName, char *defaultResult); char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult);
HRESULT doesConfigValueExist (char *subkey, char *valueName); HRESULT doesConfigValueExist (const char *subkey, const char *valueName);
HRESULT removeConfigValue (char *subkey, char *valueName); HRESULT removeConfigValue (const char *subkey, const char *valueName);
/* X11DRV */ /* X11DRV */
......
...@@ -1191,7 +1191,7 @@ static void db_task_printsym(unsigned int addr, int size) ...@@ -1191,7 +1191,7 @@ static void db_task_printsym(unsigned int addr, int size)
DEBUG_PrintAddress( &address, db_disasm_16 ? MODE_16 : MODE_32, TRUE ); DEBUG_PrintAddress( &address, db_disasm_16 ? MODE_16 : MODE_32, TRUE );
} }
void db_print_address(char *seg, int size, struct i_addr *addrp, int byref) void db_print_address(const char *seg, int size, struct i_addr *addrp, int byref)
{ {
if (addrp->is_reg) { if (addrp->is_reg) {
DEBUG_Printf(DBG_CHN_MESG,"%s", db_reg[size][addrp->disp]); DEBUG_Printf(DBG_CHN_MESG,"%s", db_reg[size][addrp->disp]);
...@@ -1237,7 +1237,7 @@ void db_print_address(char *seg, int size, struct i_addr *addrp, int byref) ...@@ -1237,7 +1237,7 @@ void db_print_address(char *seg, int size, struct i_addr *addrp, int byref)
* and return updated location. * and return updated location.
*/ */
void db_disasm_esc( DBG_ADDR *addr, int inst, int short_addr, void db_disasm_esc( DBG_ADDR *addr, int inst, int short_addr,
int size, char *seg ) int size, const char *seg )
{ {
int regmodrm; int regmodrm;
const struct finst *fp; const struct finst *fp;
...@@ -1327,7 +1327,7 @@ void DEBUG_Disasm( DBG_ADDR *addr, int display ) ...@@ -1327,7 +1327,7 @@ void DEBUG_Disasm( DBG_ADDR *addr, int display )
int inst; int inst;
int size; int size;
int short_addr; int short_addr;
char * seg; const char *seg;
const struct inst *ip; const struct inst *ip;
const char *i_name; const char *i_name;
int i_size; int i_size;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
static void mode_command(int); static void mode_command(int);
int yylex(void); int yylex(void);
int yyerror(char *); int yyerror(const char *);
%} %}
...@@ -479,7 +479,7 @@ void DEBUG_Parser(LPCSTR filename) ...@@ -479,7 +479,7 @@ void DEBUG_Parser(LPCSTR filename)
set_default_channels(); set_default_channels();
} }
int yyerror(char* s) int yyerror(const char* s)
{ {
DEBUG_Printf(DBG_CHN_MESG, "%s\n", s); DEBUG_Printf(DBG_CHN_MESG, "%s\n", s);
return 0; return 0;
......
...@@ -503,7 +503,7 @@ extern int DEBUG_GetObjectSize(struct datatype * dt); ...@@ -503,7 +503,7 @@ extern int DEBUG_GetObjectSize(struct datatype * dt);
extern unsigned int DEBUG_ArrayIndex(const DBG_VALUE * addr, DBG_VALUE * result, extern unsigned int DEBUG_ArrayIndex(const DBG_VALUE * addr, DBG_VALUE * result,
int index); int index);
extern struct datatype * DEBUG_FindOrMakePointerType(struct datatype * reftype); extern struct datatype * DEBUG_FindOrMakePointerType(struct datatype * reftype);
extern long long int DEBUG_GetExprValue(const DBG_VALUE * addr, char ** format); extern long long int DEBUG_GetExprValue(const DBG_VALUE * addr, const char ** format);
extern int DEBUG_SetBitfieldParams(struct datatype * dt, int offset, extern int DEBUG_SetBitfieldParams(struct datatype * dt, int offset,
int nbits, struct datatype * dt2); int nbits, struct datatype * dt2);
extern int DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2); extern int DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2);
......
...@@ -1406,8 +1406,8 @@ static void packet_query_monitor_mem(struct gdb_context* gdbctx, int len, const ...@@ -1406,8 +1406,8 @@ static void packet_query_monitor_mem(struct gdb_context* gdbctx, int len, const
{ {
MEMORY_BASIC_INFORMATION mbi; MEMORY_BASIC_INFORMATION mbi;
char* addr = 0; char* addr = 0;
char* state; const char* state;
char* type; const char* type;
char prot[3+1]; char prot[3+1];
char buffer[128]; char buffer[128];
...@@ -2015,10 +2015,10 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl ...@@ -2015,10 +2015,10 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
break; break;
case 0: /* in child... and alive */ case 0: /* in child... and alive */
{ {
char buf[MAX_PATH]; char buf[MAX_PATH];
int fd; int fd;
char* gdb_path; const char* gdb_path;
FILE* f; FILE* f;
if (!(gdb_path = getenv("WINE_GDB"))) gdb_path = "gdb"; if (!(gdb_path = getenv("WINE_GDB"))) gdb_path = "gdb";
strcpy(buf,"/tmp/winegdb.XXXXXX"); strcpy(buf,"/tmp/winegdb.XXXXXX");
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#endif #endif
#ifdef __i386__ #ifdef __i386__
static char * reg_name[] = static const char * reg_name[] =
{ {
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
}; };
...@@ -523,7 +523,8 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag, ...@@ -523,7 +523,8 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
int mid, high, low; int mid, high, low;
unsigned int * ptr; unsigned int * ptr;
int lineno; int lineno;
char * lineinfo, *sourcefile; const char * lineinfo;
char *sourcefile;
int i; int i;
char linebuff[16]; char linebuff[16];
unsigned val; unsigned val;
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
*/ */
void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format ) void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
{ {
char * default_format; const char * default_format;
long long int res; long long int res;
assert(value->cookie == DV_TARGET || value->cookie == DV_HOST); assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
...@@ -94,7 +94,7 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format ) ...@@ -94,7 +94,7 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
if (strstr(default_format, "%S") != NULL) if (strstr(default_format, "%S") != NULL)
{ {
char* ptr; const char* ptr;
int state = 0; int state = 0;
/* FIXME: simplistic implementation for default_format being /* FIXME: simplistic implementation for default_format being
...@@ -631,8 +631,8 @@ void DEBUG_InfoVirtual(DWORD pid) ...@@ -631,8 +631,8 @@ void DEBUG_InfoVirtual(DWORD pid)
{ {
MEMORY_BASIC_INFORMATION mbi; MEMORY_BASIC_INFORMATION mbi;
char* addr = 0; char* addr = 0;
char* state; const char* state;
char* type; const char* type;
char prot[3+1]; char prot[3+1];
HANDLE hProc; HANDLE hProc;
......
...@@ -60,15 +60,15 @@ struct datatype ...@@ -60,15 +60,15 @@ struct datatype
{ {
enum debug_type type; enum debug_type type;
struct datatype * next; struct datatype * next;
char * name; const char * name;
union union
{ {
struct struct
{ {
char basic_type; char basic_type;
char * output_format; const char * output_format;
char basic_size; char basic_size;
unsigned b_signed:1; unsigned b_signed:1;
} basic; } basic;
struct struct
{ {
...@@ -133,8 +133,8 @@ static unsigned int type_hash( const char * name ) ...@@ -133,8 +133,8 @@ static unsigned int type_hash( const char * name )
static struct datatype * static struct datatype *
DEBUG_InitBasic(int type, char * name, int size, int b_signed, DEBUG_InitBasic(int type, const char * name, int size, int b_signed,
char * output_format) const char * output_format)
{ {
int hash; int hash;
...@@ -346,13 +346,13 @@ DEBUG_InitTypes(void) ...@@ -346,13 +346,13 @@ DEBUG_InitTypes(void)
} }
long long int long long int
DEBUG_GetExprValue(const DBG_VALUE* _value, char** format) DEBUG_GetExprValue(const DBG_VALUE* _value, const char** format)
{ {
long long int rtn; long long int rtn;
unsigned int rtn2; unsigned int rtn2;
struct datatype * type2 = NULL; struct datatype * type2 = NULL;
struct en_values * e; struct en_values * e;
char * def_format = "0x%x"; const char * def_format = "0x%x";
DBG_VALUE value = *_value; DBG_VALUE value = *_value;
assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST); assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST);
...@@ -943,7 +943,7 @@ leave: ...@@ -943,7 +943,7 @@ leave:
static void DEBUG_DumpAType(struct datatype* dt, BOOL deep) static void DEBUG_DumpAType(struct datatype* dt, BOOL deep)
{ {
char* name = (dt->name) ? dt->name : "--none--"; const char* name = (dt->name) ? dt->name : "--none--";
/* EPP DEBUG_Printf(DBG_CHN_MESG, "0x%08lx ", (unsigned long)dt); */ /* EPP DEBUG_Printf(DBG_CHN_MESG, "0x%08lx ", (unsigned long)dt); */
switch (dt->type) switch (dt->type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment