Commit 32c6e823 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

imm32: Use the ARRAY_SIZE() macro.

parent f22d727e
...@@ -308,7 +308,7 @@ static HMODULE load_graphics_driver(void) ...@@ -308,7 +308,7 @@ static HMODULE load_graphics_driver(void)
HKEY hkey; HKEY hkey;
DWORD size; DWORD size;
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
WCHAR key[(sizeof(key_pathW) + sizeof(displayW)) / sizeof(WCHAR) + 40]; WCHAR key[ARRAY_SIZE( key_pathW ) + ARRAY_SIZE( displayW ) + 40];
UINT guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), display_device_guid_propW )); UINT guid_atom = HandleToULong( GetPropW( GetDesktopWindow(), display_device_guid_propW ));
if (!guid_atom) return 0; if (!guid_atom) return 0;
...@@ -769,7 +769,7 @@ HIMC WINAPI ImmCreateContext(void) ...@@ -769,7 +769,7 @@ HIMC WINAPI ImmCreateContext(void)
gl->dwSize = sizeof(GUIDELINE); gl->dwSize = sizeof(GUIDELINE);
ImmUnlockIMCC(new_context->IMC.hGuideLine); ImmUnlockIMCC(new_context->IMC.hGuideLine);
for (i = 0; i < sizeof(new_context->IMC.cfCandForm) / sizeof(CANDIDATEFORM); i++) for (i = 0; i < ARRAY_SIZE(new_context->IMC.cfCandForm); i++)
new_context->IMC.cfCandForm[i].dwIndex = ~0u; new_context->IMC.cfCandForm[i].dwIndex = ~0u;
/* Initialize the IME Private */ /* Initialize the IME Private */
...@@ -1013,8 +1013,7 @@ DWORD WINAPI ImmGetCandidateListA( ...@@ -1013,8 +1013,7 @@ DWORD WINAPI ImmGetCandidateListA(
return 0; return 0;
candinfo = ImmLockIMCC(data->IMC.hCandInfo); candinfo = ImmLockIMCC(data->IMC.hCandInfo);
if ( dwIndex >= candinfo->dwCount || if (dwIndex >= candinfo->dwCount || dwIndex >= ARRAY_SIZE(candinfo->dwOffset))
dwIndex >= (sizeof(candinfo->dwOffset) / sizeof(DWORD)) )
goto done; goto done;
candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]); candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]);
...@@ -1117,8 +1116,7 @@ DWORD WINAPI ImmGetCandidateListW( ...@@ -1117,8 +1116,7 @@ DWORD WINAPI ImmGetCandidateListW(
return 0; return 0;
candinfo = ImmLockIMCC(data->IMC.hCandInfo); candinfo = ImmLockIMCC(data->IMC.hCandInfo);
if ( dwIndex >= candinfo->dwCount || if (dwIndex >= candinfo->dwCount || dwIndex >= ARRAY_SIZE(candinfo->dwOffset))
dwIndex >= (sizeof(candinfo->dwOffset) / sizeof(DWORD)) )
goto done; goto done;
candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]); candlist = (LPCANDIDATELIST)((LPBYTE)candinfo + candinfo->dwOffset[dwIndex]);
...@@ -1152,7 +1150,7 @@ BOOL WINAPI ImmGetCandidateWindow( ...@@ -1152,7 +1150,7 @@ BOOL WINAPI ImmGetCandidateWindow(
if (!data || !lpCandidate) if (!data || !lpCandidate)
return FALSE; return FALSE;
if ( dwIndex >= (sizeof(data->IMC.cfCandForm) / sizeof(CANDIDATEFORM)) ) if (dwIndex >= ARRAY_SIZE(data->IMC.cfCandForm))
return FALSE; return FALSE;
if (data->IMC.cfCandForm[dwIndex].dwIndex != dwIndex) if (data->IMC.cfCandForm[dwIndex].dwIndex != dwIndex)
...@@ -1624,8 +1622,7 @@ static BOOL needs_ime_window(HWND hwnd) ...@@ -1624,8 +1622,7 @@ static BOOL needs_ime_window(HWND hwnd)
{ {
WCHAR classW[8]; WCHAR classW[8];
if (GetClassNameW(hwnd, classW, sizeof(classW)/sizeof(classW[0])) && if (GetClassNameW(hwnd, classW, ARRAY_SIZE(classW)) && !strcmpW(classW, szwIME))
!strcmpW(classW, szwIME))
return FALSE; return FALSE;
if (GetClassLongPtrW(hwnd, GCL_STYLE) & CS_IME) return FALSE; if (GetClassLongPtrW(hwnd, GCL_STYLE) & CS_IME) return FALSE;
...@@ -1844,7 +1841,7 @@ UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen) ...@@ -1844,7 +1841,7 @@ UINT WINAPI ImmGetIMEFileNameW(HKL hKL, LPWSTR lpszFileName, UINT uBufLen)
HKEY hkey; HKEY hkey;
DWORD length; DWORD length;
DWORD rc; DWORD rc;
WCHAR regKey[sizeof(szImeRegFmt)/sizeof(WCHAR)+8]; WCHAR regKey[ARRAY_SIZE(szImeRegFmt)+8];
wsprintfW( regKey, szImeRegFmt, (ULONG_PTR)hKL ); wsprintfW( regKey, szImeRegFmt, (ULONG_PTR)hKL );
rc = RegOpenKeyW( HKEY_LOCAL_MACHINE, regKey, &hkey); rc = RegOpenKeyW( HKEY_LOCAL_MACHINE, regKey, &hkey);
...@@ -2062,7 +2059,7 @@ HKL WINAPI ImmInstallIMEW( ...@@ -2062,7 +2059,7 @@ HKL WINAPI ImmInstallIMEW(
HKL hkl; HKL hkl;
DWORD rc; DWORD rc;
HKEY hkey; HKEY hkey;
WCHAR regKey[sizeof(szImeRegFmt)/sizeof(WCHAR)+8]; WCHAR regKey[ARRAY_SIZE(szImeRegFmt)+8];
TRACE ("(%s, %s):\n", debugstr_w(lpszIMEFileName), TRACE ("(%s, %s):\n", debugstr_w(lpszIMEFileName),
debugstr_w(lpszLayoutText)); debugstr_w(lpszLayoutText));
...@@ -2314,7 +2311,7 @@ BOOL WINAPI ImmSetCandidateWindow( ...@@ -2314,7 +2311,7 @@ BOOL WINAPI ImmSetCandidateWindow(
wine_dbgstr_point(&lpCandidate->ptCurrentPos), wine_dbgstr_point(&lpCandidate->ptCurrentPos),
wine_dbgstr_rect(&lpCandidate->rcArea)); wine_dbgstr_rect(&lpCandidate->rcArea));
if ( lpCandidate->dwIndex >= (sizeof(data->IMC.cfCandForm) / sizeof(CANDIDATEFORM)) ) if (lpCandidate->dwIndex >= ARRAY_SIZE(data->IMC.cfCandForm))
return FALSE; return FALSE;
data->IMC.cfCandForm[lpCandidate->dwIndex] = *lpCandidate; data->IMC.cfCandForm[lpCandidate->dwIndex] = *lpCandidate;
......
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