Commit d41e6cac authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mscoree: Use the ARRAY_SIZE() macro.

parent 434ced69
......@@ -417,7 +417,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
TRACE("%s %s %s\n", debugstr_wn(pNamespaceUri,nNamespaceUri),
debugstr_wn(pLocalName,nLocalName), debugstr_wn(pQName,nQName));
if (This->statenum == sizeof(This->states) / sizeof(This->states[0]) - 1)
if (This->statenum == ARRAY_SIZE(This->states) - 1)
{
ERR("file has too much nesting\n");
return E_FAIL;
......@@ -426,8 +426,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
switch (This->states[This->statenum])
{
case STATE_ROOT:
if (nLocalName == sizeof(configuration)/sizeof(WCHAR)-1 &&
lstrcmpW(pLocalName, configuration) == 0)
if (nLocalName == ARRAY_SIZE(configuration) - 1 && lstrcmpW(pLocalName, configuration) == 0)
{
This->states[++This->statenum] = STATE_CONFIGURATION;
break;
......@@ -435,15 +434,13 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_CONFIGURATION:
if (nLocalName == sizeof(startup)/sizeof(WCHAR)-1 &&
lstrcmpW(pLocalName, startup) == 0)
if (nLocalName == ARRAY_SIZE(startup) - 1 && lstrcmpW(pLocalName, startup) == 0)
{
hr = parse_startup(This, pAttr);
This->states[++This->statenum] = STATE_STARTUP;
break;
}
else if (nLocalName == sizeof(runtime)/sizeof(WCHAR)-1 &&
lstrcmpW(pLocalName, runtime) == 0)
else if (nLocalName == ARRAY_SIZE(runtime) - 1 && lstrcmpW(pLocalName, runtime) == 0)
{
This->states[++This->statenum] = STATE_RUNTIME;
break;
......@@ -451,7 +448,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_RUNTIME:
if (nLocalName == sizeof(assemblyBinding)/sizeof(WCHAR)-1 &&
if (nLocalName == ARRAY_SIZE(assemblyBinding) - 1 &&
lstrcmpW(pLocalName, assemblyBinding) == 0)
{
This->states[++This->statenum] = STATE_ASSEMBLY_BINDING;
......@@ -460,8 +457,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_ASSEMBLY_BINDING:
if (nLocalName == sizeof(probing)/sizeof(WCHAR)-1 &&
lstrcmpW(pLocalName, probing) == 0)
if (nLocalName == ARRAY_SIZE(probing) - 1 && lstrcmpW(pLocalName, probing) == 0)
{
hr = parse_probing(This, pAttr);
This->states[++This->statenum] = STATE_PROBING;
......@@ -470,7 +466,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_STARTUP:
if (nLocalName == sizeof(supportedRuntime)/sizeof(WCHAR)-1 &&
if (nLocalName == ARRAY_SIZE(supportedRuntime) - 1 &&
lstrcmpW(pLocalName, supportedRuntime) == 0)
{
hr = parse_supported_runtime(This, pAttr);
......
......@@ -138,7 +138,7 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
if (!config_path)
{
DWORD len = sizeof(config_dir)/sizeof(*config_dir);
DWORD len = ARRAY_SIZE(config_dir);
static const WCHAR machine_configW[] = {'\\','C','O','N','F','I','G','\\','m','a','c','h','i','n','e','.','c','o','n','f','i','g',0};
......@@ -159,7 +159,7 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
goto end;
}
GetModuleFileNameW(NULL, base_dir, sizeof(base_dir) / sizeof(*base_dir));
GetModuleFileNameW(NULL, base_dir, ARRAY_SIZE(base_dir));
base_dirA = WtoA(base_dir);
if (!base_dirA)
{
......@@ -1674,7 +1674,7 @@ HRESULT create_monodata(REFIID riid, LPVOID *ppObj )
if (res != ERROR_SUCCESS || numKeys == 0)
goto cleanup;
numKeys--;
keyLength = sizeof(subkeyName) / sizeof(WCHAR);
keyLength = ARRAY_SIZE(subkeyName);
res = RegEnumKeyExW(key, numKeys, subkeyName, &keyLength, 0, 0, 0, 0);
if (res != ERROR_SUCCESS)
goto cleanup;
......
......@@ -751,7 +751,7 @@ static BOOL install_wine_mono(void)
}
}
len = GetSystemDirectoryW(app, MAX_PATH-sizeof(controlW)/sizeof(WCHAR));
len = GetSystemDirectoryW(app, MAX_PATH - ARRAY_SIZE(controlW));
memcpy(app+len, controlW, sizeof(controlW));
args = HeapAlloc(GetProcessHeap(), 0, (len*sizeof(WCHAR) + sizeof(controlW) + sizeof(argsW)));
......@@ -759,7 +759,7 @@ static BOOL install_wine_mono(void)
return FALSE;
memcpy(args, app, len*sizeof(WCHAR) + sizeof(controlW));
memcpy(args + len + sizeof(controlW)/sizeof(WCHAR)-1, argsW, sizeof(argsW));
memcpy(args + len + ARRAY_SIZE(controlW) - 1, argsW, sizeof(argsW));
TRACE("starting %s\n", debugstr_w(args));
......
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