Changeset 769 for trunk/src/corelib/tools/qvarlengtharray.h
- Timestamp:
- Aug 2, 2010, 9:27:30 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.6.3 (added) merged: 768 /branches/vendor/nokia/qt/current merged: 767 /branches/vendor/nokia/qt/4.6.2 removed
- Property svn:mergeinfo changed
-
trunk/src/corelib/tools/qvarlengtharray.h
r651 r769 129 129 void realloc(int size, int alloc); 130 130 131 int a; 132 int s; 133 T *ptr; 131 int a; 132 int s; 133 T *ptr; 134 134 union { 135 135 // ### Qt 5: Use 'Prealloc * sizeof(T)' as array size … … 194 194 T *oldPtr = ptr; 195 195 int osize = s; 196 // s = asize; 197 196 197 const int copySize = qMin(asize, osize); 198 198 if (aalloc != a) { 199 199 ptr = reinterpret_cast<T *>(qMalloc(aalloc * sizeof(T))); … … 206 206 QT_TRY { 207 207 // copy all the old elements 208 const int copySize = qMin(asize, osize);209 208 while (s < copySize) { 210 209 new (ptr+s) T(*(oldPtr+s)); … … 222 221 } 223 222 } else { 224 qMemCopy(ptr, oldPtr, qMin(asize, osize) * sizeof(T)); 225 s = asize; 223 qMemCopy(ptr, oldPtr, copySize * sizeof(T)); 226 224 } 227 225 } else { … … 230 228 } 231 229 } 232 233 if (QTypeInfo<T>::isComplex) { 230 s = copySize; 231 232 if (QTypeInfo<T>::isComplex) { 233 // destroy remaining old objects 234 234 while (osize > asize) 235 235 (oldPtr+(--osize))->~T(); 236 if( oldPtr == ptr )237 s = osize;238 236 } 239 237
Note:
See TracChangeset
for help on using the changeset viewer.