Constify various char* vars, parameters, etc. for more -Wwrite-strings cleanness

-Wwrite-strings is useful to detect code where string literals and e.g. alloc'd
strings are used side-by-side, potentially creating dangerous situations, or to
find uses of old, non-constified APIs.  However, enabling it would still flood
the log with too many warnings.  Also, GCC wrongly warns for initializations of
char arrays.

git-svn-id: https://svn.eduke32.com/eduke32@2796 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-07-01 22:11:33 +00:00
parent 8a89c07261
commit bdedbc6f76
25 changed files with 95 additions and 86 deletions

View file

@ -803,8 +803,8 @@ int32_t md_loadmodel(const char *fn);
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags); int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, float yoffset, int32_t flags);
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal); // int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
extern char *G_DefaultDefFile(void); extern const char *G_DefaultDefFile(void);
extern char *G_DefFile(void); extern const char *G_DefFile(void);
extern char *g_defNamePtr; extern char *g_defNamePtr;
extern char **g_defModules; extern char **g_defModules;

View file

@ -108,7 +108,7 @@ int32_t OSD_GetRowsCur(void);
void OSD_Init(void); void OSD_Init(void);
// sets the file to echo output to // sets the file to echo output to
void OSD_SetLogFile(char *fn); void OSD_SetLogFile(const char *fn);
// sets the functions the OSD will call to interrogate the environment // sets the functions the OSD will call to interrogate the environment
void OSD_SetFunctions( void OSD_SetFunctions(

View file

@ -174,10 +174,10 @@ typedef struct s_prrograminfo {
typedef struct s_prprogrambit { typedef struct s_prprogrambit {
int32_t bit; int32_t bit;
char* vert_def; const char* vert_def;
char* vert_prog; const char* vert_prog;
char* frag_def; const char* frag_def;
char* frag_prog; const char* frag_prog;
} _prprogrambit; } _prprogrambit;
#include "prlights.h" #include "prlights.h"

View file

@ -774,7 +774,7 @@ void OSD_Init(void)
// //
// OSD_SetLogFile() -- Sets the text file where printed text should be echoed // OSD_SetLogFile() -- Sets the text file where printed text should be echoed
// //
void OSD_SetLogFile(char *fn) void OSD_SetLogFile(const char *fn)
{ {
if (osdlog) if (osdlog)
{ {

View file

@ -4949,7 +4949,7 @@ static void polymer_compileprogram(int32_t programbits)
{ {
int32_t i, enabledbits; int32_t i, enabledbits;
GLhandleARB vert, frag, program; GLhandleARB vert, frag, program;
GLcharARB* source[PR_BIT_COUNT * 2]; const GLcharARB* source[PR_BIT_COUNT * 2];
GLcharARB infobuffer[PR_INFO_LOG_BUFFER_SIZE]; GLcharARB infobuffer[PR_INFO_LOG_BUFFER_SIZE];
GLint linkstatus; GLint linkstatus;
@ -4971,7 +4971,7 @@ static void polymer_compileprogram(int32_t programbits)
i++; i++;
} }
bglShaderSourceARB(vert, enabledbits, (const GLcharARB**)source, NULL); bglShaderSourceARB(vert, enabledbits, source, NULL);
bglCompileShaderARB(vert); bglCompileShaderARB(vert);

View file

@ -217,7 +217,7 @@ const char oldkeydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
"Dpad_Aiming", "", "", "Dpad_Aiming", "", "",
}; };
static char * mousedefaults[] = static const char * mousedefaults[] =
{ {
"Fire", "Fire",
"MedKit", "MedKit",
@ -232,7 +232,7 @@ static char * mousedefaults[] =
}; };
static char * mouseclickeddefaults[] = static const char * mouseclickeddefaults[] =
{ {
"", "",
"", "",
@ -247,14 +247,14 @@ static char * mouseclickeddefaults[] =
}; };
static char * mouseanalogdefaults[] = static const char * mouseanalogdefaults[] =
{ {
"analog_turning", "analog_turning",
"analog_moving", "analog_moving",
}; };
static char * mousedigitaldefaults[] = static const char * mousedigitaldefaults[] =
{ {
"", "",
"", "",
@ -263,7 +263,7 @@ static char * mousedigitaldefaults[] =
}; };
#if defined(GEKKO) #if defined(GEKKO)
static char * joystickdefaults[] = static const char * joystickdefaults[] =
{ {
"Open", // A "Open", // A
"Fire", // B "Fire", // B
@ -304,7 +304,7 @@ static char * joystickdefaults[] =
}; };
static char * joystickclickeddefaults[] = static const char * joystickclickeddefaults[] =
{ {
"", "",
"", "",
@ -345,7 +345,7 @@ static char * joystickclickeddefaults[] =
}; };
static char * joystickanalogdefaults[] = static const char * joystickanalogdefaults[] =
{ {
"analog_strafing", "analog_strafing",
"analog_moving", "analog_moving",
@ -366,7 +366,7 @@ static char * joystickanalogdefaults[] =
}; };
static char * joystickdigitaldefaults[] = static const char * joystickdigitaldefaults[] =
{ {
"", "",
"", "",
@ -386,7 +386,7 @@ static char * joystickdigitaldefaults[] =
"", "",
}; };
#else #else
static char * joystickdefaults[] = static const char * joystickdefaults[] =
{ {
"Fire", "Fire",
"Strafe", "Strafe",
@ -427,7 +427,7 @@ static char * joystickdefaults[] =
}; };
static char * joystickclickeddefaults[] = static const char * joystickclickeddefaults[] =
{ {
"", "",
"Inventory", "Inventory",
@ -468,7 +468,7 @@ static char * joystickclickeddefaults[] =
}; };
static char * joystickanalogdefaults[] = static const char * joystickanalogdefaults[] =
{ {
"analog_turning", "analog_turning",
"analog_moving", "analog_moving",
@ -481,7 +481,7 @@ static char * joystickanalogdefaults[] =
}; };
static char * joystickdigitaldefaults[] = static const char * joystickdigitaldefaults[] =
{ {
"", "",
"", "",

View file

@ -9617,9 +9617,9 @@ enum
T_INCLUDEDEFAULT, T_INCLUDEDEFAULT,
}; };
int32_t parsegroupfiles(scriptfile *script); static int32_t parsegroupfiles(scriptfile *script);
void parsegroupfiles_include(const char *fn, scriptfile *script, char *cmdtokptr) static void parsegroupfiles_include(const char *fn, scriptfile *script, const char *cmdtokptr)
{ {
scriptfile *included; scriptfile *included;
@ -9639,7 +9639,7 @@ void parsegroupfiles_include(const char *fn, scriptfile *script, char *cmdtokptr
} }
} }
int32_t parsegroupfiles(scriptfile *script) static int32_t parsegroupfiles(scriptfile *script)
{ {
int32_t tokn; int32_t tokn;
char *cmdtokptr; char *cmdtokptr;
@ -10074,7 +10074,7 @@ static int32_t loadtilegroups(const char *fn)
/// vvv Parse CON files partially to get sound definitions /// vvv Parse CON files partially to get sound definitions
static int32_t parseconsounds(scriptfile *script); static int32_t parseconsounds(scriptfile *script);
static void parseconsounds_include(const char *fn, scriptfile *script, char *cmdtokptr) static void parseconsounds_include(const char *fn, scriptfile *script, const char *cmdtokptr)
{ {
scriptfile *included; scriptfile *included;

View file

@ -16,10 +16,10 @@ int32_t g_gameType = GAMEFLAG_DUKE;
// grp/con/def handling // grp/con/def handling
char *defaultgamegrp[GAMECOUNT] = { "DUKE3D.GRP", "NAM.GRP", "NAPALM.GRP", "WW2GI.GRP" }; const char *defaultgamegrp[GAMECOUNT] = { "DUKE3D.GRP", "NAM.GRP", "NAPALM.GRP", "WW2GI.GRP" };
char *defaultdeffilename[GAMECOUNT] = { "duke3d.def", "nam.def", "napalm.def", "ww2gi.def" }; const char *defaultdeffilename[GAMECOUNT] = { "duke3d.def", "nam.def", "napalm.def", "ww2gi.def" };
char *defaultconfilename = "GAME.CON"; const char *defaultconfilename = "GAME.CON";
char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON", "NAPALM.CON", "WW2GI.CON" }; const char *defaultgameconfilename[GAMECOUNT] = { "EDUKE.CON", "NAM.CON", "NAPALM.CON", "WW2GI.CON" };
// g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH) // g_grpNamePtr can ONLY point to a malloc'd block (length BMAX_PATH)
char *g_grpNamePtr = NULL; char *g_grpNamePtr = NULL;
@ -49,7 +49,7 @@ void clearScriptNamePtr(void)
// g_scriptNamePtr assumed to be assigned to right after // g_scriptNamePtr assumed to be assigned to right after
} }
char *G_DefaultGrpFile(void) const char *G_DefaultGrpFile(void)
{ {
if (DUKE) if (DUKE)
return defaultgamegrp[GAME_DUKE]; return defaultgamegrp[GAME_DUKE];
@ -63,7 +63,7 @@ char *G_DefaultGrpFile(void)
return defaultgamegrp[0]; return defaultgamegrp[0];
} }
char *G_DefaultDefFile(void) const char *G_DefaultDefFile(void)
{ {
if (DUKE) if (DUKE)
return defaultdeffilename[GAME_DUKE]; return defaultdeffilename[GAME_DUKE];
@ -86,7 +86,7 @@ char *G_DefaultDefFile(void)
return defaultdeffilename[0]; return defaultdeffilename[0];
} }
char *G_DefaultConFile(void) const char *G_DefaultConFile(void)
{ {
if (DUKE && testkopen(defaultgameconfilename[GAME_DUKE],0)) if (DUKE && testkopen(defaultgameconfilename[GAME_DUKE],0))
return defaultgameconfilename[GAME_DUKE]; return defaultgameconfilename[GAME_DUKE];
@ -116,21 +116,21 @@ char *G_DefaultConFile(void)
return defaultconfilename; return defaultconfilename;
} }
char *G_GrpFile(void) const char *G_GrpFile(void)
{ {
if (g_grpNamePtr == NULL) if (g_grpNamePtr == NULL)
return G_DefaultGrpFile(); return G_DefaultGrpFile();
else else
return g_grpNamePtr; return g_grpNamePtr;
} }
char *G_DefFile(void) const char *G_DefFile(void)
{ {
if (g_defNamePtr == NULL) if (g_defNamePtr == NULL)
return G_DefaultDefFile(); return G_DefaultDefFile();
else else
return g_defNamePtr; return g_defNamePtr;
} }
char *G_ConFile(void) const char *G_ConFile(void)
{ {
if (g_scriptNamePtr == NULL) if (g_scriptNamePtr == NULL)
return G_DefaultConFile(); return G_DefaultConFile();

View file

@ -27,19 +27,19 @@ enum Games_t {
GAMECOUNT GAMECOUNT
}; };
extern char *defaultgamegrp[GAMECOUNT]; extern const char *defaultgamegrp[GAMECOUNT];
extern char *defaultdeffilename[GAMECOUNT]; extern const char *defaultdeffilename[GAMECOUNT];
extern char *defaultconfilename; extern const char *defaultconfilename;
extern char *defaultgameconfilename[GAMECOUNT]; extern const char *defaultgameconfilename[GAMECOUNT];
extern char *g_grpNamePtr; extern char *g_grpNamePtr;
extern char *g_scriptNamePtr; extern char *g_scriptNamePtr;
extern char *G_DefaultGrpFile(void); extern const char *G_DefaultGrpFile(void);
extern char *G_GrpFile(void); extern const char *G_GrpFile(void);
extern char *G_DefaultConFile(void); extern const char *G_DefaultConFile(void);
extern char *G_ConFile(void); extern const char *G_ConFile(void);
extern void clearGrpNamePtr(void); extern void clearGrpNamePtr(void);
extern void clearDefNamePtr(void); extern void clearDefNamePtr(void);

View file

@ -53,7 +53,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
hashtable_t h_gamefuncs = { NUMGAMEFUNCTIONS<<1, NULL }; hashtable_t h_gamefuncs = { NUMGAMEFUNCTIONS<<1, NULL };
int32_t CONFIG_FunctionNameToNum(char *func) int32_t CONFIG_FunctionNameToNum(const char *func)
{ {
int32_t i; int32_t i;
@ -95,7 +95,7 @@ char *CONFIG_FunctionNumToName(int32_t func)
*/ */
int32_t CONFIG_AnalogNameToNum(char *func) int32_t CONFIG_AnalogNameToNum(const char *func)
{ {
if (!Bstrcasecmp(func,"analog_turning")) if (!Bstrcasecmp(func,"analog_turning"))
@ -119,7 +119,7 @@ int32_t CONFIG_AnalogNameToNum(char *func)
} }
char *CONFIG_AnalogNumToName(int32_t func) const char *CONFIG_AnalogNumToName(int32_t func)
{ {
switch (func) switch (func)
{ {

View file

@ -37,10 +37,10 @@ int32_t CONFIG_SetMapBestTime(char *mapname, int32_t tm);
void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2); void CONFIG_MapKey(int32_t which, kb_scancode key1, kb_scancode oldkey1, kb_scancode key2, kb_scancode oldkey2);
int32_t CONFIG_FunctionNameToNum(char *func); int32_t CONFIG_FunctionNameToNum(const char *func);
char *CONFIG_FunctionNumToName(int32_t func); char *CONFIG_FunctionNumToName(int32_t func);
int32_t CONFIG_AnalogNameToNum(char *func); int32_t CONFIG_AnalogNameToNum(const char *func);
char *CONFIG_AnalogNumToName(int32_t func); const char *CONFIG_AnalogNumToName(int32_t func);
void CONFIG_SetDefaults(void); void CONFIG_SetDefaults(void);
void CONFIG_ReadKeys(void); void CONFIG_ReadKeys(void);

View file

@ -7358,7 +7358,7 @@ FOUNDCHEAT:
case CHEAT_MONSTERS: case CHEAT_MONSTERS:
{ {
char *s[] = { "On", "Off" }; const char *s[] = { "On", "Off" };
if (++g_noEnemies == 3) if (++g_noEnemies == 3)
g_noEnemies = 0; g_noEnemies = 0;
@ -8046,7 +8046,7 @@ FAKE_F3:
static void G_ShowParameterHelp(void) static void G_ShowParameterHelp(void)
{ {
char *s = "Usage: eduke32 [files] [options]\n" const char *s = "Usage: eduke32 [files] [options]\n"
"Example: eduke32 -q4 -a -m -tx -map nukeland.map\n\n" "Example: eduke32 -q4 -a -m -tx -map nukeland.map\n\n"
"Files can be *.grp/zip/con/def/rts\n" "Files can be *.grp/zip/con/def/rts\n"
"\n" "\n"
@ -8096,7 +8096,7 @@ static void G_ShowParameterHelp(void)
static void G_ShowDebugHelp(void) static void G_ShowDebugHelp(void)
{ {
char *s = "Usage: eduke32 [files] [options]\n" const char *s = "Usage: eduke32 [files] [options]\n"
"\n" "\n"
"-a\t\tUse fake player AI (fake multiplayer only)\n" "-a\t\tUse fake player AI (fake multiplayer only)\n"
"-cachesize #\tSets cache size, in Kb\n" "-cachesize #\tSets cache size, in Kb\n"
@ -8200,7 +8200,7 @@ static int32_t S_DefineMusic(char *ID,char *name)
static int32_t parsedefinitions_game(scriptfile *script, int32_t preload); static int32_t parsedefinitions_game(scriptfile *script, int32_t preload);
static void parsedefinitions_game_include(const char *fn, scriptfile *script, char *cmdtokptr, const int32_t preload) static void parsedefinitions_game_include(const char *fn, scriptfile *script, const char *cmdtokptr, const int32_t preload)
{ {
scriptfile *included = scriptfile_fromfile(fn); scriptfile *included = scriptfile_fromfile(fn);
@ -10314,7 +10314,7 @@ CLEAN_DIRECTORY:
if (quitevent) return 4; if (quitevent) return 4;
{ {
char *defsfile = G_DefFile(); const char *defsfile = G_DefFile();
if (!loaddefinitionsfile(defsfile)) if (!loaddefinitionsfile(defsfile))
{ {
initprintf("Definitions file \"%s\" loaded.\n",defsfile); initprintf("Definitions file \"%s\" loaded.\n",defsfile);

View file

@ -81,7 +81,7 @@ extern intptr_t *g_scriptPtr;
typedef struct typedef struct
{ {
char *name; const char *name;
int32_t lId; int32_t lId;
int32_t flags; int32_t flags;
int32_t maxParm2; int32_t maxParm2;

View file

@ -62,7 +62,7 @@ typedef struct
#define MUSIC_LoopSong ( 1 == 1 ) #define MUSIC_LoopSong ( 1 == 1 )
#define MUSIC_PlayOnce ( !MUSIC_LoopSong ) #define MUSIC_PlayOnce ( !MUSIC_LoopSong )
char *MUSIC_ErrorString( int32_t ErrorNumber ); const char *MUSIC_ErrorString( int32_t ErrorNumber );
int32_t MUSIC_Init( int32_t SoundCard, int32_t Address ); int32_t MUSIC_Init( int32_t SoundCard, int32_t Address );
int32_t MUSIC_Shutdown( void ); int32_t MUSIC_Shutdown( void );
void MUSIC_SetVolume( int32_t volume ); void MUSIC_SetVolume( int32_t volume );

View file

@ -202,7 +202,7 @@ void CONTROL_PrintAxes( void );
#define MAXBOUNDKEYS 256 #define MAXBOUNDKEYS 256
typedef struct binding { typedef struct binding {
char *key; const char *key;
char cmd[MAXBINDSTRINGLENGTH]; char cmd[MAXBINDSTRINGLENGTH];
char repeat; char repeat;
char laststate; char laststate;

View file

@ -45,7 +45,7 @@ static int32_t numpad = 0;
// translation table for taking key names to scancodes and back again // translation table for taking key names to scancodes and back again
static struct static struct
{ {
char *key; const char *key;
kb_scancode sc; kb_scancode sc;
} sctokeylut[] = } sctokeylut[] =
{ {
@ -233,7 +233,7 @@ void KB_ClearKeysDown(void)
//bflushchars(); //bflushchars();
} }
char *KB_ScanCodeToString(kb_scancode scancode) const char *KB_ScanCodeToString(kb_scancode scancode)
{ {
uint32_t s; uint32_t s;

View file

@ -92,7 +92,7 @@ int32_t KB_KeyWaiting( void ); // Checks if a character is waiting in th
char KB_Getch( void ); // Gets the next keypress char KB_Getch( void ); // Gets the next keypress
void KB_FlushKeyboardQueue( void ); // Empties the keyboard queue of all waiting characters. void KB_FlushKeyboardQueue( void ); // Empties the keyboard queue of all waiting characters.
void KB_ClearKeysDown( void ); // Clears all keys down flags. void KB_ClearKeysDown( void ); // Clears all keys down flags.
char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string const char * KB_ScanCodeToString( kb_scancode scancode ); // convert scancode into a string
kb_scancode KB_StringToScanCode( char * string ); // convert a string into a scancode kb_scancode KB_StringToScanCode( char * string ); // convert a string into a scancode
void KB_TurnKeypadOn( void ); // turn the keypad on void KB_TurnKeypadOn( void ); // turn the keypad on
void KB_TurnKeypadOff( void ); // turn the keypad off void KB_TurnKeypadOff( void ); // turn the keypad off

View file

@ -814,10 +814,11 @@ void SCRIPT_PutString
int32_t scripthandle, int32_t scripthandle,
char * sectionname, char * sectionname,
char * entryname, char * entryname,
char * string const char * string
) )
{ {
char *raw,*q,*p; const char *q;
char *raw,*p;
int32_t len = 3; int32_t len = 3;
if (!string) string = ""; if (!string) string = "";

View file

@ -218,7 +218,7 @@ void SCRIPT_PutString
int32_t scripthandle, int32_t scripthandle,
char * sectionname, char * sectionname,
char * entryname, char * entryname,
char * string const char * string
); );
/* /*

View file

@ -80,7 +80,10 @@ static int32_t soundbits, soundvoices, soundrate;
#define NUMDOUBLEMBTNS 3 // # of mouse buttons that can be double-clicked (mouse1 - mouse3) #define NUMDOUBLEMBTNS 3 // # of mouse buttons that can be double-clicked (mouse1 - mouse3)
#define NUMSINGLEMBTNS 4 // # of mouse buttons that can only be single-clicked (the rest) #define NUMSINGLEMBTNS 4 // # of mouse buttons that can only be single-clicked (the rest)
#define NUMMOUSEFUNCTIONS (NUMDOUBLEMBTNS*2+NUMSINGLEMBTNS) #define NUMMOUSEFUNCTIONS (NUMDOUBLEMBTNS*2+NUMSINGLEMBTNS)
static char *mousebuttonnames[] = { "Mouse1", "Mouse2", "Mouse3", "Mouse4", "Wheel Up", "Wheel Down", "Mouse5", "Mouse6", "Mouse7", "Mouse8"}; static const char *mousebuttonnames[] =
{ "Mouse1", "Mouse2", "Mouse3", "Mouse4", "Wheel Up",
"Wheel Down", "Mouse5", "Mouse6", "Mouse7", "Mouse8"
};
extern int32_t voting; extern int32_t voting;
@ -688,7 +691,7 @@ void M_DisplayMenus(void)
CACHE1D_FIND_REC *dir; CACHE1D_FIND_REC *dir;
int32_t c,x,i; int32_t c,x,i;
int32_t l,m; int32_t l,m;
char *p = NULL; const char *p = NULL;
Net_GetPackets(); Net_GetPackets();
@ -839,7 +842,7 @@ void M_DisplayMenus(void)
c = (320>>1)-120; c = (320>>1)-120;
{ {
int32_t io, ii, yy = 37, d=c+140, enabled; int32_t io, ii, yy = 37, d=c+140, enabled;
char *opts[] = const char *opts[] =
{ {
"Name", "Name",
"-", "-",
@ -1043,23 +1046,24 @@ void M_DisplayMenus(void)
case 1: case 1:
{ {
char *s[] = { "Auto","","","","","","","","","Blue","Red","Green","Gray","Dark gray","Dark green","Brown", const char *s[] =
"Dark blue","","","","","Bright red","","Yellow","","" { "Auto","","","","","","","","","Blue","Red","Green","Gray","Dark gray","Dark green","Brown",
}; "Dark blue","","","","","Bright red","","Yellow","",""
};
mgametext(d-50,yy,s[ud.color],MENUHIGHLIGHT(io),2+8+16); mgametext(d-50,yy,s[ud.color],MENUHIGHLIGHT(io),2+8+16);
} }
break; break;
case 2: case 2:
{ {
char *s[] = { "Blue", "Red", "Green", "Gray" }; const char *s[] = { "Blue", "Red", "Green", "Gray" };
mgametext(d-50,yy,s[ud.team],MENUHIGHLIGHT(io),2+8+16); mgametext(d-50,yy,s[ud.team],MENUHIGHLIGHT(io),2+8+16);
} }
break; break;
case 3: case 3:
{ {
char *s[] = { "Off", "All weapons", "Bullets only" }; const char *s[] = { "Off", "All weapons", "Bullets only" };
mgametext(d-50,yy,s[ud.config.AutoAim],MENUHIGHLIGHT(io),2+8+16); mgametext(d-50,yy,s[ud.config.AutoAim],MENUHIGHLIGHT(io),2+8+16);
} }
break; break;
@ -2686,7 +2690,7 @@ cheat_for_port_credits:
break; break;
case 7: case 7:
{ {
char *s[] = { "Off", "On", "Compress" }; const char *s[] = { "Off", "On", "Compress" };
enabled = (glusetexcompr && usehightile); enabled = (glusetexcompr && usehightile);
if (enabled && x==io) if (enabled && x==io)
{ {
@ -2818,7 +2822,7 @@ cheat_for_port_credits:
{ {
int32_t io, ii, yy, d=c+160+40, enabled; int32_t io, ii, yy, d=c+160+40, enabled;
char *opts[] = const char *opts[] =
{ {
"Show setup window at start", "Show setup window at start",
"Show crosshair", "Show crosshair",
@ -2991,7 +2995,7 @@ cheat_for_port_credits:
{ {
int32_t io, ii, yy, d=c+160+40, enabled; int32_t io, ii, yy, d=c+160+40, enabled;
char *opts[] = const char *opts[] =
{ {
"Parental lock", "Parental lock",
"-", "-",
@ -3071,7 +3075,7 @@ cheat_for_port_credits:
} }
modval(0,2,(int32_t *)&ud.drawweapon,1,probey==io); modval(0,2,(int32_t *)&ud.drawweapon,1,probey==io);
{ {
char *s[] = { "Off", "On", "Icon only" }; const char *s[] = { "Off", "On", "Icon only" };
mgametextpal(d,yy, s[ud.drawweapon], MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, s[ud.drawweapon], MENUHIGHLIGHT(io), 0);
break; break;
} }
@ -3092,7 +3096,7 @@ cheat_for_port_credits:
} }
modval(0,2,(int32_t *)&ud.autovote,1,probey==io); modval(0,2,(int32_t *)&ud.autovote,1,probey==io);
{ {
char *s[] = { "Off", "Vote No", "Vote Yes" }; const char *s[] = { "Off", "Vote No", "Vote Yes" };
mgametextpal(d,yy, s[ud.autovote], MENUHIGHLIGHT(io), 0); mgametextpal(d,yy, s[ud.autovote], MENUHIGHLIGHT(io), 0);
break; break;
} }
@ -3965,7 +3969,7 @@ cheat_for_port_credits:
} }
else if (function == 2) else if (function == 2)
{ {
static char *directions[] = static const char *directions[] =
{ {
"Up", "Right", "Down", "Left" "Up", "Right", "Down", "Left"
}; };
@ -4217,7 +4221,7 @@ cheat_for_port_credits:
} }
else else
{ {
static char *directions[] = static const char *directions[] =
{ {
"Up", "Right", "Down", "Left" "Up", "Right", "Down", "Left"
}; };
@ -4510,7 +4514,7 @@ cheat_for_port_credits:
{ {
int32_t io, ii, yy, d=c+160+40, enabled, j; int32_t io, ii, yy, d=c+160+40, enabled, j;
char *opts[] = const char *opts[] =
{ {
"Sound", "Sound",
"Sound volume", "Sound volume",

View file

@ -38,7 +38,7 @@ int16_t DynamicTileMap[MAXTILES];
struct dynitem struct dynitem
{ {
char *str; const char *str;
int32_t *dynvalptr; int32_t *dynvalptr;
const int16_t staticval; const int16_t staticval;
}; };

View file

@ -854,7 +854,11 @@ keydef_t ConsoleKeys[]=
{0,0} {0,0}
}; };
char *ConsoleButtons[] = { "mouse1", "mouse2", "mouse3", "mouse4", "mwheelup", "mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8" }; const char *ConsoleButtons[] =
{
"mouse1", "mouse2", "mouse3", "mouse4", "mwheelup",
"mwheeldn", "mouse5", "mouse6", "mouse7", "mouse8"
};
static int32_t osdcmd_bind(const osdfuncparm_t *parm) static int32_t osdcmd_bind(const osdfuncparm_t *parm)
{ {

View file

@ -38,12 +38,12 @@ extern float r_ambientlight,r_ambientlightrecip;
#pragma pack(push,1) #pragma pack(push,1)
// key bindings stuff // key bindings stuff
typedef struct { typedef struct {
char *name; const char *name;
int32_t id; int32_t id;
} keydef_t; } keydef_t;
extern keydef_t ConsoleKeys[]; extern keydef_t ConsoleKeys[];
extern char *ConsoleButtons[]; extern const char *ConsoleButtons[];
#pragma pack(pop) #pragma pack(pop)
#endif // __osdcmds_h__ #endif // __osdcmds_h__

View file

@ -338,7 +338,7 @@ static void G_PrecacheSounds(void)
} }
} }
static void G_DoLoadScreen(char *statustext, int32_t percent) static void G_DoLoadScreen(const char *statustext, int32_t percent)
{ {
int32_t i=0,j; int32_t i=0,j;

View file

@ -75,7 +75,7 @@ static void setErrorMessage(const char *msg)
// The music functions... // The music functions...
char *MUSIC_ErrorString(int32_t ErrorNumber) const char *MUSIC_ErrorString(int32_t ErrorNumber)
{ {
switch (ErrorNumber) switch (ErrorNumber)
{ {