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