summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-04-05 14:22:45 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2016-04-05 14:22:45 +0200
commitf2856875843efce9a00e90dad05bde358ab82197 (patch)
tree93346c38504ce04f0bf02dfe4a21299feb1be8ed /src/corelib/tools/qlocale.cpp
parenta7b04275082d065f392e7f18c54ea9b41507ae40 (diff)
parenta2970719c26c946fd6fea7d902aad6706a4ca6ea (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: examples/corelib/ipc/ipc.pro src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r--src/corelib/tools/qlocale.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index ca70d89a83..e5a21dfef4 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -91,9 +91,8 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include "qlocale_data_p.h"
QT_END_INCLUDE_NAMESPACE
-QLocale::Language QLocalePrivate::codeToLanguage(const QString &code)
+QLocale::Language QLocalePrivate::codeToLanguage(const QChar *code, int len) Q_DECL_NOTHROW
{
- int len = code.length();
if (len != 2 && len != 3)
return QLocale::C;
ushort uc1 = code[0].toLower().unicode();
@@ -134,17 +133,16 @@ QLocale::Language QLocalePrivate::codeToLanguage(const QString &code)
return QLocale::C;
}
-QLocale::Script QLocalePrivate::codeToScript(const QString &code)
+QLocale::Script QLocalePrivate::codeToScript(const QChar *code, int len) Q_DECL_NOTHROW
{
- int len = code.length();
if (len != 4)
return QLocale::AnyScript;
// script is titlecased in our data
- unsigned char c0 = code.at(0).toUpper().toLatin1();
- unsigned char c1 = code.at(1).toLower().toLatin1();
- unsigned char c2 = code.at(2).toLower().toLatin1();
- unsigned char c3 = code.at(3).toLower().toLatin1();
+ unsigned char c0 = code[0].toUpper().toLatin1();
+ unsigned char c1 = code[1].toLower().toLatin1();
+ unsigned char c2 = code[2].toLower().toLatin1();
+ unsigned char c3 = code[3].toLower().toLatin1();
const unsigned char *c = script_code_list;
for (int i = 0; i < QLocale::LastScript; ++i, c += 4) {
@@ -154,9 +152,8 @@ QLocale::Script QLocalePrivate::codeToScript(const QString &code)
return QLocale::AnyScript;
}
-QLocale::Country QLocalePrivate::codeToCountry(const QString &code)
+QLocale::Country QLocalePrivate::codeToCountry(const QChar *code, int len) Q_DECL_NOTHROW
{
- int len = code.length();
if (len != 2 && len != 3)
return QLocale::AnyCountry;
ushort uc1 = code[0].toUpper().unicode();