shlwapi: Avoid ARRAY_SIZE-like macros.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-09-15 00:10:30 +02:00 committed by Alexandre Julliard
parent 15b17a0e4b
commit 923cb0a957
3 changed files with 8 additions and 11 deletions

View File

@ -4217,8 +4217,6 @@ HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR lpszFile, LPWSTR lpszPath, DWORD
{ {
static const WCHAR szWeb[] = {'\\','W','e','b','\\','\0'}; static const WCHAR szWeb[] = {'\\','W','e','b','\\','\0'};
static const WCHAR szWebMui[] = {'m','u','i','\\','%','0','4','x','\\','\0'}; static const WCHAR szWebMui[] = {'m','u','i','\\','%','0','4','x','\\','\0'};
#define szWebLen (sizeof(szWeb)/sizeof(WCHAR))
#define szWebMuiLen ((sizeof(szWebMui)+1)/sizeof(WCHAR))
DWORD dwLen, dwFileLen; DWORD dwLen, dwFileLen;
LANGID lidSystem, lidUser; LANGID lidSystem, lidUser;
@ -4231,11 +4229,11 @@ HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR lpszFile, LPWSTR lpszPath, DWORD
dwFileLen = strlenW(lpszFile); dwFileLen = strlenW(lpszFile);
if (dwLen + dwFileLen + szWebLen >= dwPathLen) if (dwLen + dwFileLen + ARRAY_SIZE(szWeb) >= dwPathLen)
return E_FAIL; /* lpszPath too short */ return E_FAIL; /* lpszPath too short */
strcpyW(lpszPath+dwLen, szWeb); strcpyW(lpszPath+dwLen, szWeb);
dwLen += szWebLen; dwLen += ARRAY_SIZE(szWeb);
dwPathLen = dwPathLen - dwLen; /* Remaining space */ dwPathLen = dwPathLen - dwLen; /* Remaining space */
lidSystem = GetSystemDefaultUILanguage(); lidSystem = GetSystemDefaultUILanguage();
@ -4243,11 +4241,11 @@ HRESULT WINAPI SHGetWebFolderFilePathW(LPCWSTR lpszFile, LPWSTR lpszPath, DWORD
if (lidSystem != lidUser) if (lidSystem != lidUser)
{ {
if (dwFileLen + szWebMuiLen < dwPathLen) if (dwFileLen + ARRAY_SIZE(szWebMui) < dwPathLen)
{ {
/* Use localised content in the users UI language if present */ /* Use localised content in the users UI language if present */
wsprintfW(lpszPath + dwLen, szWebMui, lidUser); wsprintfW(lpszPath + dwLen, szWebMui, lidUser);
strcpyW(lpszPath + dwLen + szWebMuiLen, lpszFile); strcpyW(lpszPath + dwLen + ARRAY_SIZE(szWebMui), lpszFile);
if (PathFileExistsW(lpszPath)) if (PathFileExistsW(lpszPath))
return S_OK; return S_OK;
} }

View File

@ -2426,19 +2426,18 @@ HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID guid, LPCWSTR lpszValue, BOOL bUseHKCU,
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\', 'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\',
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
'E','x','p','l','o','r','e','r','\\','C','L','S','I','D','\\' }; 'E','x','p','l','o','r','e','r','\\','C','L','S','I','D','\\' };
#define szClassIdKeyLen (sizeof(szClassIdKey)/sizeof(WCHAR))
WCHAR szKey[MAX_PATH]; WCHAR szKey[MAX_PATH];
DWORD dwRet; DWORD dwRet;
HKEY hkey; HKEY hkey;
/* Create the key string */ /* Create the key string */
memcpy(szKey, szClassIdKey, sizeof(szClassIdKey)); memcpy(szKey, szClassIdKey, sizeof(szClassIdKey));
SHStringFromGUIDW(guid, szKey + szClassIdKeyLen, 39); /* Append guid */ SHStringFromGUIDW(guid, szKey + ARRAY_SIZE(szClassIdKey), 39); /* Append guid */
if(lpszValue) if(lpszValue)
{ {
szKey[szClassIdKeyLen + 39] = '\\'; szKey[ARRAY_SIZE(szClassIdKey) + 39] = '\\';
strcpyW(szKey + szClassIdKeyLen + 40, lpszValue); /* Append value name */ strcpyW(szKey + ARRAY_SIZE(szClassIdKey) + 40, lpszValue); /* Append value name */
} }
hkey = bUseHKCU ? HKEY_CURRENT_USER : HKEY_CLASSES_ROOT; hkey = bUseHKCU ? HKEY_CURRENT_USER : HKEY_CLASSES_ROOT;

View File

@ -2570,7 +2570,7 @@ HRESULT WINAPI MLBuildResURLW(LPCWSTR lpszLibName, HMODULE hMod, DWORD dwFlags,
LPCWSTR lpszRes, LPWSTR lpszDest, DWORD dwDestLen) LPCWSTR lpszRes, LPWSTR lpszDest, DWORD dwDestLen)
{ {
static const WCHAR szRes[] = { 'r','e','s',':','/','/','\0' }; static const WCHAR szRes[] = { 'r','e','s',':','/','/','\0' };
#define szResLen ((sizeof(szRes) - sizeof(WCHAR))/sizeof(WCHAR)) static const unsigned int szResLen = ARRAY_SIZE(szRes) - 1;
HRESULT hRet = E_FAIL; HRESULT hRet = E_FAIL;
TRACE("(%s,%p,0x%08x,%s,%p,%d)\n", debugstr_w(lpszLibName), hMod, dwFlags, TRACE("(%s,%p,0x%08x,%s,%p,%d)\n", debugstr_w(lpszLibName), hMod, dwFlags,