Module: wine Branch: master Commit: 2fddd6211efa8aec93d1e4f5296ac21a9f3af272 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2fddd6211efa8aec93d1e4f52...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Wed Feb 27 14:19:14 2019 +0200
comctl32/listbox: Use a helper to set item data by index.
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
---
dlls/comctl32/listbox.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 2b6702a..954866a 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -161,6 +161,11 @@ static ULONG_PTR get_item_data( const LB_DESCR *descr, UINT index ) return (descr->style & LBS_NODATA) ? 0 : descr->items[index].data; }
+static void set_item_data( LB_DESCR *descr, UINT index, ULONG_PTR data ) +{ + if (!(descr->style & LBS_NODATA)) descr->items[index].data = data; +} + static WCHAR *get_item_string( const LB_DESCR *descr, UINT index ) { return HAS_STRINGS(descr) ? descr->items[index].str : NULL; @@ -2684,7 +2689,7 @@ static LRESULT CALLBACK LISTBOX_WindowProc( HWND hwnd, UINT msg, WPARAM wParam, SetLastError(ERROR_INVALID_INDEX); return LB_ERR; } - if (!(descr->style & LBS_NODATA)) descr->items[wParam].data = lParam; + set_item_data(descr, wParam, lParam); /* undocumented: returns TRUE, not LB_OKAY (0) */ return TRUE;