Converted if ( string == "" ) constructs to if ( string.empty() )
Fixed a warning in soundmgr.cxx.
This commit is contained in:
parent
4d4cd16012
commit
e95429572c
11 changed files with 23 additions and 23 deletions
|
@ -1076,7 +1076,7 @@ FGTextLayer::Chunk::Chunk (const string &text, const string &fmt)
|
|||
: _type(FGTextLayer::TEXT), _fmt(fmt)
|
||||
{
|
||||
_text = text;
|
||||
if (_fmt == "")
|
||||
if (_fmt.empty())
|
||||
_fmt = "%s";
|
||||
}
|
||||
|
||||
|
@ -1084,7 +1084,7 @@ FGTextLayer::Chunk::Chunk (ChunkType type, const SGPropertyNode * node,
|
|||
const string &fmt, float mult)
|
||||
: _type(type), _fmt(fmt), _mult(mult)
|
||||
{
|
||||
if (_fmt == "") {
|
||||
if (_fmt.empty()) {
|
||||
if (type == TEXT_VALUE)
|
||||
_fmt = "%s";
|
||||
else
|
||||
|
|
|
@ -295,7 +295,7 @@ readTransformation (const SGPropertyNode * node, float w_scale, float h_scale)
|
|||
type = "rotation";
|
||||
}
|
||||
|
||||
if (propName != (string)"") {
|
||||
if (!propName.empty()) {
|
||||
target = fgGetNode(propName.c_str(), true);
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ readPanel (const SGPropertyNode * root)
|
|||
// Get multibackground if any...
|
||||
//
|
||||
string mbgTexture = root->getStringValue("multibackground[0]");
|
||||
if (mbgTexture != (string)"") {
|
||||
if (!mbgTexture.empty()) {
|
||||
panel->setMultiBackground(FGTextureManager::createTexture(mbgTexture.c_str()), 0);
|
||||
SG_LOG( SG_COCKPIT, SG_INFO, "Set background texture to " << mbgTexture );
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ void guiErrorMessage (const char *txt, const sg_throwable &throwable)
|
|||
string msg = txt;
|
||||
msg += '\n';
|
||||
msg += throwable.getFormattedMessage();
|
||||
if (throwable.getOrigin() != (string)"") {
|
||||
if (!throwable.getOrigin().empty()) {
|
||||
msg += "\n (reported by ";
|
||||
msg += throwable.getOrigin();
|
||||
msg += ')';
|
||||
|
|
|
@ -110,7 +110,7 @@ FGBinding::read (const SGPropertyNode * node)
|
|||
}
|
||||
|
||||
_command_name = node->getStringValue("command", "");
|
||||
if (_command_name == "") {
|
||||
if (_command_name.empty()) {
|
||||
SG_LOG(SG_INPUT, SG_ALERT, "No command supplied for binding.");
|
||||
_command = 0;
|
||||
return;
|
||||
|
|
|
@ -140,7 +140,7 @@ bool fgInitFGRoot ( int argc, char **argv ) {
|
|||
|
||||
#if defined( unix ) || defined( __CYGWIN__ )
|
||||
// Next check home directory for .fgfsrc.hostname file
|
||||
if ( root == "" ) {
|
||||
if ( root.empty() ) {
|
||||
envp = ::getenv( "HOME" );
|
||||
if ( envp != NULL ) {
|
||||
SGPath config( envp );
|
||||
|
@ -155,7 +155,7 @@ bool fgInitFGRoot ( int argc, char **argv ) {
|
|||
#endif
|
||||
|
||||
// Next check home directory for .fgfsrc file
|
||||
if ( root == "" ) {
|
||||
if ( root.empty() ) {
|
||||
envp = ::getenv( "HOME" );
|
||||
if ( envp != NULL ) {
|
||||
SGPath config( envp );
|
||||
|
@ -165,7 +165,7 @@ bool fgInitFGRoot ( int argc, char **argv ) {
|
|||
}
|
||||
|
||||
// Next check if fg-root is set as an env variable
|
||||
if ( root == "" ) {
|
||||
if ( root.empty() ) {
|
||||
envp = ::getenv( "FG_ROOT" );
|
||||
if ( envp != NULL ) {
|
||||
root = envp;
|
||||
|
@ -174,7 +174,7 @@ bool fgInitFGRoot ( int argc, char **argv ) {
|
|||
|
||||
// Otherwise, default to a random compiled-in location if we can't
|
||||
// find fg-root any other way.
|
||||
if ( root == "" ) {
|
||||
if ( root.empty() ) {
|
||||
#if defined( __CYGWIN__ )
|
||||
root = "/FlightGear";
|
||||
#elif defined( WIN32 )
|
||||
|
|
|
@ -105,7 +105,7 @@ getLoggingClasses ()
|
|||
string result = "";
|
||||
for (int i = 0; log_class_mappings[i].c != SG_UNDEFD; i++) {
|
||||
if ((classes&log_class_mappings[i].c) > 0) {
|
||||
if (result != (string)"")
|
||||
if (!result.empty())
|
||||
result += '|';
|
||||
result += log_class_mappings[i].name;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ setLoggingClasses (const char * c)
|
|||
return;
|
||||
}
|
||||
|
||||
if (classes == "" || classes == "all") { // default
|
||||
if (classes.empty() || classes == "all") { // default
|
||||
logbuf::set_log_classes(SG_ALL);
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Enabled all logging classes: "
|
||||
<< getLoggingClasses());
|
||||
|
@ -200,7 +200,7 @@ setLoggingPriority (const char * p)
|
|||
logbuf::set_log_priority(SG_BULK);
|
||||
} else if (priority == "debug") {
|
||||
logbuf::set_log_priority(SG_DEBUG);
|
||||
} else if (priority == "" || priority == "info") { // default
|
||||
} else if (priority.empty() || priority == "info") { // default
|
||||
logbuf::set_log_priority(SG_INFO);
|
||||
} else if (priority == "warn") {
|
||||
logbuf::set_log_priority(SG_WARN);
|
||||
|
|
|
@ -103,7 +103,7 @@ bool FGFixList::query( const string& ident, double lon, double lat, double elev,
|
|||
FGFix *fix, double *heading, double *dist )
|
||||
{
|
||||
*fix = fixlist[ident];
|
||||
if ( fix->get_ident() == "" ) {
|
||||
if ( fix->get_ident().empty() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ bool FGProps::process_command( const char *cmd ) {
|
|||
}
|
||||
} else if ( command == "pwd" ) {
|
||||
string ttt = node->getPath();
|
||||
if ( ttt == "" ) {
|
||||
if ( ttt.empty() ) {
|
||||
ttt = "/";
|
||||
}
|
||||
ttt += "\n";
|
||||
|
@ -269,7 +269,7 @@ bool FGProps::process_command( const char *cmd ) {
|
|||
|
||||
if ( mode == PROMPT ) {
|
||||
string prompt = node->getPath();
|
||||
if ( prompt == "" ) {
|
||||
if ( prompt.empty() ) {
|
||||
prompt = "/";
|
||||
}
|
||||
prompt += "> ";
|
||||
|
|
|
@ -92,7 +92,7 @@ FGTileLoader::add( FGTileEntry* tile )
|
|||
static bool beenhere = false;
|
||||
if (!beenhere)
|
||||
{
|
||||
if ( globals->get_fg_scenery() != (string)"" ) {
|
||||
if ( !globals->get_fg_scenery().empty() ) {
|
||||
tile_path.set( globals->get_fg_scenery() );
|
||||
} else {
|
||||
tile_path.set( globals->get_fg_root() );
|
||||
|
|
|
@ -53,7 +53,7 @@ FGFX::init()
|
|||
|
||||
string path_str = node->getStringValue("path");
|
||||
SGPath path( globals->get_fg_root() );
|
||||
if (path_str == "") {
|
||||
if (path_str.empty()) {
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "Incorrect path in configuration file.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
|
||||
// constructor
|
||||
FGSimpleSound::FGSimpleSound( string file )
|
||||
: requests(0),
|
||||
: pitch(1.0),
|
||||
volume(1.0),
|
||||
pitch(1.0)
|
||||
requests(0)
|
||||
{
|
||||
SGPath slfile( globals->get_fg_root() );
|
||||
slfile.append( file );
|
||||
|
@ -54,9 +54,9 @@ FGSimpleSound::FGSimpleSound( string file )
|
|||
}
|
||||
|
||||
FGSimpleSound::FGSimpleSound( unsigned char *buffer, int len )
|
||||
: requests(0),
|
||||
: pitch(1.0),
|
||||
volume(1.0),
|
||||
pitch(1.0)
|
||||
requests(0)
|
||||
{
|
||||
sample = new slSample ( buffer, len );
|
||||
pitch_envelope = new slEnvelope( 1, SL_SAMPLE_ONE_SHOT );
|
||||
|
@ -245,7 +245,7 @@ bool FGSoundMgr::add( FGSimpleSound *sound, const string& refname ) {
|
|||
FGSimpleSound *FGSoundMgr::add( const string& refname, const string &file ) {
|
||||
FGSimpleSound *sound;
|
||||
|
||||
if (file == (string)"")
|
||||
if (file.empty())
|
||||
return NULL;
|
||||
|
||||
sample_map_iterator it = samples.find(file);
|
||||
|
|
Loading…
Reference in a new issue