]> git.mxchange.org Git - flightgear.git/commitdiff
Converted if ( string == "" ) constructs to if ( string.empty() )
authorcurt <curt>
Wed, 20 Mar 2002 19:16:13 +0000 (19:16 +0000)
committercurt <curt>
Wed, 20 Mar 2002 19:16:13 +0000 (19:16 +0000)
Fixed a warning in soundmgr.cxx.

src/Cockpit/panel.cxx
src/Cockpit/panel_io.cxx
src/GUI/gui.cxx
src/Input/input.cxx
src/Main/fg_init.cxx
src/Main/fg_props.cxx
src/Navaids/fixlist.cxx
src/Network/props.cxx
src/Scenery/FGTileLoader.cxx
src/Sound/fg_fx.cxx
src/Sound/soundmgr.cxx

index 5443c0437d373f682ff6817f2af5dfc11bf06290..7538e29b673b5307083e7a2f2df0d9761ff5ed03 100644 (file)
@@ -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
index d7707d68793973fc8112f0a6f46c23eaeed6d61c..b81717430377f78988ba13e832d70cb0bbbd1cb3 100644 (file)
@@ -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 );
 
index 3ecbcb6c955a29f8033cabf0576d2018c356966f..67662bcc927014f2844dd74f1b970ad634f06ac0 100644 (file)
@@ -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 += ')';
index 7dfbc57b49902779a4920e35ef0784bd404424f1..baccfb3aafe50d228ad315ed7a54df3ee494565f 100644 (file)
@@ -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;
index 132e3fdcc1d6cb9d7cc5cd1b2f268cabad188104..48f4af1f24cdced3d9b0012405a7c84b0d165a48 100644 (file)
@@ -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 )
index 0ba8109acbae88b71ffcf484839c2fff173183cf..2d63d14f160f5ed6419b2f6f70c5daf1b1e68133 100644 (file)
@@ -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);
index 55a083166f9d3737b72771c443ba007ea4624948..e3a02a84e6402183cfc452ac059d57ea5d78562b 100644 (file)
@@ -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;
     }
 
index 3dcc682002f227bee62ce743f1476794fa40c711..b54ac4d2912776a9c842610edacfde41ae1ee46e 100644 (file)
@@ -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 += "> ";
index 2e0a01b2b860da2016717a9d4004341a66c3e5cb..3bbe26521f994e9a27932f5885287540ff890c84 100644 (file)
@@ -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() );
index a58bd4abacffff17b12165f608c0d0f5352d1d15..d7b58e54390dcac6ab90a1a8e6336bb60ce7dc83 100644 (file)
@@ -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;
    }
index 0580ae588da0680b891f47965fc3f272ed8fa1bc..edd46700d4fa4a05b80148f6aa55b757a31b4eda 100644 (file)
@@ -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);