Fix -Wwrite-strings warnings

deprecated conversion from string constant to ‘char*’

Constify lots of "char *".
This commit is contained in:
dhewg 2011-11-30 22:15:10 +01:00 committed by Daniel Gibson
parent d83cf21bde
commit 64df913412
20 changed files with 51 additions and 51 deletions

View file

@ -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",

View file

@ -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() ) {

View file

@ -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 );

View file

@ -4230,7 +4230,7 @@ idMultiplayerGame::GetTeamFlag
================
*/
void idMultiplayerGame::FindTeamFlags( void ) {
char * flagDefs[2] =
const char * flagDefs[2] =
{
"team_CTF_redflag",
"team_CTF_blueflag"

View file

@ -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();

View file

@ -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>", "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, "<PUSH>" ); 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 ) {

View file

@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms
const char * const RESULT_STRING = "<RESULT>";
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 );

View file

@ -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 ];

View file

@ -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 );

View file

@ -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 ];

View file

@ -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();

View file

@ -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>", "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, "<PUSH>" ); 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 ) {

View file

@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms
const char * const RESULT_STRING = "<RESULT>";
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 );

View file

@ -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 ];

View file

@ -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 );

View file

@ -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 ];

View file

@ -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

View file

@ -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;

View file

@ -625,7 +625,7 @@ void idParser::AddBuiltinDefines( void ) {
define_t *define;
struct builtin
{
char *string;
const char *string;
int id;
} builtin[] = {
{ "__LINE__", BUILTIN_LINE },

View file

@ -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 );