From fd4b0686526694adc3ed7afb38eac6e7c757fbd4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 11 Apr 2003 22:05:24 +0000 Subject: [PATCH] fixed bug with searching in sorted arrays git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20143 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/common/dynarray.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index bce3da07e6..631cf86d87 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -197,6 +197,7 @@ wxBase - compilation with wxUSE_ODBC=1 fixed (dbkeyg.h file was missing in the archive) - bug in wxDateTime with timezones on systems with tm_gmtoff in struct tm fixed - fixed bug in wxArray::Shrink() (Seth Manley) +- fixed bug with searching in sorted arrays (Jürgen Palm) wxGTK: diff --git a/src/common/dynarray.cpp b/src/common/dynarray.cpp index 25a80d3860..24df3c7ecd 100644 --- a/src/common/dynarray.cpp +++ b/src/common/dynarray.cpp @@ -248,7 +248,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 */ \