forked from organicmaps/organicmaps
Minor code fixes.
This commit is contained in:
parent
d5daf9d692
commit
ff62b5cc45
2 changed files with 11 additions and 3 deletions
|
@ -172,21 +172,25 @@ static size_t w(UniChar c, UniChar * buf)
|
|||
|
||||
void MakeLowerCase(UniString & s)
|
||||
{
|
||||
UniString r;
|
||||
size_t const size = s.size();
|
||||
|
||||
UniString r;
|
||||
r.reserve(size);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
UniChar const c = LowerUniChar(s[i]);
|
||||
if (c != 0)
|
||||
r.push_back(c);
|
||||
else
|
||||
{ // special case, replace this char with two or more chars for full case folding
|
||||
{
|
||||
// special case, replace this char with two or more chars for full case folding
|
||||
UniChar cc[3];
|
||||
size_t const count = w(s[i], &cc[0]);
|
||||
for (size_t j = 0; j < count; ++j)
|
||||
r.push_back(cc[j]);
|
||||
}
|
||||
}
|
||||
|
||||
s.swap(r);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,11 @@ static void w(strings::UniString & r, uint16_t startIndex, int count)
|
|||
|
||||
void Normalize(strings::UniString & s)
|
||||
{
|
||||
size_t const size = s.size();
|
||||
|
||||
strings::UniString r;
|
||||
for (size_t i = 0; i < s.size(); ++i)
|
||||
r.reserve(size);
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
{
|
||||
strings::UniChar const c = s[i];
|
||||
// ASCII optimization
|
||||
|
@ -4582,6 +4585,7 @@ void Normalize(strings::UniString & s)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
s.swap(r);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue