diff --git a/tools/quake3/common/aselib.c b/tools/quake3/common/aselib.c index 6cb63d69..d9cf6b41 100644 --- a/tools/quake3/common/aselib.c +++ b/tools/quake3/common/aselib.c @@ -418,8 +418,8 @@ static void ASE_KeyMAP_DIFFUSE( const char *token ){ strClear( path_get_last_separator( filename ) ); /* replaces a relative path with a full path */ - if ( !strncmp( bitmap, "../", 3 ) ) { - while ( !strncmp( bitmap, "../", 3 ) ) + if ( strEqualPrefix( bitmap, "../" ) ) { + while ( strEqualPrefix( bitmap, "../" ) ) { /* remove last item from path */ strClear( path_get_last_separator( filename ) ); diff --git a/tools/quake3/q3data/models.c b/tools/quake3/q3data/models.c index a91203b0..533379bd 100644 --- a/tools/quake3/q3data/models.c +++ b/tools/quake3/q3data/models.c @@ -1308,7 +1308,7 @@ void Cmd_Cd( void ){ if ( !g_only[0] ) { return; } - if ( strncmp( token, g_only, strlen( g_only ) ) ) { + if ( !strEqualPrefix( token, g_only ) ) { g_skipmodel = true; printf( "skipping %s\n", token ); } diff --git a/tools/quake3/q3data/video.c b/tools/quake3/q3data/video.c index b548804c..dcb34323 100644 --- a/tools/quake3/q3data/video.c +++ b/tools/quake3/q3data/video.c @@ -106,7 +106,7 @@ void FindNextChunk( char *name ){ // Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len); data_p -= 8; last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 ); - if ( !strncmp( (const char*)data_p, name, 4 ) ) { + if ( strEqualPrefix( (const char*)data_p, name ) ) { return; } } @@ -155,7 +155,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){ // find "RIFF" chunk FindChunk( "RIFF" ); - if ( !( data_p && !strncmp( (const char*)( data_p + 8 ), "WAVE", 4 ) ) ) { + if ( !( data_p && strEqualPrefix( (const char*)( data_p + 8 ), "WAVE" ) ) ) { printf( "Missing RIFF/WAVE chunks\n" ); return info; } @@ -191,7 +191,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){ // if the next chunk is a LIST chunk, look for a cue length marker FindNextChunk( "LIST" ); if ( data_p ) { - if ( !strncmp( (const char*)( data_p + 28 ), "mark", 4 ) ) { // this is not a proper parse, but it works with cooledit... + if ( strEqualPrefix( (const char*)( data_p + 28 ), "mark" ) ) { // this is not a proper parse, but it works with cooledit... data_p += 24; i = GetLittleLong(); // samples in loop info.samples = info.loopstart + i; diff --git a/tools/quake3/q3map2/convert_bsp.c b/tools/quake3/q3map2/convert_bsp.c index 9ab65048..33c39a8c 100644 --- a/tools/quake3/q3map2/convert_bsp.c +++ b/tools/quake3/q3map2/convert_bsp.c @@ -462,13 +462,13 @@ int ScaleBSPMain( int argc, char **argv ){ /* scale origin */ GetVectorForKey( &entities[ i ], "origin", vec ); if ( ( vec[ 0 ] || vec[ 1 ] || vec[ 2 ] ) ) { - if ( !strncmp( ValueForKey( &entities[i], "classname" ), "info_player_", 12 ) ) { + if ( striEqualPrefix( ValueForKey( &entities[i], "classname" ), "info_player_" ) ) { vec[2] += spawn_ref; } vec[0] *= scale[0]; vec[1] *= scale[1]; vec[2] *= scale[2]; - if ( !strncmp( ValueForKey( &entities[i], "classname" ), "info_player_", 12 ) ) { + if ( striEqualPrefix( ValueForKey( &entities[i], "classname" ), "info_player_" ) ) { vec[2] -= spawn_ref; } sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] ); @@ -702,13 +702,13 @@ int ShiftBSPMain( int argc, char **argv ){ /* shift origin */ GetVectorForKey( &entities[ i ], "origin", vec ); if ( ( vec[ 0 ] || vec[ 1 ] || vec[ 2 ] ) ) { - if ( !strncmp( ValueForKey( &entities[i], "classname" ), "info_player_", 12 ) ) { + if ( striEqualPrefix( ValueForKey( &entities[i], "classname" ), "info_player_" ) ) { vec[2] += spawn_ref; } vec[0] += scale[0]; vec[1] += scale[1]; vec[2] += scale[2]; - if ( !strncmp( ValueForKey( &entities[i], "classname" ), "info_player_", 12 ) ) { + if ( striEqualPrefix( ValueForKey( &entities[i], "classname" ), "info_player_" ) ) { vec[2] -= spawn_ref; } sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] ); diff --git a/tools/quake3/q3map2/convert_map.c b/tools/quake3/q3map2/convert_map.c index 8e734155..d3dc56d4 100644 --- a/tools/quake3/q3map2/convert_map.c +++ b/tools/quake3/q3map2/convert_map.c @@ -156,7 +156,7 @@ exwinding: ; } } - //if(strncmp(buildSide->shaderInfo->shader, "textures/common/", 16)) + //if(!striEqualPrefix(buildSide->shaderInfo->shader, "textures/common/")) // fprintf(stderr, "brushside with %s: %d matches (%f area)\n", buildSide->shaderInfo->shader, matches, best); } @@ -713,7 +713,7 @@ static void ConvertBrush( FILE *f, int num, bspBrush_t *brush, vec3_t origin, bo else { //vec3_t vecs[ 2 ]; - if ( strncmp( buildSide->shaderInfo->shader, "textures/common/", 16 ) ) { + if ( !striEqualPrefix( buildSide->shaderInfo->shader, "textures/common/" ) ) { if ( !strEqual( buildSide->shaderInfo->shader, "noshader" ) ) { if ( !strEqual( buildSide->shaderInfo->shader, "default" ) ) { //fprintf( stderr, "no matching triangle for brushside using %s (hopefully nobody can see this side anyway)\n", buildSide->shaderInfo->shader ); diff --git a/tools/quake3/q3map2/minimap.c b/tools/quake3/q3map2/minimap.c index 444026ae..b039e3fb 100644 --- a/tools/quake3/q3map2/minimap.c +++ b/tools/quake3/q3map2/minimap.c @@ -438,7 +438,7 @@ void MergeRelativePath( char *out, const char *absolute, const char *relative ){ const char *endpos = absolute + strlen( absolute ); while ( endpos != absolute && path_separator( endpos[-1] ) ) --endpos; - while ( !strncmp( relative, "../", 3 ) || !strncmp( relative, "..\\", 3 ) ) + while ( strEqualPrefix( relative, "../" ) || strEqualPrefix( relative, "..\\" ) ) { relative += 3; while ( endpos != absolute )