From 7edbf1c8e537627bdc45e65a70efb2bf67196938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Mon, 25 Feb 2019 10:31:01 +0000 Subject: [PATCH] user32/listbox: Use is_item_selected in GetSelCount and GetSelItems. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/user32/listbox.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index 0be48673ca6..826ce01cc40 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -1066,13 +1066,12 @@ static INT LISTBOX_FindString( LB_DESCR *descr, INT start, LPCWSTR str, BOOL exa static LRESULT LISTBOX_GetSelCount( const LB_DESCR *descr ) { INT i, count; - const LB_ITEMDATA *item = descr->items; if (!(descr->style & LBS_MULTIPLESEL) || (descr->style & LBS_NOSEL)) return LB_ERR; - for (i = count = 0; i < descr->nb_items; i++, item++) - if (item->selected) count++; + for (i = count = 0; i < descr->nb_items; i++) + if (is_item_selected(descr, i)) count++; return count; } @@ -1083,11 +1082,10 @@ static LRESULT LISTBOX_GetSelCount( const LB_DESCR *descr ) static LRESULT LISTBOX_GetSelItems( const LB_DESCR *descr, INT max, LPINT array ) { INT i, count; - const LB_ITEMDATA *item = descr->items; if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR; - for (i = count = 0; (i < descr->nb_items) && (count < max); i++, item++) - if (item->selected) array[count++] = i; + for (i = count = 0; (i < descr->nb_items) && (count < max); i++) + if (is_item_selected(descr, i)) array[count++] = i; return count; }