diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-12 19:17:07 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-12 19:17:07 +0200 |
commit | e2776b44a0e0e34e5a1d851916a94f7db5e7bb7b (patch) | |
tree | 7c428c524aa1b8cc42d3a581a8c13378ebd341b5 /src/corelib/tools | |
parent | 5c8aa27111fd51c8dff78fd0a276648aea08d4c1 (diff) | |
parent | af2f1e14f61ee8d3a4ade723aed9618d1707f975 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/plugins/platforms/cocoa/qcocoamenubar.mm
Change-Id: I4a699fc8a7f30b2af9de8e496c3d5f027b7495bb
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qalgorithms.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/tools/qarraydataops.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qbitarray.cpp | 3 | ||||
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 2 | ||||
-rw-r--r-- | src/corelib/tools/qsimd.cpp | 10 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 6 |
7 files changed, 18 insertions, 13 deletions
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index 7c3aa1a3b2..f3dfddec77 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -33,7 +33,7 @@ \brief The <QtAlgorithms> header includes the generic, template-based algorithms. Qt provides a number of global template functions in \c - <QtAlgorithms> that work on containers and perform well-know + <QtAlgorithms> that work on containers and perform well-known algorithms. You can use these algorithms with any \l {container class} that provides STL-style iterators, including Qt's QList, QLinkedList, QVector, QMap, and QHash classes. diff --git a/src/corelib/tools/qarraydataops.h b/src/corelib/tools/qarraydataops.h index 3cd8c51c07..c8a0825480 100644 --- a/src/corelib/tools/qarraydataops.h +++ b/src/corelib/tools/qarraydataops.h @@ -62,7 +62,7 @@ struct QPodArrayOps Q_ASSERT(newSize <= this->alloc); ::memset(this->end(), 0, (newSize - this->size) * sizeof(T)); - this->size = newSize; + this->size = int(newSize); } void copyAppend(const T *b, const T *e) @@ -84,7 +84,7 @@ struct QPodArrayOps const T *const end = iter + n; for (; iter != end; ++iter) ::memcpy(iter, &t, sizeof(T)); - this->size += n; + this->size += int(n); } void truncate(size_t newSize) @@ -92,7 +92,7 @@ struct QPodArrayOps Q_ASSERT(!this->ref.isShared()); Q_ASSERT(newSize < size_t(this->size)); - this->size = newSize; + this->size = int(newSize); } void destroyAll() // Call from destructors, ONLY! diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index 4949476f25..54c1ff8843 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -123,7 +123,8 @@ QT_BEGIN_NAMESPACE */ QBitArray::QBitArray(int size, bool value) { - if (!size) { + Q_ASSERT_X(size >= 0, "QBitArray::QBitArray", "Size must be greater than or equal to 0."); + if (size <= 0) { d.resize(0); return; } diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index a50c7da6cc..a2a58f8926 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1031,7 +1031,7 @@ void QRegularExpressionPrivate::getPatternInfo() */ class QPcreJitStackPointer { - Q_DISABLE_COPY(QPcreJitStackPointer); + Q_DISABLE_COPY(QPcreJitStackPointer) public: /*! diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index 97a64eb5bb..c81df7a6f2 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -240,14 +240,14 @@ inline quint64 _xgetbv(__int64) { return 0; } #endif static void xgetbv(uint in, uint &eax, uint &edx) { -#ifdef Q_OS_WIN - quint64 result = _xgetbv(in); - eax = result; - edx = result >> 32; -#elif defined(Q_CC_GNU) +#if defined(Q_CC_GNU) asm (".byte 0x0F, 0x01, 0xD0" // xgetbv instruction : "=a" (eax), "=d" (edx) : "c" (in)); +#elif defined(Q_OS_WIN) + quint64 result = _xgetbv(in); + eax = result; + edx = result >> 32; #endif } diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 3a2028057d..825e05ae1b 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -197,6 +197,8 @@ private: template <class T, int Prealloc> Q_INLINE_TEMPLATE QVarLengthArray<T, Prealloc>::QVarLengthArray(int asize) : s(asize) { + Q_STATIC_ASSERT_X(Prealloc > 0, "QVarLengthArray Prealloc must be greater than 0."); + Q_ASSERT_X(s >= 0, "QVarLengthArray::QVarLengthArray()", "Size must be greater than or equal to 0."); if (s > Prealloc) { ptr = reinterpret_cast<T *>(malloc(s * sizeof(T))); Q_CHECK_PTR(ptr); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 816e1f15f6..489ee821b9 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -398,7 +398,8 @@ QVector<T> &QVector<T>::operator=(const QVector<T> &v) template <typename T> QVector<T>::QVector(int asize) { - if (Q_LIKELY(asize)) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (Q_LIKELY(asize > 0)) { d = Data::allocate(asize); d->size = asize; defaultConstruct(d->begin(), d->end()); @@ -410,7 +411,8 @@ QVector<T>::QVector(int asize) template <typename T> QVector<T>::QVector(int asize, const T &t) { - if (asize) { + Q_ASSERT_X(asize >= 0, "QVector::QVector", "Size must be greater than or equal to 0."); + if (asize > 0) { d = Data::allocate(asize); d->size = asize; T* i = d->end(); |