diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2010-02-24 20:13:45 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-03-05 16:58:09 +0100 |
commit | 5cea1e11166998fc5862a782af4aa502f2b7be6a (patch) | |
tree | d926f9602580fb43567033d8d9e0fd20cab0d5e2 | |
parent | 455fac38c5a8ec9ef5c531ec7860a17b05ccfd07 (diff) |
improve error reporting
warn on upperCaseDiff/lowerCaseDiff/titleCaseDiff/caseFoldDiff 's value
exceeds signed short bounds
Merge-request: 480
Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
-rw-r--r-- | util/unicode/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp index 86da8a4297..84b50e1fc2 100644 --- a/util/unicode/main.cpp +++ b/util/unicode/main.cpp @@ -732,6 +732,8 @@ static void readUnicodeData() if (!properties[UD_UpperCase].isEmpty()) { int upperCase = properties[UD_UpperCase].toInt(&ok, 16); Q_ASSERT(ok); + if (qAbs(upperCase - codepoint) >= (1<<14)) + qWarning() << "upperCaseDiff exceeded (" << hex << codepoint << "->" << upperCase << ")"; data.p.upperCaseDiff = upperCase - codepoint; maxUpperCaseDiff = qMax(maxUpperCaseDiff, qAbs(data.p.upperCaseDiff)); if (codepoint > 0xffff) { @@ -743,6 +745,8 @@ static void readUnicodeData() if (!properties[UD_LowerCase].isEmpty()) { int lowerCase = properties[UD_LowerCase].toInt(&ok, 16); Q_ASSERT(ok); + if (qAbs(lowerCase - codepoint) >= (1<<14)) + qWarning() << "lowerCaseDiff exceeded (" << hex << codepoint << "->" << lowerCase << ")"; data.p.lowerCaseDiff = lowerCase - codepoint; maxLowerCaseDiff = qMax(maxLowerCaseDiff, qAbs(data.p.lowerCaseDiff)); if (codepoint > 0xffff) { @@ -757,6 +761,8 @@ static void readUnicodeData() if (!properties[UD_TitleCase].isEmpty()) { int titleCase = properties[UD_TitleCase].toInt(&ok, 16); Q_ASSERT(ok); + if (qAbs(titleCase - codepoint) >= (1<<14)) + qWarning() << "titleCaseDiff exceeded (" << hex << codepoint << "->" << titleCase << ")"; data.p.titleCaseDiff = titleCase - codepoint; maxTitleCaseDiff = qMax(maxTitleCaseDiff, qAbs(data.p.titleCaseDiff)); if (codepoint > 0xffff) { @@ -1258,6 +1264,8 @@ static void readCaseFolding() UnicodeData ud = unicodeData.value(codepoint, UnicodeData(codepoint)); if (foldMap.size() == 1) { + if (qAbs(foldMap.at(0) - codepoint) >= (1<<14)) + qWarning() << "caseFoldDiff exceeded (" << hex << codepoint << "->" << foldMap.at(0) << ")"; ud.p.caseFoldDiff = foldMap.at(0) - codepoint; maxCaseFoldDiff = qMax(maxCaseFoldDiff, qAbs(ud.p.caseFoldDiff)); if (codepoint > 0xffff) { |