urlmon: Use ARRAY_SIZE() macro.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
764df64f37
commit
8665a60680
|
@ -154,12 +154,12 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
|
||||||
memcpy(buf+len, prev_ptr, ptr-prev_ptr);
|
memcpy(buf+len, prev_ptr, ptr-prev_ptr);
|
||||||
len += ptr-prev_ptr;
|
len += ptr-prev_ptr;
|
||||||
|
|
||||||
if(!strncmpiW(ptr, expand_dirW, sizeof(expand_dirW)/sizeof(WCHAR))) {
|
if(!strncmpiW(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
|
||||||
len2 = strlenW(ctx->tmp_dir);
|
len2 = strlenW(ctx->tmp_dir);
|
||||||
if(buf)
|
if(buf)
|
||||||
memcpy(buf+len, ctx->tmp_dir, len2*sizeof(WCHAR));
|
memcpy(buf+len, ctx->tmp_dir, len2*sizeof(WCHAR));
|
||||||
len += len2;
|
len += len2;
|
||||||
ptr += sizeof(expand_dirW)/sizeof(WCHAR);
|
ptr += ARRAY_SIZE(expand_dirW);
|
||||||
}else {
|
}else {
|
||||||
FIXME("Can't expand %s\n", debugstr_w(ptr));
|
FIXME("Can't expand %s\n", debugstr_w(ptr));
|
||||||
if(buf)
|
if(buf)
|
||||||
|
@ -185,7 +185,7 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
|
||||||
|
|
||||||
static const WCHAR runW[] = {'r','u','n',0};
|
static const WCHAR runW[] = {'r','u','n',0};
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(sect_name, NULL, NULL, buf, sizeof(buf)/sizeof(*buf), ctx->install_file);
|
len = GetPrivateProfileStringW(sect_name, NULL, NULL, buf, ARRAY_SIZE(buf), ctx->install_file);
|
||||||
if(!len)
|
if(!len)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
|
||||||
WCHAR *cmd;
|
WCHAR *cmd;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(sect_name, runW, NULL, val, sizeof(val)/sizeof(*val), ctx->install_file);
|
len = GetPrivateProfileStringW(sect_name, runW, NULL, val, ARRAY_SIZE(val), ctx->install_file);
|
||||||
|
|
||||||
TRACE("Run %s\n", debugstr_w(val));
|
TRACE("Run %s\n", debugstr_w(val));
|
||||||
|
|
||||||
|
@ -229,14 +229,14 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
|
||||||
static const WCHAR setup_hooksW[] = {'S','e','t','u','p',' ','H','o','o','k','s',0};
|
static const WCHAR setup_hooksW[] = {'S','e','t','u','p',' ','H','o','o','k','s',0};
|
||||||
static const WCHAR add_codeW[] = {'A','d','d','.','C','o','d','e',0};
|
static const WCHAR add_codeW[] = {'A','d','d','.','C','o','d','e',0};
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(setup_hooksW, NULL, NULL, buf, sizeof(buf)/sizeof(*buf), ctx->install_file);
|
len = GetPrivateProfileStringW(setup_hooksW, NULL, NULL, buf, ARRAY_SIZE(buf), ctx->install_file);
|
||||||
if(len) {
|
if(len) {
|
||||||
default_install = FALSE;
|
default_install = FALSE;
|
||||||
|
|
||||||
for(key = buf; *key; key += strlenW(key)+1) {
|
for(key = buf; *key; key += strlenW(key)+1) {
|
||||||
TRACE("[Setup Hooks] key: %s\n", debugstr_w(key));
|
TRACE("[Setup Hooks] key: %s\n", debugstr_w(key));
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, sizeof(sect_name)/sizeof(*sect_name),
|
len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
|
||||||
ctx->install_file);
|
ctx->install_file);
|
||||||
if(!len) {
|
if(!len) {
|
||||||
WARN("Could not get key value\n");
|
WARN("Could not get key value\n");
|
||||||
|
@ -249,14 +249,14 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(add_codeW, NULL, NULL, buf, sizeof(buf)/sizeof(*buf), ctx->install_file);
|
len = GetPrivateProfileStringW(add_codeW, NULL, NULL, buf, ARRAY_SIZE(buf), ctx->install_file);
|
||||||
if(len) {
|
if(len) {
|
||||||
default_install = FALSE;
|
default_install = FALSE;
|
||||||
|
|
||||||
for(key = buf; *key; key += strlenW(key)+1) {
|
for(key = buf; *key; key += strlenW(key)+1) {
|
||||||
TRACE("[Add.Code] key: %s\n", debugstr_w(key));
|
TRACE("[Add.Code] key: %s\n", debugstr_w(key));
|
||||||
|
|
||||||
len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, sizeof(sect_name)/sizeof(*sect_name),
|
len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
|
||||||
ctx->install_file);
|
ctx->install_file);
|
||||||
if(!len) {
|
if(!len) {
|
||||||
WARN("Could not get key value\n");
|
WARN("Could not get key value\n");
|
||||||
|
@ -290,7 +290,7 @@ static HRESULT install_cab_file(install_ctx_t *ctx)
|
||||||
DWORD i;
|
DWORD i;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
GetTempPathW(sizeof(tmp_path)/sizeof(WCHAR), tmp_path);
|
GetTempPathW(ARRAY_SIZE(tmp_path), tmp_path);
|
||||||
|
|
||||||
for(i=0; !res && i < 100; i++) {
|
for(i=0; !res && i < 100; i++) {
|
||||||
GetTempFileNameW(tmp_path, NULL, GetTickCount() + i*17037, tmp_dir);
|
GetTempFileNameW(tmp_path, NULL, GetTickCount() + i*17037, tmp_dir);
|
||||||
|
@ -336,13 +336,13 @@ static void update_counter(install_ctx_t *ctx, HWND hwnd)
|
||||||
HWND button_hwnd;
|
HWND button_hwnd;
|
||||||
|
|
||||||
KillTimer(hwnd, ctx->timer);
|
KillTimer(hwnd, ctx->timer);
|
||||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALL, text, sizeof(text)/sizeof(WCHAR));
|
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALL, text, ARRAY_SIZE(text));
|
||||||
|
|
||||||
button_hwnd = GetDlgItem(hwnd, ID_AXINSTALL_INSTALL_BTN);
|
button_hwnd = GetDlgItem(hwnd, ID_AXINSTALL_INSTALL_BTN);
|
||||||
EnableWindow(button_hwnd, TRUE);
|
EnableWindow(button_hwnd, TRUE);
|
||||||
}else {
|
}else {
|
||||||
WCHAR buf[100];
|
WCHAR buf[100];
|
||||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, sizeof(buf)/sizeof(WCHAR));
|
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, ARRAY_SIZE(buf));
|
||||||
sprintfW(text, buf, ctx->counter);
|
sprintfW(text, buf, ctx->counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ static void failure_msgbox(install_ctx_t *ctx, HRESULT hres)
|
||||||
{
|
{
|
||||||
WCHAR buf[1024], fmt[1024];
|
WCHAR buf[1024], fmt[1024];
|
||||||
|
|
||||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, sizeof(fmt)/sizeof(WCHAR));
|
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, ARRAY_SIZE(fmt));
|
||||||
sprintfW(buf, fmt, hres);
|
sprintfW(buf, fmt, hres);
|
||||||
MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
|
MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid)
|
||||||
len = strlenW(mime)+1;
|
len = strlenW(mime)+1;
|
||||||
key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR));
|
key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR));
|
||||||
memcpy(key_name, mime_keyW, sizeof(mime_keyW));
|
memcpy(key_name, mime_keyW, sizeof(mime_keyW));
|
||||||
strcpyW(key_name + sizeof(mime_keyW)/sizeof(WCHAR), mime);
|
strcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
|
||||||
|
|
||||||
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
|
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
|
||||||
heap_free(key_name);
|
heap_free(key_name);
|
||||||
|
|
|
@ -304,7 +304,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
|
||||||
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
|
IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, &null_char);
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
hres = CoInternetParseIUri(pUri, PARSE_PATH_FROM_URL, 0, path, sizeof(path)/sizeof(WCHAR), &size, 0);
|
hres = CoInternetParseIUri(pUri, PARSE_PATH_FROM_URL, 0, path, ARRAY_SIZE(path), &size, 0);
|
||||||
if(FAILED(hres)) {
|
if(FAILED(hres)) {
|
||||||
WARN("CoInternetParseIUri failed: %08x\n", hres);
|
WARN("CoInternetParseIUri failed: %08x\n", hres);
|
||||||
return report_result(pOIProtSink, hres, 0);
|
return report_result(pOIProtSink, hres, 0);
|
||||||
|
|
|
@ -342,7 +342,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
|
||||||
CoTaskMemFree(rootdoc_url);
|
CoTaskMemFree(rootdoc_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
num = sizeof(accept_mimes)/sizeof(accept_mimes[0])-1;
|
num = ARRAY_SIZE(accept_mimes) - 1;
|
||||||
hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes, num, &num);
|
hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes, num, &num);
|
||||||
if(hres == INET_E_USE_DEFAULT_SETTING) {
|
if(hres == INET_E_USE_DEFAULT_SETTING) {
|
||||||
static const WCHAR default_accept_mimeW[] = {'*','/','*',0};
|
static const WCHAR default_accept_mimeW[] = {'*','/','*',0};
|
||||||
|
@ -428,7 +428,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
|
||||||
WARN("IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n", hres);
|
WARN("IServiceProvider_QueryService IID_IHttpNegotiate2 failed: %08x\n", hres);
|
||||||
/* No goto done as per native */
|
/* No goto done as per native */
|
||||||
}else {
|
}else {
|
||||||
len = sizeof(security_id)/sizeof(security_id[0]);
|
len = ARRAY_SIZE(security_id);
|
||||||
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, security_id, &len, 0);
|
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, security_id, &len, 0);
|
||||||
IHttpNegotiate2_Release(http_negotiate2);
|
IHttpNegotiate2_Release(http_negotiate2);
|
||||||
if (hres != S_OK)
|
if (hres != S_OK)
|
||||||
|
|
|
@ -588,7 +588,7 @@ static HRESULT load_process_feature(INTERNETFEATURELIST feature)
|
||||||
BOOL check_hklm = FALSE;
|
BOOL check_hklm = FALSE;
|
||||||
BOOL enabled;
|
BOOL enabled;
|
||||||
|
|
||||||
if (!GetModuleFileNameW(NULL, module_name, sizeof(module_name)/sizeof(WCHAR))) {
|
if (!GetModuleFileNameW(NULL, module_name, ARRAY_SIZE(module_name))) {
|
||||||
ERR("Failed to get module file name: %u\n", GetLastError());
|
ERR("Failed to get module file name: %u\n", GetLastError());
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -547,12 +547,12 @@ static BOOL is_known_mime_type(const WCHAR *mime)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
for(i=0; i < sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
|
||||||
if(!strcmpW(mime, mime_filters_any_pos[i].mime))
|
if(!strcmpW(mime, mime_filters_any_pos[i].mime))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i < sizeof(mime_filters)/sizeof(*mime_filters); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
|
||||||
if(!strcmpW(mime, mime_filters[i].mime))
|
if(!strcmpW(mime, mime_filters[i].mime))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
if(proposed_mime) {
|
if(proposed_mime) {
|
||||||
ret = proposed_mime;
|
ret = proposed_mime;
|
||||||
|
|
||||||
for(i=0; i < sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
|
||||||
if(!strcmpW(proposed_mime, mime_filters_any_pos[i].mime)) {
|
if(!strcmpW(proposed_mime, mime_filters_any_pos[i].mime)) {
|
||||||
any_pos_mime = i;
|
any_pos_mime = i;
|
||||||
for(len=size; len>0; len--) {
|
for(len=size; len>0; len--) {
|
||||||
|
@ -598,8 +598,8 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(i == sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos)) {
|
if(i == ARRAY_SIZE(mime_filters_any_pos)) {
|
||||||
for(i=0; i < sizeof(mime_filters)/sizeof(*mime_filters); i++) {
|
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
|
||||||
if(!strcmpW(proposed_mime, mime_filters[i].mime)) {
|
if(!strcmpW(proposed_mime, mime_filters[i].mime)) {
|
||||||
if(!mime_filters[i].filter(buf, size))
|
if(!mime_filters[i].filter(buf, size))
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
|
@ -613,7 +613,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
* are not looked for if none of them was proposed */
|
* are not looked for if none of them was proposed */
|
||||||
if(!proposed_mime || any_pos_mime!=-1) {
|
if(!proposed_mime || any_pos_mime!=-1) {
|
||||||
for(len=size; !ret && len>0; len--) {
|
for(len=size; !ret && len>0; len--) {
|
||||||
for(i=0; i<sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
|
for(i=0; i<ARRAY_SIZE(mime_filters_any_pos); i++) {
|
||||||
if(mime_filters_any_pos[i].filter(buf+size-len, len)) {
|
if(mime_filters_any_pos[i].filter(buf+size-len, len)) {
|
||||||
ret = mime_filters_any_pos[i].mime;
|
ret = mime_filters_any_pos[i].mime;
|
||||||
break;
|
break;
|
||||||
|
@ -635,7 +635,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
|
||||||
for(len=size; ret==app_octetstreamW && len>0; len--) {
|
for(len=size; ret==app_octetstreamW && len>0; len--) {
|
||||||
if(!is_text_plain_char(buf[size-len]))
|
if(!is_text_plain_char(buf[size-len]))
|
||||||
break;
|
break;
|
||||||
for(i=0; i<sizeof(mime_filters_any_pos)/sizeof(*mime_filters_any_pos); i++) {
|
for(i=0; i<ARRAY_SIZE(mime_filters_any_pos); i++) {
|
||||||
if(mime_filters_any_pos[i].filter(buf+size-len, len)) {
|
if(mime_filters_any_pos[i].filter(buf+size-len, len)) {
|
||||||
ret = text_plainW;
|
ret = text_plainW;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -547,7 +547,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
|
||||||
else
|
else
|
||||||
path_start = path;
|
path_start = path;
|
||||||
|
|
||||||
if((ptr = strchrW(path_start, ':')) && ptr-path_start+1 < sizeof(root)/sizeof(WCHAR)) {
|
if((ptr = strchrW(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
|
||||||
UINT type;
|
UINT type;
|
||||||
|
|
||||||
memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
|
memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
|
||||||
|
@ -645,7 +645,7 @@ static HRESULT open_zone_key(HKEY parent_key, DWORD zone, HKEY *hkey)
|
||||||
{
|
{
|
||||||
static const WCHAR wszFormat[] = {'%','s','%','u',0};
|
static const WCHAR wszFormat[] = {'%','s','%','u',0};
|
||||||
|
|
||||||
WCHAR key_name[sizeof(wszZonesKey)/sizeof(WCHAR)+12];
|
WCHAR key_name[ARRAY_SIZE(wszZonesKey) + 12];
|
||||||
DWORD res;
|
DWORD res;
|
||||||
|
|
||||||
wsprintfW(key_name, wszFormat, wszZonesKey, zone);
|
wsprintfW(key_name, wszFormat, wszZonesKey, zone);
|
||||||
|
@ -1307,7 +1307,7 @@ static LPDWORD build_zonemap_from_reg(void)
|
||||||
|
|
||||||
while (!res) {
|
while (!res) {
|
||||||
name[0] = '\0';
|
name[0] = '\0';
|
||||||
len = sizeof(name) / sizeof(name[0]);
|
len = ARRAY_SIZE(name);
|
||||||
res = RegEnumKeyExW(hkey, used, name, &len, NULL, NULL, NULL, NULL);
|
res = RegEnumKeyExW(hkey, used, name, &len, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
@ -2052,7 +2052,7 @@ HRESULT WINAPI CoInternetGetSecurityUrlEx(IUri *pUri, IUri **ppSecUri, PSUACTION
|
||||||
const WCHAR *tmp = ret_url;
|
const WCHAR *tmp = ret_url;
|
||||||
|
|
||||||
/* Check and see if a "//" is after the scheme name. */
|
/* Check and see if a "//" is after the scheme name. */
|
||||||
tmp += sizeof(fileW)/sizeof(WCHAR);
|
tmp += ARRAY_SIZE(fileW);
|
||||||
if(*tmp != '/' || *(tmp+1) != '/')
|
if(*tmp != '/' || *(tmp+1) != '/')
|
||||||
hres = E_INVALIDARG;
|
hres = E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid,
|
||||||
|
|
||||||
wszKey = heap_alloc(sizeof(wszProtocolsKey)+(schema_len+1)*sizeof(WCHAR));
|
wszKey = heap_alloc(sizeof(wszProtocolsKey)+(schema_len+1)*sizeof(WCHAR));
|
||||||
memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey));
|
memcpy(wszKey, wszProtocolsKey, sizeof(wszProtocolsKey));
|
||||||
memcpy(wszKey + sizeof(wszProtocolsKey)/sizeof(WCHAR), schema, (schema_len+1)*sizeof(WCHAR));
|
memcpy(wszKey + ARRAY_SIZE(wszProtocolsKey), schema, (schema_len+1)*sizeof(WCHAR));
|
||||||
|
|
||||||
res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey);
|
res = RegOpenKeyW(HKEY_CLASSES_ROOT, wszKey, &hkey);
|
||||||
heap_free(wszKey);
|
heap_free(wszKey);
|
||||||
|
@ -171,8 +171,7 @@ BOOL is_registered_protocol(LPCWSTR url)
|
||||||
WCHAR schema[64];
|
WCHAR schema[64];
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
|
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
|
||||||
&schema_len, 0);
|
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -188,8 +187,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR url)
|
||||||
DWORD schema_len;
|
DWORD schema_len;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, sizeof(schema)/sizeof(schema[0]),
|
hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, schema, ARRAY_SIZE(schema), &schema_len, 0);
|
||||||
&schema_len, 0);
|
|
||||||
if(FAILED(hres) || !schema_len)
|
if(FAILED(hres) || !schema_len)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -578,7 +576,7 @@ static void ensure_useragent(void)
|
||||||
DWORD value_len;
|
DWORD value_len;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
value_len = sizeof(buf)/sizeof(WCHAR);
|
value_len = ARRAY_SIZE(buf);
|
||||||
res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
|
res = RegEnumValueW(key, idx, buf, &value_len, NULL, NULL, NULL, NULL);
|
||||||
if(res != ERROR_SUCCESS)
|
if(res != ERROR_SUCCESS)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -627,7 +627,7 @@ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker
|
||||||
if (!szURL || !ppmk)
|
if (!szURL || !ppmk)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if(dwFlags >= sizeof(create_flags_map)/sizeof(*create_flags_map)) {
|
if(dwFlags >= ARRAY_SIZE(create_flags_map)) {
|
||||||
FIXME("Unsupported flags %x\n", dwFlags);
|
FIXME("Unsupported flags %x\n", dwFlags);
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
@ -680,7 +680,7 @@ HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **
|
||||||
if (!pUri || !ppmk)
|
if (!pUri || !ppmk)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if(dwFlags >= sizeof(create_flags_map)/sizeof(*create_flags_map)) {
|
if(dwFlags >= ARRAY_SIZE(create_flags_map)) {
|
||||||
FIXME("Unsupported flags %x\n", dwFlags);
|
FIXME("Unsupported flags %x\n", dwFlags);
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,7 +365,7 @@ static inline BOOL is_ascii(WCHAR c)
|
||||||
static BOOL is_default_port(URL_SCHEME scheme, DWORD port) {
|
static BOOL is_default_port(URL_SCHEME scheme, DWORD port) {
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
|
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
|
||||||
if(default_ports[i].scheme == scheme && default_ports[i].port)
|
if(default_ports[i].scheme == scheme && default_ports[i].port)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
|
||||||
* Ex: edu.uk -> has no domain name.
|
* Ex: edu.uk -> has no domain name.
|
||||||
* foo.uk -> foo.uk as the domain name.
|
* foo.uk -> foo.uk as the domain name.
|
||||||
*/
|
*/
|
||||||
for(i = 0; i < sizeof(recognized_tlds)/sizeof(recognized_tlds[0]); ++i) {
|
for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
|
||||||
if(!StrCmpNIW(host, recognized_tlds[i].tld_name, 3))
|
if(!StrCmpNIW(host, recognized_tlds[i].tld_name, 3))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -584,7 +584,7 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
|
||||||
* www.google.foo.uk -> foo.uk as the domain name.
|
* www.google.foo.uk -> foo.uk as the domain name.
|
||||||
*/
|
*/
|
||||||
if(last_tld - (sec_last_tld+1) == 3) {
|
if(last_tld - (sec_last_tld+1) == 3) {
|
||||||
for(i = 0; i < sizeof(recognized_tlds)/sizeof(recognized_tlds[0]); ++i) {
|
for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
|
||||||
if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
|
if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
|
||||||
const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
|
const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
|
||||||
|
|
||||||
|
@ -1134,7 +1134,7 @@ static BOOL parse_scheme_type(parse_data *data) {
|
||||||
if(data->scheme && data->scheme_len) {
|
if(data->scheme && data->scheme_len) {
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
for(i = 0; i < sizeof(recognized_schemes)/sizeof(recognized_schemes[0]); ++i) {
|
for(i = 0; i < ARRAY_SIZE(recognized_schemes); ++i) {
|
||||||
if(lstrlenW(recognized_schemes[i].scheme_name) == data->scheme_len) {
|
if(lstrlenW(recognized_schemes[i].scheme_name) == data->scheme_len) {
|
||||||
/* Has to be a case insensitive compare. */
|
/* Has to be a case insensitive compare. */
|
||||||
if(!StrCmpNIW(recognized_schemes[i].scheme_name, data->scheme, data->scheme_len)) {
|
if(!StrCmpNIW(recognized_schemes[i].scheme_name, data->scheme, data->scheme_len)) {
|
||||||
|
@ -2728,7 +2728,7 @@ static BOOL canonicalize_port(const parse_data *data, Uri *uri, DWORD flags, BOO
|
||||||
uri->port_offset = -1;
|
uri->port_offset = -1;
|
||||||
|
|
||||||
/* Check if the scheme has a default port. */
|
/* Check if the scheme has a default port. */
|
||||||
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
|
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
|
||||||
if(default_ports[i].scheme == data->scheme_type) {
|
if(default_ports[i].scheme == data->scheme_type) {
|
||||||
has_default_port = TRUE;
|
has_default_port = TRUE;
|
||||||
default_port = default_ports[i].port;
|
default_port = default_ports[i].port;
|
||||||
|
@ -3154,7 +3154,7 @@ static BOOL canonicalize_hierpart(const parse_data *data, Uri *uri, DWORD flags,
|
||||||
uri->display_modifiers |= URI_DISPLAY_NO_ABSOLUTE_URI;
|
uri->display_modifiers |= URI_DISPLAY_NO_ABSOLUTE_URI;
|
||||||
|
|
||||||
/* Windows also sets the port for these (if they have one). */
|
/* Windows also sets the port for these (if they have one). */
|
||||||
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
|
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
|
||||||
if(data->scheme_type == default_ports[i].scheme) {
|
if(data->scheme_type == default_ports[i].scheme) {
|
||||||
uri->has_port = TRUE;
|
uri->has_port = TRUE;
|
||||||
uri->port = default_ports[i].port;
|
uri->port = default_ports[i].port;
|
||||||
|
@ -4121,7 +4121,7 @@ static DWORD generate_raw_uri(const parse_data *data, BSTR uri, DWORD flags) {
|
||||||
DWORD i;
|
DWORD i;
|
||||||
BOOL is_default = FALSE;
|
BOOL is_default = FALSE;
|
||||||
|
|
||||||
for(i = 0; i < sizeof(default_ports)/sizeof(default_ports[0]); ++i) {
|
for(i = 0; i < ARRAY_SIZE(default_ports); ++i) {
|
||||||
if(data->scheme_type == default_ports[i].scheme &&
|
if(data->scheme_type == default_ports[i].scheme &&
|
||||||
data->port_value == default_ports[i].port)
|
data->port_value == default_ports[i].port)
|
||||||
is_default = TRUE;
|
is_default = TRUE;
|
||||||
|
@ -7002,7 +7002,7 @@ static HRESULT parse_rootdocument(const Uri *uri, LPWSTR output, DWORD output_le
|
||||||
memcpy(ptr, colon_slashesW, sizeof(colon_slashesW));
|
memcpy(ptr, colon_slashesW, sizeof(colon_slashesW));
|
||||||
|
|
||||||
/* Add the authority. */
|
/* Add the authority. */
|
||||||
ptr += sizeof(colon_slashesW)/sizeof(WCHAR);
|
ptr += ARRAY_SIZE(colon_slashesW);
|
||||||
memcpy(ptr, uri->canon_uri+uri->authority_start, uri->authority_len*sizeof(WCHAR));
|
memcpy(ptr, uri->canon_uri+uri->authority_start, uri->authority_len*sizeof(WCHAR));
|
||||||
|
|
||||||
/* Add the '/' after the authority. */
|
/* Add the '/' after the authority. */
|
||||||
|
@ -7066,7 +7066,7 @@ static HRESULT parse_path_from_url(const Uri *uri, LPWSTR output, DWORD output_l
|
||||||
static const WCHAR slash_slashW[] = {'\\','\\'};
|
static const WCHAR slash_slashW[] = {'\\','\\'};
|
||||||
|
|
||||||
memcpy(ptr, slash_slashW, sizeof(slash_slashW));
|
memcpy(ptr, slash_slashW, sizeof(slash_slashW));
|
||||||
ptr += sizeof(slash_slashW)/sizeof(WCHAR);
|
ptr += ARRAY_SIZE(slash_slashW);
|
||||||
memcpy(ptr, uri->canon_uri+uri->host_start, uri->host_len*sizeof(WCHAR));
|
memcpy(ptr, uri->canon_uri+uri->host_start, uri->host_len*sizeof(WCHAR));
|
||||||
ptr += uri->host_len;
|
ptr += uri->host_len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue