[PATCH v3 8/8] comctl32/listbox: Make LBS_NODATA listboxes error on any attempt to find a value

Gabriel Ivăncescu gabrielopcode at gmail.com
Sun Nov 11 04:05:00 CST 2018


On Sat, Nov 10, 2018 at 11:46 PM Nikolay Sivov <nsivov at codeweavers.com> wrote:
>
> On 11/8/18 2:39 PM, Gabriel Ivăncescu wrote:
>
> > @@ -919,6 +919,9 @@ static INT LISTBOX_FindString( LB_DESCR *descr, INT start, LPCWSTR str, BOOL exa
> >       }
> >       else
> >       {
> > +        if (descr->style & LBS_NODATA)
> > +            return LB_ERR;
> > +
> >           if (exact && (descr->style & LBS_SORT))
> >               /* If sorted, use a WM_COMPAREITEM binary search */
> >               return LISTBOX_FindStringPos( descr, str, TRUE );
> > @@ -2450,7 +2453,7 @@ static LRESULT LISTBOX_HandleChar( LB_DESCR *descr, WCHAR charW )
> >                                   (LPARAM)descr->self );
> >           if (caret == -2) return 0;
> >       }
> > -    if (caret == -1)
> > +    if (caret == -1 && !(descr->style & LBS_NODATA))
> >           caret = LISTBOX_FindString( descr, descr->focus_item, str, FALSE);
> >       if (caret != -1)
> >       {
>
> Does it have to be deep in message handler? Can we skip right away if we
> have to?

No it doesn't have to be, it can be moved to the top of the function,
I'll do that.

>
> Also same issue, these are easily separable changes.
>

If you are referring to the caret == -1 change in HandleChar, then
it's actually useless and can be skipped completely, since LB_ERR is
-1 already.

I had it done probably because when I also made the user32 changes, it
had to set last error (but *only* the user32 variant does that, when I
tested), so it only makes sense there. I'll remove it for comctl32.



More information about the wine-devel mailing list