Module: wine Branch: master Commit: cfc0f97d93ccac3fa11c574978a3d1ff69581d61 URL: http://source.winehq.org/git/wine.git/?a=commit;h=cfc0f97d93ccac3fa11c574978...
Author: Thomas Mullaly thomas.mullaly@gmail.com Date: Thu Jun 24 16:24:48 2010 -0400
urlmon: Partially implemented IUri_GetHost.
---
dlls/urlmon/tests/uri.c | 14 +++++++------- dlls/urlmon/uri.c | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index 217654c..46b2d64 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -329,7 +329,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {".txt",S_OK,TRUE}, {"",S_FALSE,TRUE}, - {"127.0.0.1",S_OK,TRUE}, + {"127.0.0.1",S_OK,FALSE}, {"",S_FALSE,FALSE}, {"/test%20dir/test.txt",S_OK,TRUE}, {"/test%20dir/test.txt",S_OK,TRUE}, @@ -1233,7 +1233,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, - {"127.0.0.100",S_OK,TRUE}, + {"127.0.0.100",S_OK,FALSE}, {"",S_FALSE,FALSE}, {"/",S_OK,TRUE}, {"/",S_OK,TRUE}, @@ -1263,7 +1263,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, - {"127.0.0.0",S_OK,TRUE}, + {"127.0.0.0",S_OK,FALSE}, {"",S_FALSE,FALSE}, {"/",S_OK,TRUE}, {"/",S_OK,TRUE}, @@ -1293,7 +1293,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, - {"0.1.226.64",S_OK,TRUE}, + {"0.1.226.64",S_OK,FALSE}, {"",S_FALSE,FALSE}, {"/",S_OK,TRUE}, {"/",S_OK,TRUE}, @@ -1323,7 +1323,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, - {"255.255.255.255",S_OK,TRUE}, + {"255.255.255.255",S_OK,FALSE}, {"",S_FALSE,FALSE}, {"/",S_OK,TRUE}, {"/",S_OK,TRUE}, @@ -1383,7 +1383,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, - {"4294967295",S_OK,TRUE}, + {"4294967295",S_OK,FALSE}, {"",S_FALSE,FALSE}, {"/",S_OK,TRUE}, {"/",S_OK,TRUE}, @@ -1413,7 +1413,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, {"",S_FALSE,TRUE}, - {"127.001",S_OK,TRUE}, + {"127.001",S_OK,FALSE}, {"",S_FALSE,FALSE}, {"/",S_OK,TRUE}, {"/",S_OK,TRUE}, diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index 060b92e..82f48a0 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -1241,6 +1241,22 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST }
switch(uriProp) { + case Uri_PROPERTY_HOST: + if(This->host_start > -1) { + *pbstrProperty = SysAllocStringLen(This->canon_uri+This->host_start, This->host_len); + hres = S_OK; + } else { + /* Canonicalizing/parsing the host of a URI is only partially + * implemented, so return E_NOTIMPL for now. + */ + FIXME("(%p)->(%d %p %x) Partially implemented\n", This, uriProp, pbstrProperty, dwFlags); + return E_NOTIMPL; + } + + if(!(*pbstrProperty)) + hres = E_OUTOFMEMORY; + + break; case Uri_PROPERTY_PASSWORD: if(This->userinfo_split > -1) { *pbstrProperty = SysAllocStringLen( @@ -1338,6 +1354,18 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D }
switch(uriProp) { + case Uri_PROPERTY_HOST: + if(This->host_start == -1) { + /* Canonicalizing/parsing the host of a URI is only partially + * implemented, so return E_NOTIMPL for now. + */ + FIXME("(%p)->(%d %p %x) Partially implemented\n", This, uriProp, pcchProperty, dwFlags); + return E_NOTIMPL; + } + + *pcchProperty = This->host_len; + hres = (This->host_start > -1) ? S_OK : S_FALSE; + break; case Uri_PROPERTY_PASSWORD: *pcchProperty = (This->userinfo_split > -1) ? This->userinfo_len-This->userinfo_split-1 : 0; hres = (This->userinfo_split > -1) ? S_OK : S_FALSE; @@ -1483,13 +1511,8 @@ static HRESULT WINAPI Uri_GetFragment(IUri *iface, BSTR *pstrFragment)
static HRESULT WINAPI Uri_GetHost(IUri *iface, BSTR *pstrHost) { - Uri *This = URI_THIS(iface); - FIXME("(%p)->(%p)\n", This, pstrHost); - - if(!pstrHost) - return E_POINTER; - - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", iface, pstrHost); + return Uri_GetPropertyBSTR(iface, Uri_PROPERTY_HOST, pstrHost, 0); }
static HRESULT WINAPI Uri_GetPassword(IUri *iface, BSTR *pstrPassword)