QLocale: Minor code dde-uplication

Change-Id: Ie48111a8f76798eb706d6a4036c7965d32ed542b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
bb10
Konstantin Ritt 2013-08-13 05:12:35 +03:00 committed by The Qt Project
parent 2e0a4b13ad
commit cb7921a433
1 changed files with 6 additions and 8 deletions

View File

@ -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);
}