From 36c676e2b2412a5221265f72d99df6effc41e112 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 2 Nov 2020 14:00:56 +0800 Subject: [PATCH] Use the simplified toUpper for identifiers and filenames --- nel/src/3d/landscapeig_manager.cpp | 6 +++--- nel/src/ligo/primitive.cpp | 4 ++-- nel/src/misc/system_info.cpp | 2 +- nel/src/net/service.cpp | 2 +- ryzom/client/src/client_sheets/item_sheet.cpp | 6 +++--- ryzom/client/src/client_sheets/sbrick_sheet.cpp | 2 +- ryzom/client/src/color_slot_manager.cpp | 6 +++--- ryzom/client/src/init_main_loop.cpp | 4 ++-- ryzom/client/src/interface_v3/action_handler_game.cpp | 2 +- ryzom/client/src/interface_v3/action_phrase_faber.cpp | 2 +- ryzom/client/src/interface_v3/dbctrl_sheet.cpp | 4 ++-- ryzom/client/src/interface_v3/interface_manager.cpp | 2 +- .../client/src/interface_v3/item_consumable_effect.cpp | 2 +- ryzom/client/src/interface_v3/item_special_effect.cpp | 2 +- ryzom/client/src/interface_v3/macrocmd_key.cpp | 2 +- ryzom/client/src/interface_v3/people_list.cpp | 10 ++-------- ryzom/client/src/item_group_manager.cpp | 4 ++-- 17 files changed, 28 insertions(+), 34 deletions(-) diff --git a/nel/src/3d/landscapeig_manager.cpp b/nel/src/3d/landscapeig_manager.cpp index d2b276f8a..78154deda 100644 --- a/nel/src/3d/landscapeig_manager.cpp +++ b/nel/src/3d/landscapeig_manager.cpp @@ -115,7 +115,7 @@ void CLandscapeIGManager::initIG(UScene *scene, const std::string &igDesc, UDriv if (ig) { // add it to the map. - string tokId= toUpper(string(token)); + string tokId= toUpperAscii(string(token)); _ZoneInstanceGroupMap[tokId]= CInstanceGroupElement(ig, token); // Add a reference on the shapes @@ -295,7 +295,7 @@ UInstanceGroup *CLandscapeIGManager::getIG(const std::string &name) const std::string CLandscapeIGManager::translateName(const std::string &name) const { std::string ret; - ret= toUpper(name + ".ig"); + ret= toUpperAscii(name + ".ig"); return ret; } @@ -364,7 +364,7 @@ void CLandscapeIGManager::reloadAllIgs() const char *token= bkupIgFileNameList[i].c_str(); UInstanceGroup *ig = UInstanceGroup::createInstanceGroup(token); // add it to the map. - string tokId= toUpper(token); + string tokId= toUpperAscii(token); _ZoneInstanceGroupMap[tokId]= CInstanceGroupElement(ig, token); // If was addedToScene before, re-add to scene now. diff --git a/nel/src/ligo/primitive.cpp b/nel/src/ligo/primitive.cpp index 205464c67..c9c4f8180 100644 --- a/nel/src/ligo/primitive.cpp +++ b/nel/src/ligo/primitive.cpp @@ -1250,7 +1250,7 @@ const IPrimitive *IPrimitive::getPrimitive (const std::string &absoluteOrRelativ childName=path.substr(0,indexStr); path.erase(0, indexStr); } - childName=toUpper(childName); + childName=toUpperAscii(childName); const IPrimitive*child=NULL; uint childIndex; for (childIndex=0;childIndexgetNumChildren();childIndex++) @@ -1259,7 +1259,7 @@ const IPrimitive *IPrimitive::getPrimitive (const std::string &absoluteOrRelativ nlassert(child); string name; if ( child->getPropertyByName("class", name) - && toUpper(name)==childName ) + && toUpperAscii(name)==childName ) break; } if (childIndex>=cursor->getNumChildren()) diff --git a/nel/src/misc/system_info.cpp b/nel/src/misc/system_info.cpp index 762904443..d8a79ca77 100644 --- a/nel/src/misc/system_info.cpp +++ b/nel/src/misc/system_info.cpp @@ -1733,7 +1733,7 @@ bool CSystemInfo::getVideoInfo (std::string &deviceName, uint64 &driverVersion) HKEY keyRoot = HKEY_LOCAL_MACHINE; for (i=0; iasString()); + string srecstate = toUpperAscii(var->asString()); if ( srecstate == "RECORD" ) { _RecordingState = CCallbackNetBase::Record; diff --git a/ryzom/client/src/client_sheets/item_sheet.cpp b/ryzom/client/src/client_sheets/item_sheet.cpp index 514282b23..5918ba73c 100644 --- a/ryzom/client/src/client_sheets/item_sheet.cpp +++ b/ryzom/client/src/client_sheets/item_sheet.cpp @@ -302,7 +302,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) debug(toString("The slot name %d is Empty.", i)); // Push the possible slots for the item in the list. - SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::toUpper(slotName))); + SlotBF|= SINT64_CONSTANT(1)<< (SLOTTYPE::stringToSlotType(NLMISC::toUpperAscii(slotName))); } } } @@ -321,7 +321,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) } else { - Family = (ITEMFAMILY::EItemFamily) ITEMFAMILY::stringToItemFamily(NLMISC::toUpper( family) ); + Family = (ITEMFAMILY::EItemFamily) ITEMFAMILY::stringToItemFamily(NLMISC::toUpperAscii( family) ); if(Family == ITEMFAMILY::UNDEFINED) debug("Item Family Undefined."); } @@ -335,7 +335,7 @@ void CItemSheet::build(const NLGEORGES::UFormElm &item) } else { - ItemType = (ITEM_TYPE::TItemType) ITEM_TYPE::stringToItemType(NLMISC::toUpper(itemtype) ); + ItemType = (ITEM_TYPE::TItemType) ITEM_TYPE::stringToItemType(NLMISC::toUpperAscii(itemtype) ); if (ItemType == ITEM_TYPE::UNDEFINED) debug("Item Type Undefined."); } diff --git a/ryzom/client/src/client_sheets/sbrick_sheet.cpp b/ryzom/client/src/client_sheets/sbrick_sheet.cpp index 53d875cab..5c2584cfc 100644 --- a/ryzom/client/src/client_sheets/sbrick_sheet.cpp +++ b/ryzom/client/src/client_sheets/sbrick_sheet.cpp @@ -103,7 +103,7 @@ void CSBrickSheet::build (const NLGEORGES::UFormElm &root) { string sheetName= Id.toString(); std::string::size_type end= sheetName.find(".sbrick")-2; - BrickFamily = BRICK_FAMILIES::toSBrickFamily ( NLMISC::toUpper(sheetName.substr(0,end)) ); + BrickFamily = BRICK_FAMILIES::toSBrickFamily ( NLMISC::toUpperAscii(sheetName.substr(0,end)) ); if(BrickFamily==BRICK_FAMILIES::Unknown) nlwarning("Unknown Family for SBrick: %s", sheetName.c_str()); } diff --git a/ryzom/client/src/color_slot_manager.cpp b/ryzom/client/src/color_slot_manager.cpp index cccd680c2..87b7815bf 100644 --- a/ryzom/client/src/color_slot_manager.cpp +++ b/ryzom/client/src/color_slot_manager.cpp @@ -134,7 +134,7 @@ uint CColorSlotManager::addSlot(const TStringVect &slotDescs) _Slots.push_back(slotDescs); for(uint k = 0; k < slotDescs.size(); ++k) { - _Slots.back()[k] = NLMISC::toUpper(_Slots.back()[k]); + _Slots.back()[k] = NLMISC::toUpperAscii(_Slots.back()[k]); } return (uint)_Slots.size() - 1; } @@ -266,7 +266,7 @@ bool CColorSlotManager::parseTexName(const char *texName, std::string *texNameWi static std::string nameToParse; static std::string currentExt; static TIntCoupleVect slotsId; - nameToParse = NLMISC::toUpper(NLMISC::CFile::getFilenameWithoutExtension(texName)); + nameToParse = NLMISC::toUpperAscii(NLMISC::CFile::getFilenameWithoutExtension(texName)); TStrPos currPos = nameToParse.length(); @@ -376,7 +376,7 @@ bool CColorSlotManager::changeTexName(std::string &texName, TIntCouple *slotIDs, static TIntCoupleVect srcSlotIDs; everythingOk = true; - texNameNoExt = NLMISC::toUpper(NLMISC::CFile::getFilenameWithoutExtension(texName)); + texNameNoExt = NLMISC::toUpperAscii(NLMISC::CFile::getFilenameWithoutExtension(texName)); texExt = NLMISC::CFile::getExtension(texName); TTex2Slots::const_iterator texIt = _TexMap.find(texNameNoExt); if (texIt != _TexMap.end()) diff --git a/ryzom/client/src/init_main_loop.cpp b/ryzom/client/src/init_main_loop.cpp index 0714d1553..d7cce447d 100644 --- a/ryzom/client/src/init_main_loop.cpp +++ b/ryzom/client/src/init_main_loop.cpp @@ -229,7 +229,7 @@ struct CStatThread : public NLMISC::IRunnable name = UserEntity->getEntityName(); std::string userid = toString("u%d", NetMngr.getUserId())+name; - return toUpper(getMD5((const uint8 *)userid.c_str(), (uint32)userid.size()).toString()); + return toUpperAscii(getMD5((const uint8 *)userid.c_str(), (uint32)userid.size()).toString()); } // return true if we sent the connect because we have all information @@ -244,7 +244,7 @@ struct CStatThread : public NLMISC::IRunnable std::string params; addParam(params, "ra", randomString()); std::string session = toString("%d%d", NetMngr.getUserId(), CTime::getSecondsSince1970()); - addParam(params, "sessioncookie", toUpper(getMD5((const uint8 *)session.c_str(), (uint32)session.size()).toString())); + addParam(params, "sessioncookie", toUpperAscii(getMD5((const uint8 *)session.c_str(), (uint32)session.size()).toString())); addParam(params, "cookie", cookie()); addParam(params, "browsertoken", "X"); addParam(params, "platformtoken", "Win32"); diff --git a/ryzom/client/src/interface_v3/action_handler_game.cpp b/ryzom/client/src/interface_v3/action_handler_game.cpp index b43e8e19a..171b4bc08 100644 --- a/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -4613,7 +4613,7 @@ public: } std::locale loc(""); - const std::collate& coll = std::use_facet >(loc); + const std::collate& coll = std::use_facet >(loc); // FIXME: Probably does not work for(uint i = 0; i < nbChilds - 1; ++i) { diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index f23152b8a..71e8a28d1 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -117,7 +117,7 @@ void CActionPhraseFaber::launchFaberCastWindow(sint32 memoryLine, uint memoryIn if (!rootBrick->Properties.empty()) { - string prop= NLMISC::toUpper(rootBrick->Properties[0].Text); + string prop= NLMISC::toUpperAscii(rootBrick->Properties[0].Text); vector strList; splitString(prop, " ", strList); // The prop Id should be 'FPLAN:' diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index 4a66dd307..1723891d6 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -431,7 +431,7 @@ bool CCtrlSheetInfo::parseCtrlInfo(xmlNodePtr cur, CInterfaceGroup * /* parentGr // The string may have multiple brick type separated by | string brickTypeArray= (const char*)prop; vector strList; - NLMISC::splitString(NLMISC::toUpper(brickTypeArray), "|", strList); + NLMISC::splitString(NLMISC::toUpperAscii(brickTypeArray), "|", strList); // Test All words for(uint i=0;i params; diff --git a/ryzom/client/src/interface_v3/item_special_effect.cpp b/ryzom/client/src/interface_v3/item_special_effect.cpp index 84dbdf785..a4a0851da 100644 --- a/ryzom/client/src/interface_v3/item_special_effect.cpp +++ b/ryzom/client/src/interface_v3/item_special_effect.cpp @@ -101,7 +101,7 @@ string CItemSpecialEffectHelper::getEffect(const std::string &effect, bool &firs return result; // Get name id of effect - CSString name = toUpper(eff.splitTo(':', true)); + CSString name = toUpperAscii(eff.splitTo(':', true)); // Extract parameters from sheet vector params; diff --git a/ryzom/client/src/interface_v3/macrocmd_key.cpp b/ryzom/client/src/interface_v3/macrocmd_key.cpp index 21977f0bc..0f8055043 100644 --- a/ryzom/client/src/interface_v3/macrocmd_key.cpp +++ b/ryzom/client/src/interface_v3/macrocmd_key.cpp @@ -404,7 +404,7 @@ CModalContainerEditCmd::CModalContainerEditCmd() void CModalContainerEditCmd::create(const std::string &name, bool bDefKey, bool allowAllActions) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); - string prefix = NLMISC::toUpper(name); + string prefix = NLMISC::toUpperAscii(name); CanDefineKey = bDefKey; _AllowAllActions = allowAllActions; prefix = string(DB_EDITCMD_PREFIX) + string(":") + prefix + string(":"); diff --git a/ryzom/client/src/interface_v3/people_list.cpp b/ryzom/client/src/interface_v3/people_list.cpp index 3fb3a74a7..8c43de2eb 100644 --- a/ryzom/client/src/interface_v3/people_list.cpp +++ b/ryzom/client/src/interface_v3/people_list.cpp @@ -195,22 +195,16 @@ bool CPeopleList::sortExByContactId(const CPeople& a, const CPeople& b) //================================================================== bool CPeopleList::sortExByName(const CPeople& a, const CPeople& b) { - string name_a = toUpper(a.getName()); - string name_b = toUpper(b.getName()); - - return (name_a < name_b); + return -NLMISC::compareCaseInsensitive(a.getName(), b.getName()); // FIXME: Locale-dependent sort } //================================================================== bool CPeopleList::sortExByOnline(const CPeople& a, const CPeople& b) { - string name_a = toUpper(a.getName()); - string name_b = toUpper(b.getName()); - // We want order: online/alpha, offworld/alpha, offline/alpha if (a.Online == b.Online) { - return (name_a < name_b); + return -NLMISC::compareCaseInsensitive(a.getName(), b.getName()); // FIXME: Locale-dependent sort } else { diff --git a/ryzom/client/src/item_group_manager.cpp b/ryzom/client/src/item_group_manager.cpp index 2cbb86dac..e1fc52eb7 100644 --- a/ryzom/client/src/item_group_manager.cpp +++ b/ryzom/client/src/item_group_manager.cpp @@ -96,7 +96,7 @@ void CItemGroup::addItem(sint32 createTime, sint32 serial, SLOT_EQUIPMENT::TSlot void CItemGroup::addRemove(std::string slotName) { - SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpper(slotName)); + SLOT_EQUIPMENT::TSlotEquipment slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpperAscii(slotName)); if(slot != SLOT_EQUIPMENT::UNDEFINED) addRemove(slot); } @@ -161,7 +161,7 @@ void CItemGroup::readFrom(xmlNodePtr node) ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"slot"); std::string slot; if (ptrName) NLMISC::fromString((const char*)ptrName, slot); - item.slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpper(slot)); + item.slot = SLOT_EQUIPMENT::stringToSlotEquipment(NLMISC::toUpperAscii(slot)); // Old read, keep for compatibility reasons ptrName = (char*) xmlGetProp(curNode, (xmlChar*)"sheetName"); if (ptrName) NLMISC::fromString((const char*)ptrName, item.sheetName);