mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 19:02:59 +00:00
keep references to QByteArray objects
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a9e40f64c6
commit
835cfd56f6
2 changed files with 14 additions and 9 deletions
|
@ -1857,11 +1857,12 @@ Qt::DayOfWeek QLocale::firstDayOfWeek() const
|
|||
|
||||
QLocale::MeasurementSystem QLocalePrivate::measurementSystem() const
|
||||
{
|
||||
QByteArray latinbcp47 = bcp47Name().toLatin1();
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
UMeasurementSystem measurement = ulocdata_getMeasurementSystem(bcp47Name().toLatin1().constData(), &error);
|
||||
UMeasurementSystem measurement = ulocdata_getMeasurementSystem(latinbcp47.constData(), &error);
|
||||
if (Q_UNLIKELY(U_FAILURE(error))) {
|
||||
qWarning("QLocale::measurementSystem: ulocdata_getMeasurementSystem(%s) failed %s",
|
||||
bcp47Name().toLatin1().constData(), u_errorName(error));
|
||||
latinbcp47.constData(), u_errorName(error));
|
||||
return QLocale::MetricSystem;
|
||||
}
|
||||
switch (measurement) {
|
||||
|
@ -1930,7 +1931,8 @@ QLocale::MeasurementSystem QLocale::measurementSystem() const
|
|||
*/
|
||||
Qt::LayoutDirection QLocale::textDirection() const
|
||||
{
|
||||
if (uloc_isRightToLeft(bcp47Name().toLatin1().constData()))
|
||||
QByteArray latinbcp47 = bcp47Name().toLatin1();
|
||||
if (uloc_isRightToLeft(latinbcp47.constData()))
|
||||
return Qt::RightToLeft;
|
||||
return Qt::LeftToRight;
|
||||
}
|
||||
|
|
|
@ -243,12 +243,13 @@ bool qt_initLocale(const QString &locale)
|
|||
{
|
||||
qt_deinitLocale();
|
||||
|
||||
QByteArray latinlocale = locale.toLatin1();
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
icuCollator = ucol_open(locale.toLatin1().constData(), &error);
|
||||
icuCollator = ucol_open(latinlocale.constData(), &error);
|
||||
|
||||
if (Q_UNLIKELY(U_FAILURE(error))) {
|
||||
qWarning("qt_initLocale: ucol_open(%s) failed %s",
|
||||
locale.toLatin1().constData(), u_errorName(error));
|
||||
latinlocale.constData(), u_errorName(error));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -275,13 +276,14 @@ bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale)
|
|||
Q_ASSERT(out);
|
||||
out->resize(QMAXUSTRLEN(str.size()));
|
||||
|
||||
QByteArray latinbcp47 = locale.bcp47Name().toLatin1();
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
const int upperresult = u_strToUpper(reinterpret_cast<UChar*>(out->data()), out->size(),
|
||||
reinterpret_cast<const UChar*>(str.unicode()), str.size(),
|
||||
locale.bcp47Name().toLatin1().constData(), &error);
|
||||
latinbcp47.constData(), &error);
|
||||
if (Q_UNLIKELY(U_FAILURE(error))) {
|
||||
qWarning("qt_u_strToUpper: u_strToUpper(%s) failed %s",
|
||||
locale.bcp47Name().toLatin1().constData(), u_errorName(error));
|
||||
latinbcp47.constData(), u_errorName(error));
|
||||
out->clear();
|
||||
return false;
|
||||
}
|
||||
|
@ -295,13 +297,14 @@ bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale)
|
|||
Q_ASSERT(out);
|
||||
out->resize(QMAXUSTRLEN(str.size()));
|
||||
|
||||
QByteArray latinbcp47 = locale.bcp47Name().toLatin1();
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
const int lowerresult = u_strToLower(reinterpret_cast<UChar*>(out->data()), out->size(),
|
||||
reinterpret_cast<const UChar*>(str.unicode()), str.size(),
|
||||
locale.bcp47Name().toLatin1().constData(), &error);
|
||||
latinbcp47.constData(), &error);
|
||||
if (Q_UNLIKELY(U_FAILURE(error))) {
|
||||
qWarning("qt_u_strToLower: u_strToLower(%s) failed %s",
|
||||
locale.bcp47Name().toLatin1().constData(), u_errorName(error));
|
||||
latinbcp47.constData(), u_errorName(error));
|
||||
out->clear();
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue