X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2abb9d2f1716177aa6c0ce0fd6a2519580dc12af..70ddb200c10bb6f1075f4a39452fdcf77f84fdf5:/src/common/dynarray.cpp diff --git a/src/common/dynarray.cpp b/src/common/dynarray.cpp index 72284fcb73..012c6077a3 100644 --- a/src/common/dynarray.cpp +++ b/src/common/dynarray.cpp @@ -6,7 +6,7 @@ // Created: 12.09.97 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -221,7 +221,11 @@ void name::Shrink() \ memcpy(pNew, m_pItems, m_nCount*sizeof(T)); \ delete [] m_pItems; \ m_pItems = pNew; \ + \ + /* update the size of the new block */ \ + m_nSize = m_nCount; \ } \ + /* else: don't do anything, better keep old memory block! */ \ } \ } \ \ @@ -279,7 +283,10 @@ int name::Index(T lItem, CMPFUNC fnCompare) const \ { \ size_t n = IndexForInsert(lItem, fnCompare); \ \ - return n < m_nCount && m_pItems[n] == lItem ? (int)n : wxNOT_FOUND; \ + return n < m_nCount && \ + (*fnCompare)((const void *)(long)lItem, \ + ((const void *)(long)m_pItems[n])) ? (int)n \ + : wxNOT_FOUND; \ } \ \ /* add item at the end */ \