Commit d233a782 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

imm32: Correctly return the size of the required output buffer.

This fixes a regression introduced by fd7cda93. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46851Signed-off-by: 's avatarAkihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: 's avatarAric Stewart <aric@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 3e61c712
......@@ -1224,8 +1224,13 @@ static INT CopyCompStringIMEtoClient(const InputContextData *data, const void *s
}
else
{
ret = min(src_len * char_size, dst_len);
memcpy(dst, src, ret);
if (dst_len)
{
ret = min(src_len * char_size, dst_len);
memcpy(dst, src, ret);
}
else
ret = src_len * char_size;
}
return ret;
......
......@@ -473,6 +473,18 @@ static void test_ImmGetCompositionString(void)
len = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, wlen - 1);
ok(len == wlen - 1, "Unexpected length %d.\n", len);
ok(!memcmp(wstring, string, wlen - 1), "Unexpected buffer contents.\n");
/* Get the size of the required output buffer. */
memset(wstring, 0x1a, sizeof(wstring));
memset(cstring, 0x1a, sizeof(cstring));
len = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 0);
ok(len == alen, "Unexpected length %d.\n", len);
ok(cstring[0] == 0x1a, "Unexpected buffer contents %s.\n", cstring);
len = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, 0);
ok(len == wlen, "Unexpected length %d.\n", len);
ok(wstring[0] == 0x1a1a, "Unexpected buffer contents.\n");
}
else
win_skip("Composition string isn't available\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment