diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2013-08-13 05:12:35 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-14 22:47:10 +0200 |
commit | cb7921a4331c523a9843a2d825ed9e58b24bf26d (patch) | |
tree | 34df240c0c0ac6c086264f36b5a7925dc6f29aa2 /src/corelib/tools/qlocale.cpp | |
parent | 2e0a4b13addf1f56112bac38448be96fb02f650d (diff) |
QLocale: Minor code dde-uplication
Change-Id: Ie48111a8f76798eb706d6a4036c7965d32ed542b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index ede783bf9e..e8e4c9ad67 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -652,6 +652,11 @@ const QLocaleData *QLocaleData::c() return c_data; } +static inline QString getLocaleData(const ushort *data, int size) +{ + return size > 0 ? QString::fromRawData(reinterpret_cast<const QChar *>(data), size) : QString(); +} + static QString getLocaleListData(const ushort *data, int size, int index) { static const ushort separator = ';'; @@ -665,14 +670,7 @@ static QString getLocaleListData(const ushort *data, int size, int index) const ushort *end = data; while (size > 0 && *end != separator) ++end, --size; - if (end-data == 0) - return QString(); - return QString::fromRawData(reinterpret_cast<const QChar*>(data), end-data); -} - -static inline QString getLocaleData(const ushort *data, int size) -{ - return size ? QString::fromRawData(reinterpret_cast<const QChar*>(data), size) : QString(); + return getLocaleData(data, end - data); } |