diff --git a/tools/mbspc/mbspc/l_cmd.c b/tools/mbspc/mbspc/l_cmd.c index b5d912a3..27e7d1a5 100644 --- a/tools/mbspc/mbspc/l_cmd.c +++ b/tools/mbspc/mbspc/l_cmd.c @@ -546,30 +546,6 @@ void Q_strncpyz( char *dest, const char *src, int destsize ) { dest[destsize-1] = 0; } -char *strupr (char *start) -{ - char *in; - in = start; - while (*in) - { - *in = toupper(*in); - in++; - } - return start; -} - -char *strlower (char *start) -{ - char *in; - in = start; - while (*in) - { - *in = tolower(*in); - in++; - } - return start; -} - /* ============================================================================= diff --git a/tools/mbspc/mbspc/l_cmd.h b/tools/mbspc/mbspc/l_cmd.h index 8ac167d2..8f0ade4d 100644 --- a/tools/mbspc/mbspc/l_cmd.h +++ b/tools/mbspc/mbspc/l_cmd.h @@ -47,8 +47,6 @@ typedef unsigned char byte; extern int myargc; extern char **myargv; -char *strupr (char *in); -char *strlower (char *in); int Q_strncasecmp (char *s1, char *s2, int n); int Q_strcasecmp (char *s1, char *s2); void Q_strncpyz( char *dest, const char *src, int destsize ); diff --git a/tools/quake2/common/cmdlib.c b/tools/quake2/common/cmdlib.c index db6e2418..e67d4f71 100644 --- a/tools/quake2/common/cmdlib.c +++ b/tools/quake2/common/cmdlib.c @@ -493,35 +493,6 @@ int Q_strcasecmp( const char *s1, const char *s2 ){ } -// NOTE TTimo when switching to Multithread DLL (Release/Debug) in the config -// started getting warnings about that function, prolly a duplicate with the runtime function -// maybe we still need to have it in linux builds -/* - char *strupr (char *start) - { - char *in; - in = start; - while (*in) - { - *in = toupper(*in); - in++; - } - return start; - } - */ - -char *strlower( char *start ){ - char *in; - in = start; - while ( *in ) - { - *in = tolower( *in ); - in++; - } - return start; -} - - /* ============================================================================= diff --git a/tools/quake2/common/cmdlib.h b/tools/quake2/common/cmdlib.h index a925a5f7..bb48f739 100644 --- a/tools/quake2/common/cmdlib.h +++ b/tools/quake2/common/cmdlib.h @@ -77,7 +77,11 @@ void *safe_malloc_info( size_t size, char* info ); extern int myargc; extern char **myargv; -char *strlower( char *in ); +static inline char *strLower( char *string ){ + for( char *in = string; *in; ++in ) + *in = tolower( *in ); + return string; +} int Q_strncasecmp( const char *s1, const char *s2, int n ); int Q_strcasecmp( const char *s1, const char *s2 ); int Q_stricmp( const char *s1, const char *s2 ); diff --git a/tools/quake2/q2map/main.c b/tools/quake2/q2map/main.c index 4eb3f393..7313598b 100644 --- a/tools/quake2/q2map/main.c +++ b/tools/quake2/q2map/main.c @@ -599,7 +599,7 @@ int main( int argc, char **argv ){ else if ( !strcmp( argv[ i ], "-game" ) ) { i++; strncpy( game, argv[ i ], 64 ); - strlower( game ); + strLower( game ); } } diff --git a/tools/quake2/qdata_heretic2/common/cmdlib.c b/tools/quake2/qdata_heretic2/common/cmdlib.c index 3511ea99..e6753876 100644 --- a/tools/quake2/qdata_heretic2/common/cmdlib.c +++ b/tools/quake2/qdata_heretic2/common/cmdlib.c @@ -84,15 +84,6 @@ void *SafeMalloc( size_t n, char *desc ){ return p; } -#if defined ( __linux__ ) || defined ( __APPLE__ ) -void strlwr( char *conv_str ){ - int i; - - for ( i = 0; i < strlen( conv_str ); i++ ) - conv_str[i] = tolower( conv_str[i] ); -} -#endif - // set these before calling CheckParm int myargc; @@ -506,34 +497,6 @@ int Q_strcasecmp( const char *s1, const char *s2 ){ return Q_strncasecmp( s1, s2, 99999 ); } -// NOTE TTimo when switching to Multithread DLL (Release/Debug) in the config -// started getting warnings about that function, prolly a duplicate with the runtime function -// maybe we still need to have it in linux builds -/* - char *strupr (char *start) - { - char *in; - in = start; - while (*in) - { - *in = toupper(*in); - in++; - } - return start; - } - */ - -char *strlower( char *start ){ - char *in; - in = start; - while ( *in ) - { - *in = tolower( *in ); - in++; - } - return start; -} - /* ============================================================================= diff --git a/tools/quake2/qdata_heretic2/common/cmdlib.h b/tools/quake2/qdata_heretic2/common/cmdlib.h index d68bc837..c31dacc2 100644 --- a/tools/quake2/qdata_heretic2/common/cmdlib.h +++ b/tools/quake2/qdata_heretic2/common/cmdlib.h @@ -83,7 +83,16 @@ void *safe_malloc_info( size_t size, char* info ); extern int myargc; extern char **myargv; -char *strlower( char *in ); +static inline char *strUpper( char *string ){ + for( char *in = string; *in; ++in ) + *in = toupper( *in ); + return string; +} +static inline char *strLower( char *string ){ + for( char *in = string; *in; ++in ) + *in = tolower( *in ); + return string; +} int Q_strncasecmp( const char *s1, const char *s2, int n ); int Q_stricmp( const char *s1, const char *s2 ); int Q_strcasecmp( const char *s1, const char *s2 ); diff --git a/tools/quake2/qdata_heretic2/fmodels.c b/tools/quake2/qdata_heretic2/fmodels.c index a3e06c0b..3e887783 100644 --- a/tools/quake2/qdata_heretic2/fmodels.c +++ b/tools/quake2/qdata_heretic2/fmodels.c @@ -148,18 +148,7 @@ void GetOneGroup( trigroup_t *tris, int grp, triangle_t* triangles ); void ScaleTris( vec3_t min, vec3_t max, int Width, int Height, float* u, float* v, int verts ); void NewDrawLine( int x1, int y1, int x2, int y2, unsigned char* picture, int width, int height ); -#ifndef _WIN32 -void strupr( char *string ){ - int i; - - for ( i = 0 ; i < strlen( string ); i++ ) - toupper( string[i] ); - - return; -} - -#endif //============================================================== /* @@ -1098,7 +1087,7 @@ void FMFinishModel( void ){ for ( i = 0; i < fmheader.num_mesh_nodes; i++ ) { strcpy( name, pmnodes[i].name ); - strupr( name ); + strUpper( name ); length = strlen( name ); for ( j = 0; j < length; j++ ) { diff --git a/tools/quake2/qdata_heretic2/tmix.c b/tools/quake2/qdata_heretic2/tmix.c index 75674a01..696a1fde 100644 --- a/tools/quake2/qdata_heretic2/tmix.c +++ b/tools/quake2/qdata_heretic2/tmix.c @@ -285,11 +285,11 @@ int GetScriptInfo( char *name ){ while ( fgets( buffer, 256, fp ) ) { if ( strncmp( buffer, "//", 2 ) && strncmp( buffer, "\n", 1 ) ) { - strupr( buffer ); + strUpper( buffer ); strcpy( tempbuff, buffer ); if ( strcmp( strtok( tempbuff, delims ), "OUTPUT" ) == 0 ) { strcpy( out.name, strtok( NULL, delims ) ); - strlwr( out.name ); + strLower( out.name ); } strcpy( tempbuff, buffer ); @@ -316,7 +316,7 @@ int GetScriptInfo( char *name ){ strcpy( tempbuff, buffer ); if ( strcmp( strtok( tempbuff, delims ), "OUTSCRIPT" ) == 0 ) { strcpy( outscript, strtok( NULL, delims ) ); - strlwr( outscript ); + strLower( outscript ); } strcpy( tempbuff, buffer );