forked from Mirrors/wine-wine
imm32: Correctly return the size of the required output buffer.
This fixes a regression introduced by fd7cda93a3
.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46851
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
parent
3e61c7127e
commit
d233a78295
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue