From 9159ce0373d5faf852eea69462ba73ea7224fbca Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 19 Jul 2021 10:54:05 +0200 Subject: [PATCH] Remove some now-redundant casts to qint64 One was long redundant. The other two, relatively recently added, should be redundant thanks to the former enum member MSECS_PER_DAY being changed to a constexpr qint64 by commit 4059af81d33bb1f6a7773b77d3039f2fc53fcd23 Change-Id: I601ed8dae905fed6399ce29c25545ec651e9838a Reviewed-by: Giuseppe D'Angelo Reviewed-by: Qt CI Bot Reviewed-by: Eirik Aavitsland Reviewed-by: Andrei Golubev --- src/corelib/time/qdatetime.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp index 3b3668ddf3..65c705907a 100644 --- a/src/corelib/time/qdatetime.cpp +++ b/src/corelib/time/qdatetime.cpp @@ -2841,10 +2841,7 @@ bool QDateTimePrivate::epochMSecsToLocalTime(qint64 msecs, QDate *localDate, QTi ? QDateTimePrivate::DaylightTime : QDateTimePrivate::StandardTime; } - - // NB: cast to qint64 here is important to make sure a matching - // add_overflow is found, GCC 7.5.0 fails without this cast - if (add_overflow(msecs, qint64(sys.d->offsetFromUtc(msecs)) * MSECS_PER_SEC, &msecs)) + if (add_overflow(msecs, sys.d->offsetFromUtc(msecs) * MSECS_PER_SEC, &msecs)) return false; msecsToTime(msecs, localDate, localTime); return true; @@ -4146,9 +4143,7 @@ void QDateTime::setMSecsSinceEpoch(qint64 msecs) : QDateTimePrivate::StandardTime; offsetFromUtc = data.offsetFromUtc; if (!offsetFromUtc - // NB: cast to qint64 here is important to make sure a matching - // add_overflow is found, GCC 7.5.0 fails without this cast - || !add_overflow(msecs, qint64(offsetFromUtc * MSECS_PER_SEC), &local)) { + || !add_overflow(msecs, offsetFromUtc * MSECS_PER_SEC, &local)) { status |= QDateTimePrivate::ValidWhenMask; } } @@ -5312,7 +5307,7 @@ QDataStream &operator<<(QDataStream &out, QDate date) if (out.version() < QDataStream::Qt_5_0) return out << quint32(date.jd); else - return out << qint64(date.jd); + return out << date.jd; } /*!