Thomas Mullaly : urlmon: Can' t set the scheme name of a IUriBuilder to NULL or an empty string.
Alexandre Julliard
julliard at winehq.org
Sat Sep 18 07:42:20 CDT 2010
Module: wine
Branch: master
Commit: 0da2e4c39f9af74ffb82d47fa275cf3612a03cc7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0da2e4c39f9af74ffb82d47fa275cf3612a03cc7
Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date: Sun Sep 12 00:20:15 2010 -0400
urlmon: Can't set the scheme name of a IUriBuilder to NULL or an empty string.
---
dlls/urlmon/tests/uri.c | 78 +++++++++++++++++++++++++++++++++++++++++++++-
dlls/urlmon/uri.c | 14 +++++---
2 files changed, 84 insertions(+), 8 deletions(-)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c
index 3045b3d..85eb1e7 100644
--- a/dlls/urlmon/tests/uri.c
+++ b/dlls/urlmon/tests/uri.c
@@ -4922,6 +4922,72 @@ static const uri_builder_test uri_builder_tests[] = {
{URL_SCHEME_HTTP,S_OK},
{URLZONE_INVALID,E_NOTIMPL}
}
+ },
+ /* Can't set the scheme name to NULL. */
+ { "zip://google.com/",0,S_OK,FALSE,
+ {
+ {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
+ },
+ {FALSE},
+ 0,S_OK,TRUE,
+ 0,S_OK,TRUE,
+ 0,0,0,S_OK,TRUE,
+ {
+ {"zip://google.com/",S_OK},
+ {"google.com",S_OK},
+ {"zip://google.com/",S_OK},
+ {"google.com",S_OK},
+ {"",S_FALSE},
+ {"",S_FALSE},
+ {"google.com",S_OK},
+ {"",S_FALSE},
+ {"/",S_OK},
+ {"/",S_OK},
+ {"",S_FALSE},
+ {"zip://google.com/",S_OK},
+ {"zip",S_OK},
+ {"",S_FALSE},
+ {"",S_FALSE}
+ },
+ {
+ {Uri_HOST_DNS,S_OK},
+ {0,S_FALSE},
+ {URL_SCHEME_UNKNOWN,S_OK},
+ {URLZONE_INVALID,E_NOTIMPL}
+ }
+ },
+ /* Can't set the scheme name to an empty string. */
+ { "zip://google.com/",0,S_OK,FALSE,
+ {
+ {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
+ },
+ {FALSE},
+ 0,S_OK,TRUE,
+ 0,S_OK,TRUE,
+ 0,0,0,S_OK,TRUE,
+ {
+ {"zip://google.com/",S_OK},
+ {"google.com",S_OK},
+ {"zip://google.com/",S_OK},
+ {"google.com",S_OK},
+ {"",S_FALSE},
+ {"",S_FALSE},
+ {"google.com",S_OK},
+ {"",S_FALSE},
+ {"/",S_OK},
+ {"/",S_OK},
+ {"",S_FALSE},
+ {"zip://google.com/",S_OK},
+ {"zip",S_OK},
+ {"",S_FALSE},
+ {"",S_FALSE}
+ },
+ {
+ {Uri_HOST_DNS,S_OK},
+ {0,S_FALSE},
+ {URL_SCHEME_UNKNOWN,S_OK},
+ {URLZONE_INVALID,E_NOTIMPL}
+ }
}
};
@@ -4975,6 +5041,11 @@ static const uri_builder_remove_test uri_builder_remove_tests[] = {
{ "http://google.com/?test=x",0,S_OK,FALSE,
Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
"http://google.com/?test=x",0,S_OK,TRUE
+ },
+ /* Can't remove the scheme name. */
+ { "http://google.com/?test=x",0,S_OK,FALSE,
+ Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
+ "http://google.com/?test=x",0,S_OK,TRUE
}
};
@@ -7519,7 +7590,7 @@ static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder
prop = &(test->properties[i]);
}
- if(prop) {
+ if(prop && prop->value && *prop->value) {
/* Use expected_value unless it's NULL, then use value. */
LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
hr = IUriBuilder_GetUserName(builder, &len, &received);
@@ -7652,8 +7723,11 @@ static void test_IUriBuilder(void) {
for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
uri_builder_property prop = test.properties[j];
if(prop.change) {
- modified = TRUE;
change_property(builder, &prop, i);
+ if(prop.property != Uri_PROPERTY_SCHEME_NAME)
+ modified = TRUE;
+ else if(prop.value && *prop.value)
+ modified = TRUE;
}
}
diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c
index e69f090..b1304d8 100644
--- a/dlls/urlmon/uri.c
+++ b/dlls/urlmon/uri.c
@@ -4729,8 +4729,13 @@ static HRESULT WINAPI UriBuilder_SetSchemeName(IUriBuilder *iface, LPCWSTR pwzNe
{
UriBuilder *This = URIBUILDER_THIS(iface);
TRACE("(%p)->(%s)\n", This, debugstr_w(pwzNewValue));
- return set_builder_component(&This->scheme, &This->scheme_len, pwzNewValue, 0,
- &This->modified_props, Uri_HAS_SCHEME_NAME);
+
+ /* Only set the scheme name if it's not NULL or empty. */
+ if(pwzNewValue && *pwzNewValue)
+ return set_builder_component(&This->scheme, &This->scheme_len, pwzNewValue, 0,
+ &This->modified_props, Uri_HAS_SCHEME_NAME);
+ else
+ return E_INVALIDARG;
}
static HRESULT WINAPI UriBuilder_SetUserName(IUriBuilder *iface, LPCWSTR pwzNewValue)
@@ -4745,7 +4750,7 @@ static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPr
{
const DWORD accepted_flags = Uri_HAS_AUTHORITY|Uri_HAS_DOMAIN|Uri_HAS_EXTENSION|Uri_HAS_FRAGMENT|Uri_HAS_HOST|
Uri_HAS_PASSWORD|Uri_HAS_PATH|Uri_HAS_PATH_AND_QUERY|Uri_HAS_QUERY|
- Uri_HAS_SCHEME_NAME|Uri_HAS_USER_INFO|Uri_HAS_USER_NAME;
+ Uri_HAS_USER_INFO|Uri_HAS_USER_NAME;
UriBuilder *This = URIBUILDER_THIS(iface);
TRACE("(%p)->(0x%08x)\n", This, dwPropertyMask);
@@ -4771,9 +4776,6 @@ static HRESULT WINAPI UriBuilder_RemoveProperties(IUriBuilder *iface, DWORD dwPr
if(dwPropertyMask & Uri_HAS_QUERY)
UriBuilder_SetQuery(iface, NULL);
- if(dwPropertyMask & Uri_HAS_SCHEME_NAME)
- UriBuilder_SetSchemeName(iface, NULL);
-
if(dwPropertyMask & Uri_HAS_USER_NAME)
UriBuilder_SetUserName(iface, NULL);
More information about the wine-cvs
mailing list