QUrl stringprep: fix case folding from non-BMP to BMP

When uc > 0xffff (non-BMP character) and l == 1 (replacement is in the
BMP), we must use QString::replace so the correct number of characters
is replaced.

There's one case testing this in tst_qurlinternal, but it is being
obscured by another bug (false positive).

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

View File

@ -1468,7 +1468,7 @@ static void mapToLowerCase(QString *str, int from)
int l = 1;
while (l < 4 && entry->mapping[l])
++l;
if (l > 1) {
if (l > 1 || uc > 0xffff) {
if (uc <= 0xffff)
str->replace(i, 1, reinterpret_cast<const QChar *>(&entry->mapping[0]), l);
else