[PATCH] comdlg32: Initialize 2 RECT to 0 (Coverity)

Andrew Talbot Andrew.Talbot at talbotville.com
Fri Sep 23 14:01:30 CDT 2011


Marcus Meissner wrote:

> Hi,
> 
> If the filename and toolbar field are not present, we will be using
> uninitialized RECTs, so initialize them.
> 
> CID 5033, 5034
> 
> Ciao, Marcus
> ---
>  dlls/comdlg32/itemdlg.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
> index bc309c9..d9756c0 100644
> --- a/dlls/comdlg32/itemdlg.c
> +++ b/dlls/comdlg32/itemdlg.c
> @@ -1106,6 +1106,8 @@ static SIZE update_layout(FileDialogImpl *This)
>      SIZE ret;
>  
>      GetClientRect(This->dlg_hwnd, &dialog_rc);
> +    memset (&toolbar_rc, 0, sizeof(toolbar_rc));
> +    memset (&filename_rc, 0, sizeof(filename_rc));
>  
>      missing_width = max(0, 320 - dialog_rc.right);
>      missing_height = max(0, 200 - dialog_rc.bottom);

Hi Marcus,

Instead of using memset(), would it not be better to initialise the RECTs to
zero when declaring them, as follows?

   RECT toolbar_rc = { 0 };
   RECT filename_rc = { 0 };

-- 
Andy.





More information about the wine-devel mailing list