From bf0793e2bbcd0e0dfce12ff3339349c60ed95002 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 27 Apr 2003 21:24:36 +0000 Subject: [PATCH] *really* fixed searching in sorted arrays git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dynarray.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/dynarray.cpp b/src/common/dynarray.cpp index 1b812abedc..bdceb587b8 100644 --- a/src/common/dynarray.cpp +++ b/src/common/dynarray.cpp @@ -248,10 +248,10 @@ int name::Index(T lItem, CMPFUNC fnCompare) const \ { \ size_t n = IndexForInsert(lItem, fnCompare); \ \ - return n < m_nCount && \ + return (n >= m_nCount || \ (*fnCompare)((const void *)(long)lItem, \ - ((const void *)(long)m_pItems[n])) ? wxNOT_FOUND \ - : (int)n; \ + ((const void *)(long)m_pItems[n]))) ? wxNOT_FOUND \ + : (int)n; \ } \ \ /* add item at the end */ \