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

net: Use the ARRAY_SIZE() macro.

parent 7487e5f4
...@@ -61,8 +61,7 @@ static int output_vprintf(const WCHAR* fmt, __ms_va_list va_args) ...@@ -61,8 +61,7 @@ static int output_vprintf(const WCHAR* fmt, __ms_va_list va_args)
int len; int len;
SetLastError(NO_ERROR); SetLastError(NO_ERROR);
len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt, 0, 0, str, len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt, 0, 0, str, ARRAY_SIZE(str), &va_args);
sizeof(str)/sizeof(*str), &va_args);
if (len == 0 && GetLastError() != NO_ERROR) if (len == 0 && GetLastError() != NO_ERROR)
WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(fmt)); WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(fmt));
else else
...@@ -85,7 +84,7 @@ static int WINAPIV output_string(int msg, ...) ...@@ -85,7 +84,7 @@ static int WINAPIV output_string(int msg, ...)
WCHAR fmt[8192]; WCHAR fmt[8192];
__ms_va_list arguments; __ms_va_list arguments;
LoadStringW(GetModuleHandleW(NULL), msg, fmt, sizeof(fmt)/sizeof(fmt[0])); LoadStringW(GetModuleHandleW(NULL), msg, fmt, ARRAY_SIZE(fmt));
__ms_va_start(arguments, msg); __ms_va_start(arguments, msg);
output_vprintf(fmt, arguments); output_vprintf(fmt, arguments);
__ms_va_end(arguments); __ms_va_end(arguments);
...@@ -119,7 +118,7 @@ static BOOL net_use(int argc, const WCHAR* argv[]) ...@@ -119,7 +118,7 @@ static BOOL net_use(int argc, const WCHAR* argv[])
HMODULE hmod = GetModuleHandleW(NULL); HMODULE hmod = GetModuleHandleW(NULL);
/* Load the status strings */ /* Load the status strings */
for (i = 0; i < sizeof(status)/sizeof(*status); i++) for (i = 0; i < ARRAY_SIZE(status); i++)
{ {
status[i] = HeapAlloc(GetProcessHeap(), 0, 1024 * sizeof(**status)); status[i] = HeapAlloc(GetProcessHeap(), 0, 1024 * sizeof(**status));
LoadStringW(hmod, STRING_OK+i, status[i], 1024); LoadStringW(hmod, STRING_OK+i, status[i], 1024);
...@@ -147,7 +146,7 @@ static BOOL net_use(int argc, const WCHAR* argv[]) ...@@ -147,7 +146,7 @@ static BOOL net_use(int argc, const WCHAR* argv[])
} while (rc == ERROR_MORE_DATA); } while (rc == ERROR_MORE_DATA);
/* Release the status strings */ /* Release the status strings */
for (i = 0; i < sizeof(status)/sizeof(*status); i++) for (i = 0; i < ARRAY_SIZE(status); i++)
HeapFree(GetProcessHeap(), 0, status[i]); HeapFree(GetProcessHeap(), 0, status[i]);
return TRUE; return TRUE;
...@@ -256,7 +255,7 @@ static BOOL net_service(int operation, const WCHAR* service_name) ...@@ -256,7 +255,7 @@ static BOOL net_service(int operation, const WCHAR* service_name)
return FALSE; return FALSE;
} }
buffer_size = sizeof(service_display_name)/sizeof(*service_display_name); buffer_size = ARRAY_SIZE(service_display_name);
GetServiceDisplayNameW(SCManager, service_name, service_display_name, &buffer_size); GetServiceDisplayNameW(SCManager, service_name, service_display_name, &buffer_size);
if (!service_display_name[0]) lstrcpyW(service_display_name, service_name); if (!service_display_name[0]) lstrcpyW(service_display_name, service_name);
......
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