diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-08 21:24:25 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-04-08 21:24:26 +0200 |
commit | 4973786f0d36fc379c7e88a20c51639e93ddea2a (patch) | |
tree | d4d0e3cc8adc4be3aeef13bffb6907154daf95fd /src/corelib/tools | |
parent | 0b17d2328592c03503c41af7d594e58233255ff5 (diff) | |
parent | 00540a8345c35703aeaab072fd9e4727c9b61d5a (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Change-Id: I04f9f2749f68c0cb5a427b8d84e43b44bb143e4d
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qarraydata.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qbytearray.cpp | 34 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 25 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.h | 1 | ||||
-rw-r--r-- | src/corelib/tools/qqueue.h | 5 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 4 |
6 files changed, 40 insertions, 39 deletions
diff --git a/src/corelib/tools/qarraydata.cpp b/src/corelib/tools/qarraydata.cpp index 513d9b4ae3..ef15fae83a 100644 --- a/src/corelib/tools/qarraydata.cpp +++ b/src/corelib/tools/qarraydata.cpp @@ -38,10 +38,8 @@ QT_BEGIN_NAMESPACE -#if defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL) - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers") const QArrayData QArrayData::shared_null[2] = { { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, sizeof(QArrayData) }, // shared null @@ -52,9 +50,7 @@ static const QArrayData qt_array[3] = { { { Q_BASIC_ATOMIC_INITIALIZER(0) }, 0, 0, 0, sizeof(QArrayData) }, // unsharable empty /* zero initialized terminator */}; -#if defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL) - #pragma GCC diagnostic pop -#endif +QT_WARNING_POP static const QArrayData &qt_array_empty = qt_array[0]; static const QArrayData &qt_array_unsharable_empty = qt_array[1]; diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index eb96757457..da5d00311a 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -869,44 +869,62 @@ static inline char qToLower(char c) /*! \fn QByteArray::iterator QByteArray::begin() - \internal + Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first character in + the byte-array. + + \sa constBegin(), end() */ /*! \fn QByteArray::const_iterator QByteArray::begin() const - \internal + \overload begin() */ /*! \fn QByteArray::const_iterator QByteArray::cbegin() const \since 5.0 - \internal + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character + in the byte-array. + + \sa begin(), cend() */ /*! \fn QByteArray::const_iterator QByteArray::constBegin() const - \internal + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first character + in the byte-array. + + \sa begin(), constEnd() */ /*! \fn QByteArray::iterator QByteArray::end() - \internal + Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary character + after the last character in the byte-array. + + \sa begin(), constEnd() */ /*! \fn QByteArray::const_iterator QByteArray::end() const - \internal + \overload end() */ /*! \fn QByteArray::const_iterator QByteArray::cend() const \since 5.0 - \internal + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary + character after the last character in the list. + + \sa cbegin(), end() */ /*! \fn QByteArray::const_iterator QByteArray::constEnd() const - \internal + Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary + character after the last character in the list. + + \sa constBegin(), end() */ /*! \fn void QByteArray::push_back(const QByteArray &other) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 67f16e1f49..e445055e1d 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -3237,7 +3237,6 @@ bool QDateTime::isDaylightTime() const void QDateTime::setDate(const QDate &date) { - detach(); d->setDateTime(date, time()); } @@ -3256,7 +3255,6 @@ void QDateTime::setDate(const QDate &date) void QDateTime::setTime(const QTime &time) { - detach(); d->setDateTime(date(), time); } @@ -3278,7 +3276,7 @@ void QDateTime::setTime(const QTime &time) void QDateTime::setTimeSpec(Qt::TimeSpec spec) { - detach(); + QDateTimePrivate *d = this->d.data(); // detaches (and shadows d) d->setTimeSpec(spec, 0); d->checkValidDateTime(); } @@ -3300,7 +3298,7 @@ void QDateTime::setTimeSpec(Qt::TimeSpec spec) void QDateTime::setOffsetFromUtc(int offsetSeconds) { - detach(); + QDateTimePrivate *d = this->d.data(); // detaches (and shadows d) d->setTimeSpec(Qt::OffsetFromUTC, offsetSeconds); d->checkValidDateTime(); } @@ -3319,7 +3317,7 @@ void QDateTime::setOffsetFromUtc(int offsetSeconds) void QDateTime::setTimeZone(const QTimeZone &toZone) { - detach(); + QDateTimePrivate *d = this->d.data(); // detaches (and shadows d) d->m_spec = Qt::TimeZone; d->m_offsetFromUtc = 0; d->m_timeZone = toZone; @@ -3395,7 +3393,7 @@ uint QDateTime::toTime_t() const */ void QDateTime::setMSecsSinceEpoch(qint64 msecs) { - detach(); + QDateTimePrivate *d = this->d.data(); // detaches (and shadows d) d->m_status = 0; switch (d->m_spec) { @@ -3669,7 +3667,6 @@ QString QDateTime::toString(const QString& format) const QDateTime QDateTime::addDays(qint64 ndays) const { QDateTime dt(*this); - dt.detach(); QPair<QDate, QTime> p = d->getDateTime(); QDate &date = p.first; QTime &time = p.second; @@ -3705,7 +3702,6 @@ QDateTime QDateTime::addDays(qint64 ndays) const QDateTime QDateTime::addMonths(int nmonths) const { QDateTime dt(*this); - dt.detach(); QPair<QDate, QTime> p = d->getDateTime(); QDate &date = p.first; QTime &time = p.second; @@ -3741,7 +3737,6 @@ QDateTime QDateTime::addMonths(int nmonths) const QDateTime QDateTime::addYears(int nyears) const { QDateTime dt(*this); - dt.detach(); QPair<QDate, QTime> p = d->getDateTime(); QDate &date = p.first; QTime &time = p.second; @@ -3790,7 +3785,6 @@ QDateTime QDateTime::addMSecs(qint64 msecs) const return QDateTime(); QDateTime dt(*this); - dt.detach(); if (d->m_spec == Qt::LocalTime || d->m_spec == Qt::TimeZone) // Convert to real UTC first in case crosses daylight transition dt.setMSecsSinceEpoch(d->toMSecsSinceEpoch() + msecs); @@ -4267,7 +4261,6 @@ QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs) QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetSeconds) { QDateTime dt; - dt.detach(); dt.d->setTimeSpec(spec, offsetSeconds); dt.setMSecsSinceEpoch(msecs); return dt; @@ -4687,14 +4680,6 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format) \sa toTimeSpec() */ -/*! - \internal - */ -void QDateTime::detach() -{ - d.detach(); -} - /***************************************************************************** Date/time stream functions *****************************************************************************/ @@ -4846,8 +4831,6 @@ QDataStream &operator<<(QDataStream &out, const QDateTime &dateTime) QDataStream &operator>>(QDataStream &in, QDateTime &dateTime) { - dateTime.detach(); - QDate dt; QTime tm; qint8 ts = 0; diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 88288872df..78ec2b156a 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -321,7 +321,6 @@ public: private: friend class QDateTimePrivate; - void detach(); // ### Qt6: Using a private here has high impact on runtime // on users such as QFileInfo. In Qt 6, the data members diff --git a/src/corelib/tools/qqueue.h b/src/corelib/tools/qqueue.h index ae07c7d026..9d5bda1210 100644 --- a/src/corelib/tools/qqueue.h +++ b/src/corelib/tools/qqueue.h @@ -46,6 +46,11 @@ public: inline QQueue() {} inline ~QQueue() {} inline void swap(QQueue<T> &other) { QList<T>::swap(other); } // prevent QList<->QQueue swaps +#ifndef Q_QDOC + // bring in QList::swap(int, int). We cannot say using QList<T>::swap, + // because we don't want to make swap(QList&) available. + inline void swap(int i, int j) { QList<T>::swap(i, j); } +#endif inline void enqueue(const T &t) { QList<T>::append(t); } inline T dequeue() { return QList<T>::takeFirst(); } inline T &head() { return QList<T>::first(); } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 56dab68f33..6315c15818 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -1291,7 +1291,7 @@ const QString::Null QString::null = { }; \since 5.0 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary - item after the last item in the list. + character after the last character in the list. \sa cbegin(), end() */ @@ -1299,7 +1299,7 @@ const QString::Null QString::null = { }; /*! \fn QString::const_iterator QString::constEnd() const Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary - item after the last item in the list. + character after the last character in the list. \sa constBegin(), end() */ |