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

imm32: Reorder control flow in ImmGetConversionListA.

parent af926f1b
......@@ -1585,39 +1585,36 @@ HIMC WINAPI ImmGetContext(HWND hWnd)
/***********************************************************************
* ImmGetConversionListA (IMM32.@)
*/
DWORD WINAPI ImmGetConversionListA(
HKL hKL, HIMC hIMC,
LPCSTR pSrc, LPCANDIDATELIST lpDst,
DWORD dwBufLen, UINT uFlag)
DWORD WINAPI ImmGetConversionListA( HKL hkl, HIMC himc, const char *srcA, CANDIDATELIST *listA,
DWORD lengthA, UINT flags )
{
struct ime *immHkl = IMM_GetImmHkl( hKL );
TRACE("(%p, %p, %s, %p, %ld, %d):\n", hKL, hIMC, debugstr_a(pSrc), lpDst,
dwBufLen, uFlag);
if (immHkl->hIME && immHkl->pImeConversionList)
{
if (!is_kbd_ime_unicode(immHkl))
return immHkl->pImeConversionList(hIMC,(LPCWSTR)pSrc,lpDst,dwBufLen,uFlag);
struct ime *ime = IMM_GetImmHkl( hkl );
DWORD ret;
TRACE( "hkl %p, himc %p, srcA %s, listA %p, lengthA %lu, flags %#x.\n", hkl, himc,
debugstr_a(srcA), listA, lengthA, flags );
if (!ime->hIME || !ime->pImeConversionList) return 0;
if (!is_kbd_ime_unicode( ime ))
ret = ime->pImeConversionList( himc, (const WCHAR *)srcA, listA, lengthA, flags );
else
{
LPCANDIDATELIST lpwDst;
DWORD ret = 0, len;
LPWSTR pwSrc = strdupAtoW(pSrc);
CANDIDATELIST *listW;
WCHAR *srcW = strdupAtoW( srcA );
DWORD lengthW = ime->pImeConversionList( himc, srcW, NULL, 0, flags );
len = immHkl->pImeConversionList(hIMC, pwSrc, NULL, 0, uFlag);
lpwDst = HeapAlloc(GetProcessHeap(), 0, len);
if ( lpwDst )
if (!(listW = HeapAlloc( GetProcessHeap(), 0, lengthW ))) ret = 0;
else
{
immHkl->pImeConversionList(hIMC, pwSrc, lpwDst, len, uFlag);
ret = convert_candidatelist_WtoA( lpwDst, lpDst, dwBufLen);
HeapFree(GetProcessHeap(), 0, lpwDst);
ime->pImeConversionList( himc, srcW, listW, lengthW, flags );
ret = convert_candidatelist_WtoA( listW, listA, lengthA );
HeapFree( GetProcessHeap(), 0, listW );
}
HeapFree( GetProcessHeap(), 0, srcW );
}
HeapFree(GetProcessHeap(), 0, pwSrc);
return ret;
}
}
else
return 0;
}
/***********************************************************************
......
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