Module: wine Branch: master Commit: 2aedcf3f8c900bb55b1b0bf893029f2635f9a758 URL: https://source.winehq.org/git/wine.git/?a=commit;h=2aedcf3f8c900bb55b1b0bf89...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Tue Nov 13 12:35:58 2018 +0200
comctl32/listbox: Make SetCount fail if LBS_NODATA is not set.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/comctl32/listbox.c | 6 +----- dlls/comctl32/tests/listbox.c | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c index 3d8804a..4a2df52 100644 --- a/dlls/comctl32/listbox.c +++ b/dlls/comctl32/listbox.c @@ -1752,11 +1752,7 @@ static LRESULT LISTBOX_SetCount( LB_DESCR *descr, INT count ) { LRESULT ret;
- if (HAS_STRINGS(descr)) - { - SetLastError(ERROR_SETCOUNT_ON_BAD_LB); - return LB_ERR; - } + if (!(descr->style & LBS_NODATA)) return LB_ERR;
/* FIXME: this is far from optimal... */ if (count > descr->nb_items) diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index c560ce1..6ac3c73 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -1806,9 +1806,7 @@ static void test_set_count( void )
SetLastError( 0xdeadbeef ); ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 ); - todo_wine_if(i == 0) ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret ); - todo_wine_if(i == 1) ok( GetLastError() == 0xdeadbeef, "Unexpected error %d.\n", GetLastError() );
DestroyWindow( listbox ); @@ -2341,7 +2339,6 @@ todo_wine style = GetWindowLongA(listbox, GWL_STYLE); ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#x.\n", i, style); ret = SendMessageA(listbox, LB_SETCOUNT, 100, 0); - todo_wine_if(i == 1 || i == 4) ok(ret == LB_ERR, "%u: unexpected return value %d.\n", i, ret); DestroyWindow(listbox); }