net: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-24 00:01:27 +02:00 committed by Alexandre Julliard
parent 7487e5f4e8
commit beb464358e
1 changed files with 5 additions and 6 deletions

View File

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