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

imm32: Reorder control flow in ImmEscapeA.

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