Commit af926f1b authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

imm32: Reorder control flow in ImmEscapeW.

parent f5c5839b
......@@ -1020,36 +1020,33 @@ LRESULT WINAPI ImmEscapeA( HKL hkl, HIMC himc, UINT code, void *data )
/***********************************************************************
* ImmEscapeW (IMM32.@)
*/
LRESULT WINAPI ImmEscapeW(
HKL hKL, HIMC hIMC,
UINT uEscape, LPVOID lpData)
LRESULT WINAPI ImmEscapeW( HKL hkl, HIMC himc, UINT code, void *data )
{
struct ime *immHkl = IMM_GetImmHkl( hKL );
TRACE("(%p, %p, %d, %p):\n", hKL, hIMC, uEscape, lpData);
struct ime *ime = IMM_GetImmHkl( hkl );
LRESULT ret;
if (immHkl->hIME && immHkl->pImeEscape)
TRACE( "hkl %p, himc %p, code %u, data %p.\n", hkl, himc, code, data );
if (!ime->hIME || !ime->pImeEscape) return 0;
if (!EscapeRequiresWA( code ) || is_kbd_ime_unicode( ime ))
ret = ime->pImeEscape( himc, code, data );
else
{
if (!EscapeRequiresWA(uEscape) || is_kbd_ime_unicode(immHkl))
return immHkl->pImeEscape(hIMC,uEscape,lpData);
char buffer[81]; /* largest required buffer should be 80 */
if (code == IME_ESC_SET_EUDC_DICTIONARY)
{
WideCharToMultiByte( CP_ACP, 0, data, -1, buffer, 81, NULL, NULL );
ret = ime->pImeEscape( himc, code, buffer );
}
else
{
CHAR buffer[81]; /* largest required buffer should be 80 */
LRESULT rc;
if (uEscape == IME_ESC_SET_EUDC_DICTIONARY)
{
WideCharToMultiByte(CP_ACP,0,lpData,-1,buffer,81, NULL, NULL);
rc = immHkl->pImeEscape(hIMC,uEscape,buffer);
}
else
{
rc = immHkl->pImeEscape(hIMC,uEscape,buffer);
MultiByteToWideChar(CP_ACP,0,buffer,-1,lpData,80);
}
return rc;
ret = ime->pImeEscape( himc, code, buffer );
MultiByteToWideChar( CP_ACP, 0, buffer, -1, data, 80 );
}
}
else
return 0;
return ret;
}
/***********************************************************************
......
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