diff --git a/d3xp/Game_local.cpp b/d3xp/Game_local.cpp index d16954d..f307599 100644 --- a/d3xp/Game_local.cpp +++ b/d3xp/Game_local.cpp @@ -71,7 +71,7 @@ const char *idGameLocal::sufaceTypeNames[ MAX_SURFACE_TYPES ] = { #ifdef _D3XP // List of all defs used by the player that will stay on the fast timeline -static char* fastEntityList[] = { +static const char* fastEntityList[] = { "player_doommarine", "weapon_chainsaw", "weapon_fists", diff --git a/d3xp/Item.cpp b/d3xp/Item.cpp index c1f2d97..524952d 100644 --- a/d3xp/Item.cpp +++ b/d3xp/Item.cpp @@ -772,7 +772,7 @@ void idItemTeam::Spawn( void ) { idItemTeam::LoadScript =============== */ -function_t * idItemTeam::LoadScript( char * script ) { +function_t * idItemTeam::LoadScript( const char * script ) { function_t * function = NULL; idStr funcname = spawnArgs.GetString( script, "" ); if ( funcname.Length() ) { diff --git a/d3xp/Item.h b/d3xp/Item.h index 851ebb4..8d6c715 100644 --- a/d3xp/Item.h +++ b/d3xp/Item.h @@ -257,7 +257,7 @@ private: void Event_FlagCapture( void ); void PrivateReturn( void ); - function_t * LoadScript( char * script ); + function_t * LoadScript( const char * script ); void SpawnNugget( idVec3 pos ); void UpdateGuis( void ); diff --git a/d3xp/MultiplayerGame.cpp b/d3xp/MultiplayerGame.cpp index e315a1e..1e01d57 100644 --- a/d3xp/MultiplayerGame.cpp +++ b/d3xp/MultiplayerGame.cpp @@ -4230,7 +4230,7 @@ idMultiplayerGame::GetTeamFlag ================ */ void idMultiplayerGame::FindTeamFlags( void ) { - char * flagDefs[2] = + const char * flagDefs[2] = { "team_CTF_redflag", "team_CTF_blueflag" diff --git a/d3xp/gamesys/SysCmds.cpp b/d3xp/gamesys/SysCmds.cpp index e4838e6..4b3dbed 100644 --- a/d3xp/gamesys/SysCmds.cpp +++ b/d3xp/gamesys/SysCmds.cpp @@ -446,7 +446,7 @@ argv(0) god ================== */ void Cmd_God_f( const idCmdArgs &args ) { - char *msg; + const char *msg; idPlayer *player; player = gameLocal.GetLocalPlayer(); @@ -475,7 +475,7 @@ argv(0) notarget ================== */ void Cmd_Notarget_f( const idCmdArgs &args ) { - char *msg; + const char *msg; idPlayer *player; player = gameLocal.GetLocalPlayer(); @@ -502,7 +502,7 @@ argv(0) noclip ================== */ void Cmd_Noclip_f( const idCmdArgs &args ) { - char *msg; + const char *msg; idPlayer *player; player = gameLocal.GetLocalPlayer(); diff --git a/d3xp/script/Script_Compiler.cpp b/d3xp/script/Script_Compiler.cpp index f427bcf..9882e72 100644 --- a/d3xp/script/Script_Compiler.cpp +++ b/d3xp/script/Script_Compiler.cpp @@ -38,14 +38,14 @@ If you have questions concerning this license or the applicable additional terms #define TOP_PRIORITY 7 bool idCompiler::punctuationValid[ 256 ]; -char *idCompiler::punctuation[] = { +const char *idCompiler::punctuation[] = { "+=", "-=", "*=", "/=", "%=", "&=", "|=", "++", "--", "&&", "||", "<=", ">=", "==", "!=", "::", ";", ",", "~", "!", "*", "/", "%", "(", ")", "-", "+", "=", "[", "]", ".", "<", ">" , "&", "|", ":", NULL }; -opcode_t idCompiler::opcodes[] = { +const opcode_t idCompiler::opcodes[] = { { "", "RETURN", -1, false, &def_void, &def_void, &def_void }, { "++", "UINC_F", 1, true, &def_float, &def_void, &def_void }, @@ -207,7 +207,7 @@ idCompiler::idCompiler() ================ */ idCompiler::idCompiler() { - char **ptr; + const char **ptr; int id; // make sure we have the right # of opcodes in the table @@ -630,8 +630,8 @@ Emits an opcode to push the variable onto the stack. ============ */ bool idCompiler::EmitPush( idVarDef *expression, const idTypeDef *funcArg ) { - opcode_t *op; - opcode_t *out; + const opcode_t *op; + const opcode_t *out; out = NULL; for( op = &opcodes[ OP_PUSH_F ]; op->name && !strcmp( op->name, "" ); op++ ) { @@ -1166,7 +1166,7 @@ idVarDef *idCompiler::LookupDef( const char *name, const idVarDef *baseobj ) { idVarDef *field; etype_t type_b; etype_t type_c; - opcode_t *op; + const opcode_t *op; // check if we're accessing a field if ( baseobj && ( baseobj->Type() == ev_object ) ) { @@ -1463,8 +1463,8 @@ idCompiler::GetExpression ============== */ idVarDef *idCompiler::GetExpression( int priority ) { - opcode_t *op; - opcode_t *oldop; + const opcode_t *op; + const opcode_t *oldop; idVarDef *e; idVarDef *e2; const idVarDef *oldtype; @@ -1677,7 +1677,7 @@ void idCompiler::ParseReturnStatement( void ) { idVarDef *e; etype_t type_a; etype_t type_b; - opcode_t *op; + const opcode_t *op; if ( CheckToken( ";" ) ) { if ( scope->TypeDef()->ReturnType()->Type() != ev_void ) { diff --git a/d3xp/script/Script_Compiler.h b/d3xp/script/Script_Compiler.h index f943379..fdcfe42 100644 --- a/d3xp/script/Script_Compiler.h +++ b/d3xp/script/Script_Compiler.h @@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms const char * const RESULT_STRING = ""; typedef struct opcode_s { - char *name; - char *opname; + const char *name; + const char *opname; int priority; bool rightAssociative; idVarDef *type_a; @@ -197,7 +197,7 @@ enum { class idCompiler { private: static bool punctuationValid[ 256 ]; - static char *punctuation[]; + static const char *punctuation[]; idParser parser; idParser *parserPtr; @@ -269,7 +269,7 @@ private: void ParseNamespace( idVarDef *newScope ); public : - static opcode_t opcodes[]; + static const opcode_t opcodes[]; idCompiler(); void CompileFile( const char *text, const char *filename, bool console ); diff --git a/d3xp/script/Script_Interpreter.cpp b/d3xp/script/Script_Interpreter.cpp index 2779aae..87e3d80 100644 --- a/d3xp/script/Script_Interpreter.cpp +++ b/d3xp/script/Script_Interpreter.cpp @@ -425,7 +425,7 @@ idInterpreter::Error Aborts the currently executing function ============ */ -void idInterpreter::Error( char *fmt, ... ) const { +void idInterpreter::Error( const char *fmt, ... ) const { va_list argptr; char text[ 1024 ]; @@ -450,7 +450,7 @@ idInterpreter::Warning Prints file and line number information with warning. ============ */ -void idInterpreter::Warning( char *fmt, ... ) const { +void idInterpreter::Warning( const char *fmt, ... ) const { va_list argptr; char text[ 1024 ]; diff --git a/d3xp/script/Script_Interpreter.h b/d3xp/script/Script_Interpreter.h index add78af..c9db249 100644 --- a/d3xp/script/Script_Interpreter.h +++ b/d3xp/script/Script_Interpreter.h @@ -93,8 +93,8 @@ public: int CurrentLine( void ) const; const char *CurrentFile( void ) const; - void Error( char *fmt, ... ) const id_attribute((format(printf,2,3))); - void Warning( char *fmt, ... ) const id_attribute((format(printf,2,3))); + void Error( const char *fmt, ... ) const id_attribute((format(printf,2,3))); + void Warning( const char *fmt, ... ) const id_attribute((format(printf,2,3))); void DisplayInfo( void ) const; bool BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ); diff --git a/d3xp/script/Script_Program.cpp b/d3xp/script/Script_Program.cpp index a2fdefa..5d348fb 100644 --- a/d3xp/script/Script_Program.cpp +++ b/d3xp/script/Script_Program.cpp @@ -1627,7 +1627,7 @@ idProgram::DisassembleStatement ============== */ void idProgram::DisassembleStatement( idFile *file, int instructionPointer ) const { - opcode_t *op; + const opcode_t *op; const statement_t *statement; statement = &statements[ instructionPointer ]; diff --git a/game/gamesys/SysCmds.cpp b/game/gamesys/SysCmds.cpp index 63eed3f..b606765 100644 --- a/game/gamesys/SysCmds.cpp +++ b/game/gamesys/SysCmds.cpp @@ -395,7 +395,7 @@ argv(0) god ================== */ void Cmd_God_f( const idCmdArgs &args ) { - char *msg; + const char *msg; idPlayer *player; player = gameLocal.GetLocalPlayer(); @@ -424,7 +424,7 @@ argv(0) notarget ================== */ void Cmd_Notarget_f( const idCmdArgs &args ) { - char *msg; + const char *msg; idPlayer *player; player = gameLocal.GetLocalPlayer(); @@ -451,7 +451,7 @@ argv(0) noclip ================== */ void Cmd_Noclip_f( const idCmdArgs &args ) { - char *msg; + const char *msg; idPlayer *player; player = gameLocal.GetLocalPlayer(); diff --git a/game/script/Script_Compiler.cpp b/game/script/Script_Compiler.cpp index f427bcf..c1fe9e1 100644 --- a/game/script/Script_Compiler.cpp +++ b/game/script/Script_Compiler.cpp @@ -38,14 +38,14 @@ If you have questions concerning this license or the applicable additional terms #define TOP_PRIORITY 7 bool idCompiler::punctuationValid[ 256 ]; -char *idCompiler::punctuation[] = { +const char *idCompiler::punctuation[] = { "+=", "-=", "*=", "/=", "%=", "&=", "|=", "++", "--", "&&", "||", "<=", ">=", "==", "!=", "::", ";", ",", "~", "!", "*", "/", "%", "(", ")", "-", "+", "=", "[", "]", ".", "<", ">" , "&", "|", ":", NULL }; -opcode_t idCompiler::opcodes[] = { +const opcode_t idCompiler::opcodes[] = { { "", "RETURN", -1, false, &def_void, &def_void, &def_void }, { "++", "UINC_F", 1, true, &def_float, &def_void, &def_void }, @@ -207,7 +207,7 @@ idCompiler::idCompiler() ================ */ idCompiler::idCompiler() { - char **ptr; + const char **ptr; int id; // make sure we have the right # of opcodes in the table @@ -630,8 +630,8 @@ Emits an opcode to push the variable onto the stack. ============ */ bool idCompiler::EmitPush( idVarDef *expression, const idTypeDef *funcArg ) { - opcode_t *op; - opcode_t *out; + const opcode_t *op; + const opcode_t *out; out = NULL; for( op = &opcodes[ OP_PUSH_F ]; op->name && !strcmp( op->name, "" ); op++ ) { @@ -1166,7 +1166,7 @@ idVarDef *idCompiler::LookupDef( const char *name, const idVarDef *baseobj ) { idVarDef *field; etype_t type_b; etype_t type_c; - opcode_t *op; + const opcode_t *op; // check if we're accessing a field if ( baseobj && ( baseobj->Type() == ev_object ) ) { @@ -1463,8 +1463,8 @@ idCompiler::GetExpression ============== */ idVarDef *idCompiler::GetExpression( int priority ) { - opcode_t *op; - opcode_t *oldop; + const opcode_t *op; + const opcode_t *oldop; idVarDef *e; idVarDef *e2; const idVarDef *oldtype; @@ -1677,7 +1677,7 @@ void idCompiler::ParseReturnStatement( void ) { idVarDef *e; etype_t type_a; etype_t type_b; - opcode_t *op; + const opcode_t *op; if ( CheckToken( ";" ) ) { if ( scope->TypeDef()->ReturnType()->Type() != ev_void ) { diff --git a/game/script/Script_Compiler.h b/game/script/Script_Compiler.h index f943379..fdcfe42 100644 --- a/game/script/Script_Compiler.h +++ b/game/script/Script_Compiler.h @@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms const char * const RESULT_STRING = ""; typedef struct opcode_s { - char *name; - char *opname; + const char *name; + const char *opname; int priority; bool rightAssociative; idVarDef *type_a; @@ -197,7 +197,7 @@ enum { class idCompiler { private: static bool punctuationValid[ 256 ]; - static char *punctuation[]; + static const char *punctuation[]; idParser parser; idParser *parserPtr; @@ -269,7 +269,7 @@ private: void ParseNamespace( idVarDef *newScope ); public : - static opcode_t opcodes[]; + static const opcode_t opcodes[]; idCompiler(); void CompileFile( const char *text, const char *filename, bool console ); diff --git a/game/script/Script_Interpreter.cpp b/game/script/Script_Interpreter.cpp index 921ee1c..3da97cf 100644 --- a/game/script/Script_Interpreter.cpp +++ b/game/script/Script_Interpreter.cpp @@ -425,7 +425,7 @@ idInterpreter::Error Aborts the currently executing function ============ */ -void idInterpreter::Error( char *fmt, ... ) const { +void idInterpreter::Error( const char *fmt, ... ) const { va_list argptr; char text[ 1024 ]; @@ -450,7 +450,7 @@ idInterpreter::Warning Prints file and line number information with warning. ============ */ -void idInterpreter::Warning( char *fmt, ... ) const { +void idInterpreter::Warning( const char *fmt, ... ) const { va_list argptr; char text[ 1024 ]; diff --git a/game/script/Script_Interpreter.h b/game/script/Script_Interpreter.h index add78af..c9db249 100644 --- a/game/script/Script_Interpreter.h +++ b/game/script/Script_Interpreter.h @@ -93,8 +93,8 @@ public: int CurrentLine( void ) const; const char *CurrentFile( void ) const; - void Error( char *fmt, ... ) const id_attribute((format(printf,2,3))); - void Warning( char *fmt, ... ) const id_attribute((format(printf,2,3))); + void Error( const char *fmt, ... ) const id_attribute((format(printf,2,3))); + void Warning( const char *fmt, ... ) const id_attribute((format(printf,2,3))); void DisplayInfo( void ) const; bool BeginMultiFrameEvent( idEntity *ent, const idEventDef *event ); diff --git a/game/script/Script_Program.cpp b/game/script/Script_Program.cpp index a2fdefa..5d348fb 100644 --- a/game/script/Script_Program.cpp +++ b/game/script/Script_Program.cpp @@ -1627,7 +1627,7 @@ idProgram::DisassembleStatement ============== */ void idProgram::DisassembleStatement( idFile *file, int instructionPointer ) const { - opcode_t *op; + const opcode_t *op; const statement_t *statement; statement = &statements[ instructionPointer ]; diff --git a/idlib/Lexer.cpp b/idlib/Lexer.cpp index 9916522..9bdef6a 100644 --- a/idlib/Lexer.cpp +++ b/idlib/Lexer.cpp @@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms #define PUNCTABLE //longer punctuations first -punctuation_t default_punctuations[] = { +static const punctuation_t default_punctuations[] = { //binary operators {">>=",P_RSHIFT_ASSIGN}, {"<<=",P_LSHIFT_ASSIGN}, @@ -774,7 +774,7 @@ idLexer::ReadPunctuation */ int idLexer::ReadPunctuation( idToken *token ) { int l, n, i; - char *p; + const char *p; const punctuation_t *punc; #ifdef PUNCTABLE diff --git a/idlib/Lexer.h b/idlib/Lexer.h index ba56b15..8fd7dae 100644 --- a/idlib/Lexer.h +++ b/idlib/Lexer.h @@ -129,7 +129,7 @@ typedef enum { // punctuation typedef struct punctuation_s { - char *p; // punctuation character(s) + const char *p; // punctuation character(s) int n; // punctuation id } punctuation_t; diff --git a/idlib/Parser.cpp b/idlib/Parser.cpp index 927e3d3..c0ffeba 100644 --- a/idlib/Parser.cpp +++ b/idlib/Parser.cpp @@ -625,7 +625,7 @@ void idParser::AddBuiltinDefines( void ) { define_t *define; struct builtin { - char *string; + const char *string; int id; } builtin[] = { { "__LINE__", BUILTIN_LINE }, diff --git a/idlib/math/Simd.cpp b/idlib/math/Simd.cpp index ff3b0db..73fc97b 100644 --- a/idlib/math/Simd.cpp +++ b/idlib/math/Simd.cpp @@ -312,7 +312,7 @@ TIME_TYPE time_in_millisec( void ) { PrintClocks ============ */ -void PrintClocks( char *string, int dataCount, int clocks, int otherClocks = 0 ) { +void PrintClocks( const char *string, int dataCount, int clocks, int otherClocks = 0 ) { int i; idLib::common->Printf( string );