comctl32: Use SetRect() instead of open coding it.

Sebastian Lackner sebastian at fds-team.de
Fri Apr 29 08:31:35 CDT 2016


On 29.04.2016 15:29, Michael Stefaniuc wrote:
> On 04/29/2016 03:24 PM, Sebastian Lackner wrote:
>> On 29.04.2016 15:21, Michael Stefaniuc wrote:
>>> -    rcDragIcon.left = rcListBox.left - DRAGICON_HOTSPOT_X;
>>> -    rcDragIcon.top = rcItem.top - DRAGICON_HOTSPOT_Y;
>>> -    rcDragIcon.right = rcListBox.left;
>>> -    rcDragIcon.bottom = rcDragIcon.top + DRAGICON_HEIGHT;
>>> +    SetRect(&rcDragIcon, rcListBox.left - DRAGICON_HOTSPOT_X, rcItem.top - DRAGICON_HOTSPOT_Y,
>>> +            rcListBox.left, rcDragIcon.top + DRAGICON_HEIGHT);
>>
>> This won't work as expected. Haven't checked if there are more similar cases.
> Argghh! Missed that one.
> For whatever reason the coccinelle rule to prevent this isn't catching
> it if it happens in the last argument to the function call.  I had
> manually eliminated two other cases like this but missed this one.
> 
> bye
> 	michael
> 

Seems like its not the only one ;)

> @@ -2136,10 +2135,7 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC  hdc, INT  iItem)
>  
>  	  /* Now erase the top corner and draw diagonal edge */
>  	  SetBkColor(hdc, corner);
> -	  r1.left = r.right - ROUND_CORNER_SIZE - 1;
> -	  r1.top = r.top;
> -	  r1.right = r.right;
> -	  r1.bottom = r1.top + ROUND_CORNER_SIZE;
> +          SetRect(&r1, r.right - ROUND_CORNER_SIZE - 1, r.top, r.right, r1.top + ROUND_CORNER_SIZE);
>  	  ExtTextOutW(hdc, 0, 0, 2, &r1, NULL, 0, 0);
>  	  r1.right--;
>  	  DrawEdge(hdc, &r1, EDGE_RAISED, BF_SOFT|BF_DIAGONAL_ENDTOPLEFT);




More information about the wine-devel mailing list