wrap strncmp use
This commit is contained in:
parent
9048028faa
commit
234b0cf1d4
|
|
@ -418,8 +418,8 @@ static void ASE_KeyMAP_DIFFUSE( const char *token ){
|
||||||
strClear( path_get_last_separator( filename ) );
|
strClear( path_get_last_separator( filename ) );
|
||||||
|
|
||||||
/* replaces a relative path with a full path */
|
/* replaces a relative path with a full path */
|
||||||
if ( !strncmp( bitmap, "../", 3 ) ) {
|
if ( strEqualPrefix( bitmap, "../" ) ) {
|
||||||
while ( !strncmp( bitmap, "../", 3 ) )
|
while ( strEqualPrefix( bitmap, "../" ) )
|
||||||
{
|
{
|
||||||
/* remove last item from path */
|
/* remove last item from path */
|
||||||
strClear( path_get_last_separator( filename ) );
|
strClear( path_get_last_separator( filename ) );
|
||||||
|
|
|
||||||
|
|
@ -1308,7 +1308,7 @@ void Cmd_Cd( void ){
|
||||||
if ( !g_only[0] ) {
|
if ( !g_only[0] ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( strncmp( token, g_only, strlen( g_only ) ) ) {
|
if ( !strEqualPrefix( token, g_only ) ) {
|
||||||
g_skipmodel = true;
|
g_skipmodel = true;
|
||||||
printf( "skipping %s\n", token );
|
printf( "skipping %s\n", token );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ void FindNextChunk( char *name ){
|
||||||
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
|
// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
|
||||||
data_p -= 8;
|
data_p -= 8;
|
||||||
last_chunk = data_p + 8 + ( ( iff_chunk_len + 1 ) & ~1 );
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -155,7 +155,7 @@ wavinfo_t GetWavinfo( char *name, byte *wav, int wavlength ){
|
||||||
|
|
||||||
// find "RIFF" chunk
|
// find "RIFF" chunk
|
||||||
FindChunk( "RIFF" );
|
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" );
|
printf( "Missing RIFF/WAVE chunks\n" );
|
||||||
return info;
|
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
|
// if the next chunk is a LIST chunk, look for a cue length marker
|
||||||
FindNextChunk( "LIST" );
|
FindNextChunk( "LIST" );
|
||||||
if ( data_p ) {
|
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;
|
data_p += 24;
|
||||||
i = GetLittleLong(); // samples in loop
|
i = GetLittleLong(); // samples in loop
|
||||||
info.samples = info.loopstart + i;
|
info.samples = info.loopstart + i;
|
||||||
|
|
|
||||||
|
|
@ -462,13 +462,13 @@ int ScaleBSPMain( int argc, char **argv ){
|
||||||
/* scale origin */
|
/* scale origin */
|
||||||
GetVectorForKey( &entities[ i ], "origin", vec );
|
GetVectorForKey( &entities[ i ], "origin", vec );
|
||||||
if ( ( vec[ 0 ] || vec[ 1 ] || vec[ 2 ] ) ) {
|
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[2] += spawn_ref;
|
||||||
}
|
}
|
||||||
vec[0] *= scale[0];
|
vec[0] *= scale[0];
|
||||||
vec[1] *= scale[1];
|
vec[1] *= scale[1];
|
||||||
vec[2] *= scale[2];
|
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;
|
vec[2] -= spawn_ref;
|
||||||
}
|
}
|
||||||
sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] );
|
sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] );
|
||||||
|
|
@ -702,13 +702,13 @@ int ShiftBSPMain( int argc, char **argv ){
|
||||||
/* shift origin */
|
/* shift origin */
|
||||||
GetVectorForKey( &entities[ i ], "origin", vec );
|
GetVectorForKey( &entities[ i ], "origin", vec );
|
||||||
if ( ( vec[ 0 ] || vec[ 1 ] || vec[ 2 ] ) ) {
|
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[2] += spawn_ref;
|
||||||
}
|
}
|
||||||
vec[0] += scale[0];
|
vec[0] += scale[0];
|
||||||
vec[1] += scale[1];
|
vec[1] += scale[1];
|
||||||
vec[2] += scale[2];
|
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;
|
vec[2] -= spawn_ref;
|
||||||
}
|
}
|
||||||
sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] );
|
sprintf( str, "%f %f %f", vec[ 0 ], vec[ 1 ], vec[ 2 ] );
|
||||||
|
|
|
||||||
|
|
@ -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);
|
// 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
|
else
|
||||||
{
|
{
|
||||||
//vec3_t vecs[ 2 ];
|
//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, "noshader" ) ) {
|
||||||
if ( !strEqual( buildSide->shaderInfo->shader, "default" ) ) {
|
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 );
|
//fprintf( stderr, "no matching triangle for brushside using %s (hopefully nobody can see this side anyway)\n", buildSide->shaderInfo->shader );
|
||||||
|
|
|
||||||
|
|
@ -438,7 +438,7 @@ void MergeRelativePath( char *out, const char *absolute, const char *relative ){
|
||||||
const char *endpos = absolute + strlen( absolute );
|
const char *endpos = absolute + strlen( absolute );
|
||||||
while ( endpos != absolute && path_separator( endpos[-1] ) )
|
while ( endpos != absolute && path_separator( endpos[-1] ) )
|
||||||
--endpos;
|
--endpos;
|
||||||
while ( !strncmp( relative, "../", 3 ) || !strncmp( relative, "..\\", 3 ) )
|
while ( strEqualPrefix( relative, "../" ) || strEqualPrefix( relative, "..\\" ) )
|
||||||
{
|
{
|
||||||
relative += 3;
|
relative += 3;
|
||||||
while ( endpos != absolute )
|
while ( endpos != absolute )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user