From 2b86a180e6c1622c47fb412e46a398137969288e Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 6 Oct 2012 17:17:26 +0200 Subject: [PATCH] Changed: Replaced string empty comparisons with empty() --- code/nel/src/3d/cloud_scape.cpp | 2 +- code/nel/src/3d/cluster.cpp | 2 +- code/nel/src/3d/zone_manager.cpp | 2 +- code/nel/src/net/varpath.cpp | 4 ++-- code/nel/src/pacs/retriever_bank.h | 2 +- .../client/src/interface_v3/action_handler_phrase.cpp | 2 +- code/ryzom/client/src/interface_v3/interface_manager.cpp | 2 +- .../client/src/interface_v3/item_consumable_effect.cpp | 2 +- code/ryzom/client/src/interface_v3/lua_ihm.cpp | 2 +- code/ryzom/client/src/interface_v3/view_renderer.cpp | 6 +++--- code/ryzom/client/src/pacs_client.cpp | 2 +- code/ryzom/client/src/r2/editor.cpp | 2 +- code/ryzom/common/src/game_share/generic_xml_msg_mngr.h | 2 +- code/ryzom/common/src/game_share/object.cpp | 8 ++++---- .../ryzom/common/src/game_share/scenario_entry_points.cpp | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/code/nel/src/3d/cloud_scape.cpp b/code/nel/src/3d/cloud_scape.cpp index 5a4b92155..77d046eec 100644 --- a/code/nel/src/3d/cloud_scape.cpp +++ b/code/nel/src/3d/cloud_scape.cpp @@ -193,7 +193,7 @@ void SCloudTextureClamp::init (uint32 nWidth, uint32 nHeight, uint32 nDepth, con Mem = new uint8[NbW*Width*NbH*Height]; uint32 i, j; - if (filename == "") + if (filename.empty()) { // No filename so init with default for (i = 0; i < NbW; ++i) diff --git a/code/nel/src/3d/cluster.cpp b/code/nel/src/3d/cluster.cpp index 2faebcec7..76ed153e1 100644 --- a/code/nel/src/3d/cluster.cpp +++ b/code/nel/src/3d/cluster.cpp @@ -307,7 +307,7 @@ void CCluster::serial (NLMISC::IStream&f) _SoundGroupId = CStringMapper::map(soundGroup); f.serial(envFxName); - if (envFxName == "") + if (envFxName.empty()) envFxName = "no fx"; _EnvironmentFxId = CStringMapper::map(envFxName); } diff --git a/code/nel/src/3d/zone_manager.cpp b/code/nel/src/3d/zone_manager.cpp index 6c0a727f2..efa36fa66 100644 --- a/code/nel/src/3d/zone_manager.cpp +++ b/code/nel/src/3d/zone_manager.cpp @@ -237,7 +237,7 @@ void CZoneLoadingTask::run(void) { // Lookup the zone string zonePathLookup = CPath::lookup (_ZoneName, false, false, true); - if (zonePathLookup == "") + if (zonePathLookup.empty()) zonePathLookup = _ZoneName; CZone *ZoneTmp = new CZone; diff --git a/code/nel/src/net/varpath.cpp b/code/nel/src/net/varpath.cpp index 8bee387cd..d1ce0bcf3 100644 --- a/code/nel/src/net/varpath.cpp +++ b/code/nel/src/net/varpath.cpp @@ -89,7 +89,7 @@ void CVarPath::decode () string val = getToken (); - if (val == "") + if (val.empty()) return; if (val == "[" ) @@ -105,7 +105,7 @@ void CVarPath::decode () osbnb++; // end of token - if (val == "") + if (val.empty()) { nlwarning ("VP: Bad VarPath '%s', suppose it s an empty varpath", RawVarPath.c_str()); Destination.clear (); diff --git a/code/nel/src/pacs/retriever_bank.h b/code/nel/src/pacs/retriever_bank.h index 3dacb2463..eb7afb31b 100644 --- a/code/nel/src/pacs/retriever_bank.h +++ b/code/nel/src/pacs/retriever_bank.h @@ -142,7 +142,7 @@ public: for (i=0; igetSPhraseId(); sint32 dstMacroId= pCSDst->getMacroId(); - if ((src == "") && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) + if (src.empty() && (CHandlerPhraseMemoryCopy::haveLastPhraseElement)) { // get the slot ids from save srcIsMacro= CHandlerPhraseMemoryCopy::isMacro; diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index a9a901283..52c185b58 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1563,7 +1563,7 @@ bool CInterfaceManager::loadConfig (const string &filename) CIFile f; string sFileName; sFileName = NLMISC::CPath::lookup (filename, false); - if (sFileName == "" || !f.open(sFileName)) + if (sFileName.empty() || !f.open(sFileName)) return false; diff --git a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp index 52a3f64b7..6e50666b1 100644 --- a/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp +++ b/code/ryzom/client/src/interface_v3/item_consumable_effect.cpp @@ -43,7 +43,7 @@ void CItemConsumableEffectHelper::getItemConsumableEffectText(const CItemSheet * { CSString eff = pIS->Consumable.Properties[i]; - if (eff == "") + if (eff.empty()) continue; // Get name id of effect diff --git a/code/ryzom/client/src/interface_v3/lua_ihm.cpp b/code/ryzom/client/src/interface_v3/lua_ihm.cpp index c0500eeb7..9e5160a4e 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm.cpp @@ -1228,7 +1228,7 @@ void CLuaIHM::createLuaEnumTable(CLuaState &ls, const std::string &str) p = s.splitTo('.', true); while (p.size() > 0) { - if (path == "") + if (path.empty()) path = p; else path += "." + p; diff --git a/code/ryzom/client/src/interface_v3/view_renderer.cpp b/code/ryzom/client/src/interface_v3/view_renderer.cpp index 3655697b6..8be60402a 100644 --- a/code/ryzom/client/src/interface_v3/view_renderer.cpp +++ b/code/ryzom/client/src/interface_v3/view_renderer.cpp @@ -707,7 +707,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std: SGlobalTexture gt; // Load texture file string filename = CPath::lookup (textureFileName, false); - if (filename == "") return; + if (filename.empty()) return; CIFile ifTmp; if (ifTmp.open(filename)) CBitmap::loadSize (ifTmp, gt.Width, gt.Height); @@ -724,7 +724,7 @@ void CViewRenderer::loadTextures (const std::string &textureFileName, const std: // Load uv file CIFile iFile; filename = CPath::lookup (uvFileName, false); - if (filename == "") return; + if (filename.empty()) return; if (!iFile.open(filename)) return; _GlobalTextures.push_back (gt); @@ -866,7 +866,7 @@ sint32 CViewRenderer::createTexture (const std::string &sGlobalTextureName, SGlobalTexture gtTmp; gtTmp.FromGlobaleTexture = false; string filename = CPath::lookup (sLwrGTName, false); - if (filename == "") return -1; + if (filename.empty()) return -1; CIFile ifTmp; if (ifTmp.open(filename)) { diff --git a/code/ryzom/client/src/pacs_client.cpp b/code/ryzom/client/src/pacs_client.cpp index 04fd5cae9..5924cc935 100644 --- a/code/ryzom/client/src/pacs_client.cpp +++ b/code/ryzom/client/src/pacs_client.cpp @@ -139,7 +139,7 @@ UInstanceGroup *getCluster(const UGlobalPosition &gp) return 0; const string &strPos = GR->getIdentifier(gp); - if(strPos == "") + if(strPos.empty()) return 0; // try to find the ig in the loaded ig map std::map::const_iterator igIt = IGLoaded.find(strlwr(strPos)); diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index e8db1b390..24d8f06c0 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -6603,7 +6603,7 @@ NLMISC::CVectorD getVectorD(const CObject *obj) CObject *buildVector(const NLMISC::CVectorD &vector, const std::string &instanceId /*= ""*/) { CObject *table; - if (instanceId == "") + if (instanceId.empty()) { table = getEditor().getDMC().newComponent("Position"); table->set("x", vector.x); diff --git a/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h b/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h index feb8baed7..a6a6a7167 100644 --- a/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h +++ b/code/ryzom/common/src/game_share/generic_xml_msg_mngr.h @@ -470,7 +470,7 @@ protected: /// display nodes void xmlDisplay() { - std::string ntype = (Name == "" ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch"); + std::string ntype = (Name.empty() ? "client_messages_description" : NbBits == 0 ? "leaf" : "branch"); nlinfo("<%s name=\"%s\" description=\"%s\">", ntype.c_str(), Name.c_str(), Description.c_str()); diff --git a/code/ryzom/common/src/game_share/object.cpp b/code/ryzom/common/src/game_share/object.cpp index 1537a9995..6d1feb2fe 100644 --- a/code/ryzom/common/src/game_share/object.cpp +++ b/code/ryzom/common/src/game_share/object.cpp @@ -483,7 +483,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si nlassert(index != -1); instanceId = parent->getAttr("InstanceId")->toString(); attrName = parent->getKey(index); - if (attrName == "") + if (attrName.empty()) { position = index; } @@ -501,7 +501,7 @@ bool CObject::getShortestName(std::string &instanceId, std::string &attrName, si nlassert(index2 != -1); sint32 index = parent->findIndex(this); nlassert(index != -1); - if (parent2->getKey(index2) == "") + if (parent2->getKey(index2).empty()) { nlassert(0); // TMP : want to see if may possibly happen return false; @@ -1092,7 +1092,7 @@ void CObjectTable::doSerialize(std::string& out, CSerializeContext& context) co if ( _Value[i].second->isString("Name") && _Value[i].second->isString("LocationId") && _Value[i].second->toString("Name") == "Permanent" - && _Value[i].second->toString("LocationId") == "") + && _Value[i].second->toString("LocationId").empty()) { isDefault = true; } @@ -1248,7 +1248,7 @@ bool CObjectTable::setObject(const std::string& key, CObject* value) //H_AUTO(R2_CObjectTable_setObject) CHECK_TABLE_INTEGRITY value->setGhost(this->getGhost()); - if (key == "") + if (key.empty()) { clear(); 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 886a5ac6b..f68b1d6f8 100644 --- a/code/ryzom/common/src/game_share/scenario_entry_points.cpp +++ b/code/ryzom/common/src/game_share/scenario_entry_points.cpp @@ -406,7 +406,7 @@ void CScenarioEntryPoints::loadFromXMLFile() nlinfo("Different packages for island '%s' in file %s", island, _EntryPointsFilename.c_str()); } } - if(package == "") + if(package.empty()) nlinfo("no 'package' tag in %s island", island); else completeIsland.Package = CSString(package);