Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/corelib/tools/qvarlengtharray.h

    r651 r769  
    129129    void realloc(int size, int alloc);
    130130
    131     int a;
    132     int s;
    133     T *ptr;
     131    int a;
     132    int s;
     133    T *ptr;
    134134    union {
    135135        // ### Qt 5: Use 'Prealloc * sizeof(T)' as array size
     
    194194    T *oldPtr = ptr;
    195195    int osize = s;
    196     // s = asize;
    197 
     196
     197    const int copySize = qMin(asize, osize);
    198198    if (aalloc != a) {
    199199        ptr = reinterpret_cast<T *>(qMalloc(aalloc * sizeof(T)));
     
    206206                QT_TRY {
    207207                    // copy all the old elements
    208                     const int copySize = qMin(asize, osize);
    209208                    while (s < copySize) {
    210209                        new (ptr+s) T(*(oldPtr+s));
     
    222221                }
    223222            } else {
    224                 qMemCopy(ptr, oldPtr, qMin(asize, osize) * sizeof(T));
    225                 s = asize;
     223                qMemCopy(ptr, oldPtr, copySize * sizeof(T));
    226224            }
    227225        } else {
     
    230228        }
    231229    }
    232 
    233     if (QTypeInfo<T>::isComplex) {
     230    s = copySize;
     231
     232    if (QTypeInfo<T>::isComplex) {
     233        // destroy remaining old objects
    234234        while (osize > asize)
    235235            (oldPtr+(--osize))->~T();
    236         if( oldPtr == ptr )
    237             s = osize;
    238236    }
    239237
Note: See TracChangeset for help on using the changeset viewer.