mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: replace COM_CheckString and COM_CheckStringEmpty by COM_StringEmptyOrNULL and COM_StringEmpty
This commit is contained in:
@@ -649,7 +649,7 @@ int Cmd_AddCommandEx( const char *cmd_name, xcommand_t function, const char *cmd
|
||||
convar_t *cvar;
|
||||
cmdalias_t *alias;
|
||||
|
||||
if( !COM_CheckString( cmd_name ))
|
||||
if( COM_StringEmptyOrNULL( cmd_name ))
|
||||
{
|
||||
Con_Reportf( S_ERROR "%s: NULL name\n", funcname );
|
||||
return 0;
|
||||
|
||||
@@ -737,7 +737,7 @@ byte *GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
||||
byte *pfile;
|
||||
fs_offset_t iLength;
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
{
|
||||
if( pLength )
|
||||
*pLength = 0;
|
||||
@@ -773,7 +773,7 @@ COM_SaveFile
|
||||
int GAME_EXPORT COM_SaveFile( const char *filename, const void *data, int len )
|
||||
{
|
||||
// check for empty filename
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
return false;
|
||||
|
||||
// check for null data
|
||||
@@ -894,7 +894,7 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
||||
size_t len;
|
||||
int i;
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
return false;
|
||||
|
||||
ext = COM_FileExtension( filename );
|
||||
@@ -903,7 +903,7 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
||||
// only allow extensionless files that start with !MD5
|
||||
if( !Q_strncmp( filename, "!MD5", 4 ))
|
||||
{
|
||||
if( COM_CheckStringEmpty( ext ))
|
||||
if( !COM_StringEmpty( ext ))
|
||||
return false;
|
||||
|
||||
len = Q_strlen( filename );
|
||||
|
||||
@@ -679,7 +679,7 @@ static qboolean Cmd_GetCommandsAndCvarsList( const char *s, char *completedname,
|
||||
while( *list.completionString && (*list.completionString == '\\' || *list.completionString == '/') )
|
||||
list.completionString++;
|
||||
|
||||
if( !COM_CheckStringEmpty( list.completionString ) )
|
||||
if( COM_StringEmpty( list.completionString ) )
|
||||
return false;
|
||||
|
||||
// find matching commands and variables
|
||||
@@ -949,7 +949,7 @@ static qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
||||
|
||||
buffersize = t->numfilenames * 2 * sizeof( result );
|
||||
buffer = Mem_Calloc( host.mempool, buffersize );
|
||||
use_filter = COM_CheckStringEmpty( GI->mp_filter ) ? true : false;
|
||||
use_filter = !COM_StringEmpty( GI->mp_filter );
|
||||
|
||||
for( i = 0; i < t->numfilenames; i++ )
|
||||
{
|
||||
@@ -1165,7 +1165,8 @@ static void Con_PrintCmdMatches( const char *s, const char *unused1, const char
|
||||
{
|
||||
if( !Q_strnicmp( s, con.shortestMatch, Q_strlen( con.shortestMatch ) ) )
|
||||
{
|
||||
if( COM_CheckString( m ) ) Con_Printf( " %s ^3\"%s\"\n", s, m );
|
||||
if( !COM_StringEmptyOrNULL( m ) )
|
||||
Con_Printf( " %s ^3\"%s\"\n", s, m );
|
||||
else Con_Printf( " %s\n", s ); // variable or command without description
|
||||
}
|
||||
}
|
||||
@@ -1179,7 +1180,8 @@ static void Con_PrintCvarMatches( const char *s, const char *value, const char *
|
||||
{
|
||||
if( !Q_strnicmp( s, con.shortestMatch, Q_strlen( con.shortestMatch ) ) )
|
||||
{
|
||||
if( COM_CheckString( m ) ) Con_Printf( " %s (%s) ^3\"%s\"\n", s, value, m );
|
||||
if( !COM_StringEmptyOrNULL( m ))
|
||||
Con_Printf( " %s (%s) ^3\"%s\"\n", s, value, m );
|
||||
else Con_Printf( " %s (%s)\n", s, value ); // variable or command without description
|
||||
}
|
||||
}
|
||||
@@ -1251,7 +1253,7 @@ void Con_CompleteCommand( field_t *field, qboolean print_suggestions )
|
||||
while( *con.completionString && (*con.completionString == '\\' || *con.completionString == '/') )
|
||||
con.completionString++;
|
||||
|
||||
if( !COM_CheckStringEmpty( con.completionString ) )
|
||||
if( COM_StringEmpty( con.completionString ) )
|
||||
return;
|
||||
|
||||
// free the old autocomplete list
|
||||
@@ -1284,7 +1286,7 @@ void Con_CompleteCommand( field_t *field, qboolean print_suggestions )
|
||||
while( *con.completionBuffer && (*con.completionBuffer == '\\' || *con.completionBuffer == '/') )
|
||||
con.completionBuffer++;
|
||||
|
||||
if( !COM_CheckStringEmpty( con.completionBuffer ) )
|
||||
if( COM_StringEmpty( con.completionBuffer ) )
|
||||
return;
|
||||
|
||||
if( Cmd_AutocompleteName( con.completionBuffer, Cmd_Argc() - 1, filename, sizeof( filename ), print_suggestions ))
|
||||
@@ -1408,7 +1410,7 @@ with the archive flag set to true.
|
||||
*/
|
||||
static void Cmd_WriteOpenGLCvar( const char *name, const char *string, const char *desc, void *f )
|
||||
{
|
||||
if( !COM_CheckString( desc ))
|
||||
if( COM_StringEmptyOrNULL( desc ))
|
||||
return; // ignore cvars without description (fantom variables)
|
||||
FS_Printf( f, "%s \"%s\"\n", name, string );
|
||||
}
|
||||
@@ -1417,7 +1419,7 @@ static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc
|
||||
{
|
||||
int length;
|
||||
|
||||
if( !COM_CheckString( desc ))
|
||||
if( COM_StringEmptyOrNULL( desc ))
|
||||
return; // ignore fantom cmds
|
||||
|
||||
if( name[0] == '+' || name[0] == '-' )
|
||||
|
||||
@@ -220,7 +220,7 @@ static const char *Cvar_ValidateString( convar_t *var, const char *value )
|
||||
pszValue = szNew;
|
||||
|
||||
// g-cont. is this even need?
|
||||
if( !COM_CheckStringEmpty( szNew ) ) Q_strncpy( szNew, "empty", sizeof( szNew ));
|
||||
if( COM_StringEmpty( szNew ) ) Q_strncpy( szNew, "empty", sizeof( szNew ));
|
||||
}
|
||||
|
||||
if( FBitSet( var->flags, FCVAR_NOEXTRAWHITESPACE ))
|
||||
@@ -418,7 +418,7 @@ convar_t *Cvar_Get( const char *name, const char *value, uint32_t flags, const c
|
||||
// which executed from the config file. So we don't need to
|
||||
// change value here: we *already* have actual value from config.
|
||||
// in other cases we need to rewrite them
|
||||
if( COM_CheckStringEmpty( var->desc ))
|
||||
if( !COM_StringEmpty( var->desc ))
|
||||
{
|
||||
// directly set value
|
||||
size_t len = Q_strlen( value ) + 1;
|
||||
|
||||
@@ -258,7 +258,7 @@ static qboolean FS_DetermineRootDirectory( char *out, size_t size )
|
||||
{
|
||||
const char *path = getenv( "XASH3D_BASEDIR" );
|
||||
|
||||
if( COM_CheckString( path ))
|
||||
if( !COM_StringEmptyOrNULL( path ))
|
||||
{
|
||||
Q_strncpy( out, path, size );
|
||||
return true;
|
||||
@@ -314,7 +314,7 @@ static qboolean FS_DetermineReadOnlyRootDirectory( char *out, size_t size )
|
||||
if( _Sys_GetParmFromCmdLine( "-rodir", out, size ))
|
||||
return true;
|
||||
|
||||
if( COM_CheckString( env_rodir ))
|
||||
if( !COM_StringEmptyOrNULL( env_rodir ))
|
||||
{
|
||||
Q_strncpy( out, env_rodir, size );
|
||||
return true;
|
||||
@@ -334,7 +334,7 @@ void FS_Init( const char *basedir )
|
||||
char rodir[MAX_OSPATH], rootdir[MAX_OSPATH];
|
||||
rodir[0] = rootdir[0] = 0;
|
||||
|
||||
if( !FS_DetermineRootDirectory( rootdir, sizeof( rootdir )) || !COM_CheckStringEmpty( rootdir ))
|
||||
if( !FS_DetermineRootDirectory( rootdir, sizeof( rootdir )) || COM_StringEmpty( rootdir ))
|
||||
{
|
||||
Sys_Error( "couldn't determine current directory (empty string)" );
|
||||
return;
|
||||
|
||||
@@ -560,7 +560,7 @@ static qboolean Host_RegisterDecal( const char *name, int *count )
|
||||
char shortname[MAX_QPATH];
|
||||
int i;
|
||||
|
||||
if( !COM_CheckString( name ))
|
||||
if( COM_StringEmptyOrNULL( name ))
|
||||
return 0;
|
||||
|
||||
COM_FileBase( name, shortname, sizeof( shortname ));
|
||||
@@ -957,7 +957,7 @@ static int Host_CheckBugcomp_splitstr_handler( char *prev, char *next, void *use
|
||||
|
||||
*next = '\0';
|
||||
|
||||
if( !COM_CheckStringEmpty( prev ))
|
||||
if( COM_StringEmpty( prev ))
|
||||
return 0;
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( bugcomp_features ); i++ )
|
||||
|
||||
@@ -117,7 +117,7 @@ void COM_ChangeLevel( char const *pNewLevel, char const *pLandmarkName, qboolean
|
||||
Q_strncpy( GameState->levelName, pNewLevel, sizeof( GameState->levelName ));
|
||||
GameState->backgroundMap = background;
|
||||
|
||||
if( COM_CheckString( pLandmarkName ))
|
||||
if( !COM_StringEmptyOrNULL( pLandmarkName ))
|
||||
{
|
||||
Q_strncpy( GameState->landmarkName, pLandmarkName, sizeof( GameState->landmarkName ));
|
||||
GameState->loadGame = true;
|
||||
|
||||
@@ -106,7 +106,7 @@ static void HPAK_CreatePak( const char *filename, resource_t *pResource, byte *p
|
||||
file_t *fout;
|
||||
MD5Context_t ctx = { 0 };
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
return;
|
||||
|
||||
if(( fin != NULL && pData != NULL ) || ( fin == NULL && pData == NULL ))
|
||||
@@ -393,7 +393,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet, qboolean de
|
||||
if( quiet ) HPAK_FlushHostQueue();
|
||||
|
||||
// not an error - just flush queue
|
||||
if( !COM_CheckString( filename ) )
|
||||
if( COM_StringEmptyOrNULL( filename ) )
|
||||
return true;
|
||||
|
||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||
@@ -496,7 +496,7 @@ void HPAK_CheckIntegrity( const char *filename )
|
||||
{
|
||||
string pakname;
|
||||
|
||||
if( !COM_CheckString( filename ) )
|
||||
if( COM_StringEmptyOrNULL( filename ) )
|
||||
return;
|
||||
|
||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||
@@ -513,7 +513,7 @@ void HPAK_CheckSize( const char *filename )
|
||||
maxsize = hpk_maxsize.value;
|
||||
if( maxsize <= 0 ) return;
|
||||
|
||||
if( !COM_CheckString( filename ) )
|
||||
if( COM_StringEmptyOrNULL( filename ) )
|
||||
return;
|
||||
|
||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||
@@ -536,7 +536,7 @@ qboolean HPAK_ResourceForHash( const char *filename, byte *hash, resource_t *pRe
|
||||
file_t *f;
|
||||
hash_pack_queue_t *p;
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
return false;
|
||||
|
||||
for( p = gp_hpak_queue; p != NULL; p = p->next )
|
||||
@@ -594,7 +594,7 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
|
||||
string pakname;
|
||||
file_t *f;
|
||||
|
||||
if( !COM_CheckString( filename ) )
|
||||
if( COM_StringEmptyOrNULL( filename ) )
|
||||
return false;
|
||||
|
||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||
@@ -659,7 +659,7 @@ qboolean HPAK_GetDataPointer( const char *filename, resource_t *pResource, byte
|
||||
file_t *f;
|
||||
int i;
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
return false;
|
||||
|
||||
if( buffer ) *buffer = NULL;
|
||||
@@ -761,7 +761,7 @@ void HPAK_RemoveLump( const char *name, resource_t *pResource )
|
||||
hpak_info_t hpak_save;
|
||||
int i, j;
|
||||
|
||||
if( !COM_CheckString( name ) || !pResource )
|
||||
if( COM_StringEmptyOrNULL( name ) || !pResource )
|
||||
return;
|
||||
|
||||
HPAK_FlushHostQueue();
|
||||
|
||||
@@ -324,7 +324,7 @@ static int HTTP_FileConnect( httpfile_t *file )
|
||||
|
||||
file->blocktime = 0;
|
||||
|
||||
if( !COM_CheckStringEmpty( http_useragent.string ) || !Q_strcmp( http_useragent.string, "xash3d" ))
|
||||
if( COM_StringEmpty( http_useragent.string ) || !Q_strcmp( http_useragent.string, "xash3d" ))
|
||||
{
|
||||
Q_snprintf( useragent, sizeof( useragent ), "%s/%s (%s-%s; build %d; %s)",
|
||||
XASH_ENGINE_NAME, XASH_VERSION, Q_buildos( ), Q_buildarch( ), Q_buildnum( ), g_buildcommit );
|
||||
|
||||
@@ -268,7 +268,7 @@ static const loadpixformat_t *Image_GetLoadFormatForExtension( const char *ext )
|
||||
{
|
||||
const loadpixformat_t *format;
|
||||
|
||||
if( !COM_CheckStringEmpty( ext ))
|
||||
if( COM_StringEmpty( ext ))
|
||||
return NULL;
|
||||
|
||||
for( format = image.loadformats; format->ext; format++ )
|
||||
@@ -503,7 +503,7 @@ writes image as any known format
|
||||
qboolean FS_SaveImage( const char *filename, rgbdata_t *pix )
|
||||
{
|
||||
const char *ext = COM_FileExtension( filename );
|
||||
qboolean anyformat = !COM_CheckStringEmpty( ext );
|
||||
qboolean anyformat = COM_StringEmpty( ext );
|
||||
string path, savename;
|
||||
const savepixformat_t *format;
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ qboolean Info_IsValid( const char *s )
|
||||
}
|
||||
*o = 0;
|
||||
|
||||
if( !COM_CheckStringEmpty( value ) )
|
||||
if( COM_StringEmpty( value ) )
|
||||
return false;
|
||||
|
||||
if( *s ) s++;
|
||||
@@ -439,7 +439,7 @@ qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, i
|
||||
|
||||
Info_RemoveKey( s, key );
|
||||
|
||||
if( !COM_CheckString( value ) )
|
||||
if( COM_StringEmptyOrNULL( value ) )
|
||||
return true; // just clear variable
|
||||
|
||||
Q_snprintf( new, sizeof( new ), "\\%s\\%s", key, value );
|
||||
|
||||
@@ -215,7 +215,7 @@ void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t si
|
||||
switch( eLibType )
|
||||
{
|
||||
case LIBRARY_GAMEUI:
|
||||
if( COM_CheckStringEmpty( host.menulib ))
|
||||
if( !COM_StringEmpty( host.menulib ))
|
||||
{
|
||||
if( host.menulib[0] == '@' )
|
||||
COM_GenerateClientLibraryPath( host.menulib + 1, out, size );
|
||||
@@ -224,7 +224,7 @@ void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t si
|
||||
else COM_GenerateClientLibraryPath( "menu", out, size );
|
||||
break;
|
||||
case LIBRARY_CLIENT:
|
||||
if( COM_CheckStringEmpty( host.clientlib ))
|
||||
if( !COM_StringEmpty( host.clientlib ))
|
||||
{
|
||||
if( host.clientlib[0] == '@' )
|
||||
COM_GenerateClientLibraryPath( host.clientlib + 1, out, size );
|
||||
@@ -233,7 +233,7 @@ void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t si
|
||||
else COM_GenerateClientLibraryPath( "client", out, size );
|
||||
break;
|
||||
case LIBRARY_SERVER:
|
||||
if( COM_CheckStringEmpty( host.gamedll ))
|
||||
if( !COM_StringEmpty( host.gamedll ))
|
||||
{
|
||||
if( host.gamedll[0] == '@' )
|
||||
COM_GenerateServerLibraryPath( host.gamedll + 1, out, size );
|
||||
|
||||
@@ -453,7 +453,7 @@ static int Mod_LoadTextureFromWadList( wadlist_t *list, const char *name, rgbdat
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !list || !COM_CheckString( name ))
|
||||
if( !list || COM_StringEmptyOrNULL( name ))
|
||||
return -1;
|
||||
|
||||
// check wads in reverse order
|
||||
@@ -1156,7 +1156,7 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
|
||||
qboolean model_found;
|
||||
qboolean origin_found;
|
||||
|
||||
if( !entities || !COM_CheckString( modelname ))
|
||||
if( !entities || COM_StringEmptyOrNULL( modelname ))
|
||||
return;
|
||||
|
||||
if( !origin || !VectorIsNull( origin ))
|
||||
@@ -2117,7 +2117,7 @@ static int Mod_LoadEntities_splitstr_handler( char *prev, char *next, void *user
|
||||
|
||||
*next = '\0';
|
||||
|
||||
if( !COM_CheckStringEmpty( prev ))
|
||||
if( COM_StringEmpty( prev ))
|
||||
return 0;
|
||||
|
||||
COM_FixSlashes( prev );
|
||||
@@ -3918,7 +3918,7 @@ static qboolean Mod_LoadBmodelLumps( model_t *mod, byte *mod_base, size_t buffer
|
||||
}
|
||||
}
|
||||
|
||||
if( COM_CheckString( wadvalue ))
|
||||
if( !COM_StringEmptyOrNULL( wadvalue ))
|
||||
{
|
||||
wadvalue[Q_strlen( wadvalue ) - 2] = '\0'; // kill the last semicolon
|
||||
Con_Reportf( "Wad files required to run the map: \"%s\"\n", wadvalue );
|
||||
|
||||
@@ -431,7 +431,7 @@ model_t *Mod_ForName( const char *name, qboolean crash, qboolean trackCRC )
|
||||
{
|
||||
model_t *mod;
|
||||
|
||||
if( !COM_CheckString( name ))
|
||||
if( COM_StringEmptyOrNULL( name ))
|
||||
return NULL;
|
||||
|
||||
mod = Mod_FindName( name, trackCRC );
|
||||
@@ -575,7 +575,7 @@ void Mod_LoadCacheFile( const char *filename, cache_user_t *cu )
|
||||
|
||||
Assert( cu != NULL );
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
return;
|
||||
|
||||
Q_strncpy( modname, filename, sizeof( modname ));
|
||||
|
||||
@@ -1224,7 +1224,7 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
|
||||
uncompressedSize = MSG_ReadLong( msg );
|
||||
}
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
{
|
||||
Con_Printf( S_ERROR "file fragment received with no filename\nFlushing input queue\n" );
|
||||
Netchan_FlushIncoming( chan, FRAG_FILE_STREAM );
|
||||
@@ -1448,7 +1448,7 @@ void Netchan_UpdateProgress( netchan_t *chan )
|
||||
}
|
||||
*out = '\0';
|
||||
|
||||
if( COM_CheckStringEmpty( sz ) && sz[0] != '!' )
|
||||
if( !COM_StringEmpty( sz ) && sz[0] != '!' )
|
||||
Q_strncpy( host.downloadfile, sz, sizeof( host.downloadfile ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ static delta_info_t *Delta_FindStruct( const char *name )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !COM_CheckString( name ))
|
||||
if( COM_StringEmptyOrNULL( name ))
|
||||
return NULL;
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( dt_info ); i++ )
|
||||
@@ -466,7 +466,7 @@ static delta_info_t *Delta_FindStructByEncoder( const char *encoderName )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( !COM_CheckString( encoderName ) )
|
||||
if( COM_StringEmptyOrNULL( encoderName ) )
|
||||
return NULL;
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( dt_info ); i++ )
|
||||
@@ -596,7 +596,7 @@ static void Delta_WriteTableField( sizebuf_t *msg, int tableIndex, const delta_t
|
||||
|
||||
Assert( pField != NULL );
|
||||
|
||||
if( !COM_CheckString( pField->name ))
|
||||
if( COM_StringEmptyOrNULL( pField->name ))
|
||||
return;// not initialized ?
|
||||
|
||||
dt = Delta_FindStructByIndex( tableIndex );
|
||||
|
||||
@@ -507,7 +507,7 @@ qboolean NET_StringToFilterAdr( const char *s, netadr_t *adr, uint *prefixlen )
|
||||
byte ip6[16];
|
||||
uint len;
|
||||
|
||||
if( !COM_CheckStringEmpty( s ))
|
||||
if( COM_StringEmpty( s ))
|
||||
return false;
|
||||
|
||||
memset( adr, 0, sizeof( *adr ));
|
||||
@@ -1631,7 +1631,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family )
|
||||
Con_DPrintf( S_WARN "%s: port %d setsockopt IPV6_MULTICAST_LOOP: %s\n", __func__, port, NET_ErrorString( ));
|
||||
}
|
||||
|
||||
if( COM_CheckStringEmpty( net_iface ) && Q_stricmp( net_iface, "localhost" ))
|
||||
if( !COM_StringEmpty( net_iface ) && Q_stricmp( net_iface, "localhost" ))
|
||||
NET_StringToSockaddr( net_iface, &addr, false, AF_INET6 );
|
||||
else ((struct sockaddr_in6 *)&addr)->sin6_addr = in6addr_any;
|
||||
|
||||
@@ -1668,7 +1668,7 @@ static int NET_IPSocket( const char *net_iface, int port, int family )
|
||||
Con_DPrintf( S_WARN "%s: port %d setsockopt IP_MULTICAST_LOOP: %s\n", __func__, port, NET_ErrorString( ));
|
||||
}
|
||||
|
||||
if( COM_CheckStringEmpty( net_iface ) && Q_stricmp( net_iface, "localhost" ))
|
||||
if( !COM_StringEmpty( net_iface ) && Q_stricmp( net_iface, "localhost" ))
|
||||
NET_StringToSockaddr( net_iface, &addr, false, AF_INET );
|
||||
else ((struct sockaddr_in *)&addr)->sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
|
||||
@@ -447,7 +447,7 @@ qboolean Sound_Process( wavdata_t **wav, int rate, int width, int channels, uint
|
||||
qboolean Sound_SupportedFileFormat( const char *fileext )
|
||||
{
|
||||
const loadwavfmt_t *format;
|
||||
if( COM_CheckStringEmpty( fileext ))
|
||||
if( !COM_StringEmpty( fileext ))
|
||||
{
|
||||
for( format = sound.loadformats; format && format->ext; format++ )
|
||||
{
|
||||
|
||||
@@ -130,7 +130,7 @@ static qboolean SoundList_ParseGroup( soundlst_t *lst, char **file )
|
||||
Con_Printf( "%s: expected '}' but got '{' during group list parse\n", __func__ );
|
||||
return false;
|
||||
}
|
||||
else if( !COM_CheckStringEmpty( token ))
|
||||
else if( COM_StringEmpty( token ))
|
||||
{
|
||||
Con_Printf( "%s: expected '}' but got EOF during group list parse\n", __func__ );
|
||||
return false;
|
||||
|
||||
@@ -151,14 +151,14 @@ const char *Sys_GetCurrentUser( void )
|
||||
#elif XASH_PSVITA
|
||||
static string username;
|
||||
sceAppUtilSystemParamGetString( SCE_SYSTEM_PARAM_ID_USERNAME, username, sizeof( username ) - 1 );
|
||||
if( COM_CheckStringEmpty( username ))
|
||||
if( !COM_StringEmpty( username ))
|
||||
return username;
|
||||
#elif XASH_POSIX && !XASH_ANDROID && !XASH_NSWITCH
|
||||
static string username;
|
||||
struct passwd *pw = getpwuid( geteuid( ));
|
||||
|
||||
// POSIX standard says pw _might_ point to static area, so let's make a copy
|
||||
if( pw && COM_CheckString( pw->pw_name ))
|
||||
if( pw && !COM_StringEmptyOrNULL( pw->pw_name ))
|
||||
{
|
||||
Q_strncpy( username, pw->pw_name, sizeof( username ));
|
||||
return username;
|
||||
@@ -643,7 +643,7 @@ void *Sys_GetNativeObject( const char *obj )
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if( !COM_CheckString( obj ))
|
||||
if( COM_StringEmptyOrNULL( obj ))
|
||||
return NULL;
|
||||
|
||||
ptr = FS_GetNativeObject( obj );
|
||||
|
||||
@@ -140,7 +140,7 @@ static const char *Mem_CheckFilename( const char *filename )
|
||||
{
|
||||
static const char *dummy = "<corrupted>\0";
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
if( COM_StringEmptyOrNULL( filename ))
|
||||
return dummy;
|
||||
|
||||
if( memchr( filename, '\0', MAX_OSPATH ) != NULL )
|
||||
|
||||
Reference in New Issue
Block a user