Re: comctl32: Avoid using memset on RECTs.
On 29.07.2016 13:24, Michael Stefaniuc wrote:
Signed-off-by: Michael Stefaniuc <mstefani(a)redhat.de> --- dlls/comctl32/status.c | 4 ++-- dlls/comctl32/tab.c | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index 738c33b..08ca158 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -127,8 +127,8 @@ STATUSBAR_ComputeHeight(STATUS_INFO *infoPtr) * textHeight pixels large */ HDC hdc = GetDC(infoPtr->Self); RECT r; - memset (&r, 0, sizeof (r)); - r.bottom = max(infoPtr->minHeight, tm.tmHeight); + + SetRect(&r, 0, 0, 0, max(infoPtr->minHeight, tm.tmHeight)); if (SUCCEEDED(GetThemeBackgroundExtent(theme, hdc, SP_PANE, 0, &r, &r))) { height = r.bottom - r.top; diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index 0ed9152..62e34f9 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -373,12 +373,9 @@ static BOOL TAB_InternalGetItemRect( TRACE("Not Visible\n"); /* need to initialize these to empty rects */ if (itemRect) - { - memset(itemRect,0,sizeof(RECT)); - itemRect->bottom = infoPtr->tabHeight; - } + SetRect(itemRect, 0, 0, 0, infoPtr->tabHeight); if (selectedRect) - memset(selectedRect,0,sizeof(RECT)); + SetRectEmpty(selectedRect); return FALSE; }
You probably can remove null rect checks as well.
On 07/29/2016 01:14 PM, Nikolay Sivov wrote:
On 29.07.2016 13:24, Michael Stefaniuc wrote:
Signed-off-by: Michael Stefaniuc <mstefani(a)redhat.de> --- dlls/comctl32/status.c | 4 ++-- dlls/comctl32/tab.c | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index 738c33b..08ca158 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -127,8 +127,8 @@ STATUSBAR_ComputeHeight(STATUS_INFO *infoPtr) * textHeight pixels large */ HDC hdc = GetDC(infoPtr->Self); RECT r; - memset (&r, 0, sizeof (r)); - r.bottom = max(infoPtr->minHeight, tm.tmHeight); + + SetRect(&r, 0, 0, 0, max(infoPtr->minHeight, tm.tmHeight)); if (SUCCEEDED(GetThemeBackgroundExtent(theme, hdc, SP_PANE, 0, &r, &r))) { height = r.bottom - r.top; diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index 0ed9152..62e34f9 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -373,12 +373,9 @@ static BOOL TAB_InternalGetItemRect( TRACE("Not Visible\n"); /* need to initialize these to empty rects */ if (itemRect) - { - memset(itemRect,0,sizeof(RECT)); - itemRect->bottom = infoPtr->tabHeight; - } + SetRect(itemRect, 0, 0, 0, infoPtr->tabHeight); if (selectedRect) - memset(selectedRect,0,sizeof(RECT)); + SetRectEmpty(selectedRect); return FALSE; }
You probably can remove null rect checks as well. Probably? That isn't obvious from the context. Those two are input parameters to TAB_InternalGetItemRect() that aren't checked beforehand.
bye micheal
participants (2)
-
Michael Stefaniuc -
Nikolay Sivov