imm32: Set lengths to 0 for NULL strings in ImmSetCompositionString().
This commit is contained in:
parent
834a88fc3f
commit
d71fb7229f
2 changed files with 19 additions and 1 deletions
|
@ -2539,6 +2539,9 @@ BOOL WINAPI ImmSetCompositionStringA(
|
|||
return FALSE;
|
||||
|
||||
if (!(ime = imc_select_ime( data ))) return FALSE;
|
||||
if (!lpComp) dwCompLen = 0;
|
||||
if (!lpRead) dwReadLen = 0;
|
||||
|
||||
if (!ime_is_unicode( ime )) return ime->pImeSetCompositionString( hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen );
|
||||
|
||||
comp_len = MultiByteToWideChar(CP_ACP, 0, lpComp, dwCompLen, NULL, 0);
|
||||
|
@ -2596,6 +2599,9 @@ BOOL WINAPI ImmSetCompositionStringW(
|
|||
return FALSE;
|
||||
|
||||
if (!(ime = imc_select_ime( data ))) return FALSE;
|
||||
if (!lpComp) dwCompLen = 0;
|
||||
if (!lpRead) dwReadLen = 0;
|
||||
|
||||
if (ime_is_unicode( ime )) return ime->pImeSetCompositionString( hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen );
|
||||
|
||||
comp_len = WideCharToMultiByte(CP_ACP, 0, lpComp, dwCompLen, NULL, 0, NULL,
|
||||
|
|
|
@ -1085,12 +1085,24 @@ static void test_SCS_SETSTR(void)
|
|||
DWORD prop;
|
||||
|
||||
imc = ImmGetContext(hwnd);
|
||||
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL,0);
|
||||
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL, 0);
|
||||
if (!ret) {
|
||||
win_skip("Composition isn't supported\n");
|
||||
ImmReleaseContext(hwnd, imc);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, NULL, 128, NULL, 128);
|
||||
ok(ret, "got error %lu.\n", GetLastError());
|
||||
|
||||
alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20);
|
||||
ok(!alen, "got %ld.\n", alen);
|
||||
wlen = ImmGetCompositionStringW(imc, GCS_COMPSTR, wstring, 20);
|
||||
ok(!wlen, "got %ld.\n", alen);
|
||||
|
||||
ret = ImmSetCompositionStringW(imc, SCS_SETSTR, string, sizeof(string), NULL, 2);
|
||||
ok(ret, "got error %lu.\n", GetLastError());
|
||||
|
||||
msg_spy_flush_msgs();
|
||||
|
||||
alen = ImmGetCompositionStringA(imc, GCS_COMPSTR, cstring, 20);
|
||||
|
|
Loading…
Add table
Reference in a new issue