diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-29 13:51:16 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-29 15:30:17 +0200 |
commit | 1cc571593a67f3e688a5cbb896f0be71ca5a2b30 (patch) | |
tree | c652360c9276cbf475244fd02313d64e3df11a96 /src/corelib/json | |
parent | 829c59aa4acf94bd979f6a3162808be36802d79a (diff) | |
parent | cc74452d6d259d36ac47c536f11a5efb269e8e44 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a
were reverted because of reconstruction in 5.7.
defineTest(qtConfTest_checkCompiler) in configure.pri is smart
enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5.
DirectWrite: Fix advances being scaled to 0
Since 131eee5cd, the stretch of a font can be 0, meaning
"whatever the font provides". In combination with ec7fee96,
this would cause advances in the DirectWrite engine to be scaled to
0, causing the QRawFont test to fail.
Conflicts:
configure
mkspecs/features/uikit/device_destinations.sh
mkspecs/features/uikit/xcodebuild.mk
src/corelib/global/qglobal.cpp
src/corelib/global/qnamespace.qdoc
src/plugins/platforms/cocoa/qcocoamenuitem.h
src/plugins/platforms/windows/qwindowsservices.cpp
src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
src/widgets/kernel/qapplication.cpp
tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp
Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
Diffstat (limited to 'src/corelib/json')
-rw-r--r-- | src/corelib/json/qjson_p.h | 54 | ||||
-rw-r--r-- | src/corelib/json/qjsonvalue.h | 2 |
2 files changed, 35 insertions, 21 deletions
diff --git a/src/corelib/json/qjson_p.h b/src/corelib/json/qjson_p.h index 1cffdbc250..4be62172a2 100644 --- a/src/corelib/json/qjson_p.h +++ b/src/corelib/json/qjson_p.h @@ -323,7 +323,7 @@ class Latin1String; class String { public: - String(const char *data) { d = (Data *)data; } + explicit String(const char *data) { d = (Data *)data; } struct Data { qle_int length; @@ -397,7 +397,7 @@ public: class Latin1String { public: - Latin1String(const char *data) { d = (Data *)data; } + explicit Latin1String(const char *data) { d = (Data *)data; } struct Data { qle_short length; @@ -438,26 +438,10 @@ public: return *this; } - inline bool operator ==(const QString &str) const { - return QLatin1String(d->latin1, d->length) == str; - } - inline bool operator !=(const QString &str) const { - return !operator ==(str); - } - inline bool operator >=(const QString &str) const { - return QLatin1String(d->latin1, d->length) >= str; + QLatin1String toQLatin1String() const Q_DECL_NOTHROW { + return QLatin1String(d->latin1, d->length); } - inline bool operator ==(const Latin1String &str) const { - return d->length == str.d->length && !strcmp(d->latin1, str.d->latin1); - } - inline bool operator >=(const Latin1String &str) const { - int l = qMin(d->length, str.d->length); - int val = strncmp(d->latin1, str.d->latin1, l); - if (!val) - val = d->length - str.d->length; - return val >= 0; - } inline bool operator<(const String &str) const { const qle_ushort *uc = (qle_ushort *) str.d->utf16; @@ -488,6 +472,36 @@ public: } }; +#define DEF_OP(op) \ + inline bool operator op(Latin1String lhs, Latin1String rhs) Q_DECL_NOTHROW \ + { \ + return lhs.toQLatin1String() op rhs.toQLatin1String(); \ + } \ + inline bool operator op(QLatin1String lhs, Latin1String rhs) Q_DECL_NOTHROW \ + { \ + return lhs op rhs.toQLatin1String(); \ + } \ + inline bool operator op(Latin1String lhs, QLatin1String rhs) Q_DECL_NOTHROW \ + { \ + return lhs.toQLatin1String() op rhs; \ + } \ + inline bool operator op(const QString &lhs, Latin1String rhs) Q_DECL_NOTHROW \ + { \ + return lhs op rhs.toQLatin1String(); \ + } \ + inline bool operator op(Latin1String lhs, const QString &rhs) Q_DECL_NOTHROW \ + { \ + return lhs.toQLatin1String() op rhs; \ + } \ + /*end*/ +DEF_OP(==) +DEF_OP(!=) +DEF_OP(< ) +DEF_OP(> ) +DEF_OP(<=) +DEF_OP(>=) +#undef DEF_OP + inline bool String::operator ==(const Latin1String &str) const { if ((int)d->length != (int)str.d->length) diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h index 1ce7f745e0..a853acaddd 100644 --- a/src/corelib/json/qjsonvalue.h +++ b/src/corelib/json/qjsonvalue.h @@ -82,7 +82,7 @@ public: QJsonValue(QLatin1String s); #ifndef QT_NO_CAST_FROM_ASCII inline QT_ASCII_CAST_WARN QJsonValue(const char *s) - : d(0), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); } + : d(Q_NULLPTR), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); } #endif QJsonValue(const QJsonArray &a); QJsonValue(const QJsonObject &o); |