From 2fdcd7d27f5ddf1645e184731b470309d26c6a82 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 25 Oct 2016 15:52:14 +0200 Subject: [PATCH] Changed: Use empty() to check if a string is empty --- code/nel/include/nel/3d/tile_bank.h | 2 +- code/nel/src/3d/landscape.cpp | 10 +++++----- code/nel/src/3d/landscapeig_manager.cpp | 8 ++++---- code/nel/src/3d/tile_bank.cpp | 14 +++++++------- code/nel/src/sound/audio_mixer_user.cpp | 2 +- code/ryzom/client/src/connection.cpp | 2 +- code/ryzom/client/src/entity_cl.h | 2 +- code/ryzom/client/src/login.cpp | 2 +- .../client/src/r2/displayer_visual_entity.cpp | 2 +- .../src/game_share/scenario_entry_points.cpp | 2 +- .../common/src/game_share/small_string_manager.cpp | 2 +- .../common/src/game_share/string_mgr_module.cpp | 2 +- 12 files changed, 25 insertions(+), 25 deletions(-) diff --git a/code/nel/include/nel/3d/tile_bank.h b/code/nel/include/nel/3d/tile_bank.h index 32a205e6d..ec96afb64 100644 --- a/code/nel/include/nel/3d/tile_bank.h +++ b/code/nel/include/nel/3d/tile_bank.h @@ -320,7 +320,7 @@ public: // For edition: change the tileVegetableDesc. NB: only the TileVegetableDescFileName is serialised. void setTileVegetableDesc (const CTileVegetableDesc &tvd); /** try to load the vegetable tile desc associated with the fileName (nlinfo() if can't) - * lookup into CPath. no-op if string=="". + * lookup into CPath. no-op if string empty */ void loadTileVegetableDesc(); diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index d588fa424..e3658dd88 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -1831,9 +1831,9 @@ void CLandscape::loadTile(uint16 tileId) if(tile) textName= tile->getRelativeFileName(CTile::additive); else - textName= ""; + textName.clear(); // If no additive for this tile, rdrpass is NULL. - if(textName=="") + if(textName.empty()) tileInfo->AdditiveRdrPass= NULL; else { @@ -1844,7 +1844,7 @@ void CLandscape::loadTile(uint16 tileId) // We may have an alpha part for additive. textName= tile->getRelativeFileName (CTile::alpha); - if(textName!="") + if(!textName.empty()) // Must Use clamp for alpha (although NVidia drivers are buggy), because the texture doesn't tile at all pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName, true); @@ -1866,7 +1866,7 @@ void CLandscape::loadTile(uint16 tileId) if(tile) { textName= tile->getRelativeFileName(CTile::diffuse); - if(textName!="") + if(!textName.empty()) // Avoid using Clamp for diffuse, because of recent NVidia GL drivers Bugs in 77.72 pass.TextureDiffuse= findTileTexture(TileBank.getAbsPath()+textName, false); else @@ -1880,7 +1880,7 @@ void CLandscape::loadTile(uint16 tileId) if(tile) { textName= tile->getRelativeFileName (CTile::alpha); - if(textName!="") + if(!textName.empty()) // Must Use clamp for alpha (although NVidia drivers are buggy), because the texture doesn't tile at all pass.TextureAlpha= findTileTexture(TileBank.getAbsPath()+textName, true); } diff --git a/code/nel/src/3d/landscapeig_manager.cpp b/code/nel/src/3d/landscapeig_manager.cpp index f4388f9fa..500373360 100644 --- a/code/nel/src/3d/landscapeig_manager.cpp +++ b/code/nel/src/3d/landscapeig_manager.cpp @@ -174,7 +174,7 @@ UInstanceGroup *CLandscapeIGManager::loadZoneIG(const std::string &name) { NL3D_HAUTO_LAND_MNGR_LOAD_ZONEIG - if(name=="") + if(name.empty()) return NULL; // try to find this InstanceGroup. @@ -232,7 +232,7 @@ void CLandscapeIGManager::unloadArrayZoneIG(const std::vector &name void CLandscapeIGManager::unloadZoneIG(const std::string &name) { NL3D_HAUTO_LAND_MNGR_UNLOAD_ZONEIG - if(name=="") + if(name.empty()) return; // try to find this InstanceGroup. @@ -255,7 +255,7 @@ void CLandscapeIGManager::unloadZoneIG(const std::string &name) // *************************************************************************** bool CLandscapeIGManager::isIGAddedToScene(const std::string &name) const { - if(name=="") + if(name.empty()) return false; // try to find this InstanceGroup. @@ -272,7 +272,7 @@ bool CLandscapeIGManager::isIGAddedToScene(const std::string &name) const // *************************************************************************** UInstanceGroup *CLandscapeIGManager::getIG(const std::string &name) const { - if(name=="") + if(name.empty()) return NULL; // try to find this InstanceGroup. diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index d4e26ab06..0f05b3df6 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -264,7 +264,7 @@ sint CTileBank::getNumBitmap (CTile::TBitmap bitmap) const if (!_TileVector[i].isFree()) { const std::string &str=_TileVector[i].getRelativeFileName (bitmap); - if (str!="") + if (!str.empty()) { std::vector vect (str.length()+1); memcpy (&*vect.begin(), str.c_str(), str.length()+1); @@ -583,7 +583,7 @@ void CTileBank::removeDisplacementMap (uint mapId) if (mapId==_DisplacementMap.size()-1) { // Resize the array ? - while ((mapId>0)&&(_DisplacementMap[mapId]._FileName=="")) + while ((mapId>0)&&(_DisplacementMap[mapId]._FileName.empty())) _DisplacementMap.resize (mapId--); } } @@ -608,7 +608,7 @@ uint CTileBank::getDisplacementMap (const string &fileName) for (noiseTile=0; noiseTile<_DisplacementMap.size(); noiseTile++) { // Same name ? - if (_DisplacementMap[noiseTile]._FileName=="") + if (_DisplacementMap[noiseTile]._FileName.empty()) break; } if (noiseTile==_DisplacementMap.size()) @@ -1433,7 +1433,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type) while (ite!=_Tile128.end()) { // If the file name is valid - if (bank.getTile (*ite)->getRelativeFileName(type)!="") + if (!bank.getTile (*ite)->getRelativeFileName(type).empty()) { // Don't delete, bDelete=false; @@ -1450,7 +1450,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type) while (ite!=_Tile256.end()) { // If the file name is valid - if (bank.getTile (*ite)->getRelativeFileName(type)!="") + if (!bank.getTile (*ite)->getRelativeFileName(type).empty()) { // Don't delete, bDelete=false; @@ -1474,7 +1474,7 @@ void CTileSet::deleteBordersIfLast (const CTileBank& bank, CTile::TBitmap type) if (nTile!=-1) { // If the file name is valid - if (bank.getTile (nTile)->getRelativeFileName(type)!="") + if (!bank.getTile (nTile)->getRelativeFileName(type).empty()) { // Don't delete, bDelete=false; @@ -1564,7 +1564,7 @@ const CTileVegetableDesc &CTileSet::getTileVegetableDesc() const // *************************************************************************** void CTileSet::loadTileVegetableDesc() { - if(_TileVegetableDescFileName!="") + if(!_TileVegetableDescFileName.empty()) { try { diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 6f2c2b449..4d86df788 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -1797,7 +1797,7 @@ void CAudioMixerUser::addSource( CSourceCommon *source ) _Sources.insert( source ); // _profile(( "AM: ADDSOURCE, SOUND: %d, TRACK: %p, NAME=%s", source->getSound(), source->getTrack(), -// source->getSound() && (source->getSound()->getName()!="") ? source->getSound()->getName().c_str() : "" )); +// source->getSound() && (!source->getSound()->getName().empty()) ? source->getSound()->getName().c_str() : "" )); } diff --git a/code/ryzom/client/src/connection.cpp b/code/ryzom/client/src/connection.cpp index 69c05cc08..e20e05140 100644 --- a/code/ryzom/client/src/connection.cpp +++ b/code/ryzom/client/src/connection.cpp @@ -2798,7 +2798,7 @@ class CAHScenarioControl : public IActionHandler // description string description = sessionBrowser._LastDescription; - if(description!="") + if(!description.empty()) { result = scenarioWnd->findFromShortId(string("edit_small_description")); if(result) diff --git a/code/ryzom/client/src/entity_cl.h b/code/ryzom/client/src/entity_cl.h index 328ec1cc7..d9cdd5927 100644 --- a/code/ryzom/client/src/entity_cl.h +++ b/code/ryzom/client/src/entity_cl.h @@ -171,7 +171,7 @@ public: // hide every static fxs void hideStaticFXs(); - // Create the loading instance. return false if shapeName!="" while still fails to load. else return true. + // Create the loading instance. return false if shapeName is not empty while still fails to load. else return true. bool createLoading(const std::string &shapeName, const std::string &stickPoint=std::string(""), sint texture=-1, bool clearIfFail= true); // Apply Colors diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index d29306202..bef90af95 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -2588,7 +2588,7 @@ class CAHOnCreateAccountSubmit : public IActionHandler for(uint i=0; itoString("Title"); //obsolete - if(actName!=firstPart && actName!="") + if(actName!=firstPart && !actName.empty()) actName = firstPart+":"+actName; } else diff --git a/code/ryzom/common/src/game_share/scenario_entry_points.cpp b/code/ryzom/common/src/game_share/scenario_entry_points.cpp index 51e3c56c3..c97689211 100644 --- a/code/ryzom/common/src/game_share/scenario_entry_points.cpp +++ b/code/ryzom/common/src/game_share/scenario_entry_points.cpp @@ -385,7 +385,7 @@ void CScenarioEntryPoints::loadFromXMLFile() shortEntryPoint.Y = entryPoint.Y; entryPoints.push_back(shortEntryPoint); - if(package=="") + if(package.empty()) package=entryPoint.Package; else if(package!=entryPoint.Package) nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str()); diff --git a/code/ryzom/common/src/game_share/small_string_manager.cpp b/code/ryzom/common/src/game_share/small_string_manager.cpp index 83414b668..bcc2a67da 100644 --- a/code/ryzom/common/src/game_share/small_string_manager.cpp +++ b/code/ryzom/common/src/game_share/small_string_manager.cpp @@ -225,7 +225,7 @@ void CStringTableManager::setValue(uint32 tableId,const std::string& localId, co if(found2!=localTable->end()) { std::string oldValue = _StringMgr.getString(found2->second); - if (oldValue=="") nlwarning("error! no string %u in string manager! ",found2->second); + if (oldValue.empty()) nlwarning("error! no string %u in string manager! ",found2->second); _StringMgr.unregisterString(oldValue); found2->second = _StringMgr.registerString(value); } diff --git a/code/ryzom/common/src/game_share/string_mgr_module.cpp b/code/ryzom/common/src/game_share/string_mgr_module.cpp index 49d9a9122..e28fc0c8c 100644 --- a/code/ryzom/common/src/game_share/string_mgr_module.cpp +++ b/code/ryzom/common/src/game_share/string_mgr_module.cpp @@ -469,7 +469,7 @@ static std::string formatString(std::string str,std::vector args) void CStringManagerModule::translateAndForwardWithArg(TDataSetRow senderId,CChatGroup::TGroupType groupType,std::string id,TSessionId sessionId,std::vector& args) { std::string text = getValue(sessionId.asInt(), id ); - if (text!="") + if (!text.empty()) { std::string toSend = formatString(text,args); send(senderId,groupType,toSend);