From 9bf3228abc742e61ce1ca7295cfa7e277f82a6e6 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 25 May 2016 17:12:13 +0000 Subject: [PATCH] avoid unnecessary casts and constructions there are many more of those Signed-off-by: Ivailo Monev --- src/core/tools/qchar.h | 4 ---- src/core/tools/qdatetime.cpp | 4 ++-- src/core/xml/qxmlstream.cpp | 2 +- src/xml/sax/qxml.cpp | 8 ++++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/core/tools/qchar.h b/src/core/tools/qchar.h index 414bc0975..a29b797e5 100644 --- a/src/core/tools/qchar.h +++ b/src/core/tools/qchar.h @@ -225,11 +225,7 @@ public: char toAscii() const; inline char toLatin1() const; inline ushort unicode() const { return ucs; } -#ifdef Q_NO_PACKED_REFERENCE - inline ushort &unicode() { return const_cast(ucs); } -#else inline ushort &unicode() { return ucs; } -#endif static QChar fromAscii(char c); static QChar fromLatin1(char c); diff --git a/src/core/tools/qdatetime.cpp b/src/core/tools/qdatetime.cpp index d606a2462..810c4237b 100644 --- a/src/core/tools/qdatetime.cpp +++ b/src/core/tools/qdatetime.cpp @@ -3907,7 +3907,7 @@ static void localToUtc(QDate &date, QTime &time, int isdst) localTM.tm_mday = fakeDate.day(); localTM.tm_mon = fakeDate.month() - 1; localTM.tm_year = fakeDate.year() - 1900; - localTM.tm_isdst = (int)isdst; + localTM.tm_isdst = isdst; #if defined(Q_OS_WINCE) time_t secsSince1Jan1970UTC = (toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000); #else @@ -3941,7 +3941,7 @@ static void localToUtc(QDate &date, QTime &time, int isdst) res.tm_mday = sysTime.wDay; res.tm_mon = sysTime.wMonth - 1; res.tm_year = sysTime.wYear - 1900; - res.tm_isdst = (int)isdst; + res.tm_isdst = isdst; brokenDown = &res; #elif !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) // use the reentrant version of gmtime() where available diff --git a/src/core/xml/qxmlstream.cpp b/src/core/xml/qxmlstream.cpp index 4545c10b1..0a9f574f7 100644 --- a/src/core/xml/qxmlstream.cpp +++ b/src/core/xml/qxmlstream.cpp @@ -3101,7 +3101,7 @@ void QXmlStreamWriterPrivate::writeEscaped(const QString &s, bool escapeWhitespa else escaped += c; } else { - escaped += QChar(c); + escaped += c; } } write(escaped); diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index b413030d0..bb6b7fc2b 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -4459,7 +4459,7 @@ bool QXmlSimpleReaderPrivate::parseContent() bool QXmlSimpleReaderPrivate::reportEndEntities() { - int count = (int)xmlRefStack.count(); + int count = xmlRefStack.count(); while (count != 0 && xmlRefStack.top().isEmpty()) { if (contentHnd) { if (reportWhitespaceCharData || !string().simplified().isEmpty()) { @@ -7751,7 +7751,7 @@ bool QXmlSimpleReaderPrivate::processReference() { // Bypassed stringAddC(QLatin1Char('&')); - for (int i=0; i<(int)reference.length(); i++) { + for (int i=0; i