[v2] riched20: Properly clear all of a buffer of type WCHAR. WCHAR.

Huw Davies huw at codeweavers.com
Tue May 10 07:23:30 CDT 2016


On 10 May 2016, at 12:53, Gerald Pfeifer <gerald at pfeifer.com> wrote:
> 
> Per Huw's preference (when I offered an alternate approach), this now 
> properly clears this buffer (which is of type WCHAR, so MAX_BUF_LEN
> fell short).
> 
> Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
> ---
> dlls/riched20/tests/editor.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
> index ae9c0a5..3678b95 100644
> --- a/dlls/riched20/tests/editor.c
> +++ b/dlls/riched20/tests/editor.c
> @@ -3822,7 +3822,7 @@ static void test_EM_SETTEXTEX(void)
>   getText.flags = GT_DEFAULT;
>   getText.lpDefaultChar = NULL;
>   getText.lpUsedDefChar = NULL;
> -  memset(buf, 0, MAX_BUF_LEN);
> +  memset(buf, 0, sizeof buf);
>   SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf);
>   ok(lstrcmpW(buf, TestItem2) == 0,
>       "EM_GETTEXTEX results not what was set by EM_SETTEXTEX\n”);

I’d prefer "sizeof(buf)", since that’s what’s used further down this function (and in most
other places in Wine for that matter).

Huw.

> @@ -3837,7 +3837,7 @@ static void test_EM_SETTEXTEX(void)
>   getText.flags = GT_USECRLF;   /* <-- asking for CR -> CRLF conversion */
>   getText.lpDefaultChar = NULL;
>   getText.lpUsedDefChar = NULL;
> -  memset(buf, 0, MAX_BUF_LEN);
> +  memset(buf, 0, sizeof buf);
>   SendMessageA(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM)buf);
>   ok(lstrcmpW(buf, TestItem1) == 0,
>       "EM_GETTEXTEX results not what was set by EM_SETTEXTEX\n");
> -- 
> 2.8.1




More information about the wine-devel mailing list