Explicitly use toLowerAscii for filenames and identifiers

ryzomclassic-develop
kaetemi 4 years ago
parent 625d269c11
commit 29f313853d

@ -586,7 +586,7 @@ void CGroupNpc::addParameter(std::string const& parameter)
std::string key, tail; std::string key, tail;
// force lowercase // force lowercase
std::string p = NLMISC::toLower(parameter); std::string p = NLMISC::toLowerAscii(parameter);
AI_SHARE::stringToKeywordAndTail(p, key, tail); AI_SHARE::stringToKeywordAndTail(p, key, tail);
breakable breakable

@ -187,7 +187,7 @@ public:
/// Store mapping 'name:variant' -> squad to be used later by getSquadByVariantName() /// Store mapping 'name:variant' -> squad to be used later by getSquadByVariantName()
void registerSquadVariant(const std::string& nameAndVariant, CGroupDesc<COutpostSquadFamily> *squad ) void registerSquadVariant(const std::string& nameAndVariant, CGroupDesc<COutpostSquadFamily> *squad )
{ {
if ( ! _SquadVariantNameToGroupDesc.insert( std::make_pair( NLMISC::toLower( nameAndVariant ), squad ) ).second ) if ( ! _SquadVariantNameToGroupDesc.insert( std::make_pair( NLMISC::toLowerAscii( nameAndVariant ), squad ) ).second )
nlwarning( "Duplicate squad template / squad variant '%s'", nameAndVariant.c_str() ); nlwarning( "Duplicate squad template / squad variant '%s'", nameAndVariant.c_str() );
} }
@ -200,7 +200,7 @@ public:
/// Get a squad by name:variant (works only during primitive parsing), or NULL if not found. Not case-sensitive. /// Get a squad by name:variant (works only during primitive parsing), or NULL if not found. Not case-sensitive.
CGroupDesc<COutpostSquadFamily> *getSquadByVariantName(const std::string& nameAndVariant) CGroupDesc<COutpostSquadFamily> *getSquadByVariantName(const std::string& nameAndVariant)
{ {
std::map<std::string, NLMISC::CSmartPtr< CGroupDesc<COutpostSquadFamily> > >::iterator it = _SquadVariantNameToGroupDesc.find( NLMISC::toLower( nameAndVariant ) ); std::map<std::string, NLMISC::CSmartPtr< CGroupDesc<COutpostSquadFamily> > >::iterator it = _SquadVariantNameToGroupDesc.find( NLMISC::toLowerAscii( nameAndVariant ) );
if ( it != _SquadVariantNameToGroupDesc.end() ) if ( it != _SquadVariantNameToGroupDesc.end() )
return (*it).second; return (*it).second;
else else

@ -648,7 +648,7 @@ DEFINE_ACTION_TEMPLATE1(ContextOutpostGroupDesc,GT_GPRM,FamilyT)
string param; string param;
args[i].get(param); args[i].get(param);
param = NLMISC::toLower(param); param = NLMISC::toLowerAscii(param);
if ( param == "contact camp" if ( param == "contact camp"
|| param == "contact outpost" || param == "contact outpost"

@ -1053,7 +1053,7 @@ DEFINE_ACTION_TEMPLATE1(ContextGroupDesc,GT_GPRM,FamilyT)
std::string param; std::string param;
args[i].get(param); args[i].get(param);
param = NLMISC::toLower(param); param = NLMISC::toLowerAscii(param);
if ( param == "contact camp" if ( param == "contact camp"
|| param == "contact outpost" || param == "contact outpost"

@ -38,6 +38,7 @@
#include "nel/misc/algo.h" #include "nel/misc/algo.h"
#include "nel/misc/sstring.h" #include "nel/misc/sstring.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
#include "nel/misc/string_view.h"
#include "nel/net/admin.h" #include "nel/net/admin.h"
#include "nel/net/service.h" #include "nel/net/service.h"
@ -4493,24 +4494,25 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
CPVPManager2 *inst = CPVPManager2::getInstance(); CPVPManager2 *inst = CPVPManager2::getInstance();
string pass; string pass;
string name = toLower(args[1]); string name = args[1];
TChanID channel = inst->getUserDynChannel(name); string nameLwr = toCaseInsensitive(args[1]);
TChanID channel = inst->getUserDynChannel(nameLwr);
if (args.size() < 3) if (args.size() < 3)
pass = toLower(name); pass = nameLwr;
else else
pass = args[2]; pass = args[2];
if ( (channel == DYN_CHAT_INVALID_CHAN) && (pass != string("*")) && (pass != string("***")) ) if ( (channel == DYN_CHAT_INVALID_CHAN) && (pass != nlstr("*")) && (pass != nlstr("***")) )
channel = inst->createUserChannel(name, pass); channel = inst->createUserChannel(nameLwr, pass);
if (channel != DYN_CHAT_INVALID_CHAN) if (channel != DYN_CHAT_INVALID_CHAN)
{ {
string channelPass = inst->getPassUserChannel(channel); string channelPass = inst->getPassUserChannel(channel);
if ( (channel != DYN_CHAT_INVALID_CHAN) && (pass == string("***")) && (c->havePriv(":DEV:") || c->havePriv(":SGM:") || c->havePriv(":GM:") || c->havePriv(":EM:"))) if ( (channel != DYN_CHAT_INVALID_CHAN) && (pass == nlstr("***")) && (c->havePriv(":DEV:") || c->havePriv(":SGM:") || c->havePriv(":GM:") || c->havePriv(":EM:")))
{ {
inst->deleteUserChannel(name); inst->deleteUserChannel(nameLwr);
} }
else if (channelPass == pass) else if (channelPass == pass)
{ {
@ -4521,7 +4523,7 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
} }
inst->addFactionChannelToCharacter(channel, c, true, true); inst->addFactionChannelToCharacter(channel, c, true, true);
} }
else if (pass == string("*")) else if (pass == nlstr("*"))
{ {
inst->removeFactionChannelForCharacter(channel, c, true); inst->removeFactionChannelForCharacter(channel, c, true);
} }
@ -4529,7 +4531,7 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
{ {
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal = name; params[0].Literal = name;
CCharacter::sendDynamicSystemMessage( eid, "EGS_CHANNEL_NO_RIGHTS", params ); CCharacter::sendDynamicSystemMessage( eid, nlstr("EGS_CHANNEL_NO_RIGHTS"), params );
} }
return true; return true;
@ -4537,7 +4539,7 @@ NLMISC_COMMAND (connectUserChannel, "Connect to user channels", "<user id> <chan
SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal); SM_STATIC_PARAMS_1(params, STRING_MANAGER::literal);
params[0].Literal = name; params[0].Literal = name;
CCharacter::sendDynamicSystemMessage( eid, "EGS_CHANNEL_INVALID_NAME", params ); CCharacter::sendDynamicSystemMessage( eid, nlstr("EGS_CHANNEL_INVALID_NAME"), params );
return false; return false;
} }
@ -6704,9 +6706,9 @@ ENTITY_VARIABLE (FullPVP, "Full Pvp Mode")
} }
else else
{ {
if (value=="1" || value=="on" || toLower(value)=="pvp" || toLower(value)=="true" ) if (value=="1" || value=="on" || toLowerAscii(value)=="pvp" || toLowerAscii(value)=="true" )
c->setFullPVP(true); c->setFullPVP(true);
else if (value=="0" || value=="off" || toLower(value)=="false" ) else if (value=="0" || value=="off" || toLowerAscii(value)=="false" )
c->setFullPVP(false); c->setFullPVP(false);
// c->setPVPRecentActionFlag(); // c->setPVPRecentActionFlag();
CPVPManager2::getInstance()->setPVPModeInMirror(c); CPVPManager2::getInstance()->setPVPModeInMirror(c);

@ -39,7 +39,7 @@ void CFameTrend::init()
for (i=0; i<3; ++i) for (i=0; i<3; ++i)
{ {
_StrTable[TFameTrendConvert[i].Value] = TFameTrendConvert[i].Name; _StrTable[TFameTrendConvert[i].Value] = TFameTrendConvert[i].Name;
_ValueMap[NLMISC::toLower(std::string(TFameTrendConvert[i].Name))] = TFameTrendConvert[i].Value; _ValueMap[NLMISC::toLowerAscii(std::string(TFameTrendConvert[i].Name))] = TFameTrendConvert[i].Value;
} }
_Initialised = true; _Initialised = true;
} }

@ -43,7 +43,7 @@ inline CFameTrend::TFameTrend CFameTrend::fromString(const std::string& v)
{ {
return Unknown; return Unknown;
} }
const std::map<std::string, TFameTrend>::const_iterator it = _ValueMap.find(NLMISC::toLower(v)); const std::map<std::string, TFameTrend>::const_iterator it = _ValueMap.find(NLMISC::toLowerAscii(v));
if (it == _ValueMap.end()) if (it == _ValueMap.end())
{ {
nlwarning("TFameTrend::toString(): string '%s' is not matched, 'Unknown' enum value returned", v.c_str()); nlwarning("TFameTrend::toString(): string '%s' is not matched, 'Unknown' enum value returned", v.c_str());

@ -856,7 +856,7 @@ void CGuildManager::createGuildStep2(uint32 guildId, const ucstring &guildName,
/// end current bot chat /// end current bot chat
proxy.endBotChat(); proxy.endBotChat();
proxy.updateTarget(); proxy.updateTarget();
_ExistingGuildNames.insert( NLMISC::toLower( guild->getName().toString() ) ); _ExistingGuildNames.insert( NLMISC::toCaseInsensitive( guild->getName().toUtf8() ) );
// ask the client to open it's guild interface // ask the client to open it's guild interface
PlayerManager.sendImpulseToClient( proxy.getId(),"GUILD:OPEN_GUILD_WINDOW" ); PlayerManager.sendImpulseToClient( proxy.getId(),"GUILD:OPEN_GUILD_WINDOW" );
@ -903,7 +903,7 @@ void CGuildManager::deleteGuild(uint32 id)
CStatDB::getInstance()->removeGuild(id); CStatDB::getInstance()->removeGuild(id);
} }
_ExistingGuildNames.erase( NLMISC::toLower( guild->getName().toString() ) ); _ExistingGuildNames.erase( NLMISC::toCaseInsensitive( guild->getName().toUtf8() ) );
guild->unregisterGuild(); guild->unregisterGuild();
if (!guild->isProxy()) if (!guild->isProxy())
@ -1423,7 +1423,7 @@ void CGuildManager::registerGuildAfterLoading(CGuild *guildToRegister)
// _GuildsAwaitingString.insert( make_pair( str, guildToRegister->getId() ) ); // _GuildsAwaitingString.insert( make_pair( str, guildToRegister->getId() ) );
// } // }
_ExistingGuildNames.insert( NLMISC::toLower( guildToRegister->getName().toString() ) ); _ExistingGuildNames.insert( NLMISC::toCaseInsensitive( guildToRegister->getName().toUtf8() ) );
} }
} }
@ -1477,7 +1477,7 @@ bool CGuildManager::checkGuildStrings(CGuildCharProxy & proxy,const ucstring & n
return false; return false;
} }
// check if name already exists in the guild list // check if name already exists in the guild list
if ( _ExistingGuildNames.find( NLMISC::toLower( name.toString() ) ) != _ExistingGuildNames.end() ) if ( _ExistingGuildNames.find( NLMISC::toCaseInsensitive( name.toUtf8() ) ) != _ExistingGuildNames.end() )
{ {
proxy.sendSystemMessage("GUILD_NAME_ALREADY_EXISTS"); proxy.sendSystemMessage("GUILD_NAME_ALREADY_EXISTS");
return false; return false;
@ -1491,6 +1491,7 @@ bool CGuildManager::checkGuildStrings(CGuildCharProxy & proxy,const ucstring & n
return false; return false;
} }
// FIXME: Allow unicode guild names https://github.com/kaetemi/ryzomclassic/issues/187
if ( !isalpha(name[0]) || !isalpha(name[name.size()-1]) ) if ( !isalpha(name[0]) || !isalpha(name[name.size()-1]) )
{ {
proxy.sendSystemMessage("GUILD_NAME_BAD_CHAR"); proxy.sendSystemMessage("GUILD_NAME_BAD_CHAR");
@ -1512,6 +1513,7 @@ bool CGuildManager::checkGuildStrings(CGuildCharProxy & proxy,const ucstring & n
else else
{ {
prevBlank = false; prevBlank = false;
// FIXME: Allow unicode guild names https://github.com/kaetemi/ryzomclassic/issues/187
if (!isalpha (name[i])) if (!isalpha (name[i]))
{ {
proxy.sendSystemMessage("GUILD_NAME_BAD_CHAR"); proxy.sendSystemMessage("GUILD_NAME_BAD_CHAR");

@ -2726,8 +2726,8 @@ class CMissionActionFailMissionCat : public IMissionAction
MISLOGSYNTAXERROR("<mission_category>"); MISLOGSYNTAXERROR("<mission_category>");
return false; return false;
} }
_MissionCategory = NLMISC::toLower(CMissionParser::getNoBlankString(script[1])); _MissionCategory = NLMISC::toLowerAscii(CMissionParser::getNoBlankString(script[1]));
if (NLMISC::toLower(missionData.Template->MissionCategory) == _MissionCategory) if (NLMISC::toLowerAscii(missionData.Template->MissionCategory) == _MissionCategory)
{ {
MISLOGERROR1("a mission cannot make fail its own category '%s'", _MissionCategory.c_str()); MISLOGERROR1("a mission cannot make fail its own category '%s'", _MissionCategory.c_str());
return false; return false;
@ -2762,7 +2762,7 @@ class CMissionActionFailMissionCat : public IMissionAction
pMissTemplate = pMM->getTemplate(pMiss->getTemplateId()); pMissTemplate = pMM->getTemplate(pMiss->getTemplateId());
if (pMissTemplate != NULL) if (pMissTemplate != NULL)
{ {
if (NLMISC::toLower(pMissTemplate->MissionCategory) == _MissionCategory) if (NLMISC::toLowerAscii(pMissTemplate->MissionCategory) == _MissionCategory)
{ {
pMiss->onFailure(true, false); pMiss->onFailure(true, false);
bFailed = true; bFailed = true;
@ -2775,7 +2775,7 @@ class CMissionActionFailMissionCat : public IMissionAction
pMissTemplate = pMM->getTemplate(pMiss->getMainMissionTemplateId()); pMissTemplate = pMM->getTemplate(pMiss->getMainMissionTemplateId());
if (pMissTemplate != NULL) if (pMissTemplate != NULL)
{ {
if (NLMISC::toLower(pMissTemplate->MissionCategory) == _MissionCategory) if (NLMISC::toLowerAscii(pMissTemplate->MissionCategory) == _MissionCategory)
pMiss->onFailure(true, false); pMiss->onFailure(true, false);
} }
} }

@ -55,10 +55,10 @@ public:
_Modifier1 = modifier1; _Modifier1 = modifier1;
_Modifier2 = modifier2; _Modifier2 = modifier2;
if( NLMISC::toLower(_DefenseMode) == "dodge" ) if( NLMISC::toLowerAscii(_DefenseMode) == "dodge" )
_PowerType = POWERS::ModDodgeSkill; _PowerType = POWERS::ModDodgeSkill;
else else
if( NLMISC::toLower(_DefenseMode) == "parry" ) if( NLMISC::toLowerAscii(_DefenseMode) == "parry" )
_PowerType = POWERS::ModParrySkill; _PowerType = POWERS::ModParrySkill;
else else
_PowerType = POWERS::ModDefenseSkill; _PowerType = POWERS::ModDefenseSkill;

@ -2489,8 +2489,7 @@ static void mailNotification(const std::string& to, const std::string& from)
return; return;
// first, build a valid character (upper case first, then lower case); // first, build a valid character (upper case first, then lower case);
ucstring ucCharname = toLower(to); // lower case ucstring ucCharname = ucstring::makeFromUtf8(capitalize(to));
ucCharname[0] = toUpper(ucCharname[0]); // first upper case
// second, get char id that matches the name // second, get char id that matches the name
CEntityId charId = NLMISC::CEntityIdTranslator::getInstance()->getByEntity(ucCharname); CEntityId charId = NLMISC::CEntityIdTranslator::getInstance()->getByEntity(ucCharname);

@ -85,7 +85,7 @@ bool CStringManager::CParameterTraits::eval(CStringManager::TLanguages lang,cons
} }
uint32 stringId = ew.getStringId(rowIndex, colIndex); uint32 stringId = ew.getStringId(rowIndex, colIndex);
std::string str = NLMISC::toLower(SM->getString(stringId).toString()); std::string str = NLMISC::toLowerAscii(SM->getString(stringId).toString());
LOG("SM : (paramTraits) eval condition for property %s [%s] %s [%s]", cond.Property.c_str(), str.c_str(), OperatorNames[cond.Operator], cond.ReferenceStr.c_str()); LOG("SM : (paramTraits) eval condition for property %s [%s] %s [%s]", cond.Property.c_str(), str.c_str(), OperatorNames[cond.Operator], cond.ReferenceStr.c_str());
@ -583,11 +583,11 @@ public:
std::string op1; std::string op1;
if (cond.Property == "name") if (cond.Property == "name")
{ {
op1 = NLMISC::toLower(si.SheetName); op1 = NLMISC::toLowerAscii(si.SheetName);
} }
else if (cond.Property == "gender") else if (cond.Property == "gender")
{ {
op1 = NLMISC::toLower(GSGENDER::toString(si.Gender)); op1 = NLMISC::toLowerAscii(GSGENDER::toString(si.Gender));
} }
else else
{ {
@ -984,7 +984,7 @@ public:
return false; return false;
} }
const CStringManager::TSheetInfo &si = SM->getSheetInfo(sheetId); const CStringManager::TSheetInfo &si = SM->getSheetInfo(sheetId);
op1 = NLMISC::toLower(si.SheetName); op1 = NLMISC::toLowerAscii(si.SheetName);
} }
else if (cond.Property == "gender") else if (cond.Property == "gender")
{ {
@ -994,7 +994,7 @@ public:
nlwarning("Could not find character info for EId %s to check property %s", EId.toString().c_str(), cond.Property.c_str()); nlwarning("Could not find character info for EId %s to check property %s", EId.toString().c_str(), cond.Property.c_str());
return false; return false;
} }
op1 = NLMISC::toLower(GSGENDER::toString(charInfo->getGender())); op1 = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender()));
} }
else else
{ {
@ -1080,14 +1080,14 @@ public:
} }
else if (cond.Property == "role") else if (cond.Property == "role")
{ {
op1 = NLMISC::toLower(si.ChatProfile); op1 = NLMISC::toLowerAscii(si.ChatProfile);
} }
else if (cond.Property == "title") else if (cond.Property == "title")
{ {
// we need to retrieve the charInfo // we need to retrieve the charInfo
CCharacterInfos *ci = IOS->getCharInfos(EId); CCharacterInfos *ci = IOS->getCharInfos(EId);
if (ci != NULL) if (ci != NULL)
op1 = NLMISC::toLower(ci->Title); op1 = NLMISC::toLowerAscii(ci->Title);
else else
{ {
nlwarning("No character info for bot %s, can't test property 'title' !", EId.toString().c_str()); nlwarning("No character info for bot %s, can't test property 'title' !", EId.toString().c_str());
@ -1453,11 +1453,11 @@ public:
// check if checked property is gender or name // check if checked property is gender or name
if (cond.Property == "gender") if (cond.Property == "gender")
{ {
value = NLMISC::toLower(GSGENDER::toString(charInfo->getGender())); value = NLMISC::toLowerAscii(GSGENDER::toString(charInfo->getGender()));
} }
else if (cond.Property == "name") else if (cond.Property == "name")
{ {
value = NLMISC::toLower(charInfo->ShortName.toString()); value = NLMISC::toLowerAscii(charInfo->ShortName.toString());
} }
else else
{ {

@ -912,7 +912,7 @@ uint32 CStringManager::translateTitle(const std::string &title, TLanguages lang
{ {
const std::string colName("name"); const std::string colName("name");
const CStringManager::CEntityWords &ew = getEntityWords(language, STRING_MANAGER::title); const CStringManager::CEntityWords &ew = getEntityWords(language, STRING_MANAGER::title);
std::string rowName = NLMISC::toLower(title); std::string rowName = NLMISC::toLowerAscii(title);
uint32 stringId; uint32 stringId;
stringId = ew.getStringId(rowName, colName); stringId = ew.getStringId(rowName, colName);
@ -1198,7 +1198,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, mergeWordFile, "Merge a word file into
return false; return false;
std::string lang = args[0]; std::string lang = args[0];
std::string word = toLower(args[1]); std::string word = toLowerAscii(args[1]);
std::string file = args[2]; std::string file = args[2];
// get language // get language
@ -1215,7 +1215,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, mergeWordFile, "Merge a word file into
uint i; uint i;
for (i=0; i<typeNames.size(); ++i) for (i=0; i<typeNames.size(); ++i)
{ {
if (toLower(typeNames[i].second) == word) if (toLowerAscii(typeNames[i].second) == word)
{ {
wordType = typeNames[i].first; wordType = typeNames[i].first;
break; break;
@ -1260,7 +1260,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, displayEntityWords, "display entity wo
return false; return false;
std::string lang = args[0]; std::string lang = args[0];
std::string word = toLower(args[1]); std::string word = toLowerAscii(args[1]);
std::string wc; std::string wc;
if (args.size() == 3) if (args.size() == 3)
@ -1280,7 +1280,7 @@ NLMISC_CATEGORISED_COMMAND(stringmanager, displayEntityWords, "display entity wo
uint i; uint i;
for (i=0; i<typeNames.size(); ++i) for (i=0; i<typeNames.size(); ++i)
{ {
if (toLower(typeNames[i].second) == word) if (toLowerAscii(typeNames[i].second) == word)
{ {
wordType = typeNames[i].first; wordType = typeNames[i].first;
break; break;

@ -436,7 +436,7 @@ CStringManager::CEntityWords CStringManager::parseEntityWords(const ucstring &st
for (i=1; i<ws.size(); ++i) for (i=1; i<ws.size(); ++i)
{ {
// on the first col, we uncapitalize the id // on the first col, we uncapitalize the id
ws.setData(i, 0, ucstring(NLMISC::toLower(ws.getData(i, 0).toString()))); ws.setData(i, 0, ucstring(NLMISC::toLowerAscii(ws.getData(i, 0).toString())));
ew._RowInfo.insert(make_pair(ws.getData(i, 0).toString(), i-1)); ew._RowInfo.insert(make_pair(ws.getData(i, 0).toString(), i-1));
for (uint j=0; j<ws.ColCount; ++j) for (uint j=0; j<ws.ColCount; ++j)
@ -810,7 +810,7 @@ bool CStringManager::parseTag(const CPhrase &phrase, const ucstring &tag, TRepla
nlwarning("Error reading tag property in the tag [%s]", tag.toString().c_str()); nlwarning("Error reading tag property in the tag [%s]", tag.toString().c_str());
return false; return false;
} }
spec = NLMISC::toLower(spec); spec = NLMISC::toLowerAscii(spec);
} }
else else
spec = "name"; spec = "name";
@ -1106,7 +1106,7 @@ bool CStringManager::parseParamList(ucstring::const_iterator &it, ucstring::cons
nlwarning("Error parsing parameter %u type in param list", count); nlwarning("Error parsing parameter %u type in param list", count);
return false; return false;
} }
type = NLMISC::toLower(type); type = NLMISC::toLowerAscii(type);
NLMISC::CI18N::skipWhiteSpace(it, last); NLMISC::CI18N::skipWhiteSpace(it, last);
if (!NLMISC::CI18N::parseLabel(it, last, name)) if (!NLMISC::CI18N::parseLabel(it, last, name))
@ -1543,12 +1543,12 @@ void CStringManager::setEntityWord(const std::string& path, const ucstring& valu
if ((end = path.find('.', start)) == string::npos) if ((end = path.find('.', start)) == string::npos)
return; return;
string lang = toLower(path.substr(start, end-start)); string lang = toLowerAscii(path.substr(start, end-start));
start = end+1; start = end+1;
if ((end = path.find('.', start)) == string::npos) if ((end = path.find('.', start)) == string::npos)
return; return;
string wordentity = toLower(path.substr(start, end-start)); string wordentity = toLowerAscii(path.substr(start, end-start));
start = end+1; start = end+1;
if ((end = path.find('.', start)) == string::npos) if ((end = path.find('.', start)) == string::npos)
@ -1559,14 +1559,14 @@ void CStringManager::setEntityWord(const std::string& path, const ucstring& valu
string det = path.substr(start); string det = path.substr(start);
TLanguages language = checkLanguageCode(lang); TLanguages language = checkLanguageCode(lang);
if (toLower(getLanguageCodeString(language)) != lang) if (toLowerAscii(getLanguageCodeString(language)) != lang)
return; return;
TParameterTraitList typeNames = CParameterTraits::getParameterTraitsNames(); TParameterTraitList typeNames = CParameterTraits::getParameterTraitsNames();
uint i; uint i;
for (i=0; i<typeNames.size(); ++i) for (i=0; i<typeNames.size(); ++i)
if (toLower(typeNames[i].second) == wordentity) if (toLowerAscii(typeNames[i].second) == wordentity)
break; break;
if (i >= typeNames.size()) if (i >= typeNames.size())

@ -602,7 +602,7 @@ NLMISC_CATEGORISED_COMMAND(pd_log, displayTableDescription,
useFile = logpath + args[2]; useFile = logpath + args[2];
} }
std::string tableName = toLower(args[1]); std::string tableName = toLowerAscii(args[1]);
CDBDescriptionParser desc; CDBDescriptionParser desc;
if (!desc.loadDescriptionFile(logpath + useFile)) if (!desc.loadDescriptionFile(logpath + useFile))
@ -612,7 +612,7 @@ NLMISC_CATEGORISED_COMMAND(pd_log, displayTableDescription,
uint i; uint i;
for (i=0; i<db.Tables.size(); ++i) for (i=0; i<db.Tables.size(); ++i)
if (toLower(db.Tables[i].Name) == tableName) if (toLowerAscii(db.Tables[i].Name) == tableName)
break; break;
if (i == db.Tables.size()) if (i == db.Tables.size())

@ -98,7 +98,7 @@ void CHoFGenerator::serviceUpdate()
{ {
const string & fileName = files[i]; const string & fileName = files[i];
if (toLower(CFile::getExtension(fileName)) == "hdt") if (toLowerAscii(CFile::getExtension(fileName)) == "hdt")
{ {
_HDTFiles.push_back(fileName); _HDTFiles.push_back(fileName);
} }

@ -207,7 +207,7 @@ void CMailForumService::checkFile(const std::string& file)
string getUserDirectory(uint32 shardid, const string& userName) string getUserDirectory(uint32 shardid, const string& userName)
{ {
string un = toLower(CMailForumValidator::nameToFile(userName)); string un = toCaseInsensitive(CMailForumValidator::nameToFile(userName));
string dir = CPath::standardizePath(WebRootDirectory)+toString(shardid)+"/"+un.substr(0, 2)+"/"+un+"/"; string dir = CPath::standardizePath(WebRootDirectory)+toString(shardid)+"/"+un.substr(0, 2)+"/"+un+"/";
@ -222,7 +222,7 @@ string getUserDirectory(uint32 shardid, const string& userName)
string getGuildDirectory(uint32 shardid, const string &guildName) string getGuildDirectory(uint32 shardid, const string &guildName)
{ {
string un = toLower(CMailForumValidator::nameToFile(guildName)); string un = toCaseInsensitive(CMailForumValidator::nameToFile(guildName));
string dir = CPath::standardizePath(WebRootDirectory)+toString(shardid)+"/"+un.substr(0, 2)+"/"+un+"/"; string dir = CPath::standardizePath(WebRootDirectory)+toString(shardid)+"/"+un.substr(0, 2)+"/"+un+"/";

@ -35,7 +35,7 @@ CPDStringMapper::CPDStringMapper()
*/ */
void CPDStringMapper::setMapping(const std::string& str, uint32 id) void CPDStringMapper::setMapping(const std::string& str, uint32 id)
{ {
std::string lowMapStr = NLMISC::toLower(str); std::string lowMapStr = NLMISC::toLowerAscii(str);
TStringMap::iterator its; TStringMap::iterator its;
TIdMap::iterator iti = _IdMap.find(id); TIdMap::iterator iti = _IdMap.find(id);

@ -106,7 +106,7 @@ inline const std::string& CPDStringMapper::getString(uint32 id) const
*/ */
inline uint32 CPDStringMapper::getId(const std::string& str) const inline uint32 CPDStringMapper::getId(const std::string& str) const
{ {
std::string lowMapStr = NLMISC::toLower(str); std::string lowMapStr = NLMISC::toLowerAscii(str);
TStringMap::const_iterator it = _StringMap.find(lowMapStr); TStringMap::const_iterator it = _StringMap.find(lowMapStr);
return (it == _StringMap.end()) ? UnknownString : (*it).second; return (it == _StringMap.end()) ? UnknownString : (*it).second;

@ -115,7 +115,7 @@ namespace ENTITYLOC
struct TCharInfo struct TCharInfo
{ {
TShardId ShardId; TShardId ShardId;
ucstring CharName; std::string CharName;
}; };
typedef map<TModuleProxyPtr, TShardId> TLocatorClient; typedef map<TModuleProxyPtr, TShardId> TLocatorClient;
@ -134,7 +134,7 @@ namespace ENTITYLOC
// current connected character // current connected character
TCharMap _ConnectedChars; TCharMap _ConnectedChars;
typedef CHashMap<ucstring, TCharId, CUCStringHashMapTraits> TCharNameMap; typedef CHashMap<std::string, TCharId> TCharNameMap;
// Index of connected character by name // Index of connected character by name
TCharNameMap _ConnectedCharsByName; TCharNameMap _ConnectedCharsByName;
@ -285,7 +285,7 @@ namespace ENTITYLOC
TCharMap::iterator next = first; TCharMap::iterator next = first;
++next; ++next;
// erase the name mapping // erase the name mapping
_ConnectedCharsByName.erase(toLower(first->second.CharName)); _ConnectedCharsByName.erase(toCaseInsensitive(first->second.CharName));
// erase the connected char info // erase the connected char info
_ConnectedChars.erase(first); _ConnectedChars.erase(first);
// add it to the (dis)connection event list // add it to the (dis)connection event list
@ -394,7 +394,7 @@ namespace ENTITYLOC
NLNET::IModuleProxy *getLocatorModuleForChar(const ucstring &charName) NLNET::IModuleProxy *getLocatorModuleForChar(const ucstring &charName)
{ {
TCharNameMap::iterator it(_ConnectedCharsByName.find(toLower(charName))); TCharNameMap::iterator it(_ConnectedCharsByName.find(toCaseInsensitive(charName.toUtf8()))); // FIXME: UTF-8
if (it == _ConnectedCharsByName.end()) if (it == _ConnectedCharsByName.end())
{ {
// not online // not online
@ -411,7 +411,7 @@ namespace ENTITYLOC
uint32 getShardIdForChar(const ucstring &charName) uint32 getShardIdForChar(const ucstring &charName)
{ {
TCharNameMap::iterator it(_ConnectedCharsByName.find(toLower(charName))); TCharNameMap::iterator it(_ConnectedCharsByName.find(toCaseInsensitive(charName.toUtf8()))); // FIXME: UTF-8
if (it == _ConnectedCharsByName.end()) if (it == _ConnectedCharsByName.end())
{ {
// not online // not online
@ -447,7 +447,7 @@ namespace ENTITYLOC
void onCharacterNameUpdated(uint32 charId, const std::string &oldName, const std::string &newName) void onCharacterNameUpdated(uint32 charId, const std::string &oldName, const std::string &newName)
{ {
// lookup this char in online players map // lookup this char in online players map
TCharNameMap::iterator it(_ConnectedCharsByName.find(toLower(oldName))); TCharNameMap::iterator it(_ConnectedCharsByName.find(toCaseInsensitive(oldName)));
if (it != _ConnectedCharsByName.end()) if (it != _ConnectedCharsByName.end())
{ {
@ -455,7 +455,7 @@ namespace ENTITYLOC
nlassert(charId == it->second); nlassert(charId == it->second);
_ConnectedCharsByName.erase(it); _ConnectedCharsByName.erase(it);
_ConnectedCharsByName.insert(make_pair(toLower(newName), charId)); _ConnectedCharsByName.insert(make_pair(toCaseInsensitive(newName), charId));
} }
} }
@ -617,7 +617,7 @@ namespace ENTITYLOC
_ConnectedChars.insert(make_pair(charId, ci)); _ConnectedChars.insert(make_pair(charId, ci));
// store char by name info // store char by name info
_ConnectedCharsByName.insert(make_pair(toLower(ci.CharName), charId)); _ConnectedCharsByName.insert(make_pair(toCaseInsensitive(ci.CharName), charId));
} }
// load the nel user to read privileges // load the nel user to read privileges
@ -683,7 +683,7 @@ namespace ENTITYLOC
else else
{ {
// erase the information // erase the information
_ConnectedCharsByName.erase(toLower(it->second.CharName)); _ConnectedCharsByName.erase(toCaseInsensitive(it->second.CharName));
_ConnectedChars.erase(it); _ConnectedChars.erase(it);
} }
@ -887,7 +887,7 @@ namespace ENTITYLOC
{ {
log.displayNL(" Character %u '%s' [%u:%u] connected on shard %u", log.displayNL(" Character %u '%s' [%u:%u] connected on shard %u",
first->first, first->first,
first->second.CharName.toUtf8().c_str(), first->second.CharName.c_str(),
first->first>>4, first->first>>4,
first->first&0xf, first->first&0xf,
first->second.ShardId); first->second.ShardId);

@ -584,7 +584,7 @@ namespace RSMGR
for (uint i=0; i<userAccessPriv.size(); ++i) for (uint i=0; i<userAccessPriv.size(); ++i)
{ {
string access("ds_"); string access("ds_");
access += toLower(userAccessPriv[i]); access += toLowerAscii(userAccessPriv[i]);
if (accessLevel.toString() == access) if (accessLevel.toString() == access)
return true; return true;
@ -1983,7 +1983,7 @@ endOfWelcomeUserResult:
// check the permission of the player // check the permission of the player
for (uint i=0; i<userAccessPriv.size(); ++i) for (uint i=0; i<userAccessPriv.size(); ++i)
{ {
if (_DontUsePerm || string("ds_")+toLower(userAccessPriv[i]) == shard->getRequiredState().toString()) if (_DontUsePerm || string("ds_")+toLowerAscii(userAccessPriv[i]) == shard->getRequiredState().toString())
{ {
// ok, this one is accessible // ok, this one is accessible
// this server is better (i.e had less player in it) // this server is better (i.e had less player in it)
@ -4323,7 +4323,7 @@ endOfWelcomeUserResult:
} }
} }
TAccessLevel al = string("ds_")+toLower(args[1]); TAccessLevel al = string("ds_")+toLowerAscii(args[1]);
if (al == TAccessLevel::invalid_val) if (al == TAccessLevel::invalid_val)
{ {
log.displayNL("Invalid access state '%s'", args[1].c_str()); log.displayNL("Invalid access state '%s'", args[1].c_str());

Loading…
Cancel
Save