summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-03-03 16:42:45 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-03-03 16:43:25 (GMT)
commit6380fc16d5127b28804d16b1d1672105f3851605 (patch)
treeb4000926e59f669537df3d0736bd8b1aa2de4fc3
parentf57305f37b967a761fe922d3ab1a9d530a4408bb (diff)
downloadQt-6380fc16d5127b28804d16b1d1672105f3851605.zip
Qt-6380fc16d5127b28804d16b1d1672105f3851605.tar.gz
Qt-6380fc16d5127b28804d16b1d1672105f3851605.tar.bz2
Fixed parsing on the locale name in QLocale.
Fixes QLocale autotests on Windows. Reviewed-by: trustme
-rw-r--r--src/corelib/tools/qlocale.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index efa1f6c..609bf0c 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -280,10 +280,12 @@ static bool parse_locale_tag(const QString &input, int &i, QString *result, cons
const QChar *uc = input.data() + i;
const int l = input.length();
int size = 0;
- for (; i < l && size < 5; ++i, ++size) {
+ for (; i < l && size < 8; ++i, ++size) {
if (separators.contains(*uc))
break;
- if (uc->unicode() > 0xFF) // latin only
+ if (! ((uc->unicode() >= 'a' && uc->unicode() <= 'z') ||
+ (uc->unicode() >= 'A' && uc->unicode() <= 'Z') ||
+ (uc->unicode() >= '0' && uc->unicode() <= '9')) ) // latin only
return false;
*pch++ = *uc++;
}
@@ -307,6 +309,10 @@ bool splitLocaleName(const QString &name, QString &lang, QString &script, QStrin
QChar sep = i < length ? name.at(i) : QChar();
switch (state) {
case LangState:
+ if (!sep.isNull() && !separators.contains(sep)) {
+ state = NoState;
+ break;
+ }
lang = value;
if (i == length) {
// just language was specified