Add an appearently missing return in commctrl32

Andreas Mohr andi at rhlx01.fht-esslingen.de
Tue Jul 5 13:50:08 CDT 2005


Hi,

On Tue, Jul 05, 2005 at 06:56:20PM +0100, Robbert Xerox wrote:
> Hi, let me be clear: i don't know anything about this
> comctl32 stuff, but compared to this patch:
> http://cvs.winehq.org/patch.py?id=15317
> it seems to me there's a missing return, which i added
> in this patch.I have no time to get deeper into this
> comctl32 stuff so I'll leave it for a review to others
> who know more about it. Anyways: it fixes the
> following bug in Shareaza:
> http://bugs.winehq.org/show_bug.cgi?id=2659
Hmm, well, the fact that there are many structs like
        phdi->cxy = (lpItem != NULL) ? lpItem->cxy : 0;
suggests that even if lpItem is NULL (failure mode), the outbound phdi struct
should still get filled with proper data (which is, to be fair, not much more
than a zeroed-out struct, all taken together).

IOW, it seems a lot like this should simply be another up-front failure check instead
(such code is found in many functions in comctl32 on Windows!):

   if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) {
       memset(phdi, 0, sizeof(HDITEMW));
       return FALSE;
   }

   lpItem = &infoPtr->items[nItem];
   ... 

But even that is rather non-proven, so the best thing to do here is to write
a good test suite test for this function (for the easiest way to call this
function's functionality under Windows, that is...).

Andreas Mohr



More information about the wine-devel mailing list