From b60773934dc0231b53e1fde3e5927d969bbf6298 Mon Sep 17 00:00:00 2001 From: Israel Lins Date: Mon, 15 Dec 2014 12:24:42 -0300 Subject: [QDateTime] ISO Time zone designators can be [+-]HH Added support on QDateTime::fromString to read correctly dates on ISO format with Time zone designators at format [+-]HH Change-Id: Ied5c3b7950aee3d0879af0e05398081395c18df5 Reviewed-by: Thiago Macieira Reviewed-by: Mark Brand --- src/corelib/tools/qdatetime.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index f0f6a56755..021eb5ae5d 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -248,7 +248,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0')); } -// Parse offset in [+-]HH[:]MM format +// Parse offset in [+-]HH[[:]MM] format static int fromOffsetString(const QString &offsetString, bool *valid) { *valid = false; @@ -272,7 +272,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) // Split the hour and minute parts QStringList parts = offsetString.mid(1).split(QLatin1Char(':')); if (parts.count() == 1) { - // [+-]HHMM format + // [+-]HHMM or [+-]HH format parts.append(parts.at(0).mid(2)); parts[0] = parts.at(0).left(2); } @@ -282,7 +282,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) if (!ok) return 0; - const int minute = parts.at(1).toInt(&ok); + const int minute = (parts.at(1).isEmpty()) ? 0 : parts.at(1).toInt(&ok); if (!ok || minute < 0 || minute > 59) return 0; @@ -4428,8 +4428,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) } else { // the loop below is faster but functionally equal to: // const int signIndex = isoString.indexOf(QRegExp(QStringLiteral("[+-]"))); - const int sizeOfTimeZoneString = 4; - int signIndex = isoString.size() - sizeOfTimeZoneString - 1; + int signIndex = isoString.size() - 1; bool found = false; { const QChar plus = QLatin1Char('+'); -- cgit v1.2.3 From 86ca4de8a257611d5811a1cbf9c8b5c9336188e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jan 2015 11:20:59 -0200 Subject: Doc: fix the type listed for the functions in QAtomicInteger The "int" was a left over when this was documentation for QAtomicInt. Change-Id: If7b7688982d27cbbd42f080eff7d08344b587f44 Reviewed-by: Richard J. Moore --- src/corelib/thread/qatomic.cpp | 86 ++++++++++++++++++------------------- src/corelib/thread/qatomic.h | 96 +++++++++++++++++++++--------------------- 2 files changed, 91 insertions(+), 91 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index 2ac32d5d6b..0f4c8efb03 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -250,7 +250,7 @@ /*! - \fn int QAtomicInteger::load() const + \fn T QAtomicInteger::load() const Atomically loads the value of this QAtomicInteger using relaxed memory ordering. The value is not modified in any way, but note that there's no @@ -260,7 +260,7 @@ */ /*! - \fn int QAtomicInteger::loadAcquire() const + \fn T QAtomicInteger::loadAcquire() const Atomically loads the value of this QAtomicInteger using the "Acquire" memory ordering. The value is not modified in any way, but note that there's no @@ -270,7 +270,7 @@ */ /*! - \fn void QAtomicInteger::store(int newValue) + \fn void QAtomicInteger::store(T newValue) Atomically stores the \a newValue value into this atomic type, using relaxed memory ordering. @@ -279,7 +279,7 @@ */ /*! - \fn void QAtomicInteger::storeRelease(int newValue) + \fn void QAtomicInteger::storeRelease(T newValue) Atomically stores the \a newValue value into this atomic type, using the "Release" memory ordering. @@ -288,7 +288,7 @@ */ /*! - \fn QAtomicInteger::operator int() const + \fn QAtomicInteger::operator T() const \since 5.3 Atomically loads the value of this QAtomicInteger using a sequentially @@ -300,7 +300,7 @@ */ /*! - \fn QAtomicInteger &QAtomicInteger::operator=(int newValue) + \fn QAtomicInteger &QAtomicInteger::operator=(T newValue) \since 5.3 Atomically stores the \a newValue value into this atomic type using a @@ -335,7 +335,7 @@ */ /*! - \fn int QAtomicInteger::operator++() + \fn T QAtomicInteger::operator++() \since 5.3 Atomically pre-increments the value of this QAtomicInteger. Returns the new @@ -348,7 +348,7 @@ */ /*! - \fn int QAtomicInteger::operator++(int) + \fn T QAtomicInteger::operator++(int) \since 5.3 Atomically post-increments the value of this QAtomicInteger. Returns the old @@ -373,7 +373,7 @@ */ /*! - \fn int QAtomicInteger::operator--() + \fn T QAtomicInteger::operator--() \since 5.3 Atomically pre-decrements the value of this QAtomicInteger. Returns the new @@ -386,7 +386,7 @@ */ /*! - \fn int QAtomicInteger::operator--(int) + \fn T QAtomicInteger::operator--(int) \since 5.3 Atomically post-decrements the value of this QAtomicInteger. Returns the old @@ -409,7 +409,7 @@ Returns \c true if atomic test-and-set is wait-free, false otherwise. */ -/*! \fn bool QAtomicInteger::testAndSetRelaxed(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue) Atomic test-and-set. @@ -423,7 +423,7 @@ processor to freely reorder memory accesses. */ -/*! \fn bool QAtomicInteger::testAndSetAcquire(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue) Atomic test-and-set. @@ -438,7 +438,7 @@ be re-ordered before the atomic operation. */ -/*! \fn bool QAtomicInteger::testAndSetRelease(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue) Atomic test-and-set. @@ -453,7 +453,7 @@ re-ordered after the atomic operation. */ -/*! \fn bool QAtomicInteger::testAndSetOrdered(int expectedValue, int newValue) +/*! \fn bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue) Atomic test-and-set. @@ -480,7 +480,7 @@ otherwise. */ -/*! \fn int QAtomicInteger::fetchAndStoreRelaxed(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreRelaxed(T newValue) Atomic fetch-and-store. @@ -492,7 +492,7 @@ processor to freely reorder memory accesses. */ -/*! \fn int QAtomicInteger::fetchAndStoreAcquire(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreAcquire(T newValue) Atomic fetch-and-store. @@ -505,7 +505,7 @@ be re-ordered before the atomic operation. */ -/*! \fn int QAtomicInteger::fetchAndStoreRelease(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreRelease(T newValue) Atomic fetch-and-store. @@ -518,7 +518,7 @@ re-ordered after the atomic operation. */ -/*! \fn int QAtomicInteger::fetchAndStoreOrdered(int newValue) +/*! \fn T QAtomicInteger::fetchAndStoreOrdered(T newValue) Atomic fetch-and-store. @@ -543,7 +543,7 @@ otherwise. */ -/*! \fn int QAtomicInteger::fetchAndAddRelaxed(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd) Atomic fetch-and-add. @@ -557,7 +557,7 @@ \sa operator+=(), fetchAndSubRelaxed() */ -/*! \fn int QAtomicInteger::fetchAndAddAcquire(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddAcquire(T valueToAdd) Atomic fetch-and-add. @@ -572,7 +572,7 @@ \sa operator+=(), fetchAndSubAcquire() */ -/*! \fn int QAtomicInteger::fetchAndAddRelease(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddRelease(T valueToAdd) Atomic fetch-and-add. @@ -587,7 +587,7 @@ \sa operator+=(), fetchAndSubRelease() */ -/*! \fn int QAtomicInteger::fetchAndAddOrdered(int valueToAdd) +/*! \fn T QAtomicInteger::fetchAndAddOrdered(T valueToAdd) Atomic fetch-and-add. @@ -602,7 +602,7 @@ \sa operator+=(), fetchAndSubOrdered() */ -/*! \fn int QAtomicInteger::operator+=(int valueToAdd) +/*! \fn T QAtomicInteger::operator+=(T valueToAdd) \since 5.3 Atomic add-and-fetch. @@ -616,7 +616,7 @@ \sa fetchAndAddOrdered(), operator-=() */ -/*! \fn int QAtomicInteger::fetchAndSubRelaxed(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubRelaxed(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -631,7 +631,7 @@ \sa operator-=(), fetchAndAddRelaxed() */ -/*! \fn int QAtomicInteger::fetchAndSubAcquire(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubAcquire(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -647,7 +647,7 @@ \sa operator-=(), fetchAndAddAcquire() */ -/*! \fn int QAtomicInteger::fetchAndSubRelease(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubRelease(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -663,7 +663,7 @@ \sa operator-=(), fetchAndAddRelease() */ -/*! \fn int QAtomicInteger::fetchAndSubOrdered(int valueToSub) +/*! \fn T QAtomicInteger::fetchAndSubOrdered(T valueToSub) \since 5.3 Atomic fetch-and-sub. @@ -679,7 +679,7 @@ \sa operator-=(), fetchAndAddOrdered() */ -/*! \fn int QAtomicInteger::operator-=(int valueToSub) +/*! \fn T QAtomicInteger::operator-=(T valueToSub) \since 5.3 Atomic sub-and-fetch. @@ -693,7 +693,7 @@ \sa fetchAndSubOrdered(), operator+=() */ -/*! \fn int QAtomicInteger::fetchAndOrRelaxed(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrRelaxed(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -708,7 +708,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::fetchAndOrAcquire(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrAcquire(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -724,7 +724,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::fetchAndOrRelease(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrRelease(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -740,7 +740,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::fetchAndOrOrdered(int valueToOr) +/*! \fn T QAtomicInteger::fetchAndOrOrdered(T valueToOr) \since 5.3 Atomic fetch-and-or. @@ -756,7 +756,7 @@ \sa operator|=() */ -/*! \fn int QAtomicInteger::operator|=(int valueToOr) +/*! \fn T QAtomicInteger::operator|=(T valueToOr) \since 5.3 Atomic or-and-fetch. @@ -770,7 +770,7 @@ \sa fetchAndOrOrdered() */ -/*! \fn int QAtomicInteger::fetchAndXorRelaxed(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorRelaxed(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -785,7 +785,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::fetchAndXorAcquire(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorAcquire(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -801,7 +801,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::fetchAndXorRelease(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorRelease(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -817,7 +817,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::fetchAndXorOrdered(int valueToXor) +/*! \fn T QAtomicInteger::fetchAndXorOrdered(T valueToXor) \since 5.3 Atomic fetch-and-xor. @@ -833,7 +833,7 @@ \sa operator^=() */ -/*! \fn int QAtomicInteger::operator^=(int valueToXor) +/*! \fn T QAtomicInteger::operator^=(T valueToXor) \since 5.3 Atomic xor-and-fetch. @@ -847,7 +847,7 @@ \sa fetchAndXorOrdered() */ -/*! \fn int QAtomicInteger::fetchAndAndRelaxed(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -862,7 +862,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::fetchAndAndAcquire(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndAcquire(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -878,7 +878,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::fetchAndAndRelease(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndRelease(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -894,7 +894,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::fetchAndAndOrdered(int valueToAnd) +/*! \fn T QAtomicInteger::fetchAndAndOrdered(T valueToAnd) \since 5.3 Atomic fetch-and-and. @@ -910,7 +910,7 @@ \sa operator&=() */ -/*! \fn int QAtomicInteger::operator&=(int valueToAnd) +/*! \fn T QAtomicInteger::operator&=(T valueToAnd) \since 5.3 Atomic add-and-fetch. diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h index 7526cfe0e6..72cb3866a5 100644 --- a/src/corelib/thread/qatomic.h +++ b/src/corelib/thread/qatomic.h @@ -76,13 +76,13 @@ public: } #ifdef Q_QDOC - int load() const; - int loadAcquire() const; - void store(int newValue); - void storeRelease(int newValue); + T load() const; + T loadAcquire() const; + void store(T newValue); + void storeRelease(T newValue); - operator int() const; - QAtomicInteger &operator=(int); + operator T() const; + QAtomicInteger &operator=(T); static Q_DECL_CONSTEXPR bool isReferenceCountingNative(); static Q_DECL_CONSTEXPR bool isReferenceCountingWaitFree(); @@ -93,56 +93,56 @@ public: static Q_DECL_CONSTEXPR bool isTestAndSetNative(); static Q_DECL_CONSTEXPR bool isTestAndSetWaitFree(); - bool testAndSetRelaxed(int expectedValue, int newValue); - bool testAndSetAcquire(int expectedValue, int newValue); - bool testAndSetRelease(int expectedValue, int newValue); - bool testAndSetOrdered(int expectedValue, int newValue); + bool testAndSetRelaxed(T expectedValue, T newValue); + bool testAndSetAcquire(T expectedValue, T newValue); + bool testAndSetRelease(T expectedValue, T newValue); + bool testAndSetOrdered(T expectedValue, T newValue); static Q_DECL_CONSTEXPR bool isFetchAndStoreNative(); static Q_DECL_CONSTEXPR bool isFetchAndStoreWaitFree(); - int fetchAndStoreRelaxed(int newValue); - int fetchAndStoreAcquire(int newValue); - int fetchAndStoreRelease(int newValue); - int fetchAndStoreOrdered(int newValue); + T fetchAndStoreRelaxed(T newValue); + T fetchAndStoreAcquire(T newValue); + T fetchAndStoreRelease(T newValue); + T fetchAndStoreOrdered(T newValue); static Q_DECL_CONSTEXPR bool isFetchAndAddNative(); static Q_DECL_CONSTEXPR bool isFetchAndAddWaitFree(); - int fetchAndAddRelaxed(int valueToAdd); - int fetchAndAddAcquire(int valueToAdd); - int fetchAndAddRelease(int valueToAdd); - int fetchAndAddOrdered(int valueToAdd); - - int fetchAndSubRelaxed(int valueToSub); - int fetchAndSubAcquire(int valueToSub); - int fetchAndSubRelease(int valueToSub); - int fetchAndSubOrdered(int valueToSub); - - int fetchAndOrRelaxed(int valueToOr); - int fetchAndOrAcquire(int valueToOr); - int fetchAndOrRelease(int valueToOr); - int fetchAndOrOrdered(int valueToOr); - - int fetchAndAndRelaxed(int valueToAnd); - int fetchAndAndAcquire(int valueToAnd); - int fetchAndAndRelease(int valueToAnd); - int fetchAndAndOrdered(int valueToAnd); - - int fetchAndXorRelaxed(int valueToXor); - int fetchAndXorAcquire(int valueToXor); - int fetchAndXorRelease(int valueToXor); - int fetchAndXorOrdered(int valueToXor); - - int operator++(); - int operator++(int); - int operator--(); - int operator--(int); - int operator+=(int value); - int operator-=(int value); - int operator|=(int value); - int operator&=(int value); - int operator^=(int value); + T fetchAndAddRelaxed(T valueToAdd); + T fetchAndAddAcquire(T valueToAdd); + T fetchAndAddRelease(T valueToAdd); + T fetchAndAddOrdered(T valueToAdd); + + T fetchAndSubRelaxed(T valueToSub); + T fetchAndSubAcquire(T valueToSub); + T fetchAndSubRelease(T valueToSub); + T fetchAndSubOrdered(T valueToSub); + + T fetchAndOrRelaxed(T valueToOr); + T fetchAndOrAcquire(T valueToOr); + T fetchAndOrRelease(T valueToOr); + T fetchAndOrOrdered(T valueToOr); + + T fetchAndAndRelaxed(T valueToAnd); + T fetchAndAndAcquire(T valueToAnd); + T fetchAndAndRelease(T valueToAnd); + T fetchAndAndOrdered(T valueToAnd); + + T fetchAndXorRelaxed(T valueToXor); + T fetchAndXorAcquire(T valueToXor); + T fetchAndXorRelease(T valueToXor); + T fetchAndXorOrdered(T valueToXor); + + T operator++(); + T operator++(int); + T operator--(); + T operator--(int); + T operator+=(T value); + T operator-=(T value); + T operator|=(T value); + T operator&=(T value); + T operator^=(T value); #endif }; -- cgit v1.2.3 From 350c60b79e720d005a1a554fd177dbda607079cf Mon Sep 17 00:00:00 2001 From: Raphael Kubo da Costa Date: Tue, 30 Dec 2014 19:26:09 +0200 Subject: Link against QMAKE_LIBS_EXECINFO when using backtrace(3). Add a new mkspec variable, QMAKE_LIBS_EXECINFO, for platforms where backtrace(3), backtrace_symbols(3) and others are not in libc, but rather in a separate library -- on the BSDs, this is libexecinfo. Use it in corelib/global/global.pri so that libqt5core links against it and has the proper dependency when necessary. Change-Id: I62ac36c9b3ba7ab0719420cb795087d43ec138a4 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/global/global.pri | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index fb0e7fd708..e0dd9e4f36 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -35,6 +35,9 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # Only used on platforms with CONFIG += precompile_header PRECOMPILED_HEADER = global/qt_pch.h +# qlogging.cpp uses backtrace(3), which is in a separate library on the BSDs. +LIBS_PRIVATE += $$QMAKE_LIBS_EXECINFO + linux*:!cross_compile:!static:!*-armcc* { QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) -- cgit v1.2.3 From d7fa2d060a58b0e79d7df84a4fc54f44de9b2610 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 16 Oct 2014 20:52:44 +0200 Subject: Fix a memleak in QAssociativeIterable::value() QtMetaTypePrivate::QAssociativeIterableImpl::{find,begin,end}() allocate a new _iterator, so when they're used outside of the ref-counted world of QAssociativeIterable::const_iterator, their lifetime needs to be manually managed. Instead of going to that length, which failed in previous iterations of this patch, implement value() in terms of (new) find() and let find() operate on const_iterator. Because of forwards compatibility between patch releases, use (unexported) friend functions for now with the intention to make them proper member functions come Qt 5.5. Task-number: QTBUG-41469 Change-Id: I43b21eae0c2fc4c182369e669a8b3b457be68885 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qvariant.cpp | 49 +++++++++++++++++++++++++++-------------- src/corelib/kernel/qvariant.h | 6 +++++ 2 files changed, 39 insertions(+), 16 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 2ac1bb11fb..f76201802b 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -3844,6 +3844,13 @@ void QAssociativeIterable::const_iterator::end() m_impl.end(); } +void find(QAssociativeIterable::const_iterator &it, const QVariant &key) +{ + Q_ASSERT(key.userType() == it.m_impl._metaType_id_key); + const QtMetaTypePrivate::VariantData dkey(key.userType(), key.constData(), 0 /*key.flags()*/); + it.m_impl.find(dkey); +} + /*! Returns a QAssociativeIterable::const_iterator for the beginning of the container. This can be used in stl-style iteration. @@ -3870,28 +3877,38 @@ QAssociativeIterable::const_iterator QAssociativeIterable::end() const return it; } +/*! + \internal + + Returns a QAssociativeIterable::const_iterator for the given key \a key + in the container, if the types are convertible. + + If the key is not found, returns end(). + + This can be used in stl-style iteration. + + \sa begin(), end(), value() +*/ +QAssociativeIterable::const_iterator find(const QAssociativeIterable &iterable, const QVariant &key) +{ + QAssociativeIterable::const_iterator it(iterable, new QAtomicInt(0)); + QVariant key_ = key; + if (key_.canConvert(iterable.m_impl._metaType_id_key) && key_.convert(iterable.m_impl._metaType_id_key)) + find(it, key_); + else + it.end(); + return it; +} + /*! Returns the value for the given \a key in the container, if the types are convertible. */ QVariant QAssociativeIterable::value(const QVariant &key) const { - QVariant key_ = key; - if (!key_.canConvert(m_impl._metaType_id_key)) - return QVariant(); - if (!key_.convert(m_impl._metaType_id_key)) + const const_iterator it = find(*this, key); + if (it == end()) return QVariant(); - const QtMetaTypePrivate::VariantData dkey(key_.userType(), key_.constData(), 0 /*key.flags()*/); - QtMetaTypePrivate::QAssociativeIterableImpl impl = m_impl; - impl.find(dkey); - QtMetaTypePrivate::QAssociativeIterableImpl endIt = m_impl; - endIt.end(); - if (impl.equal(endIt)) - return QVariant(); - const QtMetaTypePrivate::VariantData d = impl.getCurrentValue(); - QVariant v(d.metaTypeId, d.data, d.flags); - if (d.metaTypeId == qMetaTypeId()) - return *reinterpret_cast(d.data); - return v; + return *it; } /*! diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 7dce813bb5..90f3e8fbae 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -633,6 +633,9 @@ public: void begin(); void end(); + // ### Qt 5.5: make find() (1st one) a member function + friend void find(const_iterator &it, const QVariant &key); + friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key); public: ~const_iterator(); const_iterator(const const_iterator &other); @@ -662,6 +665,9 @@ public: const_iterator begin() const; const_iterator end() const; +private: // ### Qt 5.5: make it a public find() member function: + friend const_iterator find(const QAssociativeIterable &iterable, const QVariant &key); +public: QVariant value(const QVariant &key) const; -- cgit v1.2.3 From f3e9f11265bc6715d4d1c6e2d734fad923b10d05 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jan 2015 17:45:09 -0200 Subject: Fix change-of-sign warnings with ICC qlocale_p.h(427): error #68: integer conversion resulted in a change of sign We hadn't enabled Q_COMPILER_CONSTEXPR for ICC. Change-Id: Ie7e3070b9f8f2cf512d2745001312865e698596b Reviewed-by: Olivier Goffart Reviewed-by: Marc Mutz --- src/corelib/tools/qlocale_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index c5e62027c4..4e3022478a 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -418,9 +418,9 @@ Q_STATIC_ASSERT(!ascii_isspace('\0')); Q_STATIC_ASSERT(!ascii_isspace('\a')); Q_STATIC_ASSERT(!ascii_isspace('a')); Q_STATIC_ASSERT(!ascii_isspace('\177')); -Q_STATIC_ASSERT(!ascii_isspace('\200')); -Q_STATIC_ASSERT(!ascii_isspace('\xA0')); -Q_STATIC_ASSERT(!ascii_isspace('\377')); +Q_STATIC_ASSERT(!ascii_isspace(uchar('\200'))); +Q_STATIC_ASSERT(!ascii_isspace(uchar('\xA0'))); +Q_STATIC_ASSERT(!ascii_isspace(uchar('\377'))); #endif QT_END_NAMESPACE -- cgit v1.2.3 From 01fc82e3574614762d2ce061dd45ce4995c79e7f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 2 Jan 2015 17:45:30 -0200 Subject: Re-enable constexpr for ICC 15 The bug noted in d88e4edcd548e5bb024e75016c5a3449d103bd8d appears to be resolved. Change-Id: Id20906ff83f74bd16267d44bf447626b81187e71 Reviewed-by: Olivier Goffart Reviewed-by: Marc Mutz --- src/corelib/global/qcompilerdetection.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 5f8ca5c7cc..36ba57a0ff 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -553,6 +553,7 @@ # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 +# define Q_COMPILER_CONSTEXPR # define Q_COMPILER_ALIGNAS # define Q_COMPILER_ALIGNOF # define Q_COMPILER_INHERITING_CONSTRUCTORS -- cgit v1.2.3 From 9d9b785259103ebed616bd59a3b3f2fd6cb95019 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Dec 2014 15:59:23 -0800 Subject: Give ICC-as-Clang a Q_CC_CLANG version number too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Give it version number 3.5 for current compatibility. Change-Id: Ia023d29b3b3946f8642a0550279ae63cbb803fc5 Reviewed-by: Tor Arne Vestbø --- src/corelib/global/qcompilerdetection.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 36ba57a0ff..3f813e163b 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -145,6 +145,10 @@ # if defined(__INTEL_COMPILER) /* Intel C++ also masquerades as GCC */ # define Q_CC_INTEL (__INTEL_COMPILER) +# ifdef __clang__ +/* Intel C++ masquerades as Clang masquerading as GCC */ +# define Q_CC_CLANG 305 +# endif # define Q_ASSUME_IMPL(expr) __assume(expr) # define Q_UNREACHABLE_IMPL() __builtin_unreachable() # if __INTEL_COMPILER >= 1300 && !defined(__APPLE__) -- cgit v1.2.3 From a457bf3ff73627aa2c95f0482a838b14fd3233a0 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sat, 3 Jan 2015 19:06:38 +0200 Subject: Doc: Fixed date format doc bug in QDateTime/Qt namespace MM stands for month, SS is invalid mostly cherry picked from Qt4 commit 670f460fab6a386407c07281cf6417ccf6430970. Task-number: QTBUG-12236 Change-Id: I7af4be655d2d10f1befa1366abb48225c60d31dc Reviewed-by: Thiago Macieira --- src/corelib/global/qnamespace.qdoc | 2 +- src/corelib/tools/qdatetime.cpp | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 04055a3308..9e9a357272 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -592,7 +592,7 @@ string, "ddd MMM d yyyy". See QDate::toString() for more information. \value ISODate \l{ISO 8601} extended format: either \c{YYYY-MM-DD} for dates or - \c{YYYY-MM-DDTHH:MM:SS}, \c{YYYY-MM-DDTHH:MM:SSTZD} (e.g., 1997-07-16T19:20:30+01:00) + \c{YYYY-MM-DDTHH:mm:ss}, \c{YYYY-MM-DDTHH:mm:ssTZD} (e.g., 1997-07-16T19:20:30+01:00) for combined dates and times. \value SystemLocaleShortDate The \l{QLocale::ShortFormat}{short format} used diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 021eb5ae5d..d52dea8d4f 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -182,7 +182,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc int minOffset = 0; bool positiveOffset = false; - // Matches "Wdy, DD Mon YYYY HH:MM:SS ±hhmm" (Wdy, being optional) + // Matches "Wdy, DD Mon YYYY HH:mm:ss ±hhmm" (Wdy, being optional) QRegExp rex(QStringLiteral("^(?:[A-Z][a-z]+,)?[ \\t]*(\\d{1,2})[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d)(?::(\\d\\d))?)?[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?")); if (s.indexOf(rex) == 0) { if (dd) { @@ -203,7 +203,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc if (utcOffset) *utcOffset = ((hourOffset * 60 + minOffset) * (positiveOffset ? 60 : -60)); } else { - // Matches "Wdy Mon DD HH:MM:SS YYYY" + // Matches "Wdy Mon DD HH:mm:ss YYYY" QRegExp rex(QStringLiteral("^[A-Z][a-z]+[ \\t]+([A-Z][a-z]+)[ \\t]+(\\d\\d)(?:[ \\t]+(\\d\\d):(\\d\\d):(\\d\\d))?[ \\t]+(\\d\\d\\d\\d)[ \\t]*(?:([+-])(\\d\\d)(\\d\\d))?")); if (s.indexOf(rex) == 0) { if (dd) { @@ -233,7 +233,7 @@ static void rfcDateImpl(const QString &s, QDate *dd = 0, QTime *dt = 0, int *utc } #endif // QT_NO_DATESTRING -// Return offset in [+-]HH:MM format +// Return offset in [+-]HH:mm format // Qt::ISODate puts : between the hours and minutes, but Qt:TextDate does not static QString toOffsetString(Qt::DateFormat format, int offset) { @@ -248,7 +248,7 @@ static QString toOffsetString(Qt::DateFormat format, int offset) .arg((qAbs(offset) / 60) % 60, 2, 10, QLatin1Char('0')); } -// Parse offset in [+-]HH[[:]MM] format +// Parse offset in [+-]HH[[:]mm] format static int fromOffsetString(const QString &offsetString, bool *valid) { *valid = false; @@ -272,7 +272,7 @@ static int fromOffsetString(const QString &offsetString, bool *valid) // Split the hour and minute parts QStringList parts = offsetString.mid(1).split(QLatin1Char(':')); if (parts.count() == 1) { - // [+-]HHMM or [+-]HH format + // [+-]HHmm or [+-]HH format parts.append(parts.at(0).mid(2)); parts[0] = parts.at(0).left(2); } @@ -1598,12 +1598,12 @@ int QTime::msec() const Returns the time as a string. The \a format parameter determines the format of the string. - If \a format is Qt::TextDate, the string format is HH:MM:SS; + If \a format is Qt::TextDate, the string format is HH:mm:ss; e.g. 1 second before midnight would be "23:59:59". If \a format is Qt::ISODate, the string format corresponds to the ISO 8601 extended specification for representations of dates, - which is also HH:MM:SS. + which is also HH:mm:ss. If the \a format is Qt::SystemLocaleShortDate or Qt::SystemLocaleLongDate, the string format depends on the locale @@ -1925,13 +1925,13 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, int msec = 0; if (size == 5) { - // HH:MM format + // HH:mm format second = 0; msec = 0; } else if (string.at(5) == QLatin1Char(',') || string.at(5) == QLatin1Char('.')) { if (format == Qt::TextDate) return QTime(); - // ISODate HH:MM.SSSSSS format + // ISODate HH:mm.ssssss format // We only want 5 digits worth of fraction of minute. This follows the existing // behavior that determines how milliseconds are read; 4 millisecond digits are // read and then rounded to 3. If we read at most 5 digits for fraction of minute, @@ -1951,7 +1951,7 @@ static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, second = secondNoMs; msec = qMin(qRound(secondFraction * 1000.0), 999); } else { - // HH:MM:SS or HH:MM:SS.sssss + // HH:mm:ss or HH:mm:ss.zzz second = string.mid(6, 2).toInt(&ok); if (!ok) return QTime(); @@ -3535,7 +3535,7 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC) If the \a format is Qt::ISODate, the string format corresponds to the ISO 8601 extended specification for representations of - dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM], + dates and times, taking the form YYYY-MM-DDTHH:mm:ss[Z|[+|-]HH:mm], depending on the timeSpec() of the QDateTime. If the timeSpec() is Qt::UTC, Z will be appended to the string; if the timeSpec() is Qt::OffsetFromUTC, the offset in hours and minutes from UTC will @@ -4421,7 +4421,7 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format) isoString = isoString.right(isoString.length() - 11); int offset = 0; - // Check end of string for Time Zone definition, either Z for UTC or [+-]HH:MM for Offset + // Check end of string for Time Zone definition, either Z for UTC or [+-]HH:mm for Offset if (isoString.endsWith(QLatin1Char('Z'))) { spec = Qt::UTC; isoString = isoString.left(isoString.size() - 1); -- cgit v1.2.3 From 6796f2337ee31b4b4f07eaa54d868b999c39233a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 19 Dec 2014 11:07:47 +0100 Subject: Windows: Fix OS version determination for Windows >= 8 First, try to determine the version of kernel32.dll by using the version API. If that fails, loop using the version macros, taking the major version into account. Hangs in the minor version loop have been observed, potentially related to the major version. Task-number: QTBUG-43413 Change-Id: I982e78873510e7598c7cf839177e59812acd86f6 Reviewed-by: Joerg Bornemann --- src/corelib/global/qglobal.cpp | 78 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 10 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index ae3e86629e..997e804579 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -40,6 +40,8 @@ #include "qdir.h" #include "qdatetime.h" +#include + #ifndef QT_NO_QOBJECT #include #endif @@ -1865,6 +1867,70 @@ QT_BEGIN_INCLUDE_NAMESPACE QT_END_INCLUDE_NAMESPACE #ifndef Q_OS_WINRT + +# ifndef Q_OS_WINCE + +// Determine Windows versions >= 8 by querying the version of kernel32.dll. +static inline bool determineWinOsVersionPost8(OSVERSIONINFO *result) +{ + typedef WORD (WINAPI* PtrGetFileVersionInfoSizeW)(LPCWSTR, LPDWORD); + typedef BOOL (WINAPI* PtrVerQueryValueW)(LPCVOID, LPCWSTR, LPVOID, PUINT); + typedef BOOL (WINAPI* PtrGetFileVersionInfoW)(LPCWSTR, DWORD, DWORD, LPVOID); + + QSystemLibrary versionLib(QStringLiteral("version")); + if (!versionLib.load()) + return false; + PtrGetFileVersionInfoSizeW getFileVersionInfoSizeW = (PtrGetFileVersionInfoSizeW)versionLib.resolve("GetFileVersionInfoSizeW"); + PtrVerQueryValueW verQueryValueW = (PtrVerQueryValueW)versionLib.resolve("VerQueryValueW"); + PtrGetFileVersionInfoW getFileVersionInfoW = (PtrGetFileVersionInfoW)versionLib.resolve("GetFileVersionInfoW"); + if (!getFileVersionInfoSizeW || !verQueryValueW || !getFileVersionInfoW) + return false; + + const wchar_t kernel32Dll[] = L"kernel32.dll"; + DWORD handle; + const DWORD size = getFileVersionInfoSizeW(kernel32Dll, &handle); + if (!size) + return false; + QScopedArrayPointer versionInfo(new BYTE[size]); + if (!getFileVersionInfoW(kernel32Dll, handle, size, versionInfo.data())) + return false; + UINT uLen; + VS_FIXEDFILEINFO *fileInfo = Q_NULLPTR; + if (!verQueryValueW(versionInfo.data(), L"\\", (LPVOID *)&fileInfo, &uLen)) + return false; + const DWORD fileVersionMS = fileInfo->dwFileVersionMS; + const DWORD fileVersionLS = fileInfo->dwFileVersionLS; + result->dwMajorVersion = HIWORD(fileVersionMS); + result->dwMinorVersion = LOWORD(fileVersionMS); + result->dwBuildNumber = HIWORD(fileVersionLS); + return true; +} + +// Fallback for determining Windows versions >= 8 by looping using the +// version check macros. Note that it will return build number=0 to avoid +// inefficient looping. +static inline void determineWinOsVersionFallbackPost8(OSVERSIONINFO *result) +{ + result->dwBuildNumber = 0; + DWORDLONG conditionMask = 0; + VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); + OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result->dwMajorVersion, 0, + result->dwBuildNumber, result->dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 }; + for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMajorVersion) + result->dwMajorVersion = checkVersion.dwMajorVersion; + conditionMask = 0; + checkVersion.dwMajorVersion = result->dwMajorVersion; + checkVersion.dwMinorVersion = 0; + VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); + VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); + for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion) + result->dwMinorVersion = checkVersion.dwMinorVersion; +} + +# endif // !Q_OS_WINCE + static inline OSVERSIONINFO winOsVersion() { OSVERSIONINFO result = { sizeof(OSVERSIONINFO), 0, 0, 0, 0, {'\0'}}; @@ -1880,16 +1946,8 @@ static inline OSVERSIONINFO winOsVersion() # endif # ifndef Q_OS_WINCE if (result.dwMajorVersion == 6 && result.dwMinorVersion == 2) { - // This could be Windows 8.1 or higher. Note that as of Windows 9, - // the major version needs to be checked as well. - DWORDLONG conditionMask = 0; - VER_SET_CONDITION(conditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL); - VER_SET_CONDITION(conditionMask, VER_MINORVERSION, VER_GREATER_EQUAL); - VER_SET_CONDITION(conditionMask, VER_PLATFORMID, VER_EQUAL); - OSVERSIONINFOEX checkVersion = { sizeof(OSVERSIONINFOEX), result.dwMajorVersion, result.dwMinorVersion, - result.dwBuildNumber, result.dwPlatformId, {'\0'}, 0, 0, 0, 0, 0 }; - for ( ; VerifyVersionInfo(&checkVersion, VER_MAJORVERSION | VER_MINORVERSION | VER_PLATFORMID, conditionMask); ++checkVersion.dwMinorVersion) - result.dwMinorVersion = checkVersion.dwMinorVersion; + if (!determineWinOsVersionPost8(&result)) + determineWinOsVersionFallbackPost8(&result); } # endif // !Q_OS_WINCE return result; -- cgit v1.2.3 From da6a706eb31f1505edfaeefefc1adfb65ea6d893 Mon Sep 17 00:00:00 2001 From: Ashish Kulkarni Date: Sun, 21 Dec 2014 06:36:24 +0530 Subject: fix error when cross-compiling with --system-zlib This is broken since 1f461ac45bfa8887261510a95fb33a346d68eaba, where Z_PREFIX was defined to namespace the bundled zlib symbols. The bundled zlib is used by bootstrap.pro when cross-compiling which uses the namespaced symbols. This breaks linking of rcc when --system-zlib is used, as it will try to link to compress2 instead of z_compress2. To fix this, the aliases are pulled in via zconf.h and the bundled zlib is prepended to the INCLUDEPATH (i.e. before the system zlib). Change-Id: Iec76cbdead40f888e2ac6a887ec8f3b7bc7db501 Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qbytearray.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d8b2efbef3..a3c1cc3907 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -43,6 +43,7 @@ #include #ifndef QT_NO_COMPRESS +#include #include #endif #include -- cgit v1.2.3 From 26547c0275a25d19ddbc53edd71b277f71c4de59 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Dec 2014 19:17:05 +0100 Subject: remove nonsensical conditional we are in an #else of #ifndef QT_BOOTSTRAPPED here already. Change-Id: I02c4ff2959490110c21ad1016c664b7ddcfea7c0 Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 7ca0aa7f0b..1f8de2e05d 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -128,9 +128,7 @@ QLibrarySettings::QLibrarySettings() settings.reset(0); #else } else { -#ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = false; -#endif haveEffectivePaths = false; havePaths = false; #endif -- cgit v1.2.3 From 44f8f2084b36960fd5e04636604b2e3416e8c947 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 1 Dec 2014 19:19:05 +0100 Subject: de-duplicate and comment EffectivePaths presence detection Change-Id: Ibf9731c216df84c9e17ebd699d8349cc716ff3cc Reviewed-by: Thiago Macieira --- src/corelib/global/qlibraryinfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 1f8de2e05d..4f9f54cde8 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -116,10 +116,11 @@ QLibrarySettings::QLibrarySettings() QStringList children = settings->childGroups(); #ifdef QT_BOOTSTRAPPED haveEffectiveSourcePaths = children.contains(QLatin1String("EffectiveSourcePaths")); - haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); #else - haveEffectivePaths = children.contains(QLatin1String("EffectivePaths")); + // EffectiveSourcePaths is for the Qt build only, so needs no backwards compat trickery. + bool haveEffectiveSourcePaths = false; #endif + haveEffectivePaths = haveEffectiveSourcePaths || children.contains(QLatin1String("EffectivePaths")); // Backwards compat: an existing but empty file is claimed to contain the Paths section. havePaths = (!haveEffectivePaths && !children.contains(QLatin1String(platformsSection))) || children.contains(QLatin1String("Paths")); -- cgit v1.2.3 From c3590c76775c889fde13dc155c2a31508db612e9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 15:34:45 -0800 Subject: Update doc saying QDateTime::setTime with invalid time sets to midnight QDateTimePrivate::setDateTime has a comment saying this is intentional, so document it. Task-number: QTBUG-43704 Change-Id: Ic5d393bfd36e48a193fcffff13b965409eaf7be9 Reviewed-by: Martin Smith --- src/corelib/tools/qdatetime.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index d52dea8d4f..082b721e82 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3296,8 +3296,8 @@ bool QDateTime::isDaylightTime() const } /*! - Sets the date part of this datetime to \a date. - If no time is set, it is set to midnight. + Sets the date part of this datetime to \a date. If no time is set yet, it + is set to midnight. If \a date is invalid, this QDateTime becomes invalid. \sa date(), setTime(), setTimeSpec() */ @@ -3309,7 +3309,14 @@ void QDateTime::setDate(const QDate &date) } /*! - Sets the time part of this datetime to \a time. + Sets the time part of this datetime to \a time. If \a time is not valid, + this function sets it to midnight. Therefore, it's possible to clear any + set time in a QDateTime by setting it to a default QTime: + + \code + QDateTime dt = QDateTime::currentDateTime(); + dt.setTime(QTime()); + \endcode \sa time(), setDate(), setTimeSpec() */ -- cgit v1.2.3 From 24238e6a3188062521ce7ed6d8d5468751a28d97 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 4 Dec 2014 15:14:18 +0100 Subject: Doc: link issues in corelib Task-number: QTBUG-43115 Change-Id: Ia80802e698f16730698e9a90102f549fb35f9305 Reviewed-by: Martin Smith --- src/corelib/doc/src/external-resources.qdoc | 11 +++++++++++ src/corelib/kernel/qobject.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc index a4f1b8723a..03af1d81bf 100644 --- a/src/corelib/doc/src/external-resources.qdoc +++ b/src/corelib/doc/src/external-resources.qdoc @@ -55,3 +55,14 @@ \externalpage http://www.iana.org/assignments/character-sets/character-sets.xml \title IANA character-sets encoding file */ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/qtdesigner-manual.html + \title Using a Designer UI File in Your Application +*/ + +/*! + \externalpage http://doc-snapshot.qt-project.org/qt5-5.4/designer-widget-mode.html#the-property-editor + \title Qt Designer's Widget Editing Mode#The Property Editor +*/ +*/ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 492031d7fe..a1a04b3ce5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2741,9 +2741,9 @@ QMetaObject::Connection QObject::connect(const QObject *sender, const char *sign You can check if the QMetaObject::Connection is valid by casting it to a bool. This function works in the same way as - connect(const QObject *sender, const char *signal, + \c {connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, - Qt::ConnectionType type) + Qt::ConnectionType type)} but it uses QMetaMethod to specify signal and method. \sa connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) @@ -2996,7 +2996,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, otherwise returns \c false. This function provides the same possibilities like - disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) + \c {disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) } but uses QMetaMethod to represent the signal and the method to be disconnected. Additionally this function returnsfalse and no signals and slots disconnected @@ -4110,7 +4110,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { This macro associates extra information to the class, which is available using QObject::metaObject(). Qt makes only limited use of this feature, in - the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML} modules. + the \l{Active Qt}, \l{Qt D-Bus} and \l{Qt QML module}{Qt QML}. The extra information takes the form of a \a Name string and a \a Value literal string. @@ -4122,7 +4122,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) { \sa QMetaObject::classInfo() \sa QAxFactory \sa {Using Qt D-Bus Adaptors} - \sa {Extending QML - Default Property Example} + \sa {Extending QML} */ /*! -- cgit v1.2.3 From 871560d45c1e4ad5c70c9d6b77cad8d3b15a4103 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 23 Dec 2014 13:39:24 +0100 Subject: Doc: define target voor function qsnprintf() Task-number: QTBUG-43537 Change-Id: I76c511891a1a07eca77da399d23097e76047f824 Reviewed-by: Martin Smith --- src/corelib/tools/qvsnprintf.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/tools/qvsnprintf.cpp b/src/corelib/tools/qvsnprintf.cpp index cf595b8f31..be92e20fac 100644 --- a/src/corelib/tools/qvsnprintf.cpp +++ b/src/corelib/tools/qvsnprintf.cpp @@ -97,6 +97,7 @@ int qvsnprintf(char *str, size_t n, const char *fmt, va_list ap) #endif /*! + \target bytearray-qsnprintf \relates QByteArray A portable snprintf() function, calls qvsnprintf. -- cgit v1.2.3 From 5239ba95e8d68a96b2783793576490f119fb5700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 15 Jan 2015 23:42:25 +0100 Subject: Add missing AppDataLocation case This amends commit f3bc9f5c. Change-Id: I69b1a5080e7ac92b8a39746d814da77b17c271c2 Task-number: QTBUG-43868 Reviewed-by: Friedemann Kleint --- src/corelib/io/qstandardpaths_mac.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm index 01d1c01f78..13b864600e 100644 --- a/src/corelib/io/qstandardpaths_mac.mm +++ b/src/corelib/io/qstandardpaths_mac.mm @@ -167,6 +167,7 @@ QString QStandardPaths::writableLocation(StandardLocation type) case TempLocation: return QDir::tempPath(); case GenericDataLocation: + case AppDataLocation: case AppLocalDataLocation: case GenericCacheLocation: case CacheLocation: -- cgit v1.2.3 From be5b04fd3782cc17bebef5ad9ffd302b8a1edef4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 15 Jan 2015 09:39:24 -0800 Subject: Move enabling of C++11 Unicode Strings with ICC from 12.1 to 14.0 The support in 12.1 and 13.x appears to be incomplete. Move it to the official supported version https://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler Note: this commit will cause a conflict in 5.5 against 99357e32a0e29c73ed721d6d31da66635e6586ca Task-number: QTBUG-43864 Change-Id: Ic5d393bfd36e48a193fcffff13b9a07106e96795 Reviewed-by: Marc Mutz --- src/corelib/global/qcompilerdetection.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 3f813e163b..7effb24130 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -533,7 +533,6 @@ # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_NULLPTR # define Q_COMPILER_TEMPLATE_ALIAS -# define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_VARIADIC_TEMPLATES # endif # if __INTEL_COMPILER >= 1300 @@ -554,6 +553,7 @@ # define Q_COMPILER_RANGE_FOR # define Q_COMPILER_RAW_STRINGS # define Q_COMPILER_REF_QUALIFIERS +# define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 -- cgit v1.2.3 From ec9bc843d8a5c18459f3669c6e22acac2077df67 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 14 Jan 2015 11:02:28 -0800 Subject: Fix compilation with Apple Clang 425 This version was based on Clang mainline between releases 3.1 and 3.2, which means it has part of 3.2 features but not all. One of the missing features is __builtin_bswap16. Change-Id: Ic5d393bfd36e48a193fcffff13b95664c7f664de Reviewed-by: Shawn Rutledge --- src/corelib/global/qendian.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 7c643f7592..0e383c18d2 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian(const uchar *src) */ template T qbswap(T source); +#ifdef __has_builtin +# define QT_HAS_BUILTIN(x) __has_builtin(x) +#else +# define QT_HAS_BUILTIN(x) 0 +#endif + // GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8; // Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32) template <> inline quint64 qbswap(quint64 source) { return __builtin_bswap64(source); @@ -306,7 +312,7 @@ template <> inline quint32 qbswap(quint32 source) | ((source & 0xff000000) >> 24); } #endif // GCC & Clang intrinsics -#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302) +#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16) template <> inline quint16 qbswap(quint16 source) { return __builtin_bswap16(source); @@ -320,6 +326,8 @@ template <> inline quint16 qbswap(quint16 source) } #endif // GCC & Clang intrinsics +#undef QT_HAS_BUILTIN + // signed specializations template <> inline qint64 qbswap(qint64 source) { -- cgit v1.2.3 From 390ea21873cf229447c2dcaea85a40e472fab03c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Jan 2015 13:43:37 +0100 Subject: QByteArrayMatcher: fix undefined shift The REHASH macro is used in qFindByteArray() with a char argument. Applying the shift operator promotes (a) to int. The check in REHASH, however, checks for the shift being permissible for _unsigned_ ints. Since hashHaystack is a uint, too, rectify by casting (a) to uint prior to shifting. Found by UBSan: src/corelib/tools/qbytearraymatcher.cpp:314:72: runtime error: left shift of 34 by 30 places cannot be represented in type 'int' Change-Id: Id09c037d570ca70b49f87ad22bed31bbb7dcc7fb Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qbytearraymatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index f14d941c27..82f012be66 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -256,7 +256,7 @@ static int qFindByteArrayBoyerMoore( #define REHASH(a) \ if (sl_minus_1 < sizeof(uint) * CHAR_BIT) \ - hashHaystack -= (a) << sl_minus_1; \ + hashHaystack -= uint(a) << sl_minus_1; \ hashHaystack <<= 1 /*! -- cgit v1.2.3 From b69c2e86de99cb2ac9bcd2e33ae77c960cfbc57a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 19 Jan 2015 01:26:56 +0100 Subject: QFreeList: fix undefined behavior Signed integer overflow is undefined behavior ([expr]/4), but unsigned arithmetic doesn't overflow, so isn't ([basic.fundamental]/4, footnote there). So, use unsigned arithmetic for the loop-around serial number generation in incrementserial(). While we're at it, also use it for the masking operation in the same function. Found by UBSan. Change-Id: I500fae9d80fd3f6e39d06e79a53d271b82ea8df8 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qfreelist_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h index bfb03fb723..189140016c 100644 --- a/src/corelib/tools/qfreelist_p.h +++ b/src/corelib/tools/qfreelist_p.h @@ -171,7 +171,7 @@ class QFreeList // take the current serial number from \a o, increment it, and store it in \a n static inline int incrementserial(int o, int n) { - return (n & ConstantsType::IndexMask) | ((o + ConstantsType::SerialCounter) & ConstantsType::SerialMask); + return int((uint(n) & ConstantsType::IndexMask) | ((uint(o) + ConstantsType::SerialCounter) & ConstantsType::SerialMask)); } // the blocks -- cgit v1.2.3 From c49641a117356662aea31d8b4e7fdf4055cc0b4f Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Fri, 2 Jan 2015 20:06:08 +0800 Subject: Doc: Fix typos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I29d5576902a5d1ea25558e980081952d9157f7f0 Reviewed-by: Topi Reiniö --- src/corelib/thread/qthread.cpp | 4 ++-- src/corelib/tools/qbytearray.cpp | 2 +- src/corelib/tools/qmargins.cpp | 2 +- src/corelib/xml/qxmlstream.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 3caad7c4b2..933fd06afa 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -178,7 +178,7 @@ QThreadPrivate::~QThreadPrivate() event loop by calling exec() and runs a Qt event loop inside the thread. You can use worker objects by moving them to the thread using - QObject::moveToThread. + QObject::moveToThread(). \snippet code/src_corelib_thread_qthread.cpp worker @@ -256,7 +256,7 @@ QThreadPrivate::~QThreadPrivate() \l{Mandelbrot Example}, as that is the name of the QThread subclass). Note that this is currently not available with release builds on Windows. - \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads} + \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads}, {Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example} */ diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index a3c1cc3907..bd0215902c 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3945,7 +3945,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size) copies of it exist that have not been modified. This function can be used instead of fromRawData() to re-use - existings QByteArray objects to save memory re-allocations. + existing QByteArray objects to save memory re-allocations. \sa fromRawData(), data(), constData() */ diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 419551aaca..265e44bfcf 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QMargins &m) { /*! \fn bool QMarginsF::isNull() const - Returns \c true if all margins are is 0; otherwise returns + Returns \c true if all margins are 0; otherwise returns false. */ diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 94f6a8bcde..e4ee71f0b1 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -726,7 +726,7 @@ static const short QXmlStreamReader_tokenTypeString_indices[] = { /*! \property QXmlStreamReader::namespaceProcessing - the namespace-processing flag of the stream reader + The namespace-processing flag of the stream reader This property controls whether or not the stream reader processes namespaces. If enabled, the reader processes namespaces, otherwise @@ -3315,7 +3315,7 @@ QTextCodec *QXmlStreamWriter::codec() const /*! \property QXmlStreamWriter::autoFormatting \since 4.4 - the auto-formatting flag of the stream writer + The auto-formatting flag of the stream writer This property controls whether or not the stream writer automatically formats the generated XML data. If enabled, the -- cgit v1.2.3 From c243dd564397fedbe3d2221da72d7ce207eebade Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Wed, 14 Jan 2015 16:27:10 +0100 Subject: QIncrementalSleepTimer: Use QElapsedTimer instead of QTime Since the former is monotonic and we need a monotonic timer here. Change-Id: I34325da4fe0317e12f64629a6eef6a80990c3e1a Reviewed-by: Daniel Teske Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qwindowspipewriter_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h index 47b7744e81..6035993500 100644 --- a/src/corelib/io/qwindowspipewriter_p.h +++ b/src/corelib/io/qwindowspipewriter_p.h @@ -45,7 +45,7 @@ // We mean it. // -#include +#include #include #include #include @@ -83,7 +83,7 @@ public: { if (totalTimeOut == -1) return SLEEPMAX; - return qMax(totalTimeOut - timer.elapsed(), 0); + return qMax(int(totalTimeOut - timer.elapsed()), 0); } bool hasTimedOut() const @@ -99,7 +99,7 @@ public: } private: - QTime timer; + QElapsedTimer timer; int totalTimeOut; int nextSleep; }; -- cgit v1.2.3 From 553a3661c1272b9616900a0e97e101492d468a25 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 16 Jan 2015 21:08:22 +0100 Subject: Bump version Change-Id: I250fa893cdf831d03f9217b5dc0a5aa2f9a6a6b5 Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cb8bd15d8d..dade7fc6ec 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -37,11 +37,11 @@ #include -#define QT_VERSION_STR "5.4.1" +#define QT_VERSION_STR "5.4.2" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050401 +#define QT_VERSION 0x050402 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ -- cgit v1.2.3