=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: user32/listbox: Move the item data removal into a separate function.
Alexandre Julliard
julliard at winehq.org
Thu Feb 21 14:50:10 CST 2019
Module: wine
Branch: master
Commit: 9f5865342180af56fddec002c995fd0ae5ac7bff
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9f5865342180af56fddec002c995fd0ae5ac7bff
Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date: Wed Feb 20 15:13:12 2019 +0200
user32/listbox: Move the item data removal into a separate function.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/user32/listbox.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 7caf24c..87404c6 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -195,6 +195,15 @@ static void insert_item_data(LB_DESCR *descr, UINT index, WCHAR *str, ULONG_PTR
item->selected = FALSE;
}
+static void remove_item_data(LB_DESCR *descr, UINT index)
+{
+ LB_ITEMDATA *item;
+
+ item = descr->items + index;
+ if (index < descr->nb_items)
+ memmove(item, item + 1, (descr->nb_items - index) * sizeof(LB_ITEMDATA));
+}
+
/*********************************************************************
* listbox class descriptor
*/
@@ -1709,8 +1718,6 @@ static void LISTBOX_DeleteItem( LB_DESCR *descr, INT index )
*/
static LRESULT LISTBOX_RemoveItem( LB_DESCR *descr, INT index )
{
- LB_ITEMDATA *item;
-
if ((index < 0) || (index >= descr->nb_items)) return LB_ERR;
/* We need to invalidate the original rect instead of the updated one. */
@@ -1723,15 +1730,9 @@ static LRESULT LISTBOX_RemoveItem( LB_DESCR *descr, INT index )
}
descr->nb_items--;
LISTBOX_DeleteItem( descr, index );
+ remove_item_data(descr, index);
- /* Remove the item */
-
- item = &descr->items[index];
- if (index < descr->nb_items)
- RtlMoveMemory( item, item + 1,
- (descr->nb_items - index) * sizeof(LB_ITEMDATA) );
if (descr->anchor_item == descr->nb_items) descr->anchor_item--;
-
resize_storage(descr, descr->nb_items);
/* Repaint the items */
More information about the wine-cvs
mailing list