QUrl stringprep: recalculate the current position if the size changes

If the case folding operation results in either expansion or reduction
of the string, we need to adapt. Reduction happens most often when a
non-BMP character is case-folded to a character in the BMP (example:
mathematical signs at U+1D400-1D7FF). Expansion happens in the rare
case of symbols containing words, like U+2121 ℡ (this is part of the
unit test), and one common case: the German sharp S (ß) is expanded to
"ss".

Change-Id: I1bdbdc908b958a89bf30e4bb648d65dfdd9097f8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Thiago Macieira 2013-06-07 18:39:12 -07:00 committed by The Qt Project
parent d4dba8a5c4
commit 2ccf4c32cc

View File

@ -1472,7 +1472,8 @@ static void mapToLowerCase(QString *str, int from)
if (uc <= 0xffff)
str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
else
str->replace(i-1, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
str->replace(--i, 2, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
i += l - 1;
d = 0;
} else {
if (!d)