Fix off-by-one error

pull/2820/head
RichardTea 2020-01-02 13:24:50 +00:00
parent ab50b5e181
commit 4e50b05b85
1 changed files with 7 additions and 6 deletions

View File

@ -83,8 +83,10 @@ void ToCamelCase(std::string &text)
if (text.empty()) if (text.empty())
return; return;
// Capitalise first character // Capitalise first character
text[0] = Assimp::ToUpper(text[0]); auto it = text.begin();
for (auto it = text.begin(); it != text.end(); /*iterated below*/) (*it) = ToUpper(*it);
++it;
for (/*started above*/ ; it != text.end(); /*iterated below*/)
{ {
if ((*it) == '_') if ((*it) == '_')
{ {
@ -94,10 +96,9 @@ void ToCamelCase(std::string &text)
} }
else else
{ {
// Make next one lower case // Make lower case
(*it) = ToLower(*it);
++it; ++it;
if (it != text.end())
(*it) = ToLower(*it);
} }
} }
} }