diff --git a/tools/quake3/common/aselib.c b/tools/quake3/common/aselib.c index 31ef1494..d39b75eb 100644 --- a/tools/quake3/common/aselib.c +++ b/tools/quake3/common/aselib.c @@ -431,14 +431,14 @@ static void ASE_KeyMAP_DIFFUSE( const char *token ){ FixDOSName( bitmap ); /* remove filename from path */ - strclear( path_get_last_separator( filename ) ); + strClear( path_get_last_separator( filename ) ); /* replaces a relative path with a full path */ if ( !strncmp( bitmap, "../", 3 ) ) { while ( !strncmp( bitmap, "../", 3 ) ) { /* remove last item from path */ - strclear( path_get_last_separator( filename ) ); + strClear( path_get_last_separator( filename ) ); memmove( bitmap, &bitmap[3], sizeof( bitmap ) - 3 ); } strcat( filename, "/" ); diff --git a/tools/quake3/common/cmdlib.c b/tools/quake3/common/cmdlib.c index dc89d10b..d8afa0d7 100644 --- a/tools/quake3/common/cmdlib.c +++ b/tools/quake3/common/cmdlib.c @@ -184,7 +184,7 @@ void SetQdirFromPath( const char *path ){ // so we need to add up how much to the next separator sep = c + len; count = 1; - while ( !strempty( sep ) && !path_separator( *sep ) ) + while ( !strEmpty( sep ) && !path_separator( *sep ) ) { sep++; count++; @@ -201,7 +201,7 @@ void SetQdirFromPath( const char *path ){ FixDOSName( gamedir ); Sys_Printf( "gamedir: %s\n", gamedir ); - if ( strempty( writedir ) ) { + if ( strEmpty( writedir ) ) { strcpy( writedir, gamedir ); } else{ @@ -279,7 +279,7 @@ void Q_getwd( char *out ){ #else // Gef: Changed from getwd() to getcwd() to avoid potential buffer overflow if ( !getcwd( out, 256 ) ) { - strclear( out ); + strClear( out ); } #endif path_add_slash( out ); @@ -305,7 +305,7 @@ void Q_mkdir( const char *path ){ if ( errno == ENOENT ) { p = path_get_last_separator( path ); } - if ( !strempty( p ) ) { + if ( !strEmpty( p ) ) { strcpyQ( parentbuf, path, p - path + 1 ); if ( ( p - path ) < (ptrdiff_t) sizeof( parentbuf ) ) { Sys_Printf( "mkdir: %s: creating parent %s first\n", path, parentbuf ); @@ -419,7 +419,7 @@ skipwhite: //http://stackoverflow.com/questions/27303062/strstr-function-like-that-ignores-upper-or-lower-case //chux: Somewhat tricky to match the corner cases of strstr() with inputs like "x","", "","x", "","" -char *stristr( const char* haystack, const char* needle ) { +char *strIstr( const char* haystack, const char* needle ) { do { const char* h = haystack; const char* n = needle; @@ -750,7 +750,7 @@ void path_set_extension( char *path, const char *extension ){ // void DefaultExtension( char *path, const char *extension ){ char* ext = path_get_filename_base_end( path ); - if( strempty( ext ) ) + if( strEmpty( ext ) ) strcpy( ext, extension ); } @@ -765,11 +765,11 @@ void DefaultPath( char *path, const char *basepath ){ void StripFilename( char *path ){ - strclear( path_get_filename_start( path ) ); + strClear( path_get_filename_start( path ) ); } void StripExtension( char *path ){ - strclear( path_get_filename_base_end( path ) ); + strClear( path_get_filename_base_end( path ) ); } diff --git a/tools/quake3/common/cmdlib.h b/tools/quake3/common/cmdlib.h index b3acbc94..f77dbcfe 100644 --- a/tools/quake3/common/cmdlib.h +++ b/tools/quake3/common/cmdlib.h @@ -80,10 +80,10 @@ void *safe_calloc_info( size_t size, const char* info ); extern int myargc; extern char **myargv; -static inline qboolean strempty( const char* string ){ +static inline qboolean strEmpty( const char* string ){ return *string == '\0'; } -static inline void strclear( char* string ){ +static inline void strClear( char* string ){ *string = '\0'; } static inline char *strlower( char *string ){ @@ -95,7 +95,7 @@ static inline char *copystring( const char *src ){ // version of strdup() with s const size_t size = strlen( src ) + 1; return memcpy( safe_malloc( size ), src, size ); } -char* stristr( const char* haystack, const char* needle ); +char* strIstr( const char* haystack, const char* needle ); #ifdef WIN32 #define Q_stricmp stricmp #define Q_strncasecmp strnicmp diff --git a/tools/quake3/common/vfs.c b/tools/quake3/common/vfs.c index 968143b8..bfd43dac 100644 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@ -144,8 +144,8 @@ void vfsInitDirectory( const char *path ){ for ( j = 0; j < g_numForbiddenDirs; ++j ) { char* dbuf = strdup( path ); - if ( !strempty( dbuf ) && path_separator( dbuf[strlen( dbuf ) - 1] ) ) // del trailing slash - strclear( &dbuf[strlen( dbuf ) - 1] ); + if ( !strEmpty( dbuf ) && path_separator( dbuf[strlen( dbuf ) - 1] ) ) // del trailing slash + strClear( &dbuf[strlen( dbuf ) - 1] ); if ( matchpattern( path_get_filename_start( dbuf ), g_strForbiddenDirs[j], TRUE ) ) { free( dbuf ); return; diff --git a/tools/quake3/q3map2/autopk3.c b/tools/quake3/q3map2/autopk3.c index 301bab78..e8c98980 100644 --- a/tools/quake3/q3map2/autopk3.c +++ b/tools/quake3/q3map2/autopk3.c @@ -81,7 +81,7 @@ static inline void tex2list( StrList* texlist, StrList* EXtex, StrList* rEXtex ) //StripExtension( token ); char* dot = path_get_filename_base_end( token ); if( !Q_stricmp( dot, ".tga" ) || !Q_stricmp( dot, ".jpg" ) || !Q_stricmp( dot, ".png" ) ){ //? might want to also warn on png in non png run - strclear( dot ); + strClear( dot ); } else{ Sys_FPrintf( SYS_WRN, "WARNING4: %s : weird or missing extension in shader image path\n", token ); @@ -107,7 +107,7 @@ static inline void res2list( StrList* list, const char* res ){ while ( path_separator( *res ) ){ // kill prepended slashes ++res; } - if ( strempty( res ) ) + if ( strEmpty( res ) ) return; if( !StrList_find( list, res ) ) StrList_append( list, res ); diff --git a/tools/quake3/q3map2/path_init.c b/tools/quake3/q3map2/path_init.c index 120204bf..d28f445d 100644 --- a/tools/quake3/q3map2/path_init.c +++ b/tools/quake3/q3map2/path_init.c @@ -123,7 +123,7 @@ void LokiInitPaths( char *argv0 ){ /* do some path divining */ strcpyQ( temp, argv0, sizeof( temp ) ); - if ( strempty( path_get_last_separator( temp ) ) && path ) { + if ( strEmpty( path_get_last_separator( temp ) ) && path ) { /* This code has a special behavior when q3map2 is a symbolic link. @@ -147,10 +147,10 @@ void LokiInitPaths( char *argv0 ){ last = path; /* go through each : segment of path */ - while ( !strempty( last ) && found == qfalse ) + while ( !strEmpty( last ) && found == qfalse ) { /* null out temp */ - strclear( temp ); + strClear( temp ); /* find next chunk */ last = strchr( path, ':' ); @@ -186,8 +186,8 @@ void LokiInitPaths( char *argv0 ){ if "q3map2" is "/opt/radiant/tools/q3map2", installPath is "/opt/radiant" */ - strclear( path_get_last_separator( installPath ) ); - strclear( path_get_last_separator( installPath ) ); + strClear( path_get_last_separator( installPath ) ); + strClear( path_get_last_separator( installPath ) ); } #endif } @@ -510,12 +510,12 @@ void InitPaths( int *argc, char **argv ){ FixDOSName( temp ); Sys_FPrintf( SYS_VRB, "Searching for \"%s\" in \"%s\" (%d)...\n", game->magic, temp, i ); /* check for the game's magic word */ - char* found = stristr( temp, game->magic ); + char* found = strIstr( temp, game->magic ); if( found ){ /* now find the next slash and nuke everything after it */ found = strchr( found, '/' ); if( found ) - strclear( found ); + strClear( found ); /* add this as a base path */ AddBasePath( temp ); }