Commit 83e481fe authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

explorer: Use the ARRAY_SIZE() macro.

parent e011370f
...@@ -709,7 +709,7 @@ static const WCHAR *get_default_desktop_name(void) ...@@ -709,7 +709,7 @@ static const WCHAR *get_default_desktop_name(void)
WCHAR *ret = NULL; WCHAR *ret = NULL;
HKEY hkey; HKEY hkey;
if (desk && GetUserObjectInformationW( desk, UOI_NAME, buffer, sizeof(buffer)/sizeof(WCHAR), NULL )) if (desk && GetUserObjectInformationW( desk, UOI_NAME, buffer, ARRAY_SIZE( buffer ), NULL ))
{ {
if (strcmpiW( buffer, defaultW )) return buffer; if (strcmpiW( buffer, defaultW )) return buffer;
} }
...@@ -792,7 +792,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid ) ...@@ -792,7 +792,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
static const WCHAR drv_formatW[] = {'w','i','n','e','%','s','.','d','r','v',0}; static const WCHAR drv_formatW[] = {'w','i','n','e','%','s','.','d','r','v',0};
WCHAR buffer[MAX_PATH], libname[32], *name, *next; WCHAR buffer[MAX_PATH], libname[32], *name, *next;
WCHAR key[sizeof(device_keyW)/sizeof(WCHAR) + 39]; WCHAR key[ARRAY_SIZE( device_keyW ) + 39];
HMODULE module = 0; HMODULE module = 0;
HKEY hkey; HKEY hkey;
char error[80]; char error[80];
...@@ -809,7 +809,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid ) ...@@ -809,7 +809,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
RegCloseKey( hkey ); RegCloseKey( hkey );
} }
} }
else lstrcpynW( buffer, driver, sizeof(buffer)/sizeof(WCHAR) ); else lstrcpynW( buffer, driver, ARRAY_SIZE( buffer ));
name = buffer; name = buffer;
while (name) while (name)
...@@ -817,7 +817,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid ) ...@@ -817,7 +817,7 @@ static HMODULE load_graphics_driver( const WCHAR *driver, const GUID *guid )
next = strchrW( name, ',' ); next = strchrW( name, ',' );
if (next) *next++ = 0; if (next) *next++ = 0;
snprintfW( libname, sizeof(libname)/sizeof(WCHAR), drv_formatW, name ); snprintfW( libname, ARRAY_SIZE( libname ), drv_formatW, name );
if ((module = LoadLibraryW( libname )) != 0) break; if ((module = LoadLibraryW( libname )) != 0) break;
switch (GetLastError()) switch (GetLastError())
{ {
......
...@@ -345,10 +345,8 @@ static void make_explorer_window(IShellFolder* startFolder) ...@@ -345,10 +345,8 @@ static void make_explorer_window(IShellFolder* startFolder)
memset(nav_buttons,0,sizeof(nav_buttons)); memset(nav_buttons,0,sizeof(nav_buttons));
LoadStringW(explorer_hInstance,IDS_EXPLORER_TITLE,explorer_title, LoadStringW(explorer_hInstance,IDS_EXPLORER_TITLE,explorer_title, ARRAY_SIZE( explorer_title ));
sizeof(explorer_title)/sizeof(WCHAR)); LoadStringW(explorer_hInstance,IDS_PATHBOX_LABEL,pathbox_label, ARRAY_SIZE( pathbox_label ));
LoadStringW(explorer_hInstance,IDS_PATHBOX_LABEL,pathbox_label,
sizeof(pathbox_label)/sizeof(WCHAR));
hdc = GetDC(0); hdc = GetDC(0);
dpix = GetDeviceCaps(hdc, LOGPIXELSX); dpix = GetDeviceCaps(hdc, LOGPIXELSX);
...@@ -415,7 +413,7 @@ static void make_explorer_window(IShellFolder* startFolder) ...@@ -415,7 +413,7 @@ static void make_explorer_window(IShellFolder* startFolder)
nav_buttons[2].fsState=TBSTATE_ENABLED; nav_buttons[2].fsState=TBSTATE_ENABLED;
nav_buttons[2].fsStyle=BTNS_BUTTON|BTNS_AUTOSIZE; nav_buttons[2].fsStyle=BTNS_BUTTON|BTNS_AUTOSIZE;
SendMessageW(nav_toolbar,TB_BUTTONSTRUCTSIZE,sizeof(TBBUTTON),0); SendMessageW(nav_toolbar,TB_BUTTONSTRUCTSIZE,sizeof(TBBUTTON),0);
SendMessageW(nav_toolbar,TB_ADDBUTTONSW,sizeof(nav_buttons)/sizeof(TBBUTTON),(LPARAM)nav_buttons); SendMessageW(nav_toolbar,TB_ADDBUTTONSW,ARRAY_SIZE( nav_buttons ),(LPARAM)nav_buttons);
band_info.cbSize = sizeof(band_info); band_info.cbSize = sizeof(band_info);
band_info.fMask = RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE; band_info.fMask = RBBIM_STYLE|RBBIM_CHILD|RBBIM_CHILDSIZE|RBBIM_SIZE;
...@@ -738,38 +736,38 @@ static void parse_command_line(LPWSTR commandline,parameters_struct *parameters) ...@@ -738,38 +736,38 @@ static void parse_command_line(LPWSTR commandline,parameters_struct *parameters)
while (*p) while (*p)
{ {
while (isspaceW(*p)) p++; while (isspaceW(*p)) p++;
if (strncmpW(p, arg_n, sizeof(arg_n)/sizeof(WCHAR))==0) if (strncmpW(p, arg_n, ARRAY_SIZE( arg_n ))==0)
{ {
parameters->explorer_mode = FALSE; parameters->explorer_mode = FALSE;
p += sizeof(arg_n)/sizeof(WCHAR); p += ARRAY_SIZE( arg_n );
} }
else if (strncmpW(p, arg_e, sizeof(arg_e)/sizeof(WCHAR))==0) else if (strncmpW(p, arg_e, ARRAY_SIZE( arg_e ))==0)
{ {
parameters->explorer_mode = TRUE; parameters->explorer_mode = TRUE;
p += sizeof(arg_e)/sizeof(WCHAR); p += ARRAY_SIZE( arg_e );
} }
else if (strncmpW(p, arg_root, sizeof(arg_root)/sizeof(WCHAR))==0) else if (strncmpW(p, arg_root, ARRAY_SIZE( arg_root ))==0)
{ {
p += sizeof(arg_root)/sizeof(WCHAR); p += ARRAY_SIZE( arg_root );
p = copy_path_string(parameters->root,p); p = copy_path_string(parameters->root,p);
} }
else if (strncmpW(p, arg_select, sizeof(arg_select)/sizeof(WCHAR))==0) else if (strncmpW(p, arg_select, ARRAY_SIZE( arg_select ))==0)
{ {
p += sizeof(arg_select)/sizeof(WCHAR); p += ARRAY_SIZE( arg_select );
p = copy_path_string(parameters->selection,p); p = copy_path_string(parameters->selection,p);
if (!parameters->root[0]) if (!parameters->root[0])
copy_path_root(parameters->root, copy_path_root(parameters->root,
parameters->selection); parameters->selection);
} }
else if (strncmpW(p, arg_desktop, sizeof(arg_desktop)/sizeof(WCHAR))==0) else if (strncmpW(p, arg_desktop, ARRAY_SIZE( arg_desktop ))==0)
{ {
p += sizeof(arg_desktop)/sizeof(WCHAR); p += ARRAY_SIZE( arg_desktop );
manage_desktop( p ); /* the rest of the command line is handled by desktop mode */ manage_desktop( p ); /* the rest of the command line is handled by desktop mode */
} }
/* workaround for Worms Armageddon that hardcodes a /desktop option with quotes */ /* workaround for Worms Armageddon that hardcodes a /desktop option with quotes */
else if (strncmpW(p, arg_desktop_quotes, sizeof(arg_desktop_quotes)/sizeof(WCHAR))==0) else if (strncmpW(p, arg_desktop_quotes, ARRAY_SIZE( arg_desktop_quotes ))==0)
{ {
p += sizeof(arg_desktop_quotes)/sizeof(WCHAR); p += ARRAY_SIZE( arg_desktop_quotes );
manage_desktop( p ); /* the rest of the command line is handled by desktop mode */ manage_desktop( p ); /* the rest of the command line is handled by desktop mode */
} }
else else
......
...@@ -405,13 +405,13 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid ) ...@@ -405,13 +405,13 @@ static BOOL modify_icon( struct icon *icon, NOTIFYICONDATAW *nid )
} }
if (nid->uFlags & NIF_TIP) if (nid->uFlags & NIF_TIP)
{ {
lstrcpynW(icon->tiptext, nid->szTip, sizeof(icon->tiptext)/sizeof(WCHAR)); lstrcpynW( icon->tiptext, nid->szTip, ARRAY_SIZE( icon->tiptext ));
if (icon->display != -1) update_tooltip_text(icon); if (icon->display != -1) update_tooltip_text(icon);
} }
if (nid->uFlags & NIF_INFO && nid->cbSize >= NOTIFYICONDATAA_V2_SIZE) if (nid->uFlags & NIF_INFO && nid->cbSize >= NOTIFYICONDATAA_V2_SIZE)
{ {
lstrcpynW( icon->info_text, nid->szInfo, sizeof(icon->info_text)/sizeof(WCHAR) ); lstrcpynW( icon->info_text, nid->szInfo, ARRAY_SIZE( icon->info_text ));
lstrcpynW( icon->info_title, nid->szInfoTitle, sizeof(icon->info_title)/sizeof(WCHAR) ); lstrcpynW( icon->info_title, nid->szInfoTitle, ARRAY_SIZE( icon->info_title ));
icon->info_flags = nid->dwInfoFlags; icon->info_flags = nid->dwInfoFlags;
icon->info_timeout = max(min(nid->u.uTimeout, BALLOON_SHOW_MAX_TIMEOUT), BALLOON_SHOW_MIN_TIMEOUT); icon->info_timeout = max(min(nid->u.uTimeout, BALLOON_SHOW_MAX_TIMEOUT), BALLOON_SHOW_MIN_TIMEOUT);
icon->info_icon = nid->hBalloonIcon; icon->info_icon = nid->hBalloonIcon;
...@@ -933,7 +933,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab ...@@ -933,7 +933,7 @@ void initialize_systray( HMODULE graphics_driver, BOOL using_root, BOOL arg_enab
return; return;
} }
LoadStringW( NULL, IDS_START_LABEL, start_label, sizeof(start_label)/sizeof(WCHAR) ); LoadStringW( NULL, IDS_START_LABEL, start_label, ARRAY_SIZE( start_label ));
add_taskbar_button( 0 ); add_taskbar_button( 0 );
......
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