summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.h
diff options
context:
space:
mode:
authorHarald Fernengel <harald@trolltech.com>2009-06-26 11:35:16 +0200
committerJason Barron <jbarron@trolltech.com>2009-06-29 14:07:00 +0200
commitf1d3ed3a4adc2f1859102afb03b5c794d569940c (patch)
treea27602762705501c80fe689aac23c376612aa77e /src/corelib/tools/qvector.h
parentdb8f05e257019694f5e8076845626008f2adc3dd (diff)
Manually fix bad merges and make sure everything compiles with 4.6.
Diffstat (limited to 'src/corelib/tools/qvector.h')
-rw-r--r--src/corelib/tools/qvector.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index d9fad3aa28..c83e833562 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -436,8 +436,8 @@ void QVector<T>::realloc(int asize, int aalloc)
if (QTypeInfo<T>::isComplex && asize < d->size && d->ref == 1 ) {
// call the destructor on all objects that need to be
// destroyed when shrinking
- pOld = d->array + d->size;
- pNew = d->array + asize;
+ pOld = p->array + d->size;
+ pNew = p->array + asize;
while (asize < d->size) {
(--pOld)->~T();
d->size--;
@@ -447,23 +447,23 @@ void QVector<T>::realloc(int asize, int aalloc)
if (aalloc != d->alloc || d->ref != 1) {
// (re)allocate memory
if (QTypeInfo<T>::isStatic) {
- x.p = malloc(aalloc);
+ x.d = malloc(aalloc);
Q_CHECK_PTR(x.p);
x.d->size = 0;
} else if (d->ref != 1) {
- x.p = malloc(aalloc);
+ x.d = malloc(aalloc);
Q_CHECK_PTR(x.p);
if (QTypeInfo<T>::isComplex) {
x.d->size = 0;
} else {
- ::memcpy(x.p, p, sizeOfTypedData() + (qMin(aalloc, p->alloc) - 1) * sizeof(T));
+ ::memcpy(x.p, p, sizeOfTypedData() + (qMin(aalloc, d->alloc) - 1) * sizeof(T));
x.d->size = d->size;
}
} else {
QT_TRY {
QVectorData *mem = static_cast<QVectorData *>(qRealloc(p, sizeOfTypedData() + (aalloc - 1) * sizeof(T)));
Q_CHECK_PTR(mem);
- x.p = p = mem;
+ x.d = d = mem;
x.d->size = d->size;
} QT_CATCH (const std::bad_alloc &) {
if (aalloc > d->alloc) // ignore the error in case we are just shrinking.
@@ -478,8 +478,8 @@ void QVector<T>::realloc(int asize, int aalloc)
if (QTypeInfo<T>::isComplex) {
QT_TRY {
- pOld = d->array + x.d->size;
- pNew = x.d->array + x.d->size;
+ 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)) {
new (pNew++) T(*pOld++);
@@ -491,13 +491,13 @@ void QVector<T>::realloc(int asize, int aalloc)
x.d->size++;
}
} QT_CATCH (...) {
- free(x.d);
+ free(x.p);
QT_RETHROW;
}
} else if (asize > x.d->size) {
// initialize newly allocated memory to 0
- qMemSet(x.d->array + x.d->size, 0, (asize - x.d->size) * sizeof(T));
+ qMemSet(x.p->array + x.d->size, 0, (asize - x.d->size) * sizeof(T));
}
x.d->size = asize;