diff options
| author | Konstantin Ritt <ritt.ks@gmail.com> | 2013-08-13 05:02:34 +0300 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-14 22:46:58 +0200 |
| commit | 2e0a4b13addf1f56112bac38448be96fb02f650d (patch) | |
| tree | 6fbd02132bdba115dd762aba7b0502a5d983d982 /src/corelib/tools/qstring.cpp | |
| parent | 252bad7c589e03d3e12df02354b00a84d8e3159a (diff) | |
[2/2] Implement Unicode Normalization Form Quick Check (NF QC)
Use QuickCheck data from DerivedNormalizationProps.txt to check
if the input text is already in the desired Normalization Form.
\sa http://www.unicode.org/reports/tr15/#Detecting_Normalization_Forms
Using NF QC makes a significant boost to most operations that rely on
normalized input data, i.e. file path conversions on Mac, where "native"
form is a decomposed Unicode string.
Change-Id: I292a9da479c6beed730528fc7000c45bf1befc34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
| -rw-r--r-- | src/corelib/tools/qstring.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 36bd61098a0..936a5d68faf 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -6637,6 +6637,8 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar:: for (int i = from; i < len; ++i) { if (p[i].unicode() >= 0x80) { simple = false; + if (i > from) + from = i - 1; break; } } @@ -6679,6 +6681,10 @@ void qt_string_normalize(QString *data, QString::NormalizationForm mode, QChar:: } } } + + if (normalizationQuickCheckHelper(data, mode, from, &from)) + return; + decomposeHelper(data, mode < QString::NormalizationForm_KD, version, from); canonicalOrderHelper(data, version, from); |
