Explicitly use toLowerAscii for filenames and identifiers

develop
kaetemi 4 years ago
parent 8809d39835
commit c770191bef

@ -212,8 +212,8 @@ int main(int argc, char *argv[])
for(j=0;j<LodFilters.size();j++) for(j=0;j<LodFilters.size();j++)
{ {
// Make the test case-unsensitive // Make the test case-unsensitive
string lwrFileName= toLower(fileNameIn); string lwrFileName= toLowerAscii(fileNameIn);
string lwrFilter= toLower(LodFilters[j]); string lwrFilter= toLowerAscii(LodFilters[j]);
if( testWildCard(lwrFileName.c_str(), lwrFilter.c_str()) ) if( testWildCard(lwrFileName.c_str(), lwrFilter.c_str()) )
{ {
string clodFile= clod_dir_in+"/"+LodNames[j]+".clod"; string clodFile= clod_dir_in+"/"+LodNames[j]+".clod";

@ -180,7 +180,7 @@ bool writeFileDependingOnFilename(const std::string &filename, CBitmap &bitmap)
if (out.open(filename)) if (out.open(filename))
{ {
if (toLower(filename).find(".png") != string::npos) if (toLowerAscii(filename).find(".png") != string::npos)
{ {
bitmap.writePNG(out, 32); bitmap.writePNG(out, 32);
} }
@ -583,7 +583,7 @@ int main(int argc, char **argv)
continue; continue;
} }
sTGAname = toLower(string(tgaName)); sTGAname = toLowerAscii(string(tgaName));
// search position of extension // search position of extension
std::string tgaExt = CFile::getExtension(sTGAname); std::string tgaExt = CFile::getExtension(sTGAname);
@ -597,7 +597,7 @@ int main(int argc, char **argv)
for (i = 0; i < mapSize; ++i) for (i = 0; i < mapSize; ++i)
{ {
// get the string whitout path // get the string whitout path
findTGAName = toLower(CFile::getFilenameWithoutExtension(AllMapNames[i])); findTGAName = toLowerAscii(CFile::getFilenameWithoutExtension(AllMapNames[i]));
if( findTGAName == sTGAname ) if( findTGAName == sTGAname )
break; break;
} }

@ -353,7 +353,7 @@ int main(int nNbArg, char**ppArgs)
vector<string> vAllFiles; vector<string> vAllFiles;
for(uint i = 0, len = (uint)vAllFilesUnfiltered.size(); i < len; ++i) for(uint i = 0, len = (uint)vAllFilesUnfiltered.size(); i < len; ++i)
{ {
if (toLower(CFile::getExtension(vAllFilesUnfiltered[i])) == "ig") if (toLowerAscii(CFile::getExtension(vAllFilesUnfiltered[i])) == "ig")
{ {
vAllFiles.push_back(vAllFilesUnfiltered[i]); vAllFiles.push_back(vAllFilesUnfiltered[i]);
} }

@ -170,7 +170,7 @@ void CIgLighterLib::lightIg(CInstanceLighter &instanceLighter,
string name= igIn.getShapeName(i); string name= igIn.getShapeName(i);
bool shapeFound= true; bool shapeFound= true;
if (toLower (CFile::getExtension (name)) == "pacs_prim") if (toLowerAscii (CFile::getExtension (name)) == "pacs_prim")
{ {
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str()); nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str());
continue; continue;

@ -481,7 +481,7 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT); CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL) if (pTF != NULL)
{ {
string sTexName = NLMISC::toLower(pTF->getFileName()); string sTexName = NLMISC::toLowerAscii(pTF->getFileName());
if(pTF->getUploadFormat()==ITexture::Luminance) if(pTF->getUploadFormat()==ITexture::Luminance)
setLM8Bit.insert(sTexName); setLM8Bit.insert(sTexName);
} }
@ -530,7 +530,7 @@ int main(int nNbArg, char **ppArgs)
tmpLMs.clear(); tmpLMs.clear();
for (i = 0; i < (sint32)AllLightmapNames.size(); ++i) for (i = 0; i < (sint32)AllLightmapNames.size(); ++i)
{ {
bool lm8Bit= setLM8Bit.find( NLMISC::toLower(AllLightmapNames[i]) ) !=setLM8Bit.end(); bool lm8Bit= setLM8Bit.find( NLMISC::toLowerAscii(AllLightmapNames[i]) ) !=setLM8Bit.end();
// if same mode // if same mode
if( lm8Bit == (lmc8bitMode==1) ) if( lm8Bit == (lmc8bitMode==1) )
{ {
@ -824,13 +824,13 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT); CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL) if (pTF != NULL)
{ {
string sTexName = NLMISC::toLower(getBaseName(pTF->getFileName())); string sTexName = NLMISC::toLowerAscii(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::toLower(getBaseName(AllLightmapNames[i])); string sTexNameMoved = NLMISC::toLowerAscii(getBaseName(AllLightmapNames[i]));
if (sTexName == sTexNameMoved) if (sTexName == sTexNameMoved)
{ {
// We must remap the name and indicate to remap uvs // We must remap the name and indicate to remap uvs
bMustRemapUV = true; bMustRemapUV = true;
//string sNewTexName = NLMISC::toLower(getBaseName(AllLightmapNames[j])); //string sNewTexName = NLMISC::toLowerAscii(getBaseName(AllLightmapNames[j]));
//sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga"; //sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga";
//pTF->setFileName (sNewTexName); //pTF->setFileName (sNewTexName);
} }
@ -891,11 +891,11 @@ int main(int nNbArg, char **ppArgs)
CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT); CTextureFile *pTF = dynamic_cast<CTextureFile*>(pIT);
if (pTF != NULL) if (pTF != NULL)
{ {
string sTexName = NLMISC::toLower(getBaseName(pTF->getFileName())); string sTexName = NLMISC::toLowerAscii(getBaseName(pTF->getFileName()));
string sTexNameMoved = NLMISC::toLower(getBaseName(AllLightmapNames[i])); string sTexNameMoved = NLMISC::toLowerAscii(getBaseName(AllLightmapNames[i]));
if (sTexName == sTexNameMoved) if (sTexName == sTexNameMoved)
{ {
string sNewTexName = NLMISC::toLower(getBaseName(AllLightmapNames[j])); string sNewTexName = NLMISC::toLowerAscii(getBaseName(AllLightmapNames[j]));
sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga"; sNewTexName += NLMISC::toString(getLayerNb(pTF->getFileName())) + ".tga";
pTF->setFileName (sNewTexName); pTF->setFileName (sNewTexName);
} }

@ -3696,7 +3696,7 @@ void CObjectViewer::shootScene()
string extension = NLMISC::CFile::getExtension (tStrToUtf8(fileDlg.GetPathName())); string extension = NLMISC::CFile::getExtension (tStrToUtf8(fileDlg.GetPathName()));
// The file name without extension // The file name without extension
bool jpeg = toLower (extension) == "jpg"; bool jpeg = toLowerAscii (extension) == "jpg";
// Activate the driver // Activate the driver
CNELU::Driver->activate (); CNELU::Driver->activate ();

@ -458,7 +458,7 @@ void CSnapshotToolDlg::OnGo()
CString wildCard; CString wildCard;
m_Filters.GetText(l, wildCard); m_Filters.GetText(l, wildCard);
wildCard.MakeLower(); wildCard.MakeLower();
if (testWildCard(toLower(NLMISC::CFile::getFilename(files[k])).c_str(), tStrToUtf8(wildCard).c_str())) if (testWildCard(toLowerAscii(NLMISC::CFile::getFilename(files[k])).c_str(), tStrToUtf8(wildCard).c_str()))
{ {
_FilteredFiles.push_back(files[k]); _FilteredFiles.push_back(files[k]);
break; break;

@ -325,7 +325,7 @@ int main(int argc, char* argv[])
NLMISC::CConfigFile::CVar &bitmap_extensions = cf.getVar ("bitmap_extensions"); NLMISC::CConfigFile::CVar &bitmap_extensions = cf.getVar ("bitmap_extensions");
for (uint k = 0; k < (uint) bitmap_extensions.size(); ++k) for (uint k = 0; k < (uint) bitmap_extensions.size(); ++k)
{ {
std::string ext = "." + NLMISC::toLower(bitmap_extensions.asString(k)); std::string ext = "." + NLMISC::toLowerAscii(bitmap_extensions.asString(k));
if (std::find(bi.BitmapExtensions.begin(), bi.BitmapExtensions.end(), ext) == bi.BitmapExtensions.end()) if (std::find(bi.BitmapExtensions.begin(), bi.BitmapExtensions.end(), ext) == bi.BitmapExtensions.end())
{ {
bi.BitmapExtensions.push_back(ext); bi.BitmapExtensions.push_back(ext);
@ -483,7 +483,7 @@ static void BuildColoredVersions(const CBuildInfo &bi)
{ {
for (uint l = 0; l < bi.BitmapExtensions.size(); ++l) for (uint l = 0; l < bi.BitmapExtensions.size(); ++l)
{ {
std::string fileExt = "." + NLMISC::toLower(NLMISC::CFile::getExtension(files[k])); std::string fileExt = "." + NLMISC::toLowerAscii(NLMISC::CFile::getExtension(files[k]));
if (fileExt == bi.BitmapExtensions[l]) if (fileExt == bi.BitmapExtensions[l])
{ {
//nlwarning("Processing : %s ", files[k].c_str()); //nlwarning("Processing : %s ", files[k].c_str());
@ -532,7 +532,7 @@ static bool CheckIfNeedRebuildColoredVersionForOneBitmap(const CBuildInfo &bi, c
masks.clear(); masks.clear();
std::string fileName = NLMISC::CFile::getFilenameWithoutExtension(fileNameWithExtension); std::string fileName = NLMISC::CFile::getFilenameWithoutExtension(fileNameWithExtension);
std::string fileExt = NLMISC::toLower(NLMISC::CFile::getExtension(fileNameWithExtension)); std::string fileExt = NLMISC::toLowerAscii(NLMISC::CFile::getExtension(fileNameWithExtension));
for (uint k = 0; k < bi.ColorMasks.size(); ++k) for (uint k = 0; k < bi.ColorMasks.size(); ++k)
{ {
@ -721,7 +721,7 @@ static void BuildColoredVersionForOneBitmap(const CBuildInfo &bi, const std::str
masks.clear(); masks.clear();
std::string fileName = NLMISC::CFile::getFilenameWithoutExtension(fileNameWithExtension); std::string fileName = NLMISC::CFile::getFilenameWithoutExtension(fileNameWithExtension);
std::string fileExt = NLMISC::toLower(NLMISC::CFile::getExtension(fileNameWithExtension)); std::string fileExt = NLMISC::toLowerAscii(NLMISC::CFile::getExtension(fileNameWithExtension));
uint k; uint k;
for (k = 0; k < bi.ColorMasks.size(); ++k) for (k = 0; k < bi.ColorMasks.size(); ++k)

@ -169,7 +169,7 @@ sint main(int argc, char **argv)
if (filenames[i].find(".max") == std::string::npos) if (filenames[i].find(".max") == std::string::npos)
continue; continue;
std::string baseFilename = toLower(CFile::getFilenameWithoutExtension(filenames[i])); std::string baseFilename = toLowerAscii(CFile::getFilenameWithoutExtension(filenames[i]));
// compute the md5 of .max file // compute the md5 of .max file
std::string md5 = getNewMD5(filenames[i]).toString(); std::string md5 = getNewMD5(filenames[i]).toString();

@ -104,7 +104,7 @@ bool parseOptions(int argc, char **argv)
// Filename // Filename
else else
{ {
std::string ext = NLMISC::toLower(NLMISC::CFile::getExtension(option)); std::string ext = NLMISC::toLowerAscii(NLMISC::CFile::getExtension(option));
if (ext == "png" || ext == "tga") if (ext == "png" || ext == "tga")
{ {
@ -135,7 +135,7 @@ int main(int argc, char **argv)
for(uint i = 0; i < InputFilenames.size(); ++i) for(uint i = 0; i < InputFilenames.size(); ++i)
{ {
std::string ext = NLMISC::toLower(NLMISC::CFile::getExtension(InputFilenames[i])); std::string ext = NLMISC::toLowerAscii(NLMISC::CFile::getExtension(InputFilenames[i]));
NLMISC::CIFile input; NLMISC::CIFile input;

@ -327,10 +327,10 @@ int main(int argc, char **argv)
if (args.haveArg("a")) if (args.haveArg("a"))
{ {
std::string strAlgo = args.getArg("a").front(); std::string strAlgo = toLowerAscii(args.getArg("a").front());
if (strAlgo == "1") OptAlgo = DXT1; if (strAlgo == "1") OptAlgo = DXT1;
else if (toLower(strAlgo) == "1a") OptAlgo = DXT1A; else if (strAlgo == "1a") OptAlgo = DXT1A;
else if (strAlgo == "3") OptAlgo = DXT3; else if (strAlgo == "3") OptAlgo = DXT3;
else if (strAlgo == "5") OptAlgo = DXT5; else if (strAlgo == "5") OptAlgo = DXT5;
else if (strAlgo == "tga8") OptAlgo = TGA8; else if (strAlgo == "tga8") OptAlgo = TGA8;

@ -525,7 +525,7 @@ int main (int argc, char* argv[])
// Write the dependencies file // Write the dependencies file
FILE *outputFile; FILE *outputFile;
if ((outputFile = nlfopen (toLower (outputFileName), "w"))) if ((outputFile = nlfopen (toLowerAscii (outputFileName), "w")))
{ {
// Add a dependency entry // Add a dependency entry
fprintf (outputFile, "dependencies =\n{\n"); fprintf (outputFile, "dependencies =\n{\n");
@ -540,7 +540,7 @@ int main (int argc, char* argv[])
// Write it // Write it
string message="\t\""+zoneName+"\""; string message="\t\""+zoneName+"\"";
fprintf (outputFile, "%s", toLower (message).c_str()); fprintf (outputFile, "%s", toLowerAscii (message).c_str());
// Next ite; // Next ite;
ite++; ite++;
@ -615,7 +615,7 @@ static void computeIGBBox(const NL3D::CInstanceGroup &ig, CLightingBBox &result,
{ {
nlwarning("Unable to find shape '%s'", it->Name.c_str()); nlwarning("Unable to find shape '%s'", it->Name.c_str());
} }
else if (toLower (CFile::getExtension (shapePathName)) == "pacs_prim") else if (toLowerAscii (CFile::getExtension (shapePathName)) == "pacs_prim")
{ {
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", shapePathName.c_str()); nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", shapePathName.c_str());
} }
@ -711,7 +711,7 @@ static void computeIGBBox(const NL3D::CInstanceGroup &ig, CLightingBBox &result,
static void computeZoneIGBBox(const char *zoneName, CLightingBBox &result, TShapeMap &shapeMap, const TString2LightingBBox &additionnalIG) static void computeZoneIGBBox(const char *zoneName, CLightingBBox &result, TShapeMap &shapeMap, const TString2LightingBBox &additionnalIG)
{ {
result = CLightingBBox(); // starts with a void box result = CLightingBBox(); // starts with a void box
std::string lcZoneName = NLMISC::toLower(std::string(zoneName)); std::string lcZoneName = NLMISC::toLowerAscii(std::string(zoneName));
TString2LightingBBox::const_iterator zoneIt = additionnalIG.find(lcZoneName); TString2LightingBBox::const_iterator zoneIt = additionnalIG.find(lcZoneName);
if (zoneIt != additionnalIG.end()) if (zoneIt != additionnalIG.end())
{ {
@ -901,7 +901,7 @@ static void computeIGBBoxFromContinent(NLMISC::CConfigFile &parameter,
nlwarning("Couldn't get zone name of village %d in continent %s", continentName.c_str(), k); nlwarning("Couldn't get zone name of village %d in continent %s", continentName.c_str(), k);
continue; continue;
} }
zoneName = NLMISC::toLower(CFile::getFilenameWithoutExtension(zoneName)); zoneName = NLMISC::toLowerAscii(CFile::getFilenameWithoutExtension(zoneName));
CLightingBBox result; CLightingBBox result;
// ok, it is in the dependant zones // ok, it is in the dependant zones
computeBBoxFromVillage(currVillage, continentName, k, shapeMap, result); computeBBoxFromVillage(currVillage, continentName, k, shapeMap, result);

@ -105,7 +105,7 @@ bool getXYFromZoneName(sint32 &x, sint32 &y, const string &zoneName)
} }
if (xStr.size() != 2) if (xStr.size() != 2)
goto Fail; goto Fail;
xStr = NLMISC::toUpper(xStr); xStr = NLMISC::toUpperAscii(xStr);
x = ((xStr[0] - 'A') * 26 + (xStr[1] - 'A')); x = ((xStr[0] - 'A') * 26 + (xStr[1] - 'A'));
return true; return true;
Fail: Fail:

@ -116,7 +116,7 @@ int main(int argc, char* argv[])
if (inputFile.open (argv[1])) if (inputFile.open (argv[1]))
{ {
// Zone name // Zone name
string zoneName=toLower (string ("zone_"+getName (argv[1]))); string zoneName=toLowerAscii (string ("zone_"+getName (argv[1])));
// Load the zone // Load the zone
try try
@ -413,7 +413,7 @@ int main(int argc, char* argv[])
if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior) if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior)
continue; continue;
if (toLower (CFile::getExtension (name)) == "pacs_prim") if (toLowerAscii (CFile::getExtension (name)) == "pacs_prim")
{ {
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str()); nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str());
continue; continue;

@ -140,7 +140,7 @@ static void loadIGFromVillage(const NLGEORGES::UFormElm *villageItem, const std:
// verify that the ig is not already added (case of tr_water.ig in additional_igs) // verify that the ig is not already added (case of tr_water.ig in additional_igs)
for(uint igAdd= 0;igAdd<(uint)additionalIgNames.size();igAdd++) for(uint igAdd= 0;igAdd<(uint)additionalIgNames.size();igAdd++)
{ {
if( toLower(additionalIgNames.asString()) == toLower(igName) ) if( toLowerAscii(additionalIgNames.asString()) == toLower(igName) )
{ {
nlwarning("Skipping Village Ig %s, cause already exist in additional ig", igName.c_str()); nlwarning("Skipping Village Ig %s, cause already exist in additional ig", igName.c_str());
continue; continue;
@ -315,7 +315,7 @@ int main(int argc, char* argv[])
if (inputFile.open (argv[1])) if (inputFile.open (argv[1]))
{ {
// Zone name // Zone name
string zoneName=toLower (string ("zone_"+getName (argv[1]))); string zoneName=toLowerAscii (string ("zone_"+getName (argv[1])));
// Load the zone // Load the zone
try try
@ -702,14 +702,14 @@ int main(int argc, char* argv[])
if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior) if(group->getInstance(instance).DontCastShadow || group->getInstance(instance).DontCastShadowForExterior)
continue; continue;
if (toLower (CFile::getExtension (name)) == "pacs_prim") if (toLowerAscii (CFile::getExtension (name)) == "pacs_prim")
{ {
nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str()); nlwarning("EXPORT BUG: Can't read %s (not a shape), should not be part of .ig!", name.c_str());
continue; continue;
} }
// PS ? // PS ?
if (toLower (CFile::getExtension (name)) == "ps") if (toLowerAscii (CFile::getExtension (name)) == "ps")
continue; continue;
// Add a .shape at the end ? // Add a .shape at the end ?

@ -738,7 +738,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
} }
else if ( nlstricmp( fields[i], "parent" ) == 0 ) else if ( nlstricmp( fields[i], "parent" ) == 0 )
{ {
fields[i] = toLower( fields[i] ); fields[i] = toLowerAscii( fields[i] );
} }
else else
{ {
@ -883,7 +883,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
{ {
filebase += "." + sheetType; filebase += "." + sheetType;
} }
filebase = toLower(filebase); filebase = toLowerAscii(filebase);
string filename, dirbase; string filename, dirbase;
bool isNewSheet=true; bool isNewSheet=true;
@ -905,7 +905,7 @@ void convertCsvFile( const string &file, bool generate, const string& sheetType
else else
{ {
// Load template sheet // Load template sheet
filename = toLower(filebase); filename = toLowerAscii(filebase);
form = (CForm*)formLoader->loadForm( (string("_empty.") + sheetType).c_str() ); form = (CForm*)formLoader->loadForm( (string("_empty.") + sheetType).c_str() );
if (form == NULL) if (form == NULL)
{ {

@ -104,7 +104,7 @@ bool getXYFromZoneName(sint32 &x, sint32 &y, const string &zoneName)
} }
if (xStr.size() != 2) if (xStr.size() != 2)
goto Fail; goto Fail;
xStr = NLMISC::toUpper(xStr); xStr = NLMISC::toUpperAscii(xStr);
x = ((xStr[0] - 'A') * 26 + (xStr[1] - 'A')); x = ((xStr[0] - 'A') * 26 + (xStr[1] - 'A'));
return true; return true;
Fail: Fail:

@ -56,7 +56,7 @@ bool keepFile (const std::string &fileName)
uint i; uint i;
bool ifPresent = false; bool ifPresent = false;
bool ifTrue = false; bool ifTrue = false;
string file = toLower(CFile::getFilename (fileName)); string file = toLowerAscii(CFile::getFilename (fileName));
for (i=0; i<WildCards.size(); i++) for (i=0; i<WildCards.size(); i++)
{ {
if (WildCards[i].Not) if (WildCards[i].Not)
@ -100,7 +100,7 @@ bool packSubRecurse(const std::string &srcDirectory)
// check for files with same name // check for files with same name
for(uint i = 1, len = pathContent.size(); i < len; ++i) for(uint i = 1, len = pathContent.size(); i < len; ++i)
{ {
if (toLower(CFile::getFilename(pathContent[i-1])) == toLower(CFile::getFilename(pathContent[i]))) if (toLowerAscii(CFile::getFilename(pathContent[i-1])) == toLowerAscii(CFile::getFilename(pathContent[i])))
{ {
nlwarning("File %s is not unique in BNP!", CFile::getFilename(pathContent[i]).c_str()); nlwarning("File %s is not unique in BNP!", CFile::getFilename(pathContent[i]).c_str());
return false; return false;
@ -152,7 +152,7 @@ int main(int argc, char **argv)
for (uint i = 0; i < filters.size(); ++i) for (uint i = 0; i < filters.size(); ++i)
{ {
CWildCard card; CWildCard card;
card.Expression = toLower(filters[i]); card.Expression = toLowerAscii(filters[i]);
card.Not = false; card.Not = false;
WildCards.push_back(card); WildCards.push_back(card);
} }
@ -163,7 +163,7 @@ int main(int argc, char **argv)
for (uint i = 0; i < filters.size(); ++i) for (uint i = 0; i < filters.size(); ++i)
{ {
CWildCard card; CWildCard card;
card.Expression = toLower(filters[i]); card.Expression = toLowerAscii(filters[i]);
card.Not = true; card.Not = true;
WildCards.push_back(card); WildCards.push_back(card);
} }

@ -108,21 +108,21 @@ BOOL CData_mirrorApp::InitInstance()
cf.load (path); cf.load (path);
MainDirectory = cf.getVar ("MainDirectory").asString (); MainDirectory = cf.getVar ("MainDirectory").asString ();
MainDirectory = toLower (CPath::standardizePath (MainDirectory)); MainDirectory = toLowerAscii (CPath::standardizePath (MainDirectory));
MirrorDirectory = cf.getVar ("MirrorDirectory").asString (); MirrorDirectory = cf.getVar ("MirrorDirectory").asString ();
MirrorDirectory = toLower (CPath::standardizePath (MirrorDirectory)); MirrorDirectory = toLowerAscii (CPath::standardizePath (MirrorDirectory));
LogDirectory = cf.getVar ("LogDirectory").asString (); LogDirectory = cf.getVar ("LogDirectory").asString ();
LogDirectory = toLower (CPath::standardizePath (LogDirectory)); LogDirectory = toLowerAscii (CPath::standardizePath (LogDirectory));
IgnoreDirectory = cf.getVar ("IgnoreDirectory").asString (); IgnoreDirectory = cf.getVar ("IgnoreDirectory").asString ();
IgnoreDirectory = toLower (CPath::standardizePath (IgnoreDirectory)); IgnoreDirectory = toLowerAscii (CPath::standardizePath (IgnoreDirectory));
if (IgnoreDirectory.empty()) if (IgnoreDirectory.empty())
IgnoreDirectory = MainDirectory; IgnoreDirectory = MainDirectory;
string sBinaryCompare = cf.getVar ("BinaryCompare").asString (); string sBinaryCompare = cf.getVar ("BinaryCompare").asString ();
sBinaryCompare = toLower (sBinaryCompare); sBinaryCompare = toLowerAscii (sBinaryCompare);
BinaryCompare = false; BinaryCompare = false;
if ((sBinaryCompare == "true") || (sBinaryCompare=="1")) if ((sBinaryCompare == "true") || (sBinaryCompare=="1"))
BinaryCompare = true; BinaryCompare = true;
@ -145,12 +145,12 @@ BOOL CData_mirrorApp::InitInstance()
if (NLMISC::CFile::isDirectory (CurrentDir)) if (NLMISC::CFile::isDirectory (CurrentDir))
{ {
directory = true; directory = true;
CurrentDir = toLower(CPath::standardizePath (CurrentDir)); CurrentDir = toLowerAscii(CPath::standardizePath (CurrentDir));
} }
else if (NLMISC::CFile::fileExists (CurrentDir)) else if (NLMISC::CFile::fileExists (CurrentDir))
{ {
directory = false; directory = false;
CurrentDir = toLower(CPath::standardizePath (NLMISC::CFile::getPath (CurrentDir))); CurrentDir = toLowerAscii(CPath::standardizePath (NLMISC::CFile::getPath (CurrentDir)));
} }
else else
{ {

@ -628,7 +628,7 @@ void CData_mirrorDlg::buildSourceFiles ()
{ {
// Get the filename // Get the filename
string &str = fileSource[i]; string &str = fileSource[i];
str = toLower(str.substr (MainDirectory.size (), str.size ())); str = toLowerAscii(str.substr (MainDirectory.size (), str.size ()));
// In the ignore list ? // In the ignore list ?
if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt")) if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt"))
@ -716,7 +716,7 @@ void CData_mirrorDlg::buildSourceFiles ()
{ {
// Get the filename // Get the filename
string &str = fileSource[i]; string &str = fileSource[i];
str = toLower(str.substr (MirrorDirectory.size (), str.size ())); str = toLowerAscii(str.substr (MirrorDirectory.size (), str.size ()));
// In the ignore list ? // In the ignore list ?
if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt")) if (IgnoreFiles.find (str) == IgnoreFiles.end () && (str != "ignore_list.txt"))

@ -214,7 +214,7 @@ void extractStringsFromBinary (const vector<char> &fileArray, set<string> &filen
if (str != "") if (str != "")
{ {
// Lower case // Lower case
str = toLower (str); str = toLowerAscii (str);
// Filter extensions // Filter extensions
if (filterExtension (str.c_str(), extensions)) if (filterExtension (str.c_str(), extensions))
@ -280,7 +280,7 @@ void extractStringsFromASCII (const vector<char> &fileArray, set<string> &filena
temp[c] = begin[c]; temp[c] = begin[c];
// Lower case // Lower case
temp = toLower (temp); temp = toLowerAscii (temp);
// Filter extensions // Filter extensions
if (filterExtension (temp.c_str(), extensions)) if (filterExtension (temp.c_str(), extensions))
@ -325,7 +325,7 @@ bool loadConfigFiles (const char *ext, const char *input_files, const char *avai
while (fgets (name, 512, file)) while (fgets (name, 512, file))
{ {
// To string and lower // To string and lower
temp = toLower (string(name)); temp = toLowerAscii (string(name));
// Remove return // Remove return
removeChar (temp, '\n'); removeChar (temp, '\n');
@ -374,8 +374,8 @@ bool loadConfigFiles (const char *ext, const char *input_files, const char *avai
while (fgets (name, 512, file)) while (fgets (name, 512, file))
{ {
// To lower // To lower
temp = toLower (string(name)); temp = toLowerAscii (string(name));
temp2 = toLower (string(name)); temp2 = toLowerAscii (string(name));
// Remove space // Remove space
removeBeginEndSpaces (temp); removeBeginEndSpaces (temp);
@ -597,7 +597,7 @@ int main(int argc, char* argv[])
// It is used ? // It is used ?
if (usedFiles.find (available->first) == usedFiles.end()) if (usedFiles.find (available->first) == usedFiles.end())
{ {
string temp = toLower (available->second); string temp = toLowerAscii (available->second);
fprintf (stderr, "UNUSED: %s\n", temp.c_str()); fprintf (stderr, "UNUSED: %s\n", temp.c_str());
} }

@ -320,10 +320,10 @@ void addId( string fileName )
if( itFI == FormToId.end() ) if( itFI == FormToId.end() )
{ {
// double check : if file not found we check with lower case version of filename // double check : if file not found we check with lower case version of filename
map<string,TFormId>::iterator itFILwr = FormToId.find( toLower(fileName) ); map<string,TFormId>::iterator itFILwr = FormToId.find( toLowerAscii(fileName) );
if( itFILwr != FormToId.end() ) if( itFILwr != FormToId.end() )
{ {
nlwarning("Trying to add %s but the file %s is already known ! becareful with lower case and upper case.", fileName.c_str(), toLower(fileName).c_str()); nlwarning("Trying to add %s but the file %s is already known ! becareful with lower case and upper case.", fileName.c_str(), toLowerAscii(fileName).c_str());
NbFilesDiscarded++; NbFilesDiscarded++;
return; return;
} }

@ -64,7 +64,7 @@ bool keepFile (const char *fileName)
uint i; uint i;
bool ifPresent = false; bool ifPresent = false;
bool ifTrue = false; bool ifTrue = false;
string file = toLower(CFile::getFilename (fileName)); string file = toLowerAscii(CFile::getFilename (fileName));
for (i=0; i<WildCards.size(); i++) for (i=0; i<WildCards.size(); i++)
{ {
if (WildCards[i].Not) if (WildCards[i].Not)

@ -184,7 +184,7 @@ bool CGeorgesEditDocForm::initDocument (const char *dfnName, bool newElement)
} }
// Set file name and title // Set file name and title
std::string name2 = toLower(NLMISC::CFile::getFilenameWithoutExtension(dfnName)); std::string name2 = toLowerAscii(NLMISC::CFile::getFilenameWithoutExtension(dfnName));
SetPathName(nlUtf8ToTStr("*." + name2), FALSE); SetPathName(nlUtf8ToTStr("*." + name2), FALSE);
SetTitle(nlUtf8ToTStr("New " + name2 + " form")); SetTitle(nlUtf8ToTStr("New " + name2 + " form"));
@ -547,7 +547,7 @@ BOOL CGeorgesEditDoc::OnOpenDocument(LPCTSTR lpszPathName)
{ {
// Check form // Check form
std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(lpszPathName)); std::string ext = NLMISC::CFile::getExtension(tStrToUtf8(lpszPathName));
string extLower = toLower(ext); string extLower = toLowerAscii(ext);
if (!extLower.empty ()) if (!extLower.empty ())
{ {

@ -107,7 +107,7 @@ void CImageListEx::addResourceIcon (const char *filename)
// Add in the map // Add in the map
std::string name = NLMISC::CFile::getFilenameWithoutExtension(filename); std::string name = NLMISC::CFile::getFilenameWithoutExtension(filename);
_IconMapString.insert (std::map<string, int>::value_type (toLower(name), index)); _IconMapString.insert (std::map<string, int>::value_type (toLowerAscii(name), index));
// Release the icon // Release the icon
DestroyIcon (handle); DestroyIcon (handle);
@ -132,7 +132,7 @@ int CImageListEx::getImage (int resource) const
int CImageListEx::getImage (const char *filename) const int CImageListEx::getImage (const char *filename) const
{ {
std::string name = toLower(NLMISC::CFile::getFilenameWithoutExtension(filename)); std::string name = toLowerAscii(NLMISC::CFile::getFilenameWithoutExtension(filename));
std::map<string, int>::const_iterator ite = _IconMapString.find (name); std::map<string, int>::const_iterator ite = _IconMapString.find (name);
if (ite == _IconMapString.end()) if (ite == _IconMapString.end())
return -1; return -1;

@ -239,8 +239,8 @@ BOOL CMissionCompilerFeDlg::OnInitDialog()
{ {
// We found the same filename : check the path // We found the same filename : check the path
string srcPath = it->second; string srcPath = it->second;
srcPath = toUpper(CPath::standardizeDosPath(srcPath)); srcPath = toUpperAscii(CPath::standardizeDosPath(srcPath));
files[i] = toUpper(CPath::standardizeDosPath(files[i])); files[i] = toUpperAscii(CPath::standardizeDosPath(files[i]));
if (srcPath != files[i]) if (srcPath != files[i])
{ {
::MessageBox(NULL, _T("Primitive path and working directory are not the same !"), ::MessageBox(NULL, _T("Primitive path and working directory are not the same !"),

@ -189,7 +189,7 @@ GenderExtractor::GenderExtractor(const std::string & literal, const std::string&
const char * f = fs[level]; const char * f = fs[level];
const char * h = hs[level]; const char * h = hs[level];
_Identifier = toLower(identifier); _Identifier = toLowerAscii(identifier);
std::string newPhrase; std::string newPhrase;
@ -657,7 +657,7 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c
// use mission primitive instead // use mission primitive instead
fileName = primFileName; fileName = primFileName;
} }
if (loadedPrimitives.find(toLower(fileName)) == loadedPrimitives.end()) if (loadedPrimitives.find(toLowerAscii(fileName)) == loadedPrimitives.end())
{ {
string fullFileName = CPath::lookup(fileName, false); string fullFileName = CPath::lookup(fileName, false);
if (fullFileName.empty()) if (fullFileName.empty())
@ -670,7 +670,7 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c
if (loadXmlPrimitiveFile(*primDoc, fullFileName, ligoConfig)) if (loadXmlPrimitiveFile(*primDoc, fullFileName, ligoConfig))
{ {
// the primitive file is loaded correctly // the primitive file is loaded correctly
loadedPrimitives.insert(make_pair(toLower(fileName), TLoadedPrimitive(primDoc, fullFileName))); loadedPrimitives.insert(make_pair(toLowerAscii(fileName), TLoadedPrimitive(primDoc, fullFileName)));
CPrimitiveContext::instance().CurrentPrimitive = NULL; CPrimitiveContext::instance().CurrentPrimitive = NULL;
} }
else else
@ -679,7 +679,7 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c
throw EParseException(NULL, toString("Can't read primitive file '%s'", fullFileName.c_str()).c_str()); throw EParseException(NULL, toString("Can't read primitive file '%s'", fullFileName.c_str()).c_str());
} }
} }
TLoadedPrimitive &loadedPrim = loadedPrimitives[toLower(fileName)]; TLoadedPrimitive &loadedPrim = loadedPrimitives[toLowerAscii(fileName)];
CPrimitives *primDoc = loadedPrim.PrimDoc; CPrimitives *primDoc = loadedPrim.PrimDoc;
TPrimitiveSet scripts; TPrimitiveSet scripts;
@ -744,7 +744,7 @@ bool CMissionCompiler::installCompiledMission(NLLIGO::CLigoConfig &ligoConfig, c
fileName = primFileName; fileName = primFileName;
} }
TLoadedPrimitive &loadedPrim = loadedPrimitives[toLower(fileName)]; TLoadedPrimitive &loadedPrim = loadedPrimitives[toLowerAscii(fileName)];
CPrimitives *primDoc = loadedPrim.PrimDoc; CPrimitives *primDoc = loadedPrim.PrimDoc;
CPrimitiveContext::instance().CurrentPrimitive = primDoc; CPrimitiveContext::instance().CurrentPrimitive = primDoc;
@ -1304,7 +1304,7 @@ retry:
_Suffixe = tokens.back(); _Suffixe = tokens.back();
// generate identifier // generate identifier
_PhraseId = toUpper(md.getMissionName()+"_"+_Suffixe); _PhraseId = toUpperAscii(md.getMissionName()+"_"+_Suffixe);
set<string> ps; set<string> ps;
// select only unique params // select only unique params
@ -1857,11 +1857,11 @@ void CMissionData::parseMissionHeader(NLLIGO::IPrimitive *prim)
// _MissionTitle.init(*this, prim, vs); // _MissionTitle.init(*this, prim, vs);
_MissionDescriptionRaw = getPropertyArray(prim, "mission_description", false, false); _MissionDescriptionRaw = getPropertyArray(prim, "mission_description", false, false);
// _MissionDescription.init(*this, prim, vs); // _MissionDescription.init(*this, prim, vs);
_MonoInstance = toLower(getProperty(prim, "mono_instance", true, false)) == "true"; _MonoInstance = toBool(getProperty(prim, "mono_instance", true, false));
_RunOnce = toLower(getProperty(prim, "run_only_once", true, false)) == "true"; _RunOnce = toBool(getProperty(prim, "run_only_once", true, false));
_Replayable = toLower(getProperty(prim, "replayable", true, false)) == "true"; _Replayable = toBool(getProperty(prim, "replayable", true, false));
_NeedValidation = toLower(getProperty(prim, "need_validation", true, false)) == "true"; _NeedValidation = toBool(getProperty(prim, "need_validation", true, false));
_MissionAutoMenuRaw = getPropertyArray(prim, "phrase_auto_menu", false, false); _MissionAutoMenuRaw = getPropertyArray(prim, "phrase_auto_menu", false, false);
@ -1872,15 +1872,15 @@ void CMissionData::parseMissionHeader(NLLIGO::IPrimitive *prim)
else if (s == "guild") else if (s == "guild")
_Guild = true; _Guild = true;
_NotInJournal = NLMISC::toLower(getProperty(prim, "not_in_journal", false, false)) == "true"; _NotInJournal = NLMISC::toBool(getProperty(prim, "not_in_journal", false, false));
_AutoRemoveFromJournal = NLMISC::toLower(getProperty(prim, "auto_remove_from_journal", false, false)) == "true"; _AutoRemoveFromJournal = NLMISC::toBool(getProperty(prim, "auto_remove_from_journal", false, false));
_MissionCategory = getProperty(prim, "mission_category", false, false); _MissionCategory = getProperty(prim, "mission_category", false, false);
NLMISC::fromString(getProperty(prim, "player_replay_timer", true, false), _PlayerReplayTimer); NLMISC::fromString(getProperty(prim, "player_replay_timer", true, false), _PlayerReplayTimer);
NLMISC::fromString(getProperty(prim, "global_replay_timer", true, false), _GlobalReplayTimer); NLMISC::fromString(getProperty(prim, "global_replay_timer", true, false), _GlobalReplayTimer);
_NotProposed = NLMISC::toLower(getProperty(prim, "not_proposed", false, false)) == "true"; _NotProposed = NLMISC::toBool(getProperty(prim, "not_proposed", false, false));
_MissionAuto = NLMISC::toLower(getProperty(prim, "automatic", false, false)) == "true"; _MissionAuto = NLMISC::toBool(getProperty(prim, "automatic", false, false));
_NonAbandonnable = NLMISC::toLower(getProperty(prim, "non_abandonnable", false, false)) == "true"; _NonAbandonnable = NLMISC::toBool(getProperty(prim, "non_abandonnable", false, false));
_FailIfInventoryIsFull = NLMISC::toLower(getProperty(prim, "fail_if_inventory_is_full", false, false)) == "true"; _FailIfInventoryIsFull = NLMISC::toBool(getProperty(prim, "fail_if_inventory_is_full", false, false));
_MissionIcon = getProperty(prim, "mission_icon", false, false); _MissionIcon = getProperty(prim, "mission_icon", false, false);
if (_MissionAuto) if (_MissionAuto)

@ -471,7 +471,7 @@ public:
string s; string s;
s = md.getProperty(prim, "hide_others", true, false); s = md.getProperty(prim, "hide_others", true, false);
_HideOthers = (NLMISC::toLower(s) == "true"); _HideOthers = NLMISC::toBool(s);
} }
string genCode(CMissionData &md) string genCode(CMissionData &md)
@ -788,7 +788,7 @@ public:
string s; string s;
s = md.getProperty(prim, "group", true, false); s = md.getProperty(prim, "group", true, false);
_Group = (NLMISC::toLower(s) == "true"); _Group = NLMISC::toBool(s);
_Guild = md.getProperty(prim, "guild", false, true) == "true"; _Guild = md.getProperty(prim, "guild", false, true) == "true";
// Check: if _Guild is true then check if we are in a guild mission // Check: if _Guild is true then check if we are in a guild mission
@ -866,7 +866,7 @@ public:
string s; string s;
s = md.getProperty(prim, "group", true, false); s = md.getProperty(prim, "group", true, false);
_Group = (NLMISC::toLower(s) == "true"); _Group = NLMISC::toBool(s);
_Guild = md.getProperty(prim, "guild", false, true) == "true"; _Guild = md.getProperty(prim, "guild", false, true) == "true";
// Check: if _Guild is true then check if we are in a guild mission // Check: if _Guild is true then check if we are in a guild mission
@ -1054,7 +1054,7 @@ public:
string s; string s;
s = md.getProperty(prim, "group", true, false); s = md.getProperty(prim, "group", true, false);
_Group = (NLMISC::toLower(s) == "true"); _Group = NLMISC::toBool(s);
IStepContent::init(md, prim); IStepContent::init(md, prim);
} }
@ -1111,7 +1111,7 @@ public:
string s; string s;
s = md.getProperty(prim, "group", true, false); s = md.getProperty(prim, "group", true, false);
_Group = (NLMISC::toLower(s) == "true"); _Group = NLMISC::toBool(s);
IStepContent::init(md, prim); IStepContent::init(md, prim);
} }
@ -1169,7 +1169,7 @@ public:
string s; string s;
s = md.getProperty(prim, "group", true, false); s = md.getProperty(prim, "group", true, false);
_Group = (NLMISC::toLower(s) == "true"); _Group = NLMISC::toBool(s);
IStepContent::init(md, prim); IStepContent::init(md, prim);
} }
@ -1320,7 +1320,7 @@ public:
_WorldPosition = md.getProperty(prim, "world_position", true, false); _WorldPosition = md.getProperty(prim, "world_position", true, false);
string s; string s;
prim->getPropertyByName("once", s); prim->getPropertyByName("once", s);
_Once = (NLMISC::toLower(s) == "true"); _Once = NLMISC::toBool(s);
} }
string genCode(CMissionData &md) string genCode(CMissionData &md)
@ -3212,7 +3212,7 @@ public:
{ {
_GroupName = md.getProperty(prim, "group_to_escort", true, false); _GroupName = md.getProperty(prim, "group_to_escort", true, false);
string s = md.getProperty(prim, "save_all", true, false); string s = md.getProperty(prim, "save_all", true, false);
_SaveAll = (NLMISC::toLower(s) == "true"); _SaveAll = NLMISC::toBool(s);
CContentObjective::init(md, prim); CContentObjective::init(md, prim);
} }

@ -527,7 +527,7 @@ public:
formDate = 0; formDate = 0;
// In the map ? // In the map ?
string formShortName = NLMISC::toLower(CFile::getFilename (formName)); string formShortName = NLMISC::toLowerAscii(CFile::getFilename (formName));
map<string, CValue >::iterator ite = _FormMap.find (formShortName); map<string, CValue >::iterator ite = _FormMap.find (formShortName);
if (ite == _FormMap.end ()) if (ite == _FormMap.end ())
{ {
@ -614,7 +614,7 @@ void addPointPrimitive (CLandscape &landscape, const char *primFilename, uint32
if (point->getPropertyByName ("form", plantFilename)) if (point->getPropertyByName ("form", plantFilename))
{ {
// Add an extension // Add an extension
if (NLMISC::toLower(CFile::getExtension (plantFilename)) != "plant") if (NLMISC::toLowerAscii(CFile::getExtension (plantFilename)) != "plant")
plantFilename += ".plant"; plantFilename += ".plant";
// Load this form // Load this form
@ -669,7 +669,7 @@ void addPointPrimitive (CLandscape &landscape, const char *primFilename, uint32
instance.Scale = CVector (scale, scale, scale); instance.Scale = CVector (scale, scale, scale);
instance.nParent = -1; instance.nParent = -1;
instance.Name = shape; instance.Name = shape;
instance.InstanceName = NLMISC::toLower(CFile::getFilename (plantFilename)); instance.InstanceName = NLMISC::toLowerAscii(CFile::getFilename (plantFilename));
// Get the instance group ref // Get the instance group ref
CIgContainer::CIG &instances = igs.get (x, y); CIgContainer::CIG &instances = igs.get (x, y);
@ -826,7 +826,7 @@ int main (int argc, char**argv)
callback.progress ((float)i/(float)files.size ()); callback.progress ((float)i/(float)files.size ());
// Zonew ? // Zonew ?
if (NLMISC::toLower(CFile::getExtension (files[i])) == "zonew") if (NLMISC::toLowerAscii(CFile::getExtension (files[i])) == "zonew")
{ {
// Load it // Load it
try try
@ -890,7 +890,7 @@ int main (int argc, char**argv)
for (i=0; i<fileCount; i++) for (i=0; i<fileCount; i++)
{ {
// Primitive file ? // Primitive file ?
if (NLMISC::toLower(CFile::getExtension (files[i])) == "primitive") if (NLMISC::toLowerAscii(CFile::getExtension (files[i])) == "primitive")
{ {
// Progress bar // Progress bar
nlinfo (files[i].c_str()); nlinfo (files[i].c_str());

@ -3485,7 +3485,7 @@ BOOL CMyComboBox::PreTranslateMessage( MSG* pMsg )
_LastString.clear(); _LastString.clear();
// Add this char // Add this char
_LastString.push_back (tolower((TCHAR) pMsg->wParam)); _LastString.push_back((wchar_t)NLMISC::toLower((ucchar)pMsg->wParam));
search = true; search = true;
// New stroke time // New stroke time
@ -3518,7 +3518,7 @@ BOOL CMyComboBox::PreTranslateMessage( MSG* pMsg )
{ {
// 0 final // 0 final
text[511] = 0; text[511] = 0;
_LastString = tStrToUtf8(text); _LastString = CUtfStringView(tStrToUtf8(text)).toWide();
search = true; search = true;
} }
} }
@ -3538,11 +3538,11 @@ BOOL CMyComboBox::PreTranslateMessage( MSG* pMsg )
{ {
CString rString; CString rString;
GetLBText (i, rString); GetLBText (i, rString);
string tmp = toLower(tStrToUtf8(rString)); wstring tmp = CUtfStringView(toLower(tStrToUtf8(rString))).toWide();
uint size = std::min (_LastString.size(), tmp.size()); uint size = std::min (_LastString.size(), tmp.size());
if (size > matchSize) if (size > matchSize)
{ {
if (strncmp(tmp.c_str(), _LastString.c_str(), size) == 0) if (wcsncmp(tmp.c_str(), _LastString.c_str(), size) == 0)
{ {
matchItem = i; matchItem = i;
matchSize = size; matchSize = size;

@ -60,7 +60,7 @@ public:
bool loaded; bool loaded;
private: private:
std::string _LastString; std::wstring _LastString;
sint64 _LastStrokeTime; sint64 _LastStrokeTime;
std::vector<std::string> _data; std::vector<std::string> _data;
void reloadData(); void reloadData();

@ -110,7 +110,7 @@ void CImageListEx::addResourceIcon (const char *filename)
index = ImageList.Replace( index, handle); index = ImageList.Replace( index, handle);
// Add in the map // Add in the map
std::string name = toLower(NLMISC::CFile::getFilenameWithoutExtension(filename)); std::string name = toLowerAscii(NLMISC::CFile::getFilenameWithoutExtension(filename));
_IconMapString.insert (std::map<string, int>::value_type (name, index)); _IconMapString.insert (std::map<string, int>::value_type (name, index));
// Release the icon // Release the icon
@ -136,7 +136,7 @@ int CImageListEx::getImage (int resource) const
int CImageListEx::getImage (const char *filename) const int CImageListEx::getImage (const char *filename) const
{ {
std::string name = toLower(NLMISC::CFile::getFilenameWithoutExtension(filename)); std::string name = toLowerAscii(NLMISC::CFile::getFilenameWithoutExtension(filename));
std::map<string, int>::const_iterator ite = _IconMapString.find (name); std::map<string, int>::const_iterator ite = _IconMapString.find (name);
if (ite == _IconMapString.end()) if (ite == _IconMapString.end())
return -1; return -1;

@ -167,7 +167,7 @@ void CNameDlg::updateSearchList()
m_nameFilter.UnlockBuffer(); m_nameFilter.UnlockBuffer();
// filter // filter
if (NLMISC::toLower(ig).find(NLMISC::toLower(filter)) != std::string::npos) if (NLMISC::toLowerAscii(ig).find(NLMISC::toLowerAscii(filter)) != std::string::npos)
{ {
m_listToName.insert(std::make_pair(j, i)); m_listToName.insert(std::make_pair(j, i));
m_searchList.InsertString(j++, nlUtf8ToTStr(s)); m_searchList.InsertString(j++, nlUtf8ToTStr(s));

@ -555,7 +555,7 @@ bool CWorldEditorApp::initPath (const std::string &filename, CSplashScreen &spla
string noRecurse; string noRecurse;
if (CIXml::getPropertyString (noRecurse, search_path, "NO_RECURSE")) if (CIXml::getPropertyString (noRecurse, search_path, "NO_RECURSE"))
{ {
if (toLower(noRecurse) == "true") if (toBool(noRecurse))
recurse = false; recurse = false;
} }
@ -635,14 +635,14 @@ class CMainFrame *getMainFrame ()
std::string standardizePath (const std::string &str) std::string standardizePath (const std::string &str)
{ {
return NLMISC::toLower(NLMISC::CPath::standardizePath (str, true)); return NLMISC::toLowerAscii(NLMISC::CPath::standardizePath (str, true));
} }
// *************************************************************************** // ***************************************************************************
std::string formatString (const std::string &str) std::string formatString (const std::string &str)
{ {
string copy = NLMISC::toLower(str); string copy = NLMISC::toLowerAscii(str);
return copy; return copy;
} }

@ -222,7 +222,7 @@ void CPlugin::drawFaunaGraph(CDisplay &display, const NLLIGO::IPrimitive &grp)
if (!grp.getChild(child, k)) continue; if (!grp.getChild(child, k)) continue;
std::string className; std::string className;
if (!child->getPropertyByName("class", className)) continue; if (!child->getPropertyByName("class", className)) continue;
if (NLMISC::toLower(className) != FAUNA_PLACE) continue; if (NLMISC::toLowerAscii(className) != FAUNA_PLACE) continue;
if (_PluginAccess->isSelected(*child)) if (_PluginAccess->isSelected(*child))
{ {
found = true; found = true;
@ -239,7 +239,7 @@ void CPlugin::drawFaunaGraph(CDisplay &display, const NLLIGO::IPrimitive &grp)
if (!grp.getChild(child, k)) continue; if (!grp.getChild(child, k)) continue;
std::string className; std::string className;
if (!child->getPropertyByName("class", className)) continue; if (!child->getPropertyByName("class", className)) continue;
if (NLMISC::toLower(className) != FAUNA_PLACE) continue; if (NLMISC::toLowerAscii(className) != FAUNA_PLACE) continue;
std::string indexStr; std::string indexStr;
int index; int index;
if (!child->getPropertyByName("index", indexStr)) continue; if (!child->getPropertyByName("index", indexStr)) continue;

@ -169,7 +169,7 @@ void CSoundPlugin::ReInit()
bool fmodDriver = false; bool fmodDriver = false;
try try
{ {
fmodDriver = toLower(cf.getVar("DriverSound").asString())=="fmod"; fmodDriver = toLowerAscii(cf.getVar("DriverSound").asString())=="fmod"; // FIXME: Support all drivers
} }
catch(...) catch(...)
{ {

@ -134,7 +134,7 @@ void makeAnimByRace(const std::string &animSetFile, const std::vector<string> &a
// get the possible anim file name (lowered) // get the possible anim file name (lowered)
static vector<string> raceAnimNames; static vector<string> raceAnimNames;
raceAnimNames.clear(); raceAnimNames.clear();
buildRaceAnimNames(raceAnimNames, toLower(CFile::getFilename(animList[i]))); buildRaceAnimNames(raceAnimNames, toLowerAscii(CFile::getFilename(animList[i])));
// For each line of the animSet // For each line of the animSet
uint lastStructLine= 0; uint lastStructLine= 0;
@ -142,7 +142,7 @@ void makeAnimByRace(const std::string &animSetFile, const std::vector<string> &a
for(uint j=0;j<animSetText.size();) for(uint j=0;j<animSetText.size();)
{ {
string line= animSetText[j]; string line= animSetText[j];
string lineLwr= toLower(line); string lineLwr= toLowerAscii(line);
// Find <LOG> TAg? => stop // Find <LOG> TAg? => stop
if(line.find("<LOG>")!=string::npos) if(line.find("<LOG>")!=string::npos)

@ -87,7 +87,7 @@ void CAnimCombatState::build(const string &line)
void makeAnimMeleeImpact(const std::string &animSetFile, const set<CAnimCombatSet> &combatAnimSets) void makeAnimMeleeImpact(const std::string &animSetFile, const set<CAnimCombatSet> &combatAnimSets)
{ {
// look if this animSetFile is in the combat list to patch // look if this animSetFile is in the combat list to patch
string shortName= NLMISC::toLower(CFile::getFilenameWithoutExtension(animSetFile)); string shortName= NLMISC::toLowerAscii(CFile::getFilenameWithoutExtension(animSetFile));
CAnimCombatSet key; CAnimCombatSet key;
key.Name= shortName; key.Name= shortName;
set<CAnimCombatSet>::const_iterator it= combatAnimSets.find(key); set<CAnimCombatSet>::const_iterator it= combatAnimSets.find(key);
@ -125,7 +125,7 @@ void makeAnimMeleeImpact(const std::string &animSetFile, const set<CAnimCombatSe
for(uint j=0;j<animSetText.size();j++) for(uint j=0;j<animSetText.size();j++)
{ {
string line= animSetText[j]; string line= animSetText[j];
string lineLwr= toLower(line); string lineLwr= toLowerAscii(line);
// Find <LOG> TAg? => stop // Find <LOG> TAg? => stop
if(line.find("<LOG>")!=string::npos) if(line.find("<LOG>")!=string::npos)
@ -405,7 +405,7 @@ To generate the anim.txt file, this code has to be inserted in the client, in
if(anim && anim3d) if(anim && anim3d)
{ {
// name // name
string name= NLMISC::toLower(_AnimationSet->getAnimationName(anim->id())); string name= NLMISC::toLowerAscii(_AnimationSet->getAnimationName(anim->id()));
if(animName.empty()) if(animName.empty())
animName= name; animName= name;
else if(!extended) else if(!extended)

@ -459,9 +459,9 @@ void CPackageDescription::buildDefaultFileList()
std::vector<std::string> fileList; std::vector<std::string> fileList;
NLMISC::CPath::getPathContent(_BnpDirectory,false,false,true,fileList); NLMISC::CPath::getPathContent(_BnpDirectory,false,false,true,fileList);
for (uint32 i=0;i<fileList.size();++i) for (uint32 i=0;i<fileList.size();++i)
if (NLMISC::toLower(NLMISC::CFile::getExtension(fileList[i]))=="bnp" if (NLMISC::toLowerAscii(NLMISC::CFile::getExtension(fileList[i]))=="bnp"
|| NLMISC::toLower(NLMISC::CFile::getExtension(fileList[i]))=="snp") || NLMISC::toLowerAscii(NLMISC::CFile::getExtension(fileList[i]))=="snp")
_Categories.addFile("main",NLMISC::toLower(NLMISC::CFile::getFilename(fileList[i]))); _Categories.addFile("main",NLMISC::toLowerAscii(NLMISC::CFile::getFilename(fileList[i])));
_Categories.addFile("unpacked","root.bnp"); _Categories.addFile("unpacked","root.bnp");
} }

@ -99,16 +99,16 @@ string xmlSpecialChars(string str)
string getFullStdPathNoExt(const string &path) string getFullStdPathNoExt(const string &path)
{ {
string dir = NLMISC::toLower(NLMISC::CFile::getPath(path)); string dir = NLMISC::toLowerAscii(NLMISC::CFile::getPath(path));
string file = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(path)); string file = NLMISC::toLowerAscii(NLMISC::CFile::getFilenameWithoutExtension(path));
return dir.empty() ? file : NLMISC::CPath::standardizePath(dir)+file; return dir.empty() ? file : NLMISC::CPath::standardizePath(dir)+file;
} }
string getFullStdPath(const string &path) string getFullStdPath(const string &path)
{ {
string dir = NLMISC::toLower(NLMISC::CFile::getPath(path)); string dir = NLMISC::toLowerAscii(NLMISC::CFile::getPath(path));
string file = NLMISC::toLower(NLMISC::CFile::getFilename(path)); string file = NLMISC::toLowerAscii(NLMISC::CFile::getFilename(path));
return dir.empty() ? file : NLMISC::CPath::standardizePath(dir)+file; return dir.empty() ? file : NLMISC::CPath::standardizePath(dir)+file;
} }
@ -258,7 +258,7 @@ bool CDbNode::epilog()
setEnv("db", Name); setEnv("db", Name);
string fullfile = getFullStdPathNoExt(MainFile.empty() ? Name : MainFile); string fullfile = getFullStdPathNoExt(MainFile.empty() ? Name : MainFile);
string filename = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fullfile)); string filename = NLMISC::toLowerAscii(NLMISC::CFile::getFilenameWithoutExtension(fullfile));
setEnv("filename", filename); setEnv("filename", filename);
setEnv("fullfilename", fullfile); setEnv("fullfilename", fullfile);
@ -788,14 +788,14 @@ void CDbNode::generateLogContent()
// get file path from this file // get file path from this file
string CDbNode::getFileNoExtPath(const std::string& file) string CDbNode::getFileNoExtPath(const std::string& file)
{ {
string thisPath = NLMISC::CFile::getPath(NLMISC::toLower(getDbFile())); string thisPath = NLMISC::CFile::getPath(NLMISC::toLowerAscii(getDbFile()));
string filePath = NLMISC::CFile::getPath(NLMISC::toLower(file)); string filePath = NLMISC::CFile::getPath(NLMISC::toLowerAscii(file));
string fileName = NLMISC::CFile::getFilename(NLMISC::toLower(file)); string fileName = NLMISC::CFile::getFilename(NLMISC::toLowerAscii(file));
if (thisPath == filePath) if (thisPath == filePath)
return CFile::getFilenameWithoutExtension(fileName); return CFile::getFilenameWithoutExtension(fileName);
else else
return CPath::standardizePath(filePath)+CFile::getFilenameWithoutExtension(NLMISC::toLower(file)); return CPath::standardizePath(filePath)+CFile::getFilenameWithoutExtension(NLMISC::toLowerAscii(file));
} }
@ -825,7 +825,7 @@ bool CFileNode::generateProlog()
if (!db->Description.empty()) if (!db->Description.empty())
Hpp << db->Description << "\n"; Hpp << db->Description << "\n";
string filename = NLMISC::toLower(CFile::getFilenameWithoutExtension(Name)); string filename = NLMISC::toLowerAscii(CFile::getFilenameWithoutExtension(Name));
setEnv("fullfilename", getFullStdPathNoExt(Name)); setEnv("fullfilename", getFullStdPathNoExt(Name));
setEnv("filename", filename); setEnv("filename", filename);
@ -870,7 +870,7 @@ bool CFileNode::generateProlog()
if (SeparatedFlag) if (SeparatedFlag)
{ {
string fullfile = getFullStdPathNoExt(db->MainFile.empty() ? db->Name : db->MainFile); string fullfile = getFullStdPathNoExt(db->MainFile.empty() ? db->Name : db->MainFile);
string filename = NLMISC::toLower(NLMISC::CFile::getFilenameWithoutExtension(fullfile)); string filename = NLMISC::toLowerAscii(NLMISC::CFile::getFilenameWithoutExtension(fullfile));
Hpp << "#include \"" << filename << ".h\"\n"; Hpp << "#include \"" << filename << ".h\"\n";
Hpp << "\n"; Hpp << "\n";
} }
@ -920,7 +920,7 @@ bool CFileNode::generateEpilog()
CDbNode* db = getDbNode(); CDbNode* db = getDbNode();
string fullfile = getFullStdPathNoExt(Name); string fullfile = getFullStdPathNoExt(Name);
string filename = NLMISC::toLower(CFile::getFilenameWithoutExtension(Name)); string filename = NLMISC::toLowerAscii(CFile::getFilenameWithoutExtension(Name));
Hpp.indent(); Hpp.indent();
Hpp << "\n} // End of " << db->Name <<"\n"; Hpp << "\n} // End of " << db->Name <<"\n";
@ -948,14 +948,14 @@ bool CFileNode::generateEpilog()
string CFileNode::getFileNoExtPath(const string& file) string CFileNode::getFileNoExtPath(const string& file)
{ {
string thisPath = NLMISC::CFile::getPath(NLMISC::toLower(Name)); string thisPath = NLMISC::CFile::getPath(NLMISC::toLowerAscii(Name));
string filePath = NLMISC::CFile::getPath(NLMISC::toLower(file)); string filePath = NLMISC::CFile::getPath(NLMISC::toLowerAscii(file));
string fileName = NLMISC::CFile::getFilename(NLMISC::toLower(file)); string fileName = NLMISC::CFile::getFilename(NLMISC::toLowerAscii(file));
if (thisPath == filePath) if (thisPath == filePath)
return CFile::getFilenameWithoutExtension(fileName); return CFile::getFilenameWithoutExtension(fileName);
else else
return CFile::getFilenameWithoutExtension(NLMISC::toLower(file)); return CFile::getFilenameWithoutExtension(NLMISC::toLowerAscii(file));
} }
void CFileNode::writeFile() void CFileNode::writeFile()
@ -1301,7 +1301,7 @@ bool CEnumNode::generateContent()
gen.add("{"); gen.add("{");
gen.add("return Unknown;"); gen.add("return Unknown;");
gen.add("}"); gen.add("}");
gen.add("const std::map<std::string, "+Name+">::const_iterator\tit = _ValueMap.find(NLMISC::toLower(v));"); gen.add("const std::map<std::string, "+Name+">::const_iterator\tit = _ValueMap.find(NLMISC::toLowerAscii(v));");
gen.add("if (it == _ValueMap.end())"); gen.add("if (it == _ValueMap.end())");
gen.add("{"); gen.add("{");
gen.add("nlwarning(\""+Name+"::toString(): string '%s' is not matched, 'Unknown' enum value returned\", v.c_str());"); gen.add("nlwarning(\""+Name+"::toString(): string '%s' is not matched, 'Unknown' enum value returned\", v.c_str());");
@ -1318,7 +1318,7 @@ bool CEnumNode::generateContent()
gen.add("for (i=0; i<"+toString(Values.size())+"; ++i)"); gen.add("for (i=0; i<"+toString(Values.size())+"; ++i)");
gen.add("{"); gen.add("{");
gen.add("_StrTable["+Name+"Convert[i].Value] = "+Name+"Convert[i].Name;"); gen.add("_StrTable["+Name+"Convert[i].Value] = "+Name+"Convert[i].Name;");
gen.add("_ValueMap[NLMISC::toLower(std::string("+Name+"Convert[i].Name))] = "+Name+"Convert[i].Value;"); gen.add("_ValueMap[NLMISC::toLowerAscii(std::string("+Name+"Convert[i].Name))] = "+Name+"Convert[i].Value;");
gen.add("}"); gen.add("}");
gen.add("_Initialised = true;"); gen.add("_Initialised = true;");

@ -180,7 +180,7 @@ int main(int argc, char* argv[])
if (!zonePath.empty()) if (!zonePath.empty())
{ {
presentZonePathes.push_back(zonePath); presentZonePathes.push_back(zonePath);
presentZoneNames.push_back(toLower(zoneNames[l])); presentZoneNames.push_back(toLowerAscii(zoneNames[l]));
} }
} }
// //

@ -266,7 +266,7 @@ void CIGInfo::load(TShapeCache &shapeCache)
for(uint k = 0; k < IG->getNumInstance(); ++k) for(uint k = 0; k < IG->getNumInstance(); ++k)
{ {
std::string shapeName = standardizeShapeName(IG->getShapeName(k)); std::string shapeName = standardizeShapeName(IG->getShapeName(k));
if (NLMISC::toLower(CFile::getExtension(shapeName)) == "pacs_prim") if (NLMISC::toLowerAscii(CFile::getExtension(shapeName)) == "pacs_prim")
{ {
continue; continue;
} }

@ -311,10 +311,10 @@ sint main( sint argc, char ** argv )
} }
break; break;
case 1: // code case 1: // code
skill.Code = toUpper(string( ptr )); skill.Code = toUpperAscii(string( ptr ));
break; break;
case 2: // parent skill case 2: // parent skill
skill.ParentSkill = toUpper(string( ptr )); skill.ParentSkill = toUpperAscii(string( ptr ));
break; break;
case 3: // max skill value case 3: // max skill value
NLMISC::fromString(std::string(ptr), skill.MaxValue); NLMISC::fromString(std::string(ptr), skill.MaxValue);

@ -58,7 +58,7 @@ struct CSheetWordListBuilder : public IWordListBuilder
virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName) virtual bool buildWordList(std::vector<string> &allWords, string workSheetFileName)
{ {
SheetExt= toLower(SheetExt); SheetExt= toLowerAscii(SheetExt);
// verify the directory is correct // verify the directory is correct
if(!CFile::isDirectory(SheetPath)) if(!CFile::isDirectory(SheetPath))
@ -78,7 +78,7 @@ struct CSheetWordListBuilder : public IWordListBuilder
for(uint i=0;i<allFiles.size();i++) for(uint i=0;i<allFiles.size();i++)
{ {
string fileNameWithoutExt= CFile::getFilenameWithoutExtension(allFiles[i]); string fileNameWithoutExt= CFile::getFilenameWithoutExtension(allFiles[i]);
string extension= toLower(CFile::getExtension(allFiles[i])); string extension= toLowerAscii(CFile::getExtension(allFiles[i]));
// bad extension? // bad extension?
if(extension!=SheetExt) if(extension!=SheetExt)
continue; continue;
@ -86,7 +86,7 @@ struct CSheetWordListBuilder : public IWordListBuilder
if(fileNameWithoutExt.empty()||fileNameWithoutExt[0]=='_') if(fileNameWithoutExt.empty()||fileNameWithoutExt[0]=='_')
continue; continue;
// ok, add // ok, add
allWords.push_back(toLower(fileNameWithoutExt)); allWords.push_back(toLowerAscii(fileNameWithoutExt));
} }
return true; return true;
@ -168,7 +168,7 @@ struct CRegionPrimWordListBuilder : public IWordListBuilder
string primName; string primName;
if(placeRes[placeId]->getPropertyByName(listProp[cid], primName) && !primName.empty()) if(placeRes[placeId]->getPropertyByName(listProp[cid], primName) && !primName.empty())
{ {
primName= toLower(primName); primName= toLowerAscii(primName);
// avoid duplicate // avoid duplicate
if(allWordSet.insert(primName).second) if(allWordSet.insert(primName).second)
{ {

Loading…
Cancel
Save