summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-12-02 13:31:07 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-12-02 13:31:07 (GMT)
commitf29f1bb287c6b39bd1270802d1579f1c1d53f905 (patch)
treef903e18b163591c3590473e4a117a3c8958d8847 /src/corelib
parent271936b063fb261293e3f77f7a2273e3a4dbb5d6 (diff)
parent25023911295c201758faaa2c800b2388ddf1e0b0 (diff)
downloadQt-f29f1bb287c6b39bd1270802d1579f1c1d53f905.zip
Qt-f29f1bb287c6b39bd1270802d1579f1c1d53f905.tar.gz
Qt-f29f1bb287c6b39bd1270802d1579f1c1d53f905.tar.bz2
Merge commit 'upstream/4.6' into 4.6
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/tools/qvector.h6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 2e9f839..6623e0c 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -44,11 +44,11 @@
#include <stddef.h>
-#define QT_VERSION_STR "4.6.0"
+#define QT_VERSION_STR "4.6.1"
/*
QT_VERSION is (major << 16) + (minor << 8) + patch.
*/
-#define QT_VERSION 0x040600
+#define QT_VERSION 0x040601
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index f0de98d..201e7b3 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -324,7 +324,7 @@ void QVector<T>::detach_helper()
{ realloc(d->size, d->alloc); }
template <typename T>
void QVector<T>::reserve(int asize)
-{ if (asize > d->alloc || d->ref != 1) realloc(d->size, asize); d->capacity = 1; }
+{ if (asize > d->alloc) realloc(d->size, asize); if (d->ref == 1) d->capacity = 1; }
template <typename T>
void QVector<T>::resize(int asize)
{ realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ?
@@ -441,6 +441,7 @@ void QVector<T>::free(Data *x)
template <typename T>
void QVector<T>::realloc(int asize, int aalloc)
{
+ Q_ASSERT(asize <= aalloc);
T *pOld;
T *pNew;
union { QVectorData *d; Data *p; } x;
@@ -496,7 +497,8 @@ void QVector<T>::realloc(int asize, int aalloc)
pOld = p->array + x.d->size;
pNew = x.p->array + x.d->size;
// copy objects from the old array into the new array
- while (x.d->size < qMin(asize, d->size)) {
+ const int toMove = qMin(asize, d->size);
+ while (x.d->size < toMove) {
new (pNew++) T(*pOld++);
x.d->size++;
}