shlwapi: 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:
parent
923cb0a957
commit
9713e68a55
|
@ -276,7 +276,7 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF cfFlags, ASSOCSTR str, LPCSTR pszAssoc,
|
||||||
lpszReturnW = HeapAlloc(GetProcessHeap(), 0,
|
lpszReturnW = HeapAlloc(GetProcessHeap(), 0,
|
||||||
(dwLenOut + 1) * sizeof(WCHAR));
|
(dwLenOut + 1) * sizeof(WCHAR));
|
||||||
else
|
else
|
||||||
dwLenOut = sizeof(szReturnW) / sizeof(szReturnW[0]);
|
dwLenOut = ARRAY_SIZE(szReturnW);
|
||||||
|
|
||||||
if (!lpszReturnW)
|
if (!lpszReturnW)
|
||||||
hRet = E_OUTOFMEMORY;
|
hRet = E_OUTOFMEMORY;
|
||||||
|
|
|
@ -2440,7 +2440,7 @@ HMODULE WINAPI SHPinDllOfCLSID(REFIID refiid)
|
||||||
CHAR value[MAX_PATH], string[MAX_PATH];
|
CHAR value[MAX_PATH], string[MAX_PATH];
|
||||||
|
|
||||||
strcpy(string, "CLSID\\");
|
strcpy(string, "CLSID\\");
|
||||||
SHStringFromGUIDA(refiid, string + 6, sizeof(string)/sizeof(char) - 6);
|
SHStringFromGUIDA(refiid, string + 6, ARRAY_SIZE(string) - 6);
|
||||||
strcat(string, "\\InProcServer32");
|
strcat(string, "\\InProcServer32");
|
||||||
|
|
||||||
count = MAX_PATH;
|
count = MAX_PATH;
|
||||||
|
@ -2778,7 +2778,7 @@ VOID WINAPI SHWeakReleaseInterface(IUnknown *lpDest, IUnknown **lppUnknown)
|
||||||
BOOL WINAPI GUIDFromStringA(LPCSTR idstr, CLSID *id)
|
BOOL WINAPI GUIDFromStringA(LPCSTR idstr, CLSID *id)
|
||||||
{
|
{
|
||||||
WCHAR wClsid[40];
|
WCHAR wClsid[40];
|
||||||
MultiByteToWideChar(CP_ACP, 0, idstr, -1, wClsid, sizeof(wClsid)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP, 0, idstr, -1, wClsid, ARRAY_SIZE(wClsid));
|
||||||
return SUCCEEDED(CLSIDFromString(wClsid, id));
|
return SUCCEEDED(CLSIDFromString(wClsid, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3600,8 +3600,8 @@ HMODULE WINAPI MLLoadLibraryW(LPCWSTR new_mod, HMODULE inst_hwnd, DWORD dwCrossC
|
||||||
DWORD len;
|
DWORD len;
|
||||||
|
|
||||||
FIXME("(%s,%p,%d) semi-stub!\n", debugstr_w(new_mod), inst_hwnd, dwCrossCodePage);
|
FIXME("(%s,%p,%d) semi-stub!\n", debugstr_w(new_mod), inst_hwnd, dwCrossCodePage);
|
||||||
len = GetModuleFileNameW(inst_hwnd, mod_path, sizeof(mod_path) / sizeof(WCHAR));
|
len = GetModuleFileNameW(inst_hwnd, mod_path, ARRAY_SIZE(mod_path));
|
||||||
if (!len || len >= sizeof(mod_path) / sizeof(WCHAR)) return NULL;
|
if (!len || len >= ARRAY_SIZE(mod_path)) return NULL;
|
||||||
|
|
||||||
ptr = strrchrW(mod_path, '\\');
|
ptr = strrchrW(mod_path, '\\');
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
|
@ -4755,7 +4755,7 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText,
|
||||||
TRACE("(%p,%p,%p,%p,%08x)\n", hInstance, hWnd, lpText, lpCaption, uType);
|
TRACE("(%p,%p,%p,%p,%08x)\n", hInstance, hWnd, lpText, lpCaption, uType);
|
||||||
|
|
||||||
if (IS_INTRESOURCE(lpCaption))
|
if (IS_INTRESOURCE(lpCaption))
|
||||||
LoadStringW(hInstance, LOWORD(lpCaption), szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
|
LoadStringW(hInstance, LOWORD(lpCaption), szTitle, ARRAY_SIZE(szTitle));
|
||||||
else
|
else
|
||||||
pszTitle = lpCaption;
|
pszTitle = lpCaption;
|
||||||
|
|
||||||
|
@ -5280,8 +5280,8 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid)
|
||||||
'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
||||||
'S','h','e','l','l','C','o','m','p','a','t','i','b','i','l','i','t','y','\\',
|
'S','h','e','l','l','C','o','m','p','a','t','i','b','i','l','i','t','y','\\',
|
||||||
'O','b','j','e','c','t','s','\\','%','s',0};
|
'O','b','j','e','c','t','s','\\','%','s',0};
|
||||||
WCHAR strW[sizeof(compatpathW)/sizeof(WCHAR) + 38 /* { CLSID } */];
|
WCHAR strW[ARRAY_SIZE(compatpathW) + 38 /* { CLSID } */];
|
||||||
DWORD ret, length = sizeof(strW)/sizeof(WCHAR);
|
DWORD ret, length = ARRAY_SIZE(strW);
|
||||||
OLECHAR *clsid_str;
|
OLECHAR *clsid_str;
|
||||||
HKEY key;
|
HKEY key;
|
||||||
INT i;
|
INT i;
|
||||||
|
@ -5311,7 +5311,7 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid)
|
||||||
|
|
||||||
/* search in table */
|
/* search in table */
|
||||||
left = 0;
|
left = 0;
|
||||||
right = sizeof(objcompat_table) / sizeof(struct objcompat_entry) - 1;
|
right = ARRAY_SIZE(objcompat_table) - 1;
|
||||||
|
|
||||||
while (right >= left) {
|
while (right >= left) {
|
||||||
x = (left + right) / 2;
|
x = (left + right) / 2;
|
||||||
|
@ -5327,7 +5327,7 @@ DWORD WINAPI SHGetObjectCompatFlags(IUnknown *pUnk, const CLSID *clsid)
|
||||||
left = x + 1;
|
left = x + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
length = sizeof(strW)/sizeof(WCHAR);
|
length = ARRAY_SIZE(strW);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -3264,7 +3264,7 @@ HRESULT WINAPI PathCreateFromUrlA(LPCSTR pszUrl, LPSTR pszPath,
|
||||||
WCHAR *pathW = bufW;
|
WCHAR *pathW = bufW;
|
||||||
UNICODE_STRING urlW;
|
UNICODE_STRING urlW;
|
||||||
HRESULT ret;
|
HRESULT ret;
|
||||||
DWORD lenW = sizeof(bufW)/sizeof(WCHAR), lenA;
|
DWORD lenW = ARRAY_SIZE(bufW), lenA;
|
||||||
|
|
||||||
if (!pszUrl || !pszPath || !pcchPath || !*pcchPath)
|
if (!pszUrl || !pszPath || !pcchPath || !*pcchPath)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -3684,7 +3684,7 @@ VOID WINAPI PathSetDlgItemPathW(HWND hDlg, int id, LPCWSTR lpszPath)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (lpszPath)
|
if (lpszPath)
|
||||||
lstrcpynW(path, lpszPath, sizeof(path) / sizeof(WCHAR));
|
lstrcpynW(path, lpszPath, ARRAY_SIZE(path));
|
||||||
else
|
else
|
||||||
path[0] = '\0';
|
path[0] = '\0';
|
||||||
|
|
||||||
|
@ -4122,7 +4122,7 @@ static void init_envvars_map(struct envvars_map *map)
|
||||||
{
|
{
|
||||||
while (map->var)
|
while (map->var)
|
||||||
{
|
{
|
||||||
map->len = ExpandEnvironmentStringsW(map->var, map->path, sizeof(map->path)/sizeof(WCHAR));
|
map->len = ExpandEnvironmentStringsW(map->var, map->path, ARRAY_SIZE(map->path));
|
||||||
/* exclude null from length */
|
/* exclude null from length */
|
||||||
if (map->len) map->len--;
|
if (map->len) map->len--;
|
||||||
map++;
|
map++;
|
||||||
|
@ -4139,12 +4139,12 @@ BOOL WINAPI PathUnExpandEnvStringsW(LPCWSTR path, LPWSTR buffer, UINT buf_len)
|
||||||
static struct envvars_map null_var = {NULL, 0, {0}, 0};
|
static struct envvars_map null_var = {NULL, 0, {0}, 0};
|
||||||
struct envvars_map *match = &null_var, *cur;
|
struct envvars_map *match = &null_var, *cur;
|
||||||
struct envvars_map envvars[] = {
|
struct envvars_map envvars[] = {
|
||||||
{ allusersprofileW, sizeof(allusersprofileW)/sizeof(WCHAR) },
|
{ allusersprofileW, ARRAY_SIZE(allusersprofileW) },
|
||||||
{ appdataW, sizeof(appdataW)/sizeof(WCHAR) },
|
{ appdataW, ARRAY_SIZE(appdataW) },
|
||||||
{ programfilesW, sizeof(programfilesW)/sizeof(WCHAR) },
|
{ programfilesW, ARRAY_SIZE(programfilesW) },
|
||||||
{ systemrootW, sizeof(systemrootW)/sizeof(WCHAR) },
|
{ systemrootW, ARRAY_SIZE(systemrootW) },
|
||||||
{ systemdriveW, sizeof(systemdriveW)/sizeof(WCHAR) },
|
{ systemdriveW, ARRAY_SIZE(systemdriveW) },
|
||||||
{ userprofileW, sizeof(userprofileW)/sizeof(WCHAR) },
|
{ userprofileW, ARRAY_SIZE(userprofileW) },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
DWORD pathlen;
|
DWORD pathlen;
|
||||||
|
|
|
@ -134,7 +134,7 @@ LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSK
|
||||||
|
|
||||||
/* Create internal HUSKEY */
|
/* Create internal HUSKEY */
|
||||||
hKey = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*hKey));
|
hKey = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*hKey));
|
||||||
lstrcpynW(hKey->lpszPath, Path, sizeof(hKey->lpszPath)/sizeof(WCHAR));
|
lstrcpynW(hKey->lpszPath, Path, ARRAY_SIZE(hKey->lpszPath));
|
||||||
|
|
||||||
if (hRelativeUSKey)
|
if (hRelativeUSKey)
|
||||||
{
|
{
|
||||||
|
@ -275,7 +275,7 @@ LONG WINAPI SHRegCreateUSKeyW(LPCWSTR path, REGSAM samDesired, HUSKEY relative_k
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret_key));
|
ret_key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret_key));
|
||||||
lstrcpynW(ret_key->lpszPath, path, sizeof(ret_key->lpszPath)/sizeof(WCHAR));
|
lstrcpynW(ret_key->lpszPath, path, ARRAY_SIZE(ret_key->lpszPath));
|
||||||
|
|
||||||
if (relative_key)
|
if (relative_key)
|
||||||
{
|
{
|
||||||
|
@ -1534,7 +1534,7 @@ DWORD WINAPI SHDeleteKeyA(HKEY hKey, LPCSTR lpszSubKey)
|
||||||
{
|
{
|
||||||
WCHAR subkeyW[MAX_PATH];
|
WCHAR subkeyW[MAX_PATH];
|
||||||
|
|
||||||
MultiByteToWideChar (CP_ACP, 0, lpszSubKey, -1, subkeyW, sizeof(subkeyW)/sizeof(WCHAR));
|
MultiByteToWideChar (CP_ACP, 0, lpszSubKey, -1, subkeyW, ARRAY_SIZE(subkeyW));
|
||||||
return SHDeleteKeyW(hKey, subkeyW);
|
return SHDeleteKeyW(hKey, subkeyW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,7 +1560,7 @@ DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
|
||||||
if(!dwRet)
|
if(!dwRet)
|
||||||
{
|
{
|
||||||
dwMaxSubkeyLen++;
|
dwMaxSubkeyLen++;
|
||||||
if (dwMaxSubkeyLen > sizeof(szNameBuf)/sizeof(WCHAR))
|
if (dwMaxSubkeyLen > ARRAY_SIZE(szNameBuf))
|
||||||
/* Name too big: alloc a buffer for it */
|
/* Name too big: alloc a buffer for it */
|
||||||
lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen*sizeof(WCHAR));
|
lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen*sizeof(WCHAR));
|
||||||
|
|
||||||
|
@ -2409,7 +2409,7 @@ HRESULT WINAPI SHRegGetCLSIDKeyA(REFGUID guid, LPCSTR lpszValue, BOOL bUseHKCU,
|
||||||
WCHAR szValue[MAX_PATH];
|
WCHAR szValue[MAX_PATH];
|
||||||
|
|
||||||
if (lpszValue)
|
if (lpszValue)
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, szValue, sizeof(szValue)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP, 0, lpszValue, -1, szValue, ARRAY_SIZE(szValue));
|
||||||
|
|
||||||
return SHRegGetCLSIDKeyW(guid, lpszValue ? szValue : NULL, bUseHKCU, bCreate, phKey);
|
return SHRegGetCLSIDKeyW(guid, lpszValue ? szValue : NULL, bUseHKCU, bCreate, phKey);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ static void FillNumberFmt(NUMBERFMTW *fmt, LPWSTR decimal_buffer, int decimal_bu
|
||||||
* http://blogs.msdn.com/oldnewthing/archive/2006/04/18/578251.aspx
|
* http://blogs.msdn.com/oldnewthing/archive/2006/04/18/578251.aspx
|
||||||
*/
|
*/
|
||||||
fmt->Grouping = 0;
|
fmt->Grouping = 0;
|
||||||
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, grouping, sizeof(grouping)/sizeof(WCHAR));
|
GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SGROUPING, grouping, ARRAY_SIZE(grouping));
|
||||||
for (c = grouping; *c; c++)
|
for (c = grouping; *c; c++)
|
||||||
if (*c >= '0' && *c < '9')
|
if (*c >= '0' && *c < '9')
|
||||||
{
|
{
|
||||||
|
@ -101,8 +101,7 @@ static int FormatInt(LONGLONG qdwValue, LPWSTR pszBuf, int cchBuf)
|
||||||
WCHAR *c;
|
WCHAR *c;
|
||||||
BOOL neg = (qdwValue < 0);
|
BOOL neg = (qdwValue < 0);
|
||||||
|
|
||||||
FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR),
|
FillNumberFmt(&fmt, decimal, ARRAY_SIZE(decimal), thousand, ARRAY_SIZE(thousand));
|
||||||
thousand, sizeof thousand / sizeof (WCHAR));
|
|
||||||
|
|
||||||
c = &buf[24];
|
c = &buf[24];
|
||||||
*(--c) = 0;
|
*(--c) = 0;
|
||||||
|
@ -135,8 +134,7 @@ static int FormatDouble(double value, int decimals, LPWSTR pszBuf, int cchBuf)
|
||||||
|
|
||||||
snprintfW(buf, 64, flfmt, value);
|
snprintfW(buf, 64, flfmt, value);
|
||||||
|
|
||||||
FillNumberFmt(&fmt, decimal, sizeof decimal / sizeof (WCHAR),
|
FillNumberFmt(&fmt, decimal, ARRAY_SIZE(decimal), thousand, ARRAY_SIZE(thousand));
|
||||||
thousand, sizeof thousand / sizeof (WCHAR));
|
|
||||||
fmt.NumDigits = decimals;
|
fmt.NumDigits = decimals;
|
||||||
return GetNumberFormatW(LOCALE_USER_DEFAULT, 0, buf, &fmt, pszBuf, cchBuf);
|
return GetNumberFormatW(LOCALE_USER_DEFAULT, 0, buf, &fmt, pszBuf, cchBuf);
|
||||||
}
|
}
|
||||||
|
@ -2124,7 +2122,7 @@ INT WINAPI StrFromTimeIntervalA(LPSTR lpszStr, UINT cchMax, DWORD dwMS,
|
||||||
if (lpszStr && cchMax)
|
if (lpszStr && cchMax)
|
||||||
{
|
{
|
||||||
WCHAR szBuff[128];
|
WCHAR szBuff[128];
|
||||||
StrFromTimeIntervalW(szBuff, sizeof(szBuff)/sizeof(WCHAR), dwMS, iDigits);
|
StrFromTimeIntervalW(szBuff, ARRAY_SIZE(szBuff), dwMS, iDigits);
|
||||||
WideCharToMultiByte(CP_ACP,0,szBuff,-1,lpszStr,cchMax,0,0);
|
WideCharToMultiByte(CP_ACP,0,szBuff,-1,lpszStr,cchMax,0,0);
|
||||||
}
|
}
|
||||||
return iRet;
|
return iRet;
|
||||||
|
@ -2420,7 +2418,7 @@ LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
|
||||||
/* Note that if this loop completes without finding a match, i will be
|
/* Note that if this loop completes without finding a match, i will be
|
||||||
* pointing at the last entry, which is a catch all for > 1000 PB
|
* pointing at the last entry, which is a catch all for > 1000 PB
|
||||||
*/
|
*/
|
||||||
while (i < sizeof(bfFormats) / sizeof(SHLWAPI_BYTEFORMATS) - 1)
|
while (i < ARRAY_SIZE(bfFormats) - 1)
|
||||||
{
|
{
|
||||||
if (llBytes < bfFormats[i].dLimit)
|
if (llBytes < bfFormats[i].dLimit)
|
||||||
break;
|
break;
|
||||||
|
@ -2455,7 +2453,7 @@ LPSTR WINAPI StrFormatByteSize64A(LONGLONG llBytes, LPSTR lpszDest, UINT cchMax)
|
||||||
{
|
{
|
||||||
WCHAR wszBuff[32];
|
WCHAR wszBuff[32];
|
||||||
|
|
||||||
StrFormatByteSizeW(llBytes, wszBuff, sizeof(wszBuff)/sizeof(WCHAR));
|
StrFormatByteSizeW(llBytes, wszBuff, ARRAY_SIZE(wszBuff));
|
||||||
|
|
||||||
if (lpszDest)
|
if (lpszDest)
|
||||||
WideCharToMultiByte(CP_ACP, 0, wszBuff, -1, lpszDest, cchMax, 0, 0);
|
WideCharToMultiByte(CP_ACP, 0, wszBuff, -1, lpszDest, cchMax, 0, 0);
|
||||||
|
|
|
@ -136,7 +136,7 @@ static DWORD get_scheme_code(LPCWSTR scheme, DWORD scheme_len)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for(i=0; i < sizeof(shlwapi_schemes)/sizeof(shlwapi_schemes[0]); i++) {
|
for(i = 0; i < ARRAY_SIZE(shlwapi_schemes); i++) {
|
||||||
if(scheme_len == strlenW(shlwapi_schemes[i].scheme_name)
|
if(scheme_len == strlenW(shlwapi_schemes[i].scheme_name)
|
||||||
&& !memicmpW(scheme, shlwapi_schemes[i].scheme_name, scheme_len))
|
&& !memicmpW(scheme, shlwapi_schemes[i].scheme_name, scheme_len))
|
||||||
return shlwapi_schemes[i].scheme_number;
|
return shlwapi_schemes[i].scheme_number;
|
||||||
|
@ -182,8 +182,7 @@ HRESULT WINAPI ParseURLA(LPCSTR x, PARSEDURLA *y)
|
||||||
y->pszSuffix = ptr+1;
|
y->pszSuffix = ptr+1;
|
||||||
y->cchSuffix = strlen(y->pszSuffix);
|
y->cchSuffix = strlen(y->pszSuffix);
|
||||||
|
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, x, ptr-x,
|
len = MultiByteToWideChar(CP_ACP, 0, x, ptr-x, scheme, ARRAY_SIZE(scheme));
|
||||||
scheme, sizeof(scheme)/sizeof(WCHAR));
|
|
||||||
y->nScheme = get_scheme_code(scheme, len);
|
y->nScheme = get_scheme_code(scheme, len);
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -331,7 +330,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
is_file_url = !strncmpW(wszFile, url, sizeof(wszFile)/sizeof(WCHAR));
|
is_file_url = !strncmpW(wszFile, url, ARRAY_SIZE(wszFile));
|
||||||
|
|
||||||
if ((nByteLen >= sizeof(wszHttp) &&
|
if ((nByteLen >= sizeof(wszHttp) &&
|
||||||
!memcmp(wszHttp, url, sizeof(wszHttp))) || is_file_url)
|
!memcmp(wszHttp, url, sizeof(wszHttp))) || is_file_url)
|
||||||
|
@ -362,7 +361,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
|
||||||
|
|
||||||
if(url[1] == ':') { /* Assume path */
|
if(url[1] == ':') { /* Assume path */
|
||||||
memcpy(wk2, wszFilePrefix, sizeof(wszFilePrefix));
|
memcpy(wk2, wszFilePrefix, sizeof(wszFilePrefix));
|
||||||
wk2 += sizeof(wszFilePrefix)/sizeof(WCHAR);
|
wk2 += ARRAY_SIZE(wszFilePrefix);
|
||||||
if (dwFlags & (URL_FILE_USE_PATHURL | URL_WININET_COMPATIBILITY))
|
if (dwFlags & (URL_FILE_USE_PATHURL | URL_WININET_COMPATIBILITY))
|
||||||
{
|
{
|
||||||
slash = '\\';
|
slash = '\\';
|
||||||
|
@ -397,7 +396,7 @@ HRESULT WINAPI UrlCanonicalizeW(LPCWSTR pszUrl, LPWSTR pszCanonicalized,
|
||||||
if((dwFlags & URL_FILE_USE_PATHURL) && nByteLen >= sizeof(wszLocalhost)
|
if((dwFlags & URL_FILE_USE_PATHURL) && nByteLen >= sizeof(wszLocalhost)
|
||||||
&& is_file_url
|
&& is_file_url
|
||||||
&& !memcmp(wszLocalhost, wk1, sizeof(wszLocalhost))){
|
&& !memcmp(wszLocalhost, wk1, sizeof(wszLocalhost))){
|
||||||
wk1 += sizeof(wszLocalhost)/sizeof(WCHAR);
|
wk1 += ARRAY_SIZE(wszLocalhost);
|
||||||
while(*wk1 == '\\' && (dwFlags & URL_FILE_USE_PATHURL))
|
while(*wk1 == '\\' && (dwFlags & URL_FILE_USE_PATHURL))
|
||||||
wk1++;
|
wk1++;
|
||||||
}
|
}
|
||||||
|
@ -954,7 +953,7 @@ HRESULT WINAPI UrlEscapeA(
|
||||||
WCHAR *escapedW = bufW;
|
WCHAR *escapedW = bufW;
|
||||||
UNICODE_STRING urlW;
|
UNICODE_STRING urlW;
|
||||||
HRESULT ret;
|
HRESULT ret;
|
||||||
DWORD lenW = sizeof(bufW)/sizeof(WCHAR), lenA;
|
DWORD lenW = ARRAY_SIZE(bufW), lenA;
|
||||||
|
|
||||||
if (!pszEscaped || !pcchEscaped || !*pcchEscaped)
|
if (!pszEscaped || !pcchEscaped || !*pcchEscaped)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -1162,7 +1161,7 @@ HRESULT WINAPI UrlEscapeW(
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
||||||
if((int_flags & WINE_URL_COLLAPSE_SLASHES) && src == pszUrl + parsed_url.cchProtocol + 1) {
|
if((int_flags & WINE_URL_COLLAPSE_SLASHES) && src == pszUrl + parsed_url.cchProtocol + 1) {
|
||||||
int localhost_len = sizeof(localhost)/sizeof(WCHAR) - 1;
|
int localhost_len = ARRAY_SIZE(localhost) - 1;
|
||||||
while(cur == '/' || cur == '\\') {
|
while(cur == '/' || cur == '\\') {
|
||||||
slashes++;
|
slashes++;
|
||||||
cur = *++src;
|
cur = *++src;
|
||||||
|
@ -2442,7 +2441,7 @@ HRESULT WINAPI UrlCreateFromPathA(LPCSTR pszPath, LPSTR pszUrl, LPDWORD pcchUrl,
|
||||||
WCHAR *urlW = bufW;
|
WCHAR *urlW = bufW;
|
||||||
UNICODE_STRING pathW;
|
UNICODE_STRING pathW;
|
||||||
HRESULT ret;
|
HRESULT ret;
|
||||||
DWORD lenW = sizeof(bufW)/sizeof(WCHAR), lenA;
|
DWORD lenW = ARRAY_SIZE(bufW), lenA;
|
||||||
|
|
||||||
if(!RtlCreateUnicodeStringFromAsciiz(&pathW, pszPath))
|
if(!RtlCreateUnicodeStringFromAsciiz(&pathW, pszPath))
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -2545,13 +2544,13 @@ HRESULT WINAPI MLBuildResURLA(LPCSTR lpszLibName, HMODULE hMod, DWORD dwFlags,
|
||||||
HRESULT hRet;
|
HRESULT hRet;
|
||||||
|
|
||||||
if (lpszLibName)
|
if (lpszLibName)
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpszLibName, -1, szLibName, sizeof(szLibName)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP, 0, lpszLibName, -1, szLibName, ARRAY_SIZE(szLibName));
|
||||||
|
|
||||||
if (lpszRes)
|
if (lpszRes)
|
||||||
MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, szRes, sizeof(szRes)/sizeof(WCHAR));
|
MultiByteToWideChar(CP_ACP, 0, lpszRes, -1, szRes, ARRAY_SIZE(szRes));
|
||||||
|
|
||||||
if (dwDestLen > sizeof(szLibName)/sizeof(WCHAR))
|
if (dwDestLen > ARRAY_SIZE(szLibName))
|
||||||
dwDestLen = sizeof(szLibName)/sizeof(WCHAR);
|
dwDestLen = ARRAY_SIZE(szLibName);
|
||||||
|
|
||||||
hRet = MLBuildResURLW(lpszLibName ? szLibName : NULL, hMod, dwFlags,
|
hRet = MLBuildResURLW(lpszLibName ? szLibName : NULL, hMod, dwFlags,
|
||||||
lpszRes ? szRes : NULL, lpszDest ? szDest : NULL, dwDestLen);
|
lpszRes ? szRes : NULL, lpszDest ? szDest : NULL, dwDestLen);
|
||||||
|
@ -2592,8 +2591,8 @@ HRESULT WINAPI MLBuildResURLW(LPCWSTR lpszLibName, HMODULE hMod, DWORD dwFlags,
|
||||||
WCHAR szBuff[MAX_PATH];
|
WCHAR szBuff[MAX_PATH];
|
||||||
DWORD len;
|
DWORD len;
|
||||||
|
|
||||||
len = GetModuleFileNameW(hMod, szBuff, sizeof(szBuff)/sizeof(WCHAR));
|
len = GetModuleFileNameW(hMod, szBuff, ARRAY_SIZE(szBuff));
|
||||||
if (len && len < sizeof(szBuff)/sizeof(WCHAR))
|
if (len && len < ARRAY_SIZE(szBuff))
|
||||||
{
|
{
|
||||||
DWORD dwPathLen = strlenW(szBuff) + 1;
|
DWORD dwPathLen = strlenW(szBuff) + 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue