user32/listbox: Use is_item_selected in GetSelCount and GetSelItems.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2019-02-25 10:31:01 +00:00 committed by Alexandre Julliard
parent 170f59e574
commit 7edbf1c8e5
1 changed files with 4 additions and 6 deletions

View File

@ -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;
}