Commit 612a1941 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32: Use ARRAY_SIZE macro.

parent ad698fc7
......@@ -676,7 +676,7 @@ get_friendly_name_fail:
case ASSOCSTR_SHELLEXTENSION:
{
static const WCHAR shellexW[] = {'S','h','e','l','l','E','x','\\',0};
WCHAR keypath[sizeof(shellexW) / sizeof(shellexW[0]) + 39], guid[39];
WCHAR keypath[ARRAY_SIZE(shellexW) + 39], guid[39];
CLSID clsid;
HKEY hkey;
DWORD size;
......
......@@ -123,7 +123,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
{
int len;
GetWindowTextW( hwnd, hwndText, sizeof(hwndText)/sizeof(WCHAR));
GetWindowTextW(hwnd, hwndText, ARRAY_SIZE(hwndText));
switch(wParam) {
case VK_RETURN:
......
......@@ -82,8 +82,6 @@ static const LAYOUT_INFO g_layout_info[] =
{IDCANCEL, BF_BOTTOM|BF_RIGHT}
};
#define LAYOUT_INFO_COUNT (sizeof(g_layout_info)/sizeof(g_layout_info[0]))
#define SUPPORTEDFLAGS (BIF_STATUSTEXT | \
BIF_BROWSEFORCOMPUTER | \
BIF_RETURNFSANCESTORS | \
......@@ -667,7 +665,7 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info )
{
RECT rcWnd;
info->layout = LayoutInit(hWnd, g_layout_info, LAYOUT_INFO_COUNT);
info->layout = LayoutInit(hWnd, g_layout_info, ARRAY_SIZE(g_layout_info));
/* TODO: Windows allows shrinking the windows a bit */
GetWindowRect(hWnd, &rcWnd);
......@@ -1012,7 +1010,7 @@ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
case WM_SIZE:
if (info->layout) /* new style dialogs */
LayoutUpdate(hWnd, info->layout, g_layout_info, LAYOUT_INFO_COUNT);
LayoutUpdate(hWnd, info->layout, g_layout_info, ARRAY_SIZE(g_layout_info));
return 0;
case BFFM_SETSTATUSTEXTA:
......
......@@ -187,7 +187,7 @@ BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LP
return FALSE;
ret = FALSE;
if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, sizeof(sTempVerb)/sizeof(sTempVerb[0])))
if (HCR_GetDefaultVerbW(hkeyClass, szVerb, sTempVerb, ARRAY_SIZE(sTempVerb)))
{
WCHAR sTemp[MAX_PATH];
lstrcpyW(sTemp, swShell);
......
......@@ -124,10 +124,10 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
applet->info[i].icon = LoadIconW(applet->hModule, MAKEINTRESOURCEW(info.idIcon));
if (info.idName != CPL_DYNAMIC_RES)
LoadStringW(applet->hModule, info.idName,
applet->info[i].name, sizeof(applet->info[i].name) / sizeof(WCHAR));
applet->info[i].name, ARRAY_SIZE(applet->info[i].name));
if (info.idInfo != CPL_DYNAMIC_RES)
LoadStringW(applet->hModule, info.idInfo,
applet->info[i].info, sizeof(applet->info[i].info) / sizeof(WCHAR));
applet->info[i].info, ARRAY_SIZE(applet->info[i].info));
/* some broken control panels seem to return incorrect values in CPL_INQUIRE,
but proper data in CPL_NEWINQUIRE. if we get an empty string or a null
......@@ -159,18 +159,16 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
memcpy(applet->info[i].info, newinfo.szInfo, sizeof(newinfo.szInfo));
memcpy(applet->info[i].helpfile, newinfo.szHelpFile, sizeof(newinfo.szHelpFile));
} else {
NEWCPLINFOA *infoA = (NEWCPLINFOA *)&newinfo;
if (info.idName == CPL_DYNAMIC_RES)
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szName,
sizeof(((LPNEWCPLINFOA)&newinfo)->szName) / sizeof(CHAR),
applet->info[i].name, sizeof(applet->info[i].name) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, infoA->szName, ARRAY_SIZE(infoA->szName),
applet->info[i].name, ARRAY_SIZE(applet->info[i].name));
if (info.idInfo == CPL_DYNAMIC_RES)
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szInfo,
sizeof(((LPNEWCPLINFOA)&newinfo)->szInfo) / sizeof(CHAR),
applet->info[i].info, sizeof(applet->info[i].info) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szHelpFile,
sizeof(((LPNEWCPLINFOA)&newinfo)->szHelpFile) / sizeof(CHAR),
applet->info[i].helpfile,
sizeof(applet->info[i].helpfile) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, infoA->szInfo, ARRAY_SIZE(infoA->szInfo),
applet->info[i].info, ARRAY_SIZE(applet->info[i].info));
MultiByteToWideChar(CP_ACP, 0, infoA->szHelpFile, ARRAY_SIZE(infoA->szHelpFile),
applet->info[i].helpfile, ARRAY_SIZE(applet->info[i].helpfile));
}
}
}
......@@ -229,7 +227,7 @@ static BOOL Control_CreateListView (CPanel *panel)
/* Name column */
lvc.iSubItem = 0;
lvc.cx = (ws.right - ws.left) / 3;
LoadStringW(shell32_hInstance, IDS_CPANEL_NAME, buf, sizeof(buf) / sizeof(buf[0]));
LoadStringW(shell32_hInstance, IDS_CPANEL_NAME, buf, ARRAY_SIZE(buf));
if (ListView_InsertColumnW(panel->hWndListView, 0, &lvc) == -1)
return FALSE;
......@@ -237,8 +235,7 @@ static BOOL Control_CreateListView (CPanel *panel)
/* Description column */
lvc.iSubItem = 1;
lvc.cx = ((ws.right - ws.left) / 3) * 2;
LoadStringW(shell32_hInstance, IDS_CPANEL_DESCRIPTION, buf, sizeof(buf) /
sizeof(buf[0]));
LoadStringW(shell32_hInstance, IDS_CPANEL_DESCRIPTION, buf, ARRAY_SIZE(buf));
if (ListView_InsertColumnW(panel->hWndListView, 1, &lvc) == -1)
return FALSE;
......@@ -300,7 +297,7 @@ static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW* cs)
mii.cbSize = sizeof(MENUITEMINFOW);
mii.fMask = MIIM_ID | MIIM_STRING | MIIM_DATA;
mii.dwTypeData = applet->info[i].name;
mii.cch = sizeof(applet->info[i].name) / sizeof(WCHAR);
mii.cch = ARRAY_SIZE(applet->info[i].name);
mii.wID = IDM_CPANEL_APPLET_BASE + menucount;
mii.dwItemData = (ULONG_PTR)item;
......@@ -475,8 +472,7 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,
HICON icon = LoadImageW(shell32_hInstance, MAKEINTRESOURCEW(IDI_SHELL_CONTROL_PANEL),
IMAGE_ICON, 48, 48, LR_SHARED);
LoadStringW(shell32_hInstance, IDS_CPANEL_TITLE, appName,
sizeof(appName) / sizeof(appName[0]));
LoadStringW(shell32_hInstance, IDS_CPANEL_TITLE, appName, ARRAY_SIZE(appName));
ShellAboutW(hWnd, appName, NULL, icon);
return 0;
......@@ -616,7 +612,7 @@ static void Control_DoInterface(CPanel* panel, HWND hWnd, HINSTANCE hInst)
MSG msg;
WCHAR appName[MAX_STRING_LEN];
LoadStringW(shell32_hInstance, IDS_CPANEL_TITLE, appName, sizeof(appName) / sizeof(appName[0]));
LoadStringW(shell32_hInstance, IDS_CPANEL_TITLE, appName, ARRAY_SIZE(appName));
wc.cbSize = sizeof(wc);
wc.style = CS_HREDRAW|CS_VREDRAW;
......
......@@ -50,7 +50,7 @@ static DWORD dwDDEInst;
static const char *debugstr_hsz( HSZ hsz )
{
WCHAR buffer[256];
if (!DdeQueryStringW( dwDDEInst, hsz, buffer, sizeof(buffer)/sizeof(WCHAR), CP_WINUNICODE ))
if (!DdeQueryStringW( dwDDEInst, hsz, buffer, ARRAY_SIZE(buffer), CP_WINUNICODE ))
return "<unknown>";
return debugstr_w( buffer );
}
......
......@@ -499,8 +499,8 @@ static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId)
WCHAR Prompt[256];
WCHAR Title[256];
LoadStringW(shell32_hInstance, PromptId, Prompt, sizeof(Prompt) / sizeof(WCHAR));
LoadStringW(shell32_hInstance, TitleId, Title, sizeof(Title) / sizeof(WCHAR));
LoadStringW(shell32_hInstance, PromptId, Prompt, ARRAY_SIZE(Prompt));
LoadStringW(shell32_hInstance, TitleId, Title, ARRAY_SIZE(Title));
return MessageBoxW(hWndOwner, Prompt, Title, MB_YESNO|MB_ICONQUESTION) == IDYES;
}
......
......@@ -200,13 +200,10 @@ static void DoRestore(RecycleBinMenu *This)
WCHAR message[100];
WCHAR caption[50];
if(_ILIsFolder(ILFindLastID(dest_pidl)))
LoadStringW(shell32_hInstance,IDS_RECYCLEBIN_OVERWRITEFOLDER,
message,sizeof(message)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_OVERWRITEFOLDER, message, ARRAY_SIZE(message));
else
LoadStringW(shell32_hInstance,IDS_RECYCLEBIN_OVERWRITEFILE,
message,sizeof(message)/sizeof(WCHAR));
LoadStringW(shell32_hInstance,IDS_RECYCLEBIN_OVERWRITE_CAPTION,
caption,sizeof(caption)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_OVERWRITEFILE, message, ARRAY_SIZE(message));
LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_OVERWRITE_CAPTION, caption, ARRAY_SIZE(caption));
if(ShellMessageBoxW(shell32_hInstance,GetActiveWindow(),message,
caption,MB_YESNO|MB_ICONEXCLAMATION,
......@@ -788,22 +785,19 @@ static HRESULT erase_items(HWND parent,const LPCITEMIDLIST * apidl, UINT cidl, B
WIN32_FIND_DATAW data;
TRASH_UnpackItemID(&((*apidl)->mkid),&data);
lstrcpynW(arg,data.cFileName,MAX_PATH);
LoadStringW(shell32_hInstance,IDS_RECYCLEBIN_ERASEITEM,message,
sizeof(message)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_ERASEITEM, message, ARRAY_SIZE(message));
break;
}
default:
{
static const WCHAR format[]={'%','u','\0'};
LoadStringW(shell32_hInstance,IDS_RECYCLEBIN_ERASEMULTIPLE,
message,sizeof(message)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_ERASEMULTIPLE, message, ARRAY_SIZE(message));
sprintfW(arg,format,cidl);
break;
}
}
LoadStringW(shell32_hInstance,IDS_RECYCLEBIN_ERASE_CAPTION,caption,
sizeof(caption)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_ERASE_CAPTION, caption, ARRAY_SIZE(caption));
if(ShellMessageBoxW(shell32_hInstance,parent,message,caption,
MB_YESNO|MB_ICONEXCLAMATION,arg)!=IDYES)
return ret;
......
......@@ -1075,15 +1075,15 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
if (info)
{
SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
GetWindowTextW( hWnd, template, sizeof(template)/sizeof(WCHAR) );
GetWindowTextW( hWnd, template, ARRAY_SIZE(template) );
sprintfW( buffer, template, info->szApp );
SetWindowTextW( hWnd, buffer );
SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT1), info->szApp );
SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2), info->szOtherStuff );
GetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3),
template, sizeof(template)/sizeof(WCHAR) );
template, ARRAY_SIZE(template) );
MultiByteToWideChar( CP_UTF8, 0, wine_get_build_id(), -1,
version, sizeof(version)/sizeof(WCHAR) );
version, ARRAY_SIZE(template) );
sprintfW( buffer, template, version );
SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), buffer );
hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX);
......
......@@ -39,6 +39,8 @@
#include "wine/unicode.h"
#include "wine/list.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/*******************************************
* global SHELL32.DLL variables
*/
......
......@@ -155,7 +155,7 @@ void release_typelib(void)
if (!typelib)
return;
for (i = 0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
for (i = 0; i < ARRAY_SIZE(typeinfos); i++)
if (typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
......
......@@ -307,7 +307,7 @@ BOOL run_winemenubuilder( const WCHAR *args )
WCHAR app[MAX_PATH];
void *redir;
GetSystemDirectoryW( app, MAX_PATH - sizeof(menubuilder)/sizeof(WCHAR) );
GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE(menubuilder) );
strcatW( app, menubuilder );
len = (strlenW( app ) + strlenW( args ) + 1) * sizeof(WCHAR);
......@@ -588,7 +588,7 @@ static HRESULT Stream_ReadChunk( IStream* stm, LPVOID *data )
static BOOL Stream_LoadVolume( LOCAL_VOLUME_INFO *vol, volume_info *volume )
{
const int label_sz = sizeof volume->label/sizeof volume->label[0];
const int label_sz = ARRAY_SIZE(volume->label);
LPSTR label;
int len;
......@@ -782,14 +782,11 @@ static HRESULT WINAPI IPersistStream_fnLoad(
if (TRACE_ON(shell))
{
WCHAR sTemp[MAX_PATH];
GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE, &This->time1,
NULL, sTemp, sizeof(sTemp)/sizeof(*sTemp));
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &This->time1, NULL, sTemp, ARRAY_SIZE(sTemp));
TRACE("-- time1: %s\n", debugstr_w(sTemp) );
GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE, &This->time2,
NULL, sTemp, sizeof(sTemp)/sizeof(*sTemp));
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &This->time2, NULL, sTemp, ARRAY_SIZE(sTemp));
TRACE("-- time2: %s\n", debugstr_w(sTemp) );
GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE, &This->time3,
NULL, sTemp, sizeof(sTemp)/sizeof(*sTemp));
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &This->time3, NULL, sTemp, ARRAY_SIZE(sTemp));
TRACE("-- time3: %s\n", debugstr_w(sTemp) );
}
......
......@@ -150,7 +150,7 @@ HRESULT WINAPI SHCoCreateInstance(
}
/* we look up the dll path in the registry */
SHStringFromGUIDW(myclsid, sClassID, sizeof(sClassID)/sizeof(WCHAR));
SHStringFromGUIDW(myclsid, sClassID, ARRAY_SIZE(sClassID));
lstrcpyW(sKeyName, sCLSID);
lstrcatW(sKeyName, sClassID);
lstrcatW(sKeyName, sInProcServer32);
......@@ -258,7 +258,7 @@ DWORD WINAPI SHCLSIDFromStringA (LPCSTR clsid, CLSID *id)
{
WCHAR buffer[40];
TRACE("(%p(%s) %p)\n", clsid, clsid, id);
if (!MultiByteToWideChar( CP_ACP, 0, clsid, -1, buffer, sizeof(buffer)/sizeof(WCHAR) ))
if (!MultiByteToWideChar( CP_ACP, 0, clsid, -1, buffer, ARRAY_SIZE(buffer) ))
return CO_E_CLASSSTRING;
return CLSIDFromString( buffer, id );
}
......
......@@ -433,12 +433,12 @@ int WINAPIV ShellMessageBoxW(
hInstance,hWnd,lpText,lpCaption,uType);
if (IS_INTRESOURCE(lpCaption))
LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
LoadStringW(hInstance, LOWORD(lpCaption), szTitle, ARRAY_SIZE(szTitle));
else
pszTitle = lpCaption;
if (IS_INTRESOURCE(lpText))
LoadStringW(hInstance, LOWORD(lpText), szText, sizeof(szText)/sizeof(szText[0]));
LoadStringW(hInstance, LOWORD(lpText), szText, ARRAY_SIZE(szText));
else
pszText = lpText;
......@@ -1774,7 +1774,7 @@ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_
dwIndex = 0;
do
{
dwHandlerLen = sizeof(szHandler) / sizeof(szHandler[0]);
dwHandlerLen = ARRAY_SIZE(szHandler);
lRet = RegEnumKeyExW(hkPropSheetHandlers, dwIndex++, szHandler, &dwHandlerLen, NULL, NULL, NULL, NULL);
if (lRet != ERROR_SUCCESS)
{
......@@ -1793,7 +1793,7 @@ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_
if (SHGetValueW(hkPropSheetHandlers, szHandler, NULL, NULL, szClsidHandler, &dwClsidSize) == ERROR_SUCCESS)
{
/* Force a NULL-termination and convert the string */
szClsidHandler[(sizeof(szClsidHandler) / sizeof(szClsidHandler[0])) - 1] = 0;
szClsidHandler[ARRAY_SIZE(szClsidHandler) - 1] = 0;
lRet = SHCLSIDFromStringW(szClsidHandler, &clsid);
}
}
......
......@@ -3421,8 +3421,9 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
TRACE("0x%02x,%p\n", folder, pszPath);
if (folder >= sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]))
if (folder >= ARRAY_SIZE(CSIDL_Data))
return E_INVALIDARG;
if (!pszPath)
return E_INVALIDARG;
......@@ -3508,7 +3509,7 @@ static HRESULT _SHGetCurrentVersionPath(DWORD dwFlags, BYTE folder,
TRACE("0x%08x,0x%02x,%p\n", dwFlags, folder, pszPath);
if (folder >= sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]))
if (folder >= ARRAY_SIZE(CSIDL_Data))
return E_INVALIDARG;
if (CSIDL_Data[folder].type != CSIDL_Type_CurrVer)
return E_INVALIDARG;
......@@ -3612,7 +3613,7 @@ static HRESULT _SHGetUserProfilePath(HANDLE hToken, DWORD dwFlags, BYTE folder,
TRACE("%p,0x%08x,0x%02x,%p\n", hToken, dwFlags, folder, pszPath);
if (folder >= sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]))
if (folder >= ARRAY_SIZE(CSIDL_Data))
return E_INVALIDARG;
if (CSIDL_Data[folder].type != CSIDL_Type_User)
return E_INVALIDARG;
......@@ -3684,7 +3685,7 @@ static HRESULT _SHGetAllUsersProfilePath(DWORD dwFlags, BYTE folder,
TRACE("0x%08x,0x%02x,%p\n", dwFlags, folder, pszPath);
if (folder >= sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]))
if (folder >= ARRAY_SIZE(CSIDL_Data))
return E_INVALIDARG;
if (CSIDL_Data[folder].type != CSIDL_Type_AllUsers && CSIDL_Data[folder].type != CSIDL_Type_ProgramData)
return E_INVALIDARG;
......@@ -3997,7 +3998,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW(
if (pszPath)
*pszPath = '\0';
if (folder >= sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]))
if (folder >= ARRAY_SIZE(CSIDL_Data))
return E_INVALIDARG;
if ((SHGFP_TYPE_CURRENT != dwFlags) && (SHGFP_TYPE_DEFAULT != dwFlags))
return E_INVALIDARG;
......@@ -4293,7 +4294,7 @@ static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
}
hr = _SHRegisterFolders(hRootKey, hToken, pUserShellFolderPath,
pShellFolderPath, folders, sizeof(folders) / sizeof(folders[0]));
pShellFolderPath, folders, ARRAY_SIZE(folders));
TRACE("returning 0x%08x\n", hr);
return hr;
}
......@@ -4318,7 +4319,7 @@ static HRESULT _SHRegisterCommonShellFolders(void)
TRACE("\n");
hr = _SHRegisterFolders(HKEY_LOCAL_MACHINE, NULL, szSHUserFolders,
szSHFolders, folders, sizeof(folders) / sizeof(folders[0]));
szSHFolders, folders, ARRAY_SIZE(folders));
TRACE("returning 0x%08x\n", hr);
return hr;
}
......@@ -4411,7 +4412,7 @@ static void _SHCreateSymbolicLinks(void)
const WCHAR* MyOSXStuffW[] = { PicturesW, MoviesW, MusicW };
int acsidlMyStuff[] = { CSIDL_MYPICTURES, CSIDL_MYVIDEO, CSIDL_MYMUSIC };
static const char * const xdg_dirs[] = { "PICTURES", "VIDEOS", "MUSIC", "DOCUMENTS", "DESKTOP" };
static const unsigned int num = sizeof(xdg_dirs) / sizeof(xdg_dirs[0]);
static const unsigned int num = ARRAY_SIZE(xdg_dirs);
WCHAR wszTempPath[MAX_PATH];
char szPersonalTarget[FILENAME_MAX], *pszPersonal;
char szMyStuffTarget[FILENAME_MAX], *pszMyStuff;
......@@ -4446,7 +4447,7 @@ static void _SHCreateSymbolicLinks(void)
* 'My Videos' and 'My Music' subfolders or fail silently if
* they already exist.
*/
for (i = 0; i < sizeof(aidsMyStuff)/sizeof(*aidsMyStuff); i++)
for (i = 0; i < ARRAY_SIZE(aidsMyStuff); i++)
{
strcpy(szMyStuffTarget, szPersonalTarget);
if (_SHAppendToUnixPath(szMyStuffTarget, MAKEINTRESOURCEW(aidsMyStuff[i])))
......@@ -4486,7 +4487,7 @@ static void _SHCreateSymbolicLinks(void)
* in '%USERPROFILE%\\My Documents' or fail silently if they already exist. */
pszHome = NULL;
strcpy(szPersonalTarget, pszPersonal);
for (i = 0; i < sizeof(aidsMyStuff)/sizeof(aidsMyStuff[0]); i++) {
for (i = 0; i < ARRAY_SIZE(aidsMyStuff); i++) {
strcpy(szMyStuffTarget, szPersonalTarget);
if (_SHAppendToUnixPath(szMyStuffTarget, MAKEINTRESOURCEW(aidsMyStuff[i])))
mkdir(szMyStuffTarget, 0777);
......@@ -4494,7 +4495,7 @@ static void _SHCreateSymbolicLinks(void)
}
/* Create symbolic links for 'My Pictures', 'My Videos' and 'My Music'. */
for (i=0; i < sizeof(aidsMyStuff)/sizeof(aidsMyStuff[0]); i++)
for (i=0; i < ARRAY_SIZE(aidsMyStuff); i++)
{
/* Create the current 'My Whatever' folder and get its unix path. */
hr = SHGetFolderPathW(NULL, acsidlMyStuff[i]|CSIDL_FLAG_CREATE, NULL,
......@@ -4655,11 +4656,11 @@ static HRESULT set_folder_attributes(void)
};
unsigned int i;
WCHAR buffer[39 + (sizeof(clsidW) + sizeof(shellfolderW)) / sizeof(WCHAR)];
WCHAR buffer[39 + ARRAY_SIZE(clsidW) + ARRAY_SIZE(shellfolderW)];
LONG res;
HKEY hkey;
for (i = 0; i < sizeof(folders)/sizeof(folders[0]); i++)
for (i = 0; i < ARRAY_SIZE(folders); i++)
{
strcpyW( buffer, clsidW );
StringFromGUID2( folders[i].clsid, buffer + strlenW(buffer), 39 );
......@@ -4855,7 +4856,7 @@ HRESULT WINAPI SHGetSpecialFolderLocation(
static int csidl_from_id( const KNOWNFOLDERID *id )
{
int i;
for (i = 0; i < sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]); i++)
for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
if (IsEqualGUID( CSIDL_Data[i].id, id )) return i;
return -1;
}
......@@ -5049,7 +5050,7 @@ static HRESULT get_known_folder_registry_path(
TRACE("(%s, %s, %p)\n", debugstr_guid(rfid), debugstr_w(lpStringGuid), lpPath);
if(rfid)
StringFromGUID2(rfid, sGuid, sizeof(sGuid)/sizeof(sGuid[0]));
StringFromGUID2(rfid, sGuid, ARRAY_SIZE(sGuid));
else
lstrcpyW(sGuid, lpStringGuid);
......@@ -5178,7 +5179,7 @@ static HRESULT redirect_known_folder(
if(SUCCEEDED(hr))
{
StringFromGUID2(rfid, sGuid, sizeof(sGuid)/sizeof(sGuid[0]));
StringFromGUID2(rfid, sGuid, ARRAY_SIZE(sGuid));
hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, sGuid, 0, REG_SZ, (LPBYTE)pszTargetPath, (lstrlenW(pszTargetPath)+1)*sizeof(WCHAR)));
......@@ -5479,7 +5480,7 @@ static HRESULT get_known_folder_path_by_id(
/* if this is registry-registered known folder, get path from registry */
if(lpRegistryPath)
{
StringFromGUID2(folderId, sGuid, sizeof(sGuid)/sizeof(sGuid[0]));
StringFromGUID2(folderId, sGuid, ARRAY_SIZE(sGuid));
hr = get_known_folder_path(sGuid, lpRegistryPath, ppszPath);
}
......@@ -5709,7 +5710,7 @@ static HRESULT WINAPI foldermanager_FolderIdFromCsidl(
{
TRACE("%d, %p\n", nCsidl, pfid);
if (nCsidl >= sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]))
if (nCsidl >= ARRAY_SIZE(CSIDL_Data))
return E_INVALIDARG;
*pfid = *CSIDL_Data[nCsidl].id;
return S_OK;
......@@ -5879,7 +5880,7 @@ static HRESULT register_folder(const KNOWNFOLDERID *rfid, const KNOWNFOLDER_DEFI
if(SUCCEEDED(hr) && !IsEqualGUID(&pKFD->fidParent, &GUID_NULL))
{
WCHAR sParentGuid[39];
StringFromGUID2(&pKFD->fidParent, sParentGuid, sizeof(sParentGuid)/sizeof(sParentGuid[0]));
StringFromGUID2(&pKFD->fidParent, sParentGuid, ARRAY_SIZE(sParentGuid));
/* this known folder has parent folder */
hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, szParentFolder, 0, REG_SZ, (LPBYTE)sParentGuid, sizeof(sParentGuid)));
......@@ -5985,7 +5986,7 @@ static HRESULT foldermanager_create( void **ppv )
fm->refs = 1;
fm->num_ids = 0;
for (i = 0; i < sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]); i++)
for (i = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
{
if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL )) fm->num_ids++;
}
......@@ -5995,7 +5996,7 @@ static HRESULT foldermanager_create( void **ppv )
heap_free( fm );
return E_OUTOFMEMORY;
}
for (i = j = 0; i < sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]); i++)
for (i = j = 0; i < ARRAY_SIZE(CSIDL_Data); i++)
{
if (!IsEqualGUID( CSIDL_Data[i].id, &GUID_NULL ))
{
......@@ -6091,7 +6092,9 @@ HRESULT WINAPI SHGetKnownFolderItem(REFKNOWNFOLDERID rfid, KNOWN_FOLDER_FLAG fla
static void register_system_knownfolders(void)
{
int i;
for(i = 0; i < sizeof(CSIDL_Data) / sizeof(CSIDL_Data[0]); ++i){
for (i = 0; i < ARRAY_SIZE(CSIDL_Data); ++i)
{
const CSIDL_DATA *folder = &CSIDL_Data[i];
if(folder->pszName){
KNOWNFOLDER_DEFINITION kfd;
......
......@@ -94,8 +94,6 @@ static const shvheader desktop_header[] =
{ &FMTID_Storage, PID_STG_ATTRIBUTES, IDS_SHV_COLUMN5, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 5 },
};
#define DESKTOPSHELLVIEWCOLUMNS sizeof(desktop_header)/sizeof(shvheader)
/**************************************************************************
* ISF_Desktop_fnQueryInterface
*
......@@ -289,14 +287,14 @@ static void add_shell_namespace_extensions(IEnumIDListImpl *list, HKEY root)
static const WCHAR clsidfmtW[] = {'C','L','S','I','D','\\','%','s','\\',
'S','h','e','l','l','F','o','l','d','e','r',0};
static const WCHAR attributesW[] = {'A','t','t','r','i','b','u','t','e','s',0};
WCHAR guid[39], clsidkeyW[sizeof(clsidfmtW)/sizeof(*clsidfmtW) + 39];
WCHAR guid[39], clsidkeyW[ARRAY_SIZE(clsidfmtW) + 39];
DWORD size, i = 0;
HKEY hkey;
if (RegOpenKeyExW(root, Desktop_NameSpaceW, 0, KEY_READ, &hkey))
return;
size = sizeof(guid)/sizeof(guid[0]);
size = ARRAY_SIZE(guid);
while (!RegEnumKeyExW(hkey, i++, guid, &size, 0, NULL, NULL, NULL))
{
DWORD attributes, value_size = sizeof(attributes);
......@@ -308,7 +306,7 @@ static void add_shell_namespace_extensions(IEnumIDListImpl *list, HKEY root)
if (!(attributes & SFGAO_NONENUMERATED))
AddToEnumList(list, _ILCreateGuidFromStrW(guid));
size = sizeof(guid)/sizeof(guid[0]);
size = ARRAY_SIZE(guid);
}
RegCloseKey(hkey);
......@@ -784,8 +782,8 @@ static HRESULT WINAPI ISF_Desktop_fnGetDefaultColumnState (
TRACE ("(%p)->(%d %p)\n", This, iColumn, pcsFlags);
if (!pcsFlags || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
return E_INVALIDARG;
if (!pcsFlags || iColumn >= ARRAY_SIZE(desktop_header))
return E_INVALIDARG;
*pcsFlags = desktop_header[iColumn].pcsFlags;
......@@ -809,7 +807,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDetailsOf (IShellFolder2 * iface,
TRACE ("(%p)->(%p %i %p)\n", This, pidl, iColumn, psd);
if (!psd || iColumn >= DESKTOPSHELLVIEWCOLUMNS)
if (!psd || iColumn >= ARRAY_SIZE(desktop_header))
return E_INVALIDARG;
if (!pidl)
......@@ -846,7 +844,7 @@ static HRESULT WINAPI ISF_Desktop_fnMapColumnToSCID(IShellFolder2 *iface, UINT c
TRACE("(%p)->(%u %p)\n", This, column, scid);
if (column >= DESKTOPSHELLVIEWCOLUMNS)
if (column >= ARRAY_SIZE(desktop_header))
return E_INVALIDARG;
return shellfolder_map_column_to_scid(desktop_header, column, scid);
......
......@@ -1089,8 +1089,8 @@ ISFHelper_fnGetUniqueName (ISFHelper * iface, LPWSTR pwszName, UINT uLen)
TRACE ("(%p)(%p %u)\n", This, pwszName, uLen);
LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, sizeof(wszNewFolder)/sizeof(WCHAR));
if (uLen < sizeof(wszNewFolder)/sizeof(WCHAR) + 3)
LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, ARRAY_SIZE(wszNewFolder));
if (uLen < ARRAY_SIZE(wszNewFolder) + 3)
return E_POINTER;
lstrcpynW (pwszName, wszNewFolder, uLen);
......@@ -1180,10 +1180,8 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName,
WCHAR wszCaption[256];
/* Cannot Create folder because of permissions */
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_DENIED, wszTempText,
sizeof (wszTempText)/sizeof (wszTempText[0]));
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, wszCaption,
sizeof (wszCaption)/sizeof (wszCaption[0]));
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_DENIED, wszTempText, ARRAY_SIZE(wszTempText));
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, wszCaption, ARRAY_SIZE(wszCaption));
sprintfW (wszText, wszTempText, wszNewDir);
MessageBoxW (hwnd, wszText, wszCaption, MB_OK | MB_ICONEXCLAMATION);
}
......
......@@ -79,8 +79,6 @@ static const shvheader networkplaces_header[] =
{ NULL, 0, IDS_SHV_COLUMN9, SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT, LVCFMT_RIGHT, 10 },
};
#define NETWORKPLACESSHELLVIEWCOLUMNS sizeof(networkplaces_header)/sizeof(shvheader)
/**************************************************************************
* ISF_NetworkPlaces_Constructor
*/
......@@ -199,8 +197,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
len = strlenW(szElement);
if (len == sizeof(wszEntireNetwork)/sizeof(wszEntireNetwork[0]) &&
!strncmpiW(szElement, wszEntireNetwork, sizeof(wszEntireNetwork)/sizeof(wszEntireNetwork[0])))
if (len == ARRAY_SIZE(wszEntireNetwork) && !strncmpiW(szElement, wszEntireNetwork, ARRAY_SIZE(wszEntireNetwork)))
{
pidlTemp = _ILCreateEntireNetwork();
if (pidlTemp)
......@@ -534,7 +531,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetDefaultColumnState (
TRACE ("(%p)->(%d %p)\n", This, iColumn, pcsFlags);
if (!pcsFlags || iColumn >= NETWORKPLACESSHELLVIEWCOLUMNS)
if (!pcsFlags || iColumn >= ARRAY_SIZE(networkplaces_header))
return E_INVALIDARG;
*pcsFlags = networkplaces_header[iColumn].pcsFlags;
......@@ -567,7 +564,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnMapColumnToSCID (IShellFolder2 *iface,
TRACE("(%p)->(%u %p)\n", This, column, scid);
if (column >= NETWORKPLACESSHELLVIEWCOLUMNS)
if (column >= ARRAY_SIZE(networkplaces_header))
return E_INVALIDARG;
return shellfolder_map_column_to_scid(networkplaces_header, column, scid);
......
......@@ -1362,7 +1362,7 @@ static HRESULT WINAPI ShellFolder2_SetNameOf(IShellFolder2* iface, HWND hwnd,
return E_INVALIDARG;
/* check for invalid characters in lpcwszName. */
for (i=0; i < sizeof(awcInvalidChars)/sizeof(*awcInvalidChars); i++)
for (i=0; i < ARRAY_SIZE(awcInvalidChars); i++)
if (StrChrW(lpcwszName, awcInvalidChars[i]))
return HRESULT_FROM_WIN32(ERROR_CANCELLED);
......@@ -1862,9 +1862,9 @@ static HRESULT WINAPI SFHelper_GetUniqueName(ISFHelper* iface, LPWSTR pwszName,
TRACE("(%p)->(%p %u)\n", This, pwszName, uLen);
LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, sizeof(wszNewFolder)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, IDS_NEWFOLDER, wszNewFolder, ARRAY_SIZE(wszNewFolder));
if (uLen < sizeof(wszNewFolder)/sizeof(WCHAR)+3)
if (uLen < ARRAY_SIZE(wszNewFolder) + 3)
return E_INVALIDARG;
hr = IShellFolder2_EnumObjects(&This->IShellFolder2_iface, 0,
......@@ -1913,9 +1913,9 @@ static HRESULT WINAPI SFHelper_AddFolder(ISFHelper* iface, HWND hwnd, LPCWSTR pw
char szMessage[256 + FILENAME_MAX];
char szCaption[256];
LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_DENIED, szCaption, sizeof(szCaption));
LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_DENIED, szCaption, ARRAY_SIZE(szCaption));
sprintf(szMessage, szCaption, szNewDir);
LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_CAPTION, szCaption, sizeof(szCaption));
LoadStringA(shell32_hInstance, IDS_CREATEFOLDER_CAPTION, szCaption, ARRAY_SIZE(szCaption));
MessageBoxA(hwnd, szMessage, szCaption, MB_OK | MB_ICONEXCLAMATION);
return E_FAIL;
......
......@@ -158,7 +158,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
if (!done || (*fmt == '1'))
{
/*FIXME Is the call to SearchPathW() really needed? We already have separated out the parameter string in args. */
if (SearchPathW(NULL, lpFile, wszExe, sizeof(xlpFile)/sizeof(WCHAR), xlpFile, NULL))
if (SearchPathW(NULL, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL))
cmd = xlpFile;
else
cmd = lpFile;
......@@ -202,7 +202,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
HGLOBAL hmem = SHAllocShared(pidl, ILGetSize(pidl), 0);
pv = SHLockShared(hmem, 0);
chars = sprintfW(buf, wszILPtr, pv);
if (chars >= sizeof(buf)/sizeof(WCHAR))
if (chars >= ARRAY_SIZE(buf))
ERR("pidl format buffer too small!\n");
used += chars;
if (used < len)
......@@ -502,7 +502,7 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn
if (RegOpenKeyExW(HKEY_CLASSES_ROOT, classname, 0, 0x02000000, &hkeyClass))
return SE_ERR_NOASSOC;
if (!HCR_GetDefaultVerbW(hkeyClass, lpVerb, verb, sizeof(verb)/sizeof(verb[0])))
if (!HCR_GetDefaultVerbW(hkeyClass, lpVerb, verb, ARRAY_SIZE(verb)))
return SE_ERR_NOASSOC;
RegCloseKey(hkeyClass);
......@@ -603,13 +603,13 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
return 33;
}
if (SearchPathW(lpPath, lpFile, wszExe, sizeof(xlpFile)/sizeof(WCHAR), xlpFile, NULL))
if (SearchPathW(lpPath, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL))
{
TRACE("SearchPathW returned non-zero\n");
lpFile = xlpFile;
/* The file was found in the application-supplied default directory (or the system search path) */
}
else if (lpPath && SearchPathW(NULL, lpFile, wszExe, sizeof(xlpFile)/sizeof(WCHAR), xlpFile, NULL))
else if (lpPath && SearchPathW(NULL, lpFile, wszExe, ARRAY_SIZE(xlpFile), xlpFile, NULL))
{
TRACE("SearchPathW returned non-zero\n");
lpFile = xlpFile;
......@@ -652,7 +652,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
/* See if it's a program - if GetProfileString fails, we skip this
* section. Actually, if GetProfileString fails, we've probably
* got a lot more to worry about than running a program... */
if (GetProfileStringW(wWindows, wPrograms, wExtensions, wBuffer, sizeof(wBuffer)/sizeof(WCHAR)) > 0)
if (GetProfileStringW(wWindows, wPrograms, wExtensions, wBuffer, ARRAY_SIZE(wBuffer)) > 0)
{
CharLowerW(wBuffer);
tok = wBuffer;
......@@ -684,7 +684,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
&classnamelen) == ERROR_SUCCESS)
{
classnamelen /= sizeof(WCHAR);
if (classnamelen == sizeof(classname)/sizeof(WCHAR))
if (classnamelen == ARRAY_SIZE(classname))
classnamelen--;
classname[classnamelen] = '\0';
TRACE("File type: %s\n", debugstr_w(classname));
......@@ -734,7 +734,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
/* Toss the leading dot */
extension++;
if (GetProfileStringW(wExtensions, extension, wszEmpty, command, sizeof(command)/sizeof(WCHAR)) > 0)
if (GetProfileStringW(wExtensions, extension, wszEmpty, command, ARRAY_SIZE(command)) > 0)
{
if (strlenW(command) != 0)
{
......
......@@ -288,12 +288,13 @@ static BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir, FI
if (!SHELL_ConfirmIDs(nKindOfDialog, &ids)) return FALSE;
LoadStringW(shell32_hInstance, ids.caption_resource_id, szCaption, sizeof(szCaption)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, ids.text_resource_id, szText, sizeof(szText)/sizeof(WCHAR));
LoadStringW(shell32_hInstance, ids.caption_resource_id, szCaption, ARRAY_SIZE(szCaption));
LoadStringW(shell32_hInstance, ids.text_resource_id, szText, ARRAY_SIZE(szText));
args[0] = (DWORD_PTR)szDir;
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
szText, 0, 0, szBuffer, ARRAY_SIZE(szBuffer), (__ms_va_list*)args);
args[0] = (DWORD_PTR)szDir;
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
szText, 0, 0, szBuffer, sizeof(szBuffer)/sizeof(szBuffer[0]), (__ms_va_list*)args);
hIcon = LoadIconW(ids.hIconInstance, (LPWSTR)MAKEINTRESOURCE(ids.icon_resource_id));
ret = SHELL_ConfirmMsgBox(hWnd, szBuffer, szCaption, hIcon, op && op->bManyItems);
......
......@@ -905,7 +905,7 @@ UINT WINAPI Shell_MergeMenus (HMENU hmDst, HMENU hmSrc, UINT uInsert, UINT uIDAd
miiSrc.fType = MFT_STRING;
miiSrc.dwTypeData = szName;
miiSrc.dwItemData = 0;
miiSrc.cch = sizeof(szName)/sizeof(WCHAR);
miiSrc.cch = ARRAY_SIZE(szName);
if (!GetMenuItemInfoW(hmSrc, nItem, TRUE, &miiSrc))
{
......
......@@ -426,7 +426,7 @@ static void ShellView_InitList(IShellViewImpl *This)
lvColumn.fmt = sd.fmt;
lvColumn.cx = MulDiv(sd.cxChar, tm.tmAveCharWidth * 3, 2); /* chars->pixel */
StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
StrRetToStrNW(nameW, ARRAY_SIZE(nameW), &sd.str, NULL);
SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, This->columns, (LPARAM)&lvColumn);
}
......
......@@ -30,6 +30,7 @@
#include "winnls.h"
#include "winuser.h"
#include "shellapi.h"
#include "shell32_main.h"
#include "wine/debug.h"
#include "wine/heap.h"
......@@ -94,7 +95,7 @@ BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid)
/* szTip */
if (pnid->uFlags & NIF_TIP)
MultiByteToWideChar(CP_ACP, 0, pnid->szTip, -1, nidW.szTip, sizeof(nidW.szTip)/sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pnid->szTip, -1, nidW.szTip, ARRAY_SIZE(nidW.szTip));
if (cbSize >= NOTIFYICONDATAA_V2_SIZE)
{
......@@ -104,8 +105,8 @@ BOOL WINAPI Shell_NotifyIconA(DWORD dwMessage, PNOTIFYICONDATAA pnid)
/* szInfo, szInfoTitle */
if (pnid->uFlags & NIF_INFO)
{
MultiByteToWideChar(CP_ACP, 0, pnid->szInfo, -1, nidW.szInfo, sizeof(nidW.szInfo)/sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pnid->szInfoTitle, -1, nidW.szInfoTitle, sizeof(nidW.szInfoTitle)/sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pnid->szInfo, -1, nidW.szInfo, ARRAY_SIZE(nidW.szInfo));
MultiByteToWideChar(CP_ACP, 0, pnid->szInfoTitle, -1, nidW.szInfoTitle, ARRAY_SIZE(nidW.szInfoTitle));
}
nidW.u.uTimeout = pnid->u.uTimeout;
......@@ -228,8 +229,8 @@ noicon:
}
if (data->uFlags & NIF_INFO)
{
lstrcpynW( data->szInfo, nid->szInfo, sizeof(data->szInfo)/sizeof(WCHAR) );
lstrcpynW( data->szInfoTitle, nid->szInfoTitle, sizeof(data->szInfoTitle)/sizeof(WCHAR) );
lstrcpynW( data->szInfo, nid->szInfo, ARRAY_SIZE(data->szInfo) );
lstrcpynW( data->szInfoTitle, nid->szInfoTitle, ARRAY_SIZE(data->szInfoTitle));
data->u.uTimeout = nid->u.uTimeout;
data->dwInfoFlags = nid->dwInfoFlags;
}
......
......@@ -99,10 +99,8 @@ static const std_path paths[] = {
{"XDG_CACHE_HOME", "$HOME/.cache"}
};
#define PATHS_COUNT (sizeof(paths)/sizeof(paths[0]))
/* will be filled with paths as they are computed */
static const char *path_values[PATHS_COUNT] = {
static const char *path_values[ARRAY_SIZE(paths)] = {
NULL,
NULL,
NULL,
......@@ -161,7 +159,7 @@ static char *load_path(int path_id)
*/
static const char *XDG_GetPath(int path_id)
{
if (path_id >= PATHS_COUNT || path_id < 0)
if (path_id >= ARRAY_SIZE(paths) || path_id < 0)
{
ERR("Invalid path_id %d\n", path_id);
return NULL;
......
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