Commit 3373ed8f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/dpa: Don't use start index on searching sorted array.

parent 6a5bb87e
......@@ -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) {
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment