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;
WIN32_FIND_DATA fd;
HANDLE hff;
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;
if ((strchr(param1,'*') != NULL) && (strchr(param1,'%') != NULL)) {
......@@ -207,9 +207,9 @@ char *p;
* 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;
count = strlen(command);
......@@ -805,7 +805,7 @@ DWORD count;
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;
count = strlen(command);
......
......@@ -40,7 +40,7 @@ void WCMD_copy (void);
void WCMD_create_dir (void);
void WCMD_delete (int recurse);
void WCMD_directory (void);
void WCMD_echo (char *);
void WCMD_echo (const char *);
void WCMD_enter_paged_mode(void);
void WCMD_for (char *);
void WCMD_give_help (char *command);
......@@ -48,8 +48,8 @@ void WCMD_goto (void);
void WCMD_if (char *);
void WCMD_leave_paged_mode(void);
void WCMD_move (void);
void WCMD_output (char *format, ...);
void WCMD_output_asis (char *message);
void WCMD_output (const char *format, ...);
void WCMD_output_asis (const char *message);
void WCMD_parse (char *s, char *q, char *p1, char *p2);
void WCMD_pause (void);
void WCMD_pipe (char *command);
......
......@@ -27,7 +27,7 @@
#include "ntstatus.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",
"HELP", "IF", "LABEL", "MD", "MKDIR", "MOVE", "PATH", "PAUSE",
"PROMPT", "REM", "REN", "RENAME", "RD", "RMDIR", "SET", "SHIFT",
......@@ -728,7 +728,7 @@ int p = 0;
*
*/
void WCMD_output (char *format, ...) {
void WCMD_output (const char *format, ...) {
va_list ap;
char string[1024];
......@@ -766,7 +766,7 @@ void WCMD_leave_paged_mode(void)
* without formatting eg. when message contains '%'
*/
void WCMD_output_asis (char *message) {
void WCMD_output_asis (const char *message) {
DWORD count;
char* ptr;
char string[1024];
......
......@@ -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 */
char *getDriveValue(char letter, char *valueName) {
char *getDriveValue(char letter, const char *valueName) {
HKEY hkDrive = 0;
char *subKeyName;
char *result = NULL;
......@@ -76,7 +76,7 @@ end:
}
/* 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);
sprintf(driveSection, "Drive %c", letter);
if (newValue)
......@@ -226,8 +226,8 @@ int refreshDriveDlg (HWND hDlg)
#define DRIVE_MASK_BIT(B) 1<<(toupper(B)-'A')
typedef struct {
char *sCode;
char *sDesc;
const char *sCode;
const char *sDesc;
} code_desc_pair;
static code_desc_pair type_pairs[] = {
......
......@@ -68,14 +68,14 @@ int initialize(void) {
/*****************************************************************************
* getConfigValue: Retrieves a configuration value from the registry
*
* char *subKey : the name of the config section
* char *valueName : the name of the config value
* char *defaultResult : if the key isn't found, return this value instead
* const char *subKey : the name of the config section
* const char *valueName : the name of the config value
* 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.
*
*/
char *getConfigValue (char *subkey, char *valueName, char *defaultResult)
char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult)
{
char *buffer = NULL;
DWORD dataLength;
......@@ -129,14 +129,14 @@ end:
* 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
* char *subKey : the name of the config section
* char *valueName : the name of the config value
* char *value : the value to set the configuration key to
* const char *subKey : the name of the config section
* const char *valueName : the name of the config value
* const char *value : the value to set the configuration key to
*
* 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;
HKEY key = NULL;
......@@ -160,7 +160,7 @@ end:
}
/* 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;
HKEY key;
......@@ -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. */
HRESULT removeConfigValue(char *subkey, char *valueName) {
HRESULT removeConfigValue(const char *subkey, const char *valueName) {
HRESULT hr;
HKEY key;
WINE_TRACE("subkey=%s, valueName=%s\n", subkey, valueName);
......@@ -231,7 +231,7 @@ void destroyTransaction(struct transaction *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);
assert( section != NULL );
......
......@@ -82,7 +82,7 @@ void processTransQueue();
* 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.
*/
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 */
void destroyTransaction(struct transaction *trans);
......@@ -91,10 +91,10 @@ void destroyTransaction(struct transaction *trans);
int initialize(void);
extern HKEY configKey;
int setConfigValue (char *subkey, char *valueName, const char *value);
char *getConfigValue (char *subkey, char *valueName, char *defaultResult);
HRESULT doesConfigValueExist (char *subkey, char *valueName);
HRESULT removeConfigValue (char *subkey, char *valueName);
int setConfigValue (const char *subkey, const char *valueName, const char *value);
char *getConfigValue (const char *subkey, const char *valueName, const char *defaultResult);
HRESULT doesConfigValueExist (const char *subkey, const char *valueName);
HRESULT removeConfigValue (const char *subkey, const char *valueName);
/* X11DRV */
......
......@@ -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 );
}
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) {
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)
* and return updated location.
*/
void db_disasm_esc( DBG_ADDR *addr, int inst, int short_addr,
int size, char *seg )
int size, const char *seg )
{
int regmodrm;
const struct finst *fp;
......@@ -1327,7 +1327,7 @@ void DEBUG_Disasm( DBG_ADDR *addr, int display )
int inst;
int size;
int short_addr;
char * seg;
const char *seg;
const struct inst *ip;
const char *i_name;
int i_size;
......
......@@ -36,7 +36,7 @@
static void mode_command(int);
int yylex(void);
int yyerror(char *);
int yyerror(const char *);
%}
......@@ -479,7 +479,7 @@ void DEBUG_Parser(LPCSTR filename)
set_default_channels();
}
int yyerror(char* s)
int yyerror(const char* s)
{
DEBUG_Printf(DBG_CHN_MESG, "%s\n", s);
return 0;
......
......@@ -503,7 +503,7 @@ extern int DEBUG_GetObjectSize(struct datatype * dt);
extern unsigned int DEBUG_ArrayIndex(const DBG_VALUE * addr, DBG_VALUE * result,
int index);
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,
int nbits, 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
{
MEMORY_BASIC_INFORMATION mbi;
char* addr = 0;
char* state;
char* type;
const char* state;
const char* type;
char prot[3+1];
char buffer[128];
......@@ -2015,10 +2015,10 @@ static BOOL gdb_startup(struct gdb_context* gdbctx, DEBUG_EVENT* de, unsigned fl
break;
case 0: /* in child... and alive */
{
char buf[MAX_PATH];
int fd;
char* gdb_path;
FILE* f;
char buf[MAX_PATH];
int fd;
const char* gdb_path;
FILE* f;
if (!(gdb_path = getenv("WINE_GDB"))) gdb_path = "gdb";
strcpy(buf,"/tmp/winegdb.XXXXXX");
......
......@@ -33,7 +33,7 @@
#endif
#ifdef __i386__
static char * reg_name[] =
static const char * reg_name[] =
{
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi"
};
......@@ -523,7 +523,8 @@ const char * DEBUG_FindNearestSymbol( const DBG_ADDR *addr, int flag,
int mid, high, low;
unsigned int * ptr;
int lineno;
char * lineinfo, *sourcefile;
const char * lineinfo;
char *sourcefile;
int i;
char linebuff[16];
unsigned val;
......
......@@ -40,7 +40,7 @@
*/
void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
{
char * default_format;
const char * default_format;
long long int res;
assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
......@@ -94,7 +94,7 @@ void DEBUG_PrintBasic( const DBG_VALUE* value, int count, char format )
if (strstr(default_format, "%S") != NULL)
{
char* ptr;
const char* ptr;
int state = 0;
/* FIXME: simplistic implementation for default_format being
......@@ -631,8 +631,8 @@ void DEBUG_InfoVirtual(DWORD pid)
{
MEMORY_BASIC_INFORMATION mbi;
char* addr = 0;
char* state;
char* type;
const char* state;
const char* type;
char prot[3+1];
HANDLE hProc;
......
......@@ -60,15 +60,15 @@ struct datatype
{
enum debug_type type;
struct datatype * next;
char * name;
const char * name;
union
{
struct
{
char basic_type;
char * output_format;
char basic_size;
unsigned b_signed:1;
char basic_type;
const char * output_format;
char basic_size;
unsigned b_signed:1;
} basic;
struct
{
......@@ -133,8 +133,8 @@ static unsigned int type_hash( const char * name )
static struct datatype *
DEBUG_InitBasic(int type, char * name, int size, int b_signed,
char * output_format)
DEBUG_InitBasic(int type, const char * name, int size, int b_signed,
const char * output_format)
{
int hash;
......@@ -346,13 +346,13 @@ DEBUG_InitTypes(void)
}
long long int
DEBUG_GetExprValue(const DBG_VALUE* _value, char** format)
DEBUG_GetExprValue(const DBG_VALUE* _value, const char** format)
{
long long int rtn;
unsigned int rtn2;
struct datatype * type2 = NULL;
struct en_values * e;
char * def_format = "0x%x";
const char * def_format = "0x%x";
DBG_VALUE value = *_value;
assert(_value->cookie == DV_TARGET || _value->cookie == DV_HOST);
......@@ -943,7 +943,7 @@ leave:
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); */
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