From: Michael Stefaniuc Subject: comctl32: Avoid using CopyRect() on RECT structs. Message-Id: <20160624111104.GA30988@redhat.com> Date: Fri, 24 Jun 2016 13:11:04 +0200 Signed-off-by: Michael Stefaniuc --- There are more CopyRect() in there but those operate on RECT pointers. So I'm doing the safe change first. dlls/comctl32/draglist.c | 2 +- dlls/comctl32/listview.c | 5 ++--- dlls/comctl32/progress.c | 2 +- dlls/comctl32/propsheet.c | 2 +- dlls/comctl32/theme_combo.c | 5 ++--- dlls/comctl32/toolbar.c | 12 ++++++------ 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/dlls/comctl32/draglist.c b/dlls/comctl32/draglist.c index 2097edb..ed52e5e 100644 --- a/dlls/comctl32/draglist.c +++ b/dlls/comctl32/draglist.c @@ -264,7 +264,7 @@ VOID WINAPI DrawInsert (HWND hwndParent, HWND hwndLB, INT nItem) RedrawWindow(hwndParent, &data->last_drag_icon_rect, NULL, RDW_INTERNALPAINT | RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); - CopyRect(&data->last_drag_icon_rect, &rcDragIcon); + data->last_drag_icon_rect = rcDragIcon; if (nItem >= 0) { diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 784ca7b..cfdb7de 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -3856,9 +3856,8 @@ static void LISTVIEW_MarqueeHighlight(LISTVIEW_INFO *infoPtr, const POINT *coord iterator_frameditems_absolute(&old_elems, infoPtr, &infoPtr->marqueeRect); - CopyRect(&infoPtr->marqueeRect, &rect); - - CopyRect(&infoPtr->marqueeDrawRect, &rect); + infoPtr->marqueeRect = rect; + infoPtr->marqueeDrawRect = rect; OffsetRect(&infoPtr->marqueeDrawRect, offset->x, offset->y); iterator_frameditems_absolute(&new_elems, infoPtr, &infoPtr->marqueeRect); diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c index 98c803c..4638ffc 100644 --- a/dlls/comctl32/progress.c +++ b/dlls/comctl32/progress.c @@ -355,7 +355,7 @@ static LRESULT PROGRESS_Draw (PROGRESS_INFO *infoPtr, HDC hdc) DrawThemeParentBackground (infoPtr->Self, hdc, NULL); DrawThemeBackground (pdi.theme, hdc, part, 0, &pdi.rect, NULL); SelectClipRgn (hdc, NULL); - CopyRect (&pdi.rect, &cntRect); + pdi.rect = cntRect; } /* compute some drawing parameters */ diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c index 3b56853..8600844 100644 --- a/dlls/comctl32/propsheet.c +++ b/dlls/comctl32/propsheet.c @@ -3219,7 +3219,7 @@ static LRESULT PROPSHEET_Paint(HWND hwnd, HDC hdcParam) if (bm.bmWidth < r.right || bm.bmHeight < r.bottom) { hbr = CreateSolidBrush(GetPixel(hdcSrc, 0, 0)); - CopyRect(&r, &rzone); + r = rzone; if (bm.bmWidth < r.right) { r.left = bm.bmWidth; diff --git a/dlls/comctl32/theme_combo.c b/dlls/comctl32/theme_combo.c index 9482a3b..3ee1d92 100644 --- a/dlls/comctl32/theme_combo.c +++ b/dlls/comctl32/theme_combo.c @@ -80,7 +80,7 @@ static void paint_text (HWND hwnd, HDC hdc, DWORD dwStyle, const COMBOBOXINFO *c /* * Give ourselves some space. */ - CopyRect (&rectEdit, &cbi->rcItem); + rectEdit = cbi->rcItem; InflateRect( &rectEdit, -1, -1 ); if(dwStyle & (CBS_OWNERDRAWFIXED | CBS_OWNERDRAWVARIABLE)) @@ -187,8 +187,7 @@ static LRESULT paint (HTHEME theme, HWND hwnd, HDC hParamDC, ULONG state) GetClientRect (hwnd, &frameRect); else { - CopyRect (&frameRect, &cbi.rcItem); - + frameRect = cbi.rcItem; InflateRect(&frameRect, EDIT_CONTROL_PADDING + COMBO_XBORDERSIZE, EDIT_CONTROL_PADDING + COMBO_YBORDERSIZE); diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 9307fd4..3b32e91 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -876,7 +876,7 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, HTHEME theme = GetWindowTheme (infoPtr->hwndSelf); rc = btnPtr->rect; - CopyRect (&rcArrow, &rc); + rcArrow = rc; /* separator - doesn't send NM_CUSTOMDRAW */ if (btnPtr->fsStyle & BTNS_SEP) { @@ -929,8 +929,8 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, /* copy text & bitmap rects after adjusting for drop-down arrow * so that text & bitmap is centered in the rectangle not containing * the arrow */ - CopyRect(&rcText, &rc); - CopyRect(&rcBitmap, &rc); + rcText = rc; + rcBitmap = rc; /* Center the bitmap horizontally and vertically */ if (dwStyle & TBSTYLE_LIST) @@ -2648,9 +2648,9 @@ TOOLBAR_CustomizeDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) lpdis->rcItem.right, lpdis->rcItem.bottom); /* calculate button and text rectangles */ - CopyRect (&rcButton, &lpdis->rcItem); + rcButton = lpdis->rcItem; InflateRect (&rcButton, -1, -1); - CopyRect (&rcText, &rcButton); + rcText = rcButton; rcButton.right = rcButton.left + custInfo->tbInfo->nBitmapWidth + 6; rcText.left = rcButton.right + 2; @@ -5550,7 +5550,7 @@ TOOLBAR_LButtonDown (TOOLBAR_INFO *infoPtr, WPARAM wParam, LPARAM lParam) RECT arrowRect; infoPtr->nOldHit = nHit; - CopyRect(&arrowRect, &btnPtr->rect); + arrowRect = btnPtr->rect; arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH); /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */ -- 2.4.11