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