diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-06-08 01:39:12 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-21 00:31:25 (GMT) |
commit | 49239612ecbc57258e855012da617a3edaff7492 (patch) | |
tree | 4482326a35a6be8ef6fdfa402857988800bca1dd | |
parent | b599204accb88abe5a21dd868a961719e1fda1a0 (diff) | |
download | Qt-49239612ecbc57258e855012da617a3edaff7492.zip Qt-49239612ecbc57258e855012da617a3edaff7492.tar.gz Qt-49239612ecbc57258e855012da617a3edaff7492.tar.bz2 |
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".
(cherry-picked from qtbase commit 2ccf4c32cc593f568581dd237e1e27d39fd965a2)
Change-Id: I1bdbdc908b958a89bf30e4bb648d65dfdd9097f8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
-rw-r--r-- | src/corelib/io/qurl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index cf84eb5..1a5fad8 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2408,7 +2408,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) |