wrap strncmp use

This commit is contained in:
Garux 2020-01-24 02:47:33 +03:00
parent 9048028faa
commit 234b0cf1d4
6 changed files with 13 additions and 13 deletions

View File

@ -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 ) );

View File

@ -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 );
}

View File

@ -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;

View File

@ -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 ] );

View File

@ -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 );

View File

@ -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 )