Nikolay Sivov : comctl32/dpa: Don' t use start index on searching sorted array.
Alexandre Julliard
julliard at winehq.org
Thu Jul 16 11:57:47 CDT 2009
Module: wine
Branch: master
Commit: 3373ed8fbb6aeaf2fd6fa484e5e05d9143b34fd1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3373ed8fbb6aeaf2fd6fa484e5e05d9143b34fd1
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed Jul 15 23:59:25 2009 +0400
comctl32/dpa: Don't use start index on searching sorted array.
---
dlls/comctl32/dpa.c | 3 ++-
dlls/comctl32/tests/dpa.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/comctl32/dpa.c b/dlls/comctl32/dpa.c
index bbad10d..43f2a3a 100644
--- a/dlls/comctl32/dpa.c
+++ b/dlls/comctl32/dpa.c
@@ -802,7 +802,8 @@ INT WINAPI DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart,
INT l, r, x, n;
LPVOID *lpPtr;
- l = (nStart == -1) ? 0 : nStart;
+ /* for binary search ignore start index */
+ l = 0;
r = hdpa->nItemCount - 1;
lpPtr = hdpa->ptrs;
while (r >= l) {
diff --git a/dlls/comctl32/tests/dpa.c b/dlls/comctl32/tests/dpa.c
index ed28119..741aeb6 100644
--- a/dlls/comctl32/tests/dpa.c
+++ b/dlls/comctl32/tests/dpa.c
@@ -289,9 +289,9 @@ static void test_dpa(void)
ok(j == DPA_ERR, "j=%d\n", j);
/* ... but for a binary search it's ignored */
j = pDPA_Search(dpa, (PVOID)(INT_PTR)i, i+1, CB_CmpLT, 0xdeadbeef, DPAS_SORTED);
- todo_wine ok(j+1 == i, "j=%d i=%d\n", j, i);
+ ok(j+1 == i, "j=%d i=%d\n", j, i);
}
-
+
/* Try to get the index of a nonexistent item */
i = pDPA_GetPtrIndex(dpa, (PVOID)7);
ok(i == DPA_ERR, "i=%d\n", i);
More information about the wine-cvs
mailing list