urlmon: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-24 10:15:45 +02:00
parent dac2ea3e70
commit 42d2477edf
15 changed files with 113 additions and 122 deletions

View File

@ -4,6 +4,8 @@ IMPORTS = uuid ole32 oleaut32 shell32 rpcrt4 shlwapi wininet user32 advapi32
EXTRADEFS = -D_URLMON_
DELAYIMPORTS = advpack
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
axinstall.c \
bindctx.c \

View File

@ -84,8 +84,8 @@ static HRESULT extract_cab_file(install_ctx_t *ctx)
return hres;
}
path_len = strlenW(ctx->tmp_dir);
file_len = strlenW(ctx->file_name);
path_len = lstrlenW(ctx->tmp_dir);
file_len = lstrlenW(ctx->file_name);
ctx->install_file = heap_alloc((path_len+file_len+2)*sizeof(WCHAR));
if(!ctx->install_file)
return E_OUTOFMEMORY;
@ -149,13 +149,13 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
static const WCHAR expand_dirW[] = {'%','E','X','T','R','A','C','T','_','D','I','R','%'};
while((ptr = strchrW(ptr, '%'))) {
while((ptr = wcschr(ptr, '%'))) {
if(buf)
memcpy(buf+len, prev_ptr, ptr-prev_ptr);
len += ptr-prev_ptr;
if(!strncmpiW(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
len2 = strlenW(ctx->tmp_dir);
if(!wcsnicmp(ptr, expand_dirW, ARRAY_SIZE(expand_dirW))) {
len2 = lstrlenW(ctx->tmp_dir);
if(buf)
memcpy(buf+len, ctx->tmp_dir, len2*sizeof(WCHAR));
len += len2;
@ -172,8 +172,8 @@ static void expand_command(install_ctx_t *ctx, const WCHAR *cmd, WCHAR *buf, siz
}
if(buf)
strcpyW(buf+len, prev_ptr);
*size = len + strlenW(prev_ptr) + 1;
lstrcpyW(buf+len, prev_ptr);
*size = len + lstrlenW(prev_ptr) + 1;
}
static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
@ -189,8 +189,8 @@ static HRESULT process_hook_section(install_ctx_t *ctx, const WCHAR *sect_name)
if(!len)
return S_OK;
for(key = buf; *key; key += strlenW(key)+1) {
if(!strcmpiW(key, runW)) {
for(key = buf; *key; key += lstrlenW(key)+1) {
if(!wcsicmp(key, runW)) {
WCHAR *cmd;
size_t size;
@ -233,7 +233,7 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
if(len) {
default_install = FALSE;
for(key = buf; *key; key += strlenW(key)+1) {
for(key = buf; *key; key += lstrlenW(key)+1) {
TRACE("[Setup Hooks] key: %s\n", debugstr_w(key));
len = GetPrivateProfileStringW(setup_hooksW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
@ -253,7 +253,7 @@ static HRESULT install_inf_file(install_ctx_t *ctx)
if(len) {
default_install = FALSE;
for(key = buf; *key; key += strlenW(key)+1) {
for(key = buf; *key; key += lstrlenW(key)+1) {
TRACE("[Add.Code] key: %s\n", debugstr_w(key));
len = GetPrivateProfileStringW(add_codeW, key, NULL, sect_name, ARRAY_SIZE(sect_name),
@ -343,7 +343,7 @@ static void update_counter(install_ctx_t *ctx, HWND hwnd)
}else {
WCHAR buf[100];
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, ARRAY_SIZE(buf));
sprintfW(text, buf, ctx->counter);
swprintf(text, ARRAY_SIZE(text), buf, ctx->counter);
}
SetDlgItemTextW(hwnd, ID_AXINSTALL_INSTALL_BTN, text);
@ -445,22 +445,22 @@ static HRESULT install_file(install_ctx_t *ctx, const WCHAR *cache_file)
if(SUCCEEDED(hres)) {
const WCHAR *ptr, *ptr2, *ext;
ptr = strrchrW(path, '/');
ptr = wcsrchr(path, '/');
if(!ptr)
ptr = path;
else
ptr++;
ptr2 = strrchrW(ptr, '\\');
ptr2 = wcsrchr(ptr, '\\');
if(ptr2)
ptr = ptr2+1;
ctx->file_name = ptr;
ext = strrchrW(ptr, '.');
ext = wcsrchr(ptr, '.');
if(!ext)
ext = ptr;
if(!strcmpiW(ext, cab_extW)) {
if(!wcsicmp(ext, cab_extW)) {
hres = install_cab_file(ctx);
}else {
FIXME("Unsupported extension %s\n", debugstr_w(ext));
@ -477,7 +477,7 @@ static void failure_msgbox(install_ctx_t *ctx, HRESULT hres)
WCHAR buf[1024], fmt[1024];
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, ARRAY_SIZE(fmt));
sprintfW(buf, fmt, hres);
swprintf(buf, ARRAY_SIZE(buf), fmt, hres);
MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
}

View File

@ -199,10 +199,10 @@ static LPWSTR get_mime_clsid(LPCWSTR mime, CLSID *clsid)
'C','o','n','t','e','n','t',' ','T','y','p','e','\\'};
static const WCHAR clsidW[] = {'C','L','S','I','D',0};
len = strlenW(mime)+1;
len = lstrlenW(mime)+1;
key_name = heap_alloc(sizeof(mime_keyW) + len*sizeof(WCHAR));
memcpy(key_name, mime_keyW, sizeof(mime_keyW));
strcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
lstrcpyW(key_name + ARRAY_SIZE(mime_keyW), mime);
res = RegOpenKeyW(HKEY_CLASSES_ROOT, key_name, &hkey);
heap_free(key_name);

View File

@ -312,7 +312,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if(file_handle == INVALID_HANDLE_VALUE && (ptr = strrchrW(path, '#'))) {
if(file_handle == INVALID_HANDLE_VALUE && (ptr = wcsrchr(path, '#'))) {
/* If path contains fragment part, try without it. */
*ptr = 0;
file_handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL,
@ -333,7 +333,7 @@ static HRESULT WINAPI FileProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr
hres = IUri_GetExtension(pUri, &ext);
if(SUCCEEDED(hres)) {
if(hres == S_OK && *ext) {
if((ptr = strchrW(ext, '#')))
if((ptr = wcschr(ext, '#')))
*ptr = 0;
hres = find_mime_from_ext(ext, &mime);
if(SUCCEEDED(hres)) {

View File

@ -246,7 +246,7 @@ static ULONG send_http_request(HttpProtocol *This)
BOOL res;
send_buffer.lpcszHeader = This->full_header;
send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = strlenW(This->full_header);
send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = lstrlenW(This->full_header);
if(This->base.bind_info.dwBindVerb != BINDVERB_GET) {
switch(This->base.bind_info.stgmedData.tymed) {
@ -408,7 +408,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques
return hres;
}
len = addl_header ? strlenW(addl_header) : 0;
len = addl_header ? lstrlenW(addl_header) : 0;
This->full_header = heap_alloc(len*sizeof(WCHAR)+sizeof(default_headersW));
if(!This->full_header) {
@ -561,7 +561,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
content_type = query_http_info(This, HTTP_QUERY_CONTENT_TYPE);
if(content_type) {
/* remove the charset, if present */
LPWSTR p = strchrW(content_type, ';');
LPWSTR p = wcschr(content_type, ';');
if (p) *p = '\0';
IInternetProtocolSink_ReportProgress(This->base.protocol_sink,
@ -579,7 +579,7 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot)
content_length = query_http_info(This, HTTP_QUERY_CONTENT_LENGTH);
if(content_length) {
This->base.content_length = atoiW(content_length);
This->base.content_length = wcstol(content_length, NULL, 10);
heap_free(content_length);
}

View File

@ -156,7 +156,7 @@ static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size,
if(flags)
ERR("wrong flags\n");
ptr = strchrW(url, ':');
ptr = wcschr(url, ':');
if(ptr)
len = ptr-url;
@ -594,7 +594,7 @@ static HRESULT load_process_feature(INTERNETFEATURELIST feature)
return E_UNEXPECTED;
}
process_name = strrchrW(module_name, '\\');
process_name = wcsrchr(module_name, '\\');
if(!process_name) {
ERR("Invalid module file name: %s\n", debugstr_w(module_name));
return E_UNEXPECTED;

View File

@ -548,12 +548,12 @@ static BOOL is_known_mime_type(const WCHAR *mime)
unsigned i;
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
if(!strcmpW(mime, mime_filters_any_pos[i].mime))
if(!wcscmp(mime, mime_filters_any_pos[i].mime))
return TRUE;
}
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
if(!strcmpW(mime, mime_filters[i].mime))
if(!wcscmp(mime, mime_filters[i].mime))
return TRUE;
}
@ -569,7 +569,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
if(!proposed_mime)
return E_FAIL;
len = strlenW(proposed_mime)+1;
len = lstrlenW(proposed_mime)+1;
*ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
if(!*ret_mime)
return E_OUTOFMEMORY;
@ -578,15 +578,15 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
return S_OK;
}
if(proposed_mime && (!strcmpW(proposed_mime, app_octetstreamW)
|| !strcmpW(proposed_mime, text_plainW)))
if(proposed_mime && (!wcscmp(proposed_mime, app_octetstreamW)
|| !wcscmp(proposed_mime, text_plainW)))
proposed_mime = NULL;
if(proposed_mime) {
ret = proposed_mime;
for(i=0; i < ARRAY_SIZE(mime_filters_any_pos); i++) {
if(!strcmpW(proposed_mime, mime_filters_any_pos[i].mime)) {
if(!wcscmp(proposed_mime, mime_filters_any_pos[i].mime)) {
any_pos_mime = i;
for(len=size; len>0; len--) {
if(mime_filters_any_pos[i].filter(buf+size-len, len))
@ -600,7 +600,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
if(i == ARRAY_SIZE(mime_filters_any_pos)) {
for(i=0; i < ARRAY_SIZE(mime_filters); i++) {
if(!strcmpW(proposed_mime, mime_filters[i].mime)) {
if(!wcscmp(proposed_mime, mime_filters[i].mime)) {
if(!mime_filters[i].filter(buf, size))
ret = NULL;
break;
@ -663,7 +663,7 @@ static HRESULT find_mime_from_buffer(const BYTE *buf, DWORD size, const WCHAR *p
TRACE("found %s for %s\n", debugstr_w(ret), debugstr_an((const char*)buf, min(32, size)));
len = strlenW(ret)+1;
len = lstrlenW(ret)+1;
*ret_mime = CoTaskMemAlloc(len*sizeof(WCHAR));
if(!*ret_mime)
return E_OUTOFMEMORY;

View File

@ -286,13 +286,13 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri,
}
progid = path+1; /* skip '@' symbol */
colon_ptr = strchrW(path, ':');
colon_ptr = wcschr(path, ':');
if(!colon_ptr) {
SysFreeString(path);
return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER);
}
len = strlenW(path);
len = lstrlenW(path);
display_name = heap_alloc((len+1)*sizeof(WCHAR));
memcpy(display_name, path, (len+1)*sizeof(WCHAR));

View File

@ -307,7 +307,7 @@ HINTERNET get_internet_session(IInternetBindInfo *bind_info)
void update_user_agent(WCHAR *user_agent)
{
if(internet_session)
InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, strlenW(user_agent));
InternetSetOptionW(internet_session, INTERNET_OPTION_USER_AGENT, user_agent, lstrlenW(user_agent));
}
HRESULT protocol_start(Protocol *protocol, IInternetProtocol *prot, IUri *uri,

View File

@ -65,7 +65,7 @@ static const WCHAR wszZoneMapDomainsKey[] = {'S','o','f','t','w','a','r','e','\\
static inline BOOL is_drive_path(const WCHAR *path)
{
return isalphaW(*path) && *(path+1) == ':';
return iswalpha(*path) && *(path+1) == ':';
}
/* List of schemes types Windows seems to expect to be hierarchical. */
@ -184,8 +184,8 @@ static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone)
static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_wildcard, LPCWSTR *matched)
{
BOOL matches = FALSE;
DWORD pattern_len = strlenW(pattern);
DWORD str_len = strlenW(str);
DWORD pattern_len = lstrlenW(pattern);
DWORD str_len = lstrlenW(str);
TRACE("(%d) Checking if %s matches %s\n", implicit_wildcard, debugstr_w(str), debugstr_w(pattern));
@ -201,7 +201,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
* So in this case 'str' would have to end with ".google.com" in order
* to map to this pattern.
*/
if(str_len >= pattern_len+1 && !strcmpiW(str+(str_len-pattern_len+1), pattern+1)) {
if(str_len >= pattern_len+1 && !wcsicmp(str+(str_len-pattern_len+1), pattern+1)) {
/* Check if there's another '.' inside of the "unmatched" portion
* of 'str'.
*
@ -215,14 +215,10 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
* a match.
*/
const WCHAR *ptr;
if(str_len > pattern_len+1 && (ptr = memrchrW(str, '.', str_len-pattern_len-2))) {
if(implicit_wildcard) {
matches = TRUE;
*matched = ptr+1;
}
} else {
for (ptr = str + str_len - pattern_len; ptr > str; ptr--) if (ptr[-1] == '.') break;
if (ptr == str || implicit_wildcard) {
matches = TRUE;
*matched = str;
*matched = ptr;
}
}
} else if(implicit_wildcard && str_len > pattern_len) {
@ -241,7 +237,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
*
* Doesn't match the pattern.
*/
if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) {
if(str[str_len-pattern_len-1] == '.' && !wcsicmp(str+(str_len-pattern_len), pattern)) {
matches = TRUE;
*matched = str+(str_len-pattern_len);
}
@ -249,7 +245,7 @@ static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_w
/* The pattern doesn't have an implicit wildcard, or an explicit wildcard,
* so 'str' has to be an exact match to the 'pattern'.
*/
if(!strcmpiW(str, pattern)) {
if(!wcsicmp(str, pattern)) {
matches = TRUE;
*matched = str;
}
@ -409,7 +405,7 @@ static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain
* The mapping would only happen if the "org" key had an explicit subkey
* called "www".
*/
if(check_domain && !domain_offset && !strchrW(host, matched-host-1))
if(check_domain && !domain_offset && !wcschr(host, matched-host-1))
found = get_zone_for_scheme(domain_key, schema, zone);
}
RegCloseKey(domain_key);
@ -532,7 +528,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
if(FAILED(hres))
return hres;
if(!strcmpiW(scheme, fileW)) {
if(!wcsicmp(scheme, fileW)) {
BSTR path;
WCHAR *ptr, *path_start, root[20];
@ -547,7 +543,7 @@ static HRESULT map_security_uri_to_zone(IUri *uri, DWORD *zone)
else
path_start = path;
if((ptr = strchrW(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
if((ptr = wcschr(path_start, ':')) && ptr-path_start+1 < ARRAY_SIZE(root)) {
UINT type;
memcpy(root, path_start, (ptr-path_start+1)*sizeof(WCHAR));
@ -597,7 +593,7 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url)
hres = CoInternetGetSecurityUrl(url, &secur_url, PSU_SECURITY_URL_ONLY, 0);
if(hres != S_OK) {
DWORD size = strlenW(url)*sizeof(WCHAR);
DWORD size = lstrlenW(url)*sizeof(WCHAR);
secur_url = CoTaskMemAlloc(size);
if(!secur_url)
@ -1322,7 +1318,7 @@ static LPDWORD build_zonemap_from_reg(void)
data = new_data;
}
data[used] = atoiW(name);
data[used] = wcstol(name, NULL, 10);
}
}
if (used) {
@ -1875,7 +1871,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
if(!protocol_info)
break;
size = strlenW(url)+1;
size = lstrlenW(url)+1;
new_url = CoTaskMemAlloc(size*sizeof(WCHAR));
if(!new_url) {
hres = E_OUTOFMEMORY;
@ -1904,7 +1900,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
}
}
if(parse_hres != S_OK || !strcmpW(url, new_url))
if(parse_hres != S_OK || !wcscmp(url, new_url))
break;
CoTaskMemFree(alloc_url);
@ -1921,7 +1917,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
}
if(action == PSU_DEFAULT && (protocol_info = get_protocol_info(url))) {
size = strlenW(url)+1;
size = lstrlenW(url)+1;
new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
if(new_url) {
new_size = 0;
@ -1964,7 +1960,7 @@ static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **re
}
if(!alloc_url) {
size = strlenW(url)+1;
size = lstrlenW(url)+1;
alloc_url = CoTaskMemAlloc(size * sizeof(WCHAR));
if(!alloc_url)
return E_OUTOFMEMORY;
@ -2001,7 +1997,7 @@ HRESULT WINAPI CoInternetGetSecurityUrl(LPCWSTR pwzUrl, LPWSTR *ppwzSecUrl, PSUA
case URL_SCHEME_FTP:
case URL_SCHEME_HTTP:
case URL_SCHEME_HTTPS:
size = strlenW(secure_url)+1;
size = lstrlenW(secure_url)+1;
new_url = CoTaskMemAlloc(size * sizeof(WCHAR));
if(new_url)
hres = UrlGetPartW(secure_url, new_url, &size, URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME);

View File

@ -64,7 +64,7 @@ static name_space *find_name_space(LPCWSTR protocol)
name_space *iter;
LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
if(!strcmpiW(iter->protocol, protocol))
if(!wcsicmp(iter->protocol, protocol))
return iter;
}
@ -148,7 +148,7 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
EnterCriticalSection(&session_cs);
LIST_FOR_EACH_ENTRY(iter, &name_space_list, name_space, entry) {
if(iter->cf == cf && !strcmpiW(iter->protocol, protocol)) {
if(iter->cf == cf && !wcsicmp(iter->protocol, protocol)) {
list_remove(&iter->entry);
LeaveCriticalSection(&session_cs);
@ -265,7 +265,7 @@ IInternetProtocol *get_mime_filter(LPCWSTR mime)
EnterCriticalSection(&session_cs);
LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
if(!strcmpW(iter->mime, mime)) {
if(!wcscmp(iter->mime, mime)) {
cf = iter->cf;
break;
}
@ -408,7 +408,7 @@ static HRESULT WINAPI InternetSession_UnregisterMimeFilter(IInternetSession *ifa
EnterCriticalSection(&session_cs);
LIST_FOR_EACH_ENTRY(iter, &mime_filter_list, mime_filter, entry) {
if(iter->cf == pCF && !strcmpW(iter->mime, pwzType)) {
if(iter->cf == pCF && !wcscmp(iter->mime, pwzType)) {
list_remove(&iter->entry);
LeaveCriticalSection(&session_cs);
@ -561,8 +561,8 @@ static void ensure_useragent(void)
else
os_type = emptyW;
sprintfW(buf, formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
len = strlenW(buf);
swprintf(buf, ARRAY_SIZE(buf), formatW, is_nt, info.dwMajorVersion, info.dwMinorVersion, os_type);
len = lstrlenW(buf);
size = len+40;
ret = heap_alloc(size * sizeof(WCHAR));

View File

@ -804,7 +804,7 @@ HRESULT WINAPI MkParseDisplayNameEx(IBindCtx *pbc, LPCWSTR szDisplayName, ULONG
hres = CreateURLMoniker(NULL, szDisplayName, ppmk);
if(SUCCEEDED(hres)) {
*pchEaten = strlenW(szDisplayName);
*pchEaten = lstrlenW(szDisplayName);
return hres;
}
}
@ -887,7 +887,7 @@ HRESULT WINAPI URLDownloadToCacheFileW(LPUNKNOWN lpUnkCaller, LPCWSTR szURL, LPW
header, sizeof(header), NULL, NULL))
return E_FAIL;
if (strlenW(cache_path) > dwBufLength)
if (lstrlenW(cache_path) > dwBufLength)
return E_OUTOFMEMORY;
lstrcpyW(szFileName, cache_path);

View File

@ -18,6 +18,7 @@
*/
#include <limits.h>
#include <wchar.h>
#include "urlmon_main.h"
#include "wine/debug.h"
@ -518,7 +519,7 @@ static inline void pct_encode_val(WCHAR val, WCHAR *dest) {
*/
void find_domain_name(const WCHAR *host, DWORD host_len,
INT *domain_start) {
const WCHAR *last_tld, *sec_last_tld, *end;
const WCHAR *last_tld, *sec_last_tld, *end, *p;
end = host+host_len-1;
@ -530,12 +531,18 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
if(host_len < 4)
return;
last_tld = memrchrW(host, '.', host_len);
for (last_tld = sec_last_tld = NULL, p = host; p <= end; p++)
{
if (*p == '.')
{
sec_last_tld = last_tld;
last_tld = p;
}
}
if(!last_tld)
/* http://hostname -> has no domain name. */
return;
sec_last_tld = memrchrW(host, '.', last_tld-host);
if(!sec_last_tld) {
/* If the '.' is at the beginning of the host there
* has to be at least 3 characters in the TLD for it
@ -586,12 +593,8 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
if(last_tld - (sec_last_tld+1) == 3) {
for(i = 0; i < ARRAY_SIZE(recognized_tlds); ++i) {
if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) {
const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
if(!domain)
*domain_start = 0;
else
*domain_start = (domain+1) - host;
for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
*domain_start = p - host;
TRACE("Found domain name %s\n", debugstr_wn(host+*domain_start,
(host+host_len)-(host+*domain_start)));
return;
@ -604,12 +607,8 @@ void find_domain_name(const WCHAR *host, DWORD host_len,
* part of the TLD.
* Ex: www.google.fo.uk -> google.fo.uk as the domain name.
*/
const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host);
if(!domain)
*domain_start = 0;
else
*domain_start = (domain+1) - host;
for (p = sec_last_tld; p > host; p--) if (p[-1] == '.') break;
*domain_start = p - host;
}
} else {
/* The second to last TLD has more than 3 characters making it
@ -773,18 +772,18 @@ static BSTR pre_process_uri(LPCWSTR uri) {
start = uri;
/* Skip leading controls and whitespace. */
while(*start && (iscntrlW(*start) || isspaceW(*start))) ++start;
while(*start && (iswcntrl(*start) || iswspace(*start))) ++start;
/* URI consisted only of control/whitespace. */
if(!*start)
return SysAllocStringLen(NULL, 0);
end = start + strlenW(start);
while(--end > start && (iscntrlW(*end) || isspaceW(*end)));
end = start + lstrlenW(start);
while(--end > start && (iswcntrl(*end) || iswspace(*end)));
len = ++end - start;
for(ptr = start; ptr < end; ptr++) {
if(iscntrlW(*ptr))
if(iswcntrl(*ptr))
len--;
}
@ -793,7 +792,7 @@ static BSTR pre_process_uri(LPCWSTR uri) {
return NULL;
for(ptr = start, ptr2=ret; ptr < end; ptr++) {
if(!iscntrlW(*ptr))
if(!iswcntrl(*ptr))
*ptr2++ = *ptr;
}
@ -845,9 +844,9 @@ static DWORD ui2ipv4(WCHAR *dest, UINT address) {
if(!dest) {
WCHAR tmp[16];
ret = sprintfW(tmp, formatW, digits[0], digits[1], digits[2], digits[3]);
ret = swprintf(tmp, ARRAY_SIZE(tmp), formatW, digits[0], digits[1], digits[2], digits[3]);
} else
ret = sprintfW(dest, formatW, digits[0], digits[1], digits[2], digits[3]);
ret = swprintf(dest, 16, formatW, digits[0], digits[1], digits[2], digits[3]);
return ret;
}
@ -858,9 +857,9 @@ static DWORD ui2str(WCHAR *dest, UINT value) {
if(!dest) {
WCHAR tmp[11];
ret = sprintfW(tmp, formatW, value);
ret = swprintf(tmp, ARRAY_SIZE(tmp), formatW, value);
} else
ret = sprintfW(dest, formatW, value);
ret = swprintf(dest, 11, formatW, value);
return ret;
}
@ -1987,7 +1986,7 @@ static BOOL parse_hierpart(const WCHAR **ptr, parse_data *data, DWORD flags) {
/* For javascript: URIs, simply set everything as a path */
if(data->scheme_type == URL_SCHEME_JAVASCRIPT) {
data->path = *ptr;
data->path_len = strlenW(*ptr);
data->path_len = lstrlenW(*ptr);
data->is_opaque = TRUE;
*ptr += data->path_len;
return TRUE;
@ -2339,9 +2338,9 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
/* If NO_CANONICALIZE is not set, then windows lower cases the
* decoded value.
*/
if(!(flags & Uri_CREATE_NO_CANONICALIZE) && isupperW(val)) {
if(!(flags & Uri_CREATE_NO_CANONICALIZE) && iswupper(val)) {
if(!computeOnly)
uri->canon_uri[uri->canon_len] = tolowerW(val);
uri->canon_uri[uri->canon_len] = towlower(val);
} else {
if(!computeOnly)
uri->canon_uri[uri->canon_len] = val;
@ -2369,8 +2368,8 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
/* The percent encoded value gets lower cased also. */
if(!(flags & Uri_CREATE_NO_CANONICALIZE)) {
uri->canon_uri[uri->canon_len+1] = tolowerW(uri->canon_uri[uri->canon_len+1]);
uri->canon_uri[uri->canon_len+2] = tolowerW(uri->canon_uri[uri->canon_len+2]);
uri->canon_uri[uri->canon_len+1] = towlower(uri->canon_uri[uri->canon_len+1]);
uri->canon_uri[uri->canon_len+2] = towlower(uri->canon_uri[uri->canon_len+2]);
}
}
@ -2378,7 +2377,7 @@ static BOOL canonicalize_reg_name(const parse_data *data, Uri *uri,
} else {
if(!computeOnly) {
if(!(flags & Uri_CREATE_NO_CANONICALIZE) && known_scheme)
uri->canon_uri[uri->canon_len] = tolowerW(*ptr);
uri->canon_uri[uri->canon_len] = towlower(*ptr);
else
uri->canon_uri[uri->canon_len] = *ptr;
}
@ -2645,11 +2644,11 @@ static BOOL canonicalize_ipv6address(const parse_data *data, Uri *uri,
static const WCHAR formatW[] = {'%','x',0};
if(!computeOnly)
uri->canon_len += sprintfW(uri->canon_uri+uri->canon_len,
uri->canon_len += swprintf(uri->canon_uri+uri->canon_len, 5,
formatW, values[i]);
else {
WCHAR tmp[5];
uri->canon_len += sprintfW(tmp, formatW, values[i]);
uri->canon_len += swprintf(tmp, ARRAY_SIZE(tmp), formatW, values[i]);
}
}
}
@ -3307,7 +3306,7 @@ static BOOL canonicalize_scheme(const parse_data *data, Uri *uri, DWORD flags, B
for(i = 0; i < data->scheme_len; ++i) {
/* Scheme name must be lower case after canonicalization. */
uri->canon_uri[i + pos] = tolowerW(data->scheme[i]);
uri->canon_uri[i + pos] = towlower(data->scheme[i]);
}
uri->canon_uri[i + pos] = ':';
@ -3889,7 +3888,7 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
}
/* Fast path */
if(a->path_len == b->path_len && !strncmpiW(a->canon_uri+a->path_start, b->canon_uri+b->path_start, a->path_len)) {
if(a->path_len == b->path_len && !wcsnicmp(a->canon_uri+a->path_start, b->canon_uri+b->path_start, a->path_len)) {
*ret = TRUE;
return S_OK;
}
@ -3909,7 +3908,7 @@ static HRESULT compare_file_paths(const Uri *a, const Uri *b, BOOL *ret)
len_a = canonicalize_path_hierarchical(a->canon_uri+a->path_start, a->path_len, a->scheme_type, FALSE, 0, FALSE, canon_path_a);
len_b = canonicalize_path_hierarchical(b->canon_uri+b->path_start, b->path_len, b->scheme_type, FALSE, 0, FALSE, canon_path_b);
*ret = len_a == len_b && !strncmpiW(canon_path_a, canon_path_b, len_a);
*ret = len_a == len_b && !wcsnicmp(canon_path_a, canon_path_b, len_a);
heap_free(canon_path_a);
heap_free(canon_path_b);
@ -6417,21 +6416,18 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len,
/* If not found, try finding the end of @xxx: */
if(end == base+base_len-1)
end = *base == '@' ? memchr(base, ':', base_len) : NULL;
end = *base == '@' ? wmemchr(base, ':', base_len) : NULL;
}else {
/* Find the characters that will be copied over from the base path. */
end = memrchrW(base, '/', base_len);
if(!end && data->scheme_type == URL_SCHEME_FILE)
for (end = base + base_len - 1; end >= base; end--) if (*end == '/') break;
if(end < base && data->scheme_type == URL_SCHEME_FILE)
/* Try looking for a '\\'. */
end = memrchrW(base, '\\', base_len);
for (end = base + base_len - 1; end >= base; end--) if (*end == '\\') break;
}
}
if(end) {
base_copy_len = (end+1)-base;
*result = heap_alloc((base_copy_len+relative_len+1)*sizeof(WCHAR));
} else
*result = heap_alloc((relative_len+1)*sizeof(WCHAR));
if (end) base_copy_len = (end+1)-base;
*result = heap_alloc((base_copy_len+relative_len+1)*sizeof(WCHAR));
if(!(*result)) {
*result_len = 0;
@ -6439,10 +6435,8 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len,
}
ptr = *result;
if(end) {
memcpy(ptr, base, base_copy_len*sizeof(WCHAR));
ptr += base_copy_len;
}
memcpy(ptr, base, base_copy_len*sizeof(WCHAR));
ptr += base_copy_len;
memcpy(ptr, relative, relative_len*sizeof(WCHAR));
ptr += relative_len;

View File

@ -608,7 +608,7 @@ HRESULT WINAPI CopyStgMedium(const STGMEDIUM *src, STGMEDIUM *dst)
break;
case TYMED_FILE:
if(src->u.lpszFileName && !src->pUnkForRelease) {
DWORD size = (strlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
DWORD size = (lstrlenW(src->u.lpszFileName)+1)*sizeof(WCHAR);
dst->u.lpszFileName = CoTaskMemAlloc(size);
if(!dst->u.lpszFileName)
return E_OUTOFMEMORY;
@ -674,7 +674,7 @@ HRESULT WINAPI CopyBindInfo(const BINDINFO *pcbiSrc, BINDINFO *pcbiDest)
size = FIELD_OFFSET(BINDINFO, szExtraInfo)+sizeof(void*);
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szExtraInfo) {
size = (strlenW(pcbiSrc->szExtraInfo)+1)*sizeof(WCHAR);
size = (lstrlenW(pcbiSrc->szExtraInfo)+1)*sizeof(WCHAR);
pcbiDest->szExtraInfo = CoTaskMemAlloc(size);
if(!pcbiDest->szExtraInfo)
return E_OUTOFMEMORY;
@ -692,7 +692,7 @@ HRESULT WINAPI CopyBindInfo(const BINDINFO *pcbiSrc, BINDINFO *pcbiDest)
size = FIELD_OFFSET(BINDINFO, szCustomVerb)+sizeof(void*);
if(pcbiSrc->cbSize>=size && pcbiDest->cbSize>=size && pcbiSrc->szCustomVerb) {
size = (strlenW(pcbiSrc->szCustomVerb)+1)*sizeof(WCHAR);
size = (lstrlenW(pcbiSrc->szCustomVerb)+1)*sizeof(WCHAR);
pcbiDest->szCustomVerb = CoTaskMemAlloc(size);
if(!pcbiDest->szCustomVerb) {
CoTaskMemFree(pcbiDest->szExtraInfo);

View File

@ -31,7 +31,6 @@
#include "urlmon.h"
#include "wininet.h"
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
@ -244,7 +243,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
if(str) {
DWORD size;
size = (strlenW(str)+1)*sizeof(WCHAR);
size = (lstrlenW(str)+1)*sizeof(WCHAR);
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);