From 6aac5c5cf36fef62431b98d813803dfdc0a6b475 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 13 Feb 2015 14:55:03 +0100 Subject: Fix links in plural words. In some documents, "{QObject}s" was used which didn't show up as link. This is fixed by using "\l{QObject}s" instead. Change-Id: I90dbd543790842b242a11f3f94a32d4273ebb38d Reviewed-by: Martin Smith --- src/corelib/tools/qbytearray.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index bd0215902c..5ec8c317e8 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -726,7 +726,7 @@ static inline char qToLower(char c) occurrences of a particular value with another, use one of the two-parameter replace() overloads. - {QByteArray}s can be compared using overloaded operators such as + \l{QByteArray}s can be compared using overloaded operators such as operator<(), operator<=(), operator==(), operator>=(), and so on. The comparison is based exclusively on the numeric values of the characters and is very fast, but is not what a human would @@ -771,7 +771,7 @@ static inline char qToLower(char c) lastIndexOf(), operator<(), operator<=(), operator>(), operator>=(), toLower() and toUpper(). - This issue does not apply to {QString}s since they represent + This issue does not apply to \l{QString}s since they represent characters using Unicode. \sa QString, QBitArray -- cgit v1.2.3 From 738e9b185c72b6814bc3e4ea2a7a23adce326a73 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 14 Feb 2015 21:45:32 -0800 Subject: Fix Intel compiler warning about change of sign The variable c is unsigned, so the second operand is unsigned, constraing the -1 to be unsigned too and causing a change of sign. Instead, cast the middle operations to int, as that's the return value anyway. error #68: integer conversion resulted in a change of sign Change-Id: I1a800c709d3543699131ffff13c2fd79f14f8b43 Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Marc Mutz --- src/corelib/tools/qtools_p.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qtools_p.h b/src/corelib/tools/qtools_p.h index b48ed94236..3a407aea5b 100644 --- a/src/corelib/tools/qtools_p.h +++ b/src/corelib/tools/qtools_p.h @@ -63,9 +63,9 @@ Q_DECL_CONSTEXPR inline char toHexLower(uint value) Q_DECL_NOTHROW Q_DECL_CONSTEXPR inline int fromHex(uint c) Q_DECL_NOTHROW { - return ((c >= '0') && (c <= '9')) ? c - '0' : - ((c >= 'A') && (c <= 'F')) ? c - 'A' + 10 : - ((c >= 'a') && (c <= 'f')) ? c - 'a' + 10 : + return ((c >= '0') && (c <= '9')) ? int(c - '0') : + ((c >= 'A') && (c <= 'F')) ? int(c - 'A' + 10) : + ((c >= 'a') && (c <= 'f')) ? int(c - 'a' + 10) : /* otherwise */ -1; } @@ -76,7 +76,7 @@ Q_DECL_CONSTEXPR inline char toOct(uint value) Q_DECL_NOTHROW Q_DECL_CONSTEXPR inline int fromOct(uint c) Q_DECL_NOTHROW { - return ((c >= '0') && (c <= '7')) ? c - '0' : -1; + return ((c >= '0') && (c <= '7')) ? int(c - '0') : -1; } } -- cgit v1.2.3 From 8fbde82686a5183d1b6e9c98e677f4961fb1b11c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 13 Feb 2015 11:55:40 +0100 Subject: Fix MSVC 2013/64bit warnings about conversion from 'size_t' to 'int'. tools\qstring.cpp(243) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(287) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(292) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(305) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(312) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data Change-Id: I20b92b0783f4859e9da83364b4ec86dd8bbd1c4c Reviewed-by: Kai Koehne --- src/corelib/tools/qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index aa35d764fa..beda0f4919 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -240,7 +240,7 @@ void qt_from_latin1(ushort *dst, const char *str, size_t size) dst += offset; str += offset; # ifdef Q_COMPILER_LAMBDA - return UnrollTailLoop<15>::exec(size, [=](int i) { dst[i] = (uchar)str[i]; }); + return UnrollTailLoop<15>::exec(int(size), [=](int i) { dst[i] = (uchar)str[i]; }); # endif #endif #if defined(__mips_dsp) -- cgit v1.2.3 From 6716fe8cfdeb5f8cd63d6dde8252b25d86622404 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 21 Feb 2015 09:57:09 +0100 Subject: QVector: fix use of invalid iterators in removeAll() The c2m() function which converts a const_iterator into an iterator is a broken concept for an implicitly shared container such as QVector, because the act of calling begin() as the starting point already detaches and invalidates the c2m argument. This could be fixed in c2m, but the bug wasn't even in c2m, but in removeAll(), which called end() before c2m, so the c2m argument was already invalidated when entering c2m. The solution is to store the positions as indices instead of iterators before calling the first detaching function. Task-number: QTBUG-44592 Change-Id: I66cf4f1277e71148a4d5b5bbfb6a3369ad02db68 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qvector.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 07c66bc393..e263b99c02 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -153,7 +153,9 @@ public: const const_iterator ce = this->cend(), cit = std::find(this->cbegin(), ce, t); if (cit == ce) return 0; - const iterator e = end(), it = std::remove(c2m(cit), e, t); + // next operation detaches, so ce, cit may become invalidated: + const int firstFoundIdx = std::distance(this->cbegin(), cit); + const iterator e = end(), it = std::remove(begin() + firstFoundIdx, e, t); const int result = std::distance(it, e); erase(it, e); return result; -- cgit v1.2.3 From 402f994f12fc524871f2b1d2337ab07ad3d412b8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 21 Feb 2015 23:31:02 -0800 Subject: Timezones: Fix handling of offset-from-UTC QTimeZones Those QTimeZones failed to convert to other timezones because the data() virtual function was never overridden and reimplemented. That meant all QUtcTimeZonePrivate objects were *really* UTC, with no offset. Task-number: QTBUG-44600 Change-Id: Ia0aac2f09e9245339951ffff13c5294bb783c674 Reviewed-by: Marc Mutz --- src/corelib/tools/qtimezoneprivate.cpp | 9 +++++++++ src/corelib/tools/qtimezoneprivate_p.h | 2 ++ 2 files changed, 11 insertions(+) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index e768905462..4f6067f508 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -619,6 +619,15 @@ QTimeZonePrivate *QUtcTimeZonePrivate::clone() return new QUtcTimeZonePrivate(*this); } +QTimeZonePrivate::Data QUtcTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const +{ + Data d = invalidData(); + d.abbreviation = m_abbreviation; + d.atMSecsSinceEpoch = forMSecsSinceEpoch; + d.offsetFromUtc = m_offsetFromUtc; + return d; +} + void QUtcTimeZonePrivate::init(const QByteArray &zoneId) { m_id = zoneId; diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h index 5ba42de560..f1d934abf3 100644 --- a/src/corelib/tools/qtimezoneprivate_p.h +++ b/src/corelib/tools/qtimezoneprivate_p.h @@ -181,6 +181,8 @@ public: QTimeZonePrivate *clone(); + Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE; + QLocale::Country country() const Q_DECL_OVERRIDE; QString comment() const Q_DECL_OVERRIDE; -- cgit v1.2.3