=?UTF-8?Q?Gabriel=20Iv=C4=83ncescu=20?=: user32/listbox: Use a helper to set item data by index.

Alexandre Julliard julliard at winehq.org
Fri Mar 1 16:42:09 CST 2019


Module: wine
Branch: master
Commit: a01b90d382254ee64ebf12ef11a67b4a31961961
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=a01b90d382254ee64ebf12ef11a67b4a31961961

Author: Gabriel Ivăncescu <gabrielopcode at gmail.com>
Date:   Thu Feb 28 15:10:27 2019 +0200

user32/listbox: Use a helper to set item data by index.

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 826ce01..9bf9f90 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -156,6 +156,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;
@@ -2743,7 +2748,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
             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;
 




More information about the wine-cvs mailing list