const fixes

This commit is contained in:
Jonathan Gray 2013-05-02 13:03:47 +10:00
parent 804687385c
commit 624419334f
6 changed files with 16 additions and 12 deletions

View file

@ -724,7 +724,7 @@ static void keyConcatArgs( void ) {
} }
static void ConcatRemaining( const char *src, const char *start ) { static void ConcatRemaining( const char *src, const char *start ) {
char *str; const char *str;
str = strstr(src, start); str = strstr(src, start);
if (!str) { if (!str) {
@ -1023,7 +1023,7 @@ the K_* names are matched up.
to be configured even if they don't have defined names. to be configured even if they don't have defined names.
=================== ===================
*/ */
int Key_StringToKeynum( char *str ) { int Key_StringToKeynum( const char *str ) {
int i; int i;
if ( !str || !str[0] ) if ( !str || !str[0] )

View file

@ -501,7 +501,7 @@ void IN_CenterView (void);
void CL_VerifyCode( void ); void CL_VerifyCode( void );
float CL_KeyState (kbutton_t *key); float CL_KeyState (kbutton_t *key);
int Key_StringToKeynum( char *str ); int Key_StringToKeynum( const char *str );
const char *Key_KeynumToString( int keynum/*, qboolean bTranslate */ ); //note: translate is only called for menu display not configs const char *Key_KeynumToString( int keynum/*, qboolean bTranslate */ ); //note: translate is only called for menu display not configs
// //

View file

@ -646,7 +646,7 @@ bool FS_FileCacheable(const char* const filename)
FS_ShiftedStrStr FS_ShiftedStrStr
=========== ===========
*/ */
char *FS_ShiftedStrStr(const char *string, const char *substring, int shift) { const char *FS_ShiftedStrStr(const char *string, const char *substring, int shift) {
char buf[MAX_STRING_TOKENS]; char buf[MAX_STRING_TOKENS];
int i; int i;

View file

@ -751,24 +751,28 @@ void CStringEdPackage::AddEntry( LPCSTR psLocalReference )
LPCSTR Leetify( LPCSTR psString ) LPCSTR Leetify( LPCSTR psString )
{ {
static string str;
str = psString;
if (sp_leet->integer == 42) // very specific test, so you won't hit it accidentally if (sp_leet->integer == 42) // very specific test, so you won't hit it accidentally
{ {
static const static const
char cReplace[]={ 'o','0','l','1','e','3','a','4','s','5','t','7','i','!','h','#', char cReplace[]={ 'o','0','l','1','e','3','a','4','s','5','t','7','i','!','h','#',
'O','0','L','1','E','3','A','4','S','5','T','7','I','!','H','#' // laziness because of strchr() 'O','0','L','1','E','3','A','4','S','5','T','7','I','!','H','#' // laziness because of strchr()
}; };
static char *str;
char *p; char *p;
free(str);
str = strdup(psString);
for (int i=0; i<sizeof(cReplace); i+=2) for (int i=0; i<sizeof(cReplace); i+=2)
{ {
while ((p=strchr(str.c_str(),cReplace[i]))!=NULL) while ((p=strchr(str,cReplace[i]))!=NULL)
*p = cReplace[i+1]; *p = cReplace[i+1];
} }
}
return str.c_str(); return str;
} else {
return psString;
}
} }

View file

@ -1206,7 +1206,7 @@ image_t *R_CreateImage( const char *name, const byte *pic, int width, int height
if (name[0] == '*') if (name[0] == '*')
{ {
char *psLightMapNameSearchPos = strrchr(name,'/'); const char *psLightMapNameSearchPos = strrchr(name,'/');
if ( psLightMapNameSearchPos && !strncmp( psLightMapNameSearchPos+1, "lightmap", 8 ) ) { if ( psLightMapNameSearchPos && !strncmp( psLightMapNameSearchPos+1, "lightmap", 8 ) ) {
isLightmap = qtrue; isLightmap = qtrue;
} }

View file

@ -144,7 +144,7 @@ static qboolean IN_IsConsoleKey( int key, const unsigned char character )
// Only parse the variable when it changes // Only parse the variable when it changes
if( cl_consoleKeys->modified ) if( cl_consoleKeys->modified )
{ {
char *text_p, *token; const char *text_p, *token;
cl_consoleKeys->modified = qfalse; cl_consoleKeys->modified = qfalse;
text_p = cl_consoleKeys->string; text_p = cl_consoleKeys->string;