user32: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Stefaniuc 2018-08-08 22:20:04 +02:00 committed by Alexandre Julliard
parent 7ddbec0ecc
commit b2fc591748
5 changed files with 9 additions and 9 deletions

View File

@ -57,7 +57,7 @@ static HMODULE load_desktop_driver( HWND hwnd )
HKEY hkey;
DWORD size;
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( hwnd, display_device_guid_propW ));
USER_CheckNotLock();

View File

@ -90,7 +90,7 @@ static BOOL ICONTITLE_SetTitlePos( HWND hwnd, HWND owner )
INT cx, cy;
POINT pt;
int length = GetWindowTextW( owner, str, sizeof(str)/sizeof(WCHAR) );
int length = GetWindowTextW( owner, str, ARRAY_SIZE( str ));
while (length && str[length - 1] == ' ') /* remove trailing spaces */
str[--length] = 0;
@ -178,7 +178,7 @@ static BOOL ICONTITLE_Paint( HWND hwnd, HWND owner, HDC hDC, BOOL bActive )
{
WCHAR buffer[80];
INT length = GetWindowTextW( owner, buffer, sizeof(buffer)/sizeof(buffer[0]) );
INT length = GetWindowTextW( owner, buffer, ARRAY_SIZE( buffer ));
SetTextColor( hDC, textColor );
SetBkMode( hDC, TRANSPARENT );

View File

@ -335,7 +335,7 @@ DWORD WINAPI CharLowerBuffA( LPSTR str, DWORD len )
if (!str) return 0; /* YES */
lenW = MultiByteToWideChar(CP_ACP, 0, str, len, NULL, 0);
if (lenW > sizeof(buffer)/sizeof(WCHAR))
if (lenW > ARRAY_SIZE(buffer))
{
strW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR));
if (!strW) return 0;
@ -370,7 +370,7 @@ DWORD WINAPI CharUpperBuffA( LPSTR str, DWORD len )
if (!str) return 0; /* YES */
lenW = MultiByteToWideChar(CP_ACP, 0, str, len, NULL, 0);
if (lenW > sizeof(buffer)/sizeof(WCHAR))
if (lenW > ARRAY_SIZE(buffer))
{
strW = HeapAlloc(GetProcessHeap(), 0, lenW * sizeof(WCHAR));
if (!strW) return 0;

View File

@ -169,7 +169,7 @@ static const WCHAR *get_default_desktop(void)
static const WCHAR app_defaultsW[] = {'S','o','f','t','w','a','r','e','\\',
'W','i','n','e','\\',
'A','p','p','D','e','f','a','u','l','t','s',0};
static WCHAR buffer[MAX_PATH + sizeof(explorerW)/sizeof(WCHAR)];
static WCHAR buffer[MAX_PATH + ARRAY_SIZE(explorerW)];
WCHAR *p, *appname = buffer;
const WCHAR *ret = defaultW;
DWORD len;
@ -433,7 +433,7 @@ BOOL WINAPI ExitWindowsEx( UINT flags, DWORD reason )
STARTUPINFOW si;
void *redir;
GetSystemDirectoryW( app, MAX_PATH - sizeof(winebootW)/sizeof(WCHAR) );
GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE( winebootW ));
strcatW( app, winebootW );
strcpyW( cmdline, app );

View File

@ -2049,8 +2049,8 @@ HWND WINAPI GetDesktopWindow(void)
STARTUPINFOW si;
PROCESS_INFORMATION pi;
WCHAR windir[MAX_PATH];
WCHAR app[MAX_PATH + sizeof(explorer)/sizeof(WCHAR)];
WCHAR cmdline[MAX_PATH + (sizeof(explorer) + sizeof(args))/sizeof(WCHAR)];
WCHAR app[MAX_PATH + ARRAY_SIZE( explorer )];
WCHAR cmdline[MAX_PATH + ARRAY_SIZE( explorer ) + ARRAY_SIZE( args )];
WCHAR desktop[MAX_PATH];
void *redir;