VirtualBox

Changeset 37861 in vbox for trunk/include/VBox/com


Ignore:
Timestamp:
Jul 11, 2011 10:03:22 AM (14 years ago)
Author:
vboxsync
Message:

IPRT: fix assigning of empty lists

Location:
trunk/include/VBox/com
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/list.h

    r37553 r37861  
    131131    {
    132132        com::SafeArray<IN_BSTR> sfaOther(ComSafeArrayInArg(other));
    133         realloc_grow(sfaOther.size());
     133        realloc(sfaOther.size());
    134134        m_cSize = sfaOther.size();
    135135        for (size_t i = 0; i < m_cSize; ++i)
     
    148148     */
    149149    RTCList(const com::SafeArray<IN_BSTR> &other)
     150     : BASE(other.size())
    150151    {
    151         realloc_grow(other.size());
    152         m_cSize = other.size();
    153152        for (size_t i = 0; i < m_cSize; ++i)
    154153            RTCListHelper<T, ITYPE>::set(m_pArray, i, T(other[i]));
     
    168167        /* Values cleanup */
    169168        RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cSize);
    170 
    171169        /* Copy */
    172170        if (other.size() != m_cCapacity)
    173             realloc_grow(other.size());
     171            realloc_no_elements_clean(other.size());
    174172        m_cSize = other.size();
    175173        for (size_t i = 0; i < other.size(); ++i)
  • trunk/include/VBox/com/mtlist.h

    r37068 r37861  
    131131    {
    132132        com::SafeArray<IN_BSTR> sfaOther(ComSafeArrayInArg(other));
    133         realloc_grow(sfaOther.size());
     133        realloc(sfaOther.size());
    134134        m_cSize = sfaOther.size();
    135135        for (size_t i = 0; i < m_cSize; ++i)
     
    148148     */
    149149    RTCMTList(const com::SafeArray<IN_BSTR> &other)
     150      : BASE(other.size())
    150151    {
    151         realloc_grow(other.size());
    152         m_cSize = other.size();
    153152        for (size_t i = 0; i < m_cSize; ++i)
    154153            RTCListHelper<T, ITYPE>::set(m_pArray, i, T(other[i]));
     
    166165    {
    167166        m_guard.enterWrite();
    168         /* Values cleanup */
     167         /* Values cleanup */
    169168        RTCListHelper<T, ITYPE>::eraseRange(m_pArray, 0, m_cSize);
    170 
    171169        /* Copy */
    172170        if (other.size() != m_cCapacity)
    173             realloc_grow(other.size());
     171            realloc_no_elements_clean(other.size());
    174172        m_cSize = other.size();
    175173        for (size_t i = 0; i < other.size(); ++i)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette