Merge pull request #472 from KentuckyCompass/fixpathcase_strlen

std::string is not UTF8-aware
This commit is contained in:
Henrik Rydgård 2013-01-22 07:08:58 -08:00
commit bc1832dfdd

View File

@ -37,7 +37,7 @@ static bool FixFilenameCase(const std::string &path, std::string &filename)
if (File::Exists(path + filename))
return true;
size_t filenameSize = filename.size();
size_t filenameSize = filename.size(); // size in bytes, not characters
for (size_t i = 0; i < filenameSize; i++)
{
filename[i] = tolower(filename[i]);
@ -57,7 +57,6 @@ static bool FixFilenameCase(const std::string &path, std::string &filename)
while (!readdir_r(dirp, (dirent*) &diren, &result) && result)
{
// Hm, is this check UTF-8 compatible? (size vs strlen)
if (strlen(result->d_name) != filenameSize)
continue;