From 9d242afbd01bef6f5f0455100dc8299980ae08ca Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 10 Apr 2024 16:13:37 +0200 Subject: [PATCH] QDateTime, QTimeZone: pass ShortData by value to comparison The internal ShortData types are trivially copyable. Although their operator==()s are defined in the bodies of public API classes, they are inline and act on private member classes, so the change (technically) to a public API class should be invisible to client code, hence both source and binary compatible. Task-number: QTBUG-122619 Change-Id: I854474c02da6607e7e81aa9161ce5b5aae659f00 Reviewed-by: Thiago Macieira --- src/corelib/time/qdatetime.h | 2 +- src/corelib/time/qtimezone.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index f8a9360fbb..e1c0d29e2a 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -302,7 +302,7 @@ class Q_CORE_EXPORT QDateTime quintptr status : 8; # endif #endif - friend constexpr bool operator==(const ShortData &lhs, const ShortData &rhs) + friend constexpr bool operator==(ShortData lhs, ShortData rhs) { return lhs.status == rhs.status && lhs.msecs == rhs.msecs; } }; diff --git a/src/corelib/time/qtimezone.h b/src/corelib/time/qtimezone.h index fc53a74453..46c7d6312b 100644 --- a/src/corelib/time/qtimezone.h +++ b/src/corelib/time/qtimezone.h @@ -49,7 +49,7 @@ class Q_CORE_EXPORT QTimeZone #endif { } - friend constexpr bool operator==(const ShortData &lhs, const ShortData &rhs) + friend constexpr bool operator==(ShortData lhs, ShortData rhs) { return lhs.mode == rhs.mode && lhs.offset == rhs.offset; } constexpr Qt::TimeSpec spec() const { return Qt::TimeSpec((mode + 3) & 3); } };