mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
pass QByteArray object to qt_u_strToUpper() and qt_u_strToLower() functions
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
dee2273432
commit
0aa306b3f6
3 changed files with 10 additions and 12 deletions
|
@ -1547,7 +1547,7 @@ Qt::LayoutDirection QLocale::textDirection() const
|
|||
QString QLocale::toUpper(const QString &str) const
|
||||
{
|
||||
QString result;
|
||||
if (qt_u_strToUpper(str, &result, *this))
|
||||
if (qt_u_strToUpper(str, &result, bcp47Name()))
|
||||
return result;
|
||||
return str.toUpper();
|
||||
}
|
||||
|
@ -1560,7 +1560,7 @@ QString QLocale::toUpper(const QString &str) const
|
|||
QString QLocale::toLower(const QString &str) const
|
||||
{
|
||||
QString result;
|
||||
if (qt_u_strToLower(str, &result, *this))
|
||||
if (qt_u_strToLower(str, &result, bcp47Name()))
|
||||
return result;
|
||||
return str.toLower();
|
||||
}
|
||||
|
|
|
@ -254,19 +254,18 @@ bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale)
|
||||
bool qt_u_strToUpper(const QString &str, QString *out, const QByteArray &locale)
|
||||
{
|
||||
Q_ASSERT(out);
|
||||
out->resize(QMAXUSTRLEN(str.size()));
|
||||
|
||||
const QByteArray asciibcp47 = locale.bcp47Name();
|
||||
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(),
|
||||
asciibcp47.constData(), &error);
|
||||
locale.constData(), &error);
|
||||
if (Q_UNLIKELY(U_FAILURE(error))) {
|
||||
qWarning("qt_u_strToUpper: u_strToUpper(%s) failed %s",
|
||||
asciibcp47.constData(), u_errorName(error));
|
||||
locale.constData(), u_errorName(error));
|
||||
out->clear();
|
||||
return false;
|
||||
}
|
||||
|
@ -275,19 +274,18 @@ bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale)
|
||||
bool qt_u_strToLower(const QString &str, QString *out, const QByteArray &locale)
|
||||
{
|
||||
Q_ASSERT(out);
|
||||
out->resize(QMAXUSTRLEN(str.size()));
|
||||
|
||||
const QByteArray asciibcp47 = locale.bcp47Name();
|
||||
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(),
|
||||
asciibcp47.constData(), &error);
|
||||
locale.constData(), &error);
|
||||
if (Q_UNLIKELY(U_FAILURE(error))) {
|
||||
qWarning("qt_u_strToLower: u_strToLower(%s) failed %s",
|
||||
asciibcp47.constData(), u_errorName(error));
|
||||
locale.constData(), u_errorName(error));
|
||||
out->clear();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -97,8 +97,8 @@ bool removeGroupSeparators(QLocalePrivate::CharBuff *num);
|
|||
|
||||
bool qt_initLocale(const QByteArray &locale);
|
||||
bool qt_ucol_strcoll(const QChar *source, int sourceLength, const QChar *target, int targetLength, int *result);
|
||||
bool qt_u_strToUpper(const QString &str, QString *out, const QLocale &locale);
|
||||
bool qt_u_strToLower(const QString &str, QString *out, const QLocale &locale);
|
||||
bool qt_u_strToUpper(const QString &str, QString *out, const QByteArray &locale);
|
||||
bool qt_u_strToLower(const QString &str, QString *out, const QByteArray &locale);
|
||||
|
||||
#define QECVT_BUFFSIZE 17
|
||||
char *qFcvt(double x, int n, int *dp, int *sign, char* buf);
|
||||
|
|
Loading…
Add table
Reference in a new issue