Fix potential breakage in QString.
Negation operator ("!") have precedence over bitwise and ("&"). Change-Id: I39e2d99da6eaa4477bbe35a1259f745e05c9841a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
09c90346aa
commit
c06106f28d
@ -6999,7 +6999,7 @@ QString QString::arg(qlonglong a, int fieldWidth, int base, QChar fillChar) cons
|
|||||||
QString locale_arg;
|
QString locale_arg;
|
||||||
if (d.locale_occurrences > 0) {
|
if (d.locale_occurrences > 0) {
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
if (!locale.numberOptions() & QLocale::OmitGroupSeparator)
|
if (!(locale.numberOptions() & QLocale::OmitGroupSeparator))
|
||||||
flags |= QLocalePrivate::ThousandsGroup;
|
flags |= QLocalePrivate::ThousandsGroup;
|
||||||
locale_arg = locale.d->longLongToString(a, -1, base, fieldWidth, flags);
|
locale_arg = locale.d->longLongToString(a, -1, base, fieldWidth, flags);
|
||||||
}
|
}
|
||||||
@ -7043,7 +7043,7 @@ QString QString::arg(qulonglong a, int fieldWidth, int base, QChar fillChar) con
|
|||||||
QString locale_arg;
|
QString locale_arg;
|
||||||
if (d.locale_occurrences > 0) {
|
if (d.locale_occurrences > 0) {
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
if (!locale.numberOptions() & QLocale::OmitGroupSeparator)
|
if (!(locale.numberOptions() & QLocale::OmitGroupSeparator))
|
||||||
flags |= QLocalePrivate::ThousandsGroup;
|
flags |= QLocalePrivate::ThousandsGroup;
|
||||||
locale_arg = locale.d->unsLongLongToString(a, -1, base, fieldWidth, flags);
|
locale_arg = locale.d->unsLongLongToString(a, -1, base, fieldWidth, flags);
|
||||||
}
|
}
|
||||||
@ -7178,7 +7178,7 @@ QString QString::arg(double a, int fieldWidth, char fmt, int prec, QChar fillCha
|
|||||||
if (d.locale_occurrences > 0) {
|
if (d.locale_occurrences > 0) {
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
|
|
||||||
if (!locale.numberOptions() & QLocale::OmitGroupSeparator)
|
if (!(locale.numberOptions() & QLocale::OmitGroupSeparator))
|
||||||
flags |= QLocalePrivate::ThousandsGroup;
|
flags |= QLocalePrivate::ThousandsGroup;
|
||||||
locale_arg = locale.d->doubleToString(a, prec, form, fieldWidth, flags);
|
locale_arg = locale.d->doubleToString(a, prec, form, fieldWidth, flags);
|
||||||
}
|
}
|
||||||
|
@ -5339,11 +5339,15 @@ void tst_QString::compareRef()
|
|||||||
void tst_QString::arg_locale()
|
void tst_QString::arg_locale()
|
||||||
{
|
{
|
||||||
QLocale l(QLocale::English, QLocale::UnitedKingdom);
|
QLocale l(QLocale::English, QLocale::UnitedKingdom);
|
||||||
|
QString str("*%L1*%L2*");
|
||||||
|
|
||||||
|
QCOMPARE(str.arg(123456).arg(1234.56), QString::fromLatin1("*123,456*1,234.56*"));
|
||||||
|
QLocale::setDefault(l);
|
||||||
|
|
||||||
l.setNumberOptions(QLocale::OmitGroupSeparator);
|
l.setNumberOptions(QLocale::OmitGroupSeparator);
|
||||||
QLocale::setDefault(l);
|
QLocale::setDefault(l);
|
||||||
QString str("*%L1*%L2*");
|
QCOMPARE(str.arg(123456).arg(1234.56), QString::fromLatin1("*123456*1234.56*"));
|
||||||
str = str.arg(123456).arg(1234.56);
|
|
||||||
QCOMPARE(str, QString::fromLatin1("*123456*1234.56*"));
|
|
||||||
QLocale::setDefault(QLocale::C);
|
QLocale::setDefault(QLocale::C);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user