Alex Henrie : comctl32: Return TRUE from LVM_REDRAWITEMS with bad indices.
Alexandre Julliard
julliard at winehq.org
Mon Feb 20 15:03:45 CST 2017
Module: wine
Branch: master
Commit: 690022c61b6dfc3af59bd3afdc53b33cc51201b4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=690022c61b6dfc3af59bd3afdc53b33cc51201b4
Author: Alex Henrie <alexhenrie24 at gmail.com>
Date: Mon Feb 20 00:06:12 2017 -0700
comctl32: Return TRUE from LVM_REDRAWITEMS with bad indices.
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/listview.c | 8 ++------
dlls/comctl32/tests/listview.c | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 56e2563..c01d816 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -7989,12 +7989,8 @@ static BOOL LISTVIEW_IsItemVisible(const LISTVIEW_INFO *infoPtr, INT nItem)
static BOOL LISTVIEW_RedrawItems(const LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast)
{
INT i;
-
- if (nLast < nFirst || min(nFirst, nLast) < 0 ||
- max(nFirst, nLast) >= infoPtr->nItemCount)
- return FALSE;
-
- for (i = nFirst; i <= nLast; i++)
+
+ for (i = max(nFirst, 0); i <= min(nLast, infoPtr->nItemCount - 1); i++)
LISTVIEW_InvalidateItem(infoPtr, i);
return TRUE;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 6d21b05..f497673 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -5529,6 +5529,43 @@ static void test_LVM_SETITEMTEXT(void)
DestroyWindow(hwnd);
}
+static void test_LVM_REDRAWITEMS(void)
+{
+ HWND list;
+ DWORD ret;
+
+ list = create_listview_control(LVS_ICON);
+ ok(list != NULL, "failed to create listview window\n");
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 0);
+ expect(TRUE, ret);
+
+ insert_item(list, 0);
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, -1, 0);
+ expect(TRUE, ret);
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, 0, -1);
+ expect(TRUE, ret);
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 0);
+ expect(TRUE, ret);
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 1);
+ expect(TRUE, ret);
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, 0, 2);
+ expect(TRUE, ret);
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, 1, 0);
+ expect(TRUE, ret);
+
+ ret = SendMessageA(list, LVM_REDRAWITEMS, 2, 3);
+ expect(TRUE, ret);
+
+ DestroyWindow(list);
+}
+
static void test_imagelists(void)
{
HWND hwnd, header;
@@ -5903,6 +5940,7 @@ START_TEST(listview)
test_createdragimage();
test_dispinfo();
test_LVM_SETITEMTEXT();
+ test_LVM_REDRAWITEMS();
test_imagelists();
test_deleteitem();
test_insertitem();
More information about the wine-cvs
mailing list