Commit 9b4f0d76 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

inetcomm: Use the ARRAY_SIZE() macro.

parent 9ca68619
...@@ -1581,9 +1581,8 @@ static HRESULT decode_base64(IStream *input, IStream **ret_stream) ...@@ -1581,9 +1581,8 @@ static HRESULT decode_base64(IStream *input, IStream **ret_stream)
while(1) { while(1) {
/* skip invalid chars */ /* skip invalid chars */
while(ptr < end && while(ptr < end && (*ptr >= ARRAY_SIZE(base64_decode_table)
(*ptr >= sizeof(base64_decode_table)/sizeof(*base64_decode_table) || base64_decode_table[*ptr] == -1))
|| base64_decode_table[*ptr] == -1))
ptr++; ptr++;
if(ptr == end) if(ptr == end)
break; break;
...@@ -3715,7 +3714,7 @@ HRESULT WINAPI MimeOleObjectFromMoniker(BINDF bindf, IMoniker *moniker, IBindCtx ...@@ -3715,7 +3714,7 @@ HRESULT WINAPI MimeOleObjectFromMoniker(BINDF bindf, IMoniker *moniker, IBindCtx
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(mhtml_url, mhtml_prefixW, sizeof(mhtml_prefixW)); memcpy(mhtml_url, mhtml_prefixW, sizeof(mhtml_prefixW));
strcpyW(mhtml_url + sizeof(mhtml_prefixW)/sizeof(WCHAR), display_name); strcpyW(mhtml_url + ARRAY_SIZE(mhtml_prefixW), display_name);
HeapFree(GetProcessHeap(), 0, display_name); HeapFree(GetProcessHeap(), 0, display_name);
hres = CreateURLMoniker(NULL, mhtml_url, moniker_new); hres = CreateURLMoniker(NULL, mhtml_url, moniker_new);
......
...@@ -83,16 +83,16 @@ static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r) ...@@ -83,16 +83,16 @@ static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r)
{ {
const WCHAR *p; const WCHAR *p;
if(strncmpiW(url, mhtml_prefixW, sizeof(mhtml_prefixW)/sizeof(WCHAR))) if(strncmpiW(url, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW)))
return E_FAIL; return E_FAIL;
r->mhtml = url + sizeof(mhtml_prefixW)/sizeof(WCHAR); r->mhtml = url + ARRAY_SIZE(mhtml_prefixW);
p = strchrW(r->mhtml, '!'); p = strchrW(r->mhtml, '!');
if(p) { if(p) {
r->mhtml_len = p - r->mhtml; r->mhtml_len = p - r->mhtml;
/* FIXME: We handle '!' and '!x-usc:' in URLs as the same thing. Those should not be the same. */ /* FIXME: We handle '!' and '!x-usc:' in URLs as the same thing. Those should not be the same. */
if(!strncmpW(p, mhtml_separatorW, sizeof(mhtml_separatorW)/sizeof(WCHAR))) if(!strncmpW(p, mhtml_separatorW, ARRAY_SIZE(mhtml_separatorW)))
p += sizeof(mhtml_separatorW)/sizeof(WCHAR); p += ARRAY_SIZE(mhtml_separatorW);
else else
p++; p++;
}else { }else {
...@@ -657,7 +657,7 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa ...@@ -657,7 +657,7 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
DWORD cchResult, DWORD* pcchResult, DWORD dwReserved) DWORD cchResult, DWORD* pcchResult, DWORD dwReserved)
{ {
MimeHtmlProtocol *This = impl_from_IInternetProtocolInfo(iface); MimeHtmlProtocol *This = impl_from_IInternetProtocolInfo(iface);
size_t len = sizeof(mhtml_prefixW)/sizeof(WCHAR); size_t len = ARRAY_SIZE(mhtml_prefixW);
mhtml_url_t url; mhtml_url_t url;
WCHAR *p; WCHAR *p;
HRESULT hres; HRESULT hres;
...@@ -670,26 +670,26 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa ...@@ -670,26 +670,26 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(!strncmpiW(pwzRelativeUrl, mhtml_prefixW, sizeof(mhtml_prefixW)/sizeof(WCHAR))) { if(!strncmpiW(pwzRelativeUrl, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW))) {
FIXME("Relative URL is mhtml protocol\n"); FIXME("Relative URL is mhtml protocol\n");
return INET_E_USE_DEFAULT_PROTOCOLHANDLER; return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
} }
len += url.mhtml_len; len += url.mhtml_len;
if(*pwzRelativeUrl) if(*pwzRelativeUrl)
len += strlenW(pwzRelativeUrl) + sizeof(mhtml_separatorW)/sizeof(WCHAR); len += strlenW(pwzRelativeUrl) + ARRAY_SIZE(mhtml_separatorW);
if(len >= cchResult) { if(len >= cchResult) {
*pcchResult = 0; *pcchResult = 0;
return E_FAIL; return E_FAIL;
} }
memcpy(pwzResult, mhtml_prefixW, sizeof(mhtml_prefixW)); memcpy(pwzResult, mhtml_prefixW, sizeof(mhtml_prefixW));
p = pwzResult + sizeof(mhtml_prefixW)/sizeof(WCHAR); p = pwzResult + ARRAY_SIZE(mhtml_prefixW);
memcpy(p, url.mhtml, url.mhtml_len*sizeof(WCHAR)); memcpy(p, url.mhtml, url.mhtml_len*sizeof(WCHAR));
p += url.mhtml_len; p += url.mhtml_len;
if(*pwzRelativeUrl) { if(*pwzRelativeUrl) {
memcpy(p, mhtml_separatorW, sizeof(mhtml_separatorW)); memcpy(p, mhtml_separatorW, sizeof(mhtml_separatorW));
p += sizeof(mhtml_separatorW)/sizeof(WCHAR); p += ARRAY_SIZE(mhtml_separatorW);
strcpyW(p, pwzRelativeUrl); strcpyW(p, pwzRelativeUrl);
}else { }else {
*p = 0; *p = 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