]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed bug with searching in sorted arrays
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 11 Apr 2003 22:05:24 +0000 (22:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 11 Apr 2003 22:05:24 +0000 (22:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20143 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/common/dynarray.cpp

index 528869d0de411e2414ef51863af3f15824f45520..e4125b5563d4de9f247b96d097eaf74259e0a44c 100644 (file)
@@ -28,6 +28,7 @@ All:
 wxBase:
 
 - added Watcom makefiles
+- fixed bug with searching in sorted arrays (Jürgen Palm)
 
 All GUI ports:
 
index b760aa8b24484164a5628e64497ecfcda0ccfbd0..012c6077a324155f5b7b24b1009c4659e3dc4098 100644 (file)
@@ -283,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 */                                                   \