diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-07-01 21:45:58 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-08-04 00:37:35 -0700 |
commit | 751919d4de2dc8bc7e5898ec8dff64e3ef9eec0f (patch) | |
tree | dcc1474d12c5b3e751e8d82e49ccb33486ffcfb4 /src | |
parent | cfa955040c8543cb95fc5fe040c20b46af73c96b (diff) |
QByteArray: delegate more of operator== & !+ to QByteArrayView
QByteArrayView is capable of dealing with null pointers.
Change-Id: I89c4eb48af38408daa7cfffd16fde9ab021ebf06
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qbytearray.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 888c3b96d5..d73224cf17 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -274,15 +274,15 @@ public: friend inline bool operator==(const QByteArray &a1, const QByteArray &a2) noexcept { return QByteArrayView(a1) == QByteArrayView(a2); } friend inline bool operator==(const QByteArray &a1, const char *a2) noexcept - { return a2 ? QtPrivate::compareMemory(a1, a2) == 0 : a1.isEmpty(); } + { return QByteArrayView(a1) == QByteArrayView(a2); } friend inline bool operator==(const char *a1, const QByteArray &a2) noexcept - { return a1 ? QtPrivate::compareMemory(a1, a2) == 0 : a2.isEmpty(); } + { return QByteArrayView(a1) == QByteArrayView(a2); } friend inline bool operator!=(const QByteArray &a1, const QByteArray &a2) noexcept { return !(a1==a2); } friend inline bool operator!=(const QByteArray &a1, const char *a2) noexcept - { return a2 ? QtPrivate::compareMemory(a1, a2) != 0 : !a1.isEmpty(); } + { return QByteArrayView(a1) != QByteArrayView(a2); } friend inline bool operator!=(const char *a1, const QByteArray &a2) noexcept - { return a1 ? QtPrivate::compareMemory(a1, a2) != 0 : !a2.isEmpty(); } + { return QByteArrayView(a1) != QByteArrayView(a2); } friend inline bool operator<(const QByteArray &a1, const QByteArray &a2) noexcept { return QtPrivate::compareMemory(QByteArrayView(a1), QByteArrayView(a2)) < 0; } friend inline bool operator<(const QByteArray &a1, const char *a2) noexcept |