From a81ddd228daae8b02eacaa68ba548de68bdbf232 Mon Sep 17 00:00:00 2001 From: XoD Date: Mon, 19 Dec 2011 09:36:44 +0100 Subject: [PATCH 01/10] Fix constant string parameter. The methode Error of ScriptInterpreter is now const compliant. Signed-off-by: XoD --- neo/d3xp/script/Script_Interpreter.cpp | 2 +- neo/d3xp/script/Script_Interpreter.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/d3xp/script/Script_Interpreter.cpp b/neo/d3xp/script/Script_Interpreter.cpp index 6e07931..0442500 100644 --- a/neo/d3xp/script/Script_Interpreter.cpp +++ b/neo/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 ]; diff --git a/neo/d3xp/script/Script_Interpreter.h b/neo/d3xp/script/Script_Interpreter.h index d0ab7a9..8d6c529 100644 --- a/neo/d3xp/script/Script_Interpreter.h +++ b/neo/d3xp/script/Script_Interpreter.h @@ -93,7 +93,7 @@ public: int CurrentLine( void ) const; const char *CurrentFile( void ) const; - void Error( char *fmt, ... ) const id_attribute((format(printf,2,3))); + void Error( const char *fmt, ... ) const id_attribute((format(printf,2,3))); void Warning( char *fmt, ... ) const id_attribute((format(printf,2,3))); void DisplayInfo( void ) const; From ee1ad737cef6964be4f5b1fb3ae275d13668b0bc Mon Sep 17 00:00:00 2001 From: XoD Date: Mon, 19 Dec 2011 09:40:17 +0100 Subject: [PATCH 02/10] Fix constant string parameter. The methode Warning of ScriptInterpreter is now const compliant. Signed-off-by: XoD --- neo/d3xp/script/Script_Interpreter.cpp | 2 +- neo/d3xp/script/Script_Interpreter.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/d3xp/script/Script_Interpreter.cpp b/neo/d3xp/script/Script_Interpreter.cpp index 0442500..de63e7b 100644 --- a/neo/d3xp/script/Script_Interpreter.cpp +++ b/neo/d3xp/script/Script_Interpreter.cpp @@ -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/neo/d3xp/script/Script_Interpreter.h b/neo/d3xp/script/Script_Interpreter.h index 8d6c529..a1e650a 100644 --- a/neo/d3xp/script/Script_Interpreter.h +++ b/neo/d3xp/script/Script_Interpreter.h @@ -94,7 +94,7 @@ public: const char *CurrentFile( void ) const; void Error( const char *fmt, ... ) const id_attribute((format(printf,2,3))); - void Warning( 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 ); From 11eddc9a97d0d29217e2a763dc92afbd974bfa6c Mon Sep 17 00:00:00 2001 From: XoD Date: Mon, 19 Dec 2011 09:44:24 +0100 Subject: [PATCH 03/10] Fix static string array type. Set the static array fastEntityList constant. Signed-off-by: XoD --- neo/d3xp/Game_local.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/d3xp/Game_local.cpp b/neo/d3xp/Game_local.cpp index af14c75..d759202 100644 --- a/neo/d3xp/Game_local.cpp +++ b/neo/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", From 1ec811c3cf97f7697bf930db5d9aaa906d30869e Mon Sep 17 00:00:00 2001 From: XoD Date: Mon, 19 Dec 2011 22:01:41 +0100 Subject: [PATCH 04/10] Fix constant string parameter. The methode LoadScript of idItemTeam is now const compliant. Signed-off-by: XoD --- neo/d3xp/Item.cpp | 2 +- neo/d3xp/Item.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/neo/d3xp/Item.cpp b/neo/d3xp/Item.cpp index f1357bd..17521c6 100644 --- a/neo/d3xp/Item.cpp +++ b/neo/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/neo/d3xp/Item.h b/neo/d3xp/Item.h index e609e22..f7583a5 100644 --- a/neo/d3xp/Item.h +++ b/neo/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 ); From ea5445e22d85fc2b058ee78e8beb6321b09e8c88 Mon Sep 17 00:00:00 2001 From: XoD Date: Mon, 19 Dec 2011 22:03:37 +0100 Subject: [PATCH 05/10] Fix static string array type. Set the static array flagDefs constant. Signed-off-by: XoD --- neo/d3xp/MultiplayerGame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/d3xp/MultiplayerGame.cpp b/neo/d3xp/MultiplayerGame.cpp index 1105268..62a7a10 100644 --- a/neo/d3xp/MultiplayerGame.cpp +++ b/neo/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" From dfa3aca9fee792420b00f9e761dece58f34cabb7 Mon Sep 17 00:00:00 2001 From: XoD Date: Mon, 19 Dec 2011 22:41:03 +0100 Subject: [PATCH 06/10] Fix char* local var Set constante some char* local variable. Signed-off-by: XoD --- neo/d3xp/gamesys/SysCmds.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neo/d3xp/gamesys/SysCmds.cpp b/neo/d3xp/gamesys/SysCmds.cpp index 7b32cef..9a0f8ef 100644 --- a/neo/d3xp/gamesys/SysCmds.cpp +++ b/neo/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(); From f061e0f29ded10cfe40215f1433c86e1fe7a12bc Mon Sep 17 00:00:00 2001 From: XoD Date: Wed, 21 Dec 2011 20:55:35 +0100 Subject: [PATCH 07/10] Fix some constant string type in Script_Compiler Signed-off-by: XoD --- neo/d3xp/script/Script_Compiler.cpp | 2 +- neo/d3xp/script/Script_Compiler.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/neo/d3xp/script/Script_Compiler.cpp b/neo/d3xp/script/Script_Compiler.cpp index 183c9dd..48af6e0 100644 --- a/neo/d3xp/script/Script_Compiler.cpp +++ b/neo/d3xp/script/Script_Compiler.cpp @@ -38,7 +38,7 @@ 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[] = { "+=", "-=", "*=", "/=", "%=", "&=", "|=", "++", "--", "&&", "||", "<=", ">=", "==", "!=", "::", ";", ",", "~", "!", "*", "/", "%", "(", ")", "-", "+", diff --git a/neo/d3xp/script/Script_Compiler.h b/neo/d3xp/script/Script_Compiler.h index 51b5918..5a62ddc 100644 --- a/neo/d3xp/script/Script_Compiler.h +++ b/neo/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; From 0cd4990575dc5b936ff4f6edfaf0a536724eb9eb Mon Sep 17 00:00:00 2001 From: XoD Date: Wed, 21 Dec 2011 20:57:15 +0100 Subject: [PATCH 08/10] Fix constant string type in punctuation_s Signed-off-by: XoD --- neo/idlib/Lexer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/idlib/Lexer.h b/neo/idlib/Lexer.h index ea73cf1..9ff408c 100644 --- a/neo/idlib/Lexer.h +++ b/neo/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; From 47c7a6b9e0b56cc1c4b68ccc0e694e34501378fa Mon Sep 17 00:00:00 2001 From: XoD Date: Wed, 21 Dec 2011 21:01:32 +0100 Subject: [PATCH 09/10] Fix constant string type in PrintClocks Signed-off-by: XoD --- neo/idlib/math/Simd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/idlib/math/Simd.cpp b/neo/idlib/math/Simd.cpp index d887052..989a450 100644 --- a/neo/idlib/math/Simd.cpp +++ b/neo/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 ); From a06e7e33e273a3d48b43648311d081930bae5d1d Mon Sep 17 00:00:00 2001 From: XoD Date: Wed, 21 Dec 2011 21:11:00 +0100 Subject: [PATCH 10/10] Fix constant string type in buildin struct Signed-off-by: XoD --- neo/idlib/Parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neo/idlib/Parser.cpp b/neo/idlib/Parser.cpp index b3cb717..33af7a8 100644 --- a/neo/idlib/Parser.cpp +++ b/neo/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 },