Peter Åstrand : comctl32: LISTVIEW_InsertItemT should accept iItem < 0, when using sorted lists.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed Mar 8 06:08:33 CST 2006
Module: wine
Branch: refs/heads/master
Commit: c5552a694b07e2dea0b788717bb696b8b765f9bf
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=c5552a694b07e2dea0b788717bb696b8b765f9bf
Author: Peter Åstrand <astrand at cendio.se>
Date: Tue Mar 7 14:07:49 2006 +0100
comctl32: LISTVIEW_InsertItemT should accept iItem < 0, when using sorted lists.
---
dlls/comctl32/listview.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 9210e8d..cab119a 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -6211,7 +6211,7 @@ static INT LISTVIEW_InsertItemT(LISTVIEW
if (infoPtr->dwStyle & LVS_OWNERDATA) return infoPtr->nItemCount++;
/* make sure it's an item, and not a subitem; cannot insert a subitem */
- if (!lpLVItem || lpLVItem->iItem < 0 || lpLVItem->iSubItem) return -1;
+ if (!lpLVItem || lpLVItem->iSubItem) return -1;
if (!is_assignable_item(lpLVItem, infoPtr->dwStyle)) return -1;
@@ -6224,6 +6224,8 @@ static INT LISTVIEW_InsertItemT(LISTVIEW
is_sorted = (infoPtr->dwStyle & (LVS_SORTASCENDING | LVS_SORTDESCENDING)) &&
!(infoPtr->dwStyle & LVS_OWNERDRAWFIXED) && (LPSTR_TEXTCALLBACKW != lpLVItem->pszText);
+ if (lpLVItem->iItem < 0 && !is_sorted) return -1;
+
nItem = is_sorted ? infoPtr->nItemCount : min(lpLVItem->iItem, infoPtr->nItemCount);
TRACE(" inserting at %d, sorted=%d, count=%d, iItem=%d\n", nItem, is_sorted, infoPtr->nItemCount, lpLVItem->iItem);
nItem = DPA_InsertPtr( infoPtr->hdpaItems, nItem, hdpaSubItems );
More information about the wine-cvs
mailing list