Module: wine Branch: master Commit: c086429465cbe9387349ef6835dfa4ac1b33e654 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c086429465cbe9387349ef6835...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Jul 9 20:02:23 2008 +0200
shlwapi: Fixed handling mk protocol URLs in UrlCombineW.
---
dlls/shlwapi/tests/url.c | 2 ++ dlls/shlwapi/url.c | 42 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c index 4eb581f..ede4d7c 100644 --- a/dlls/shlwapi/tests/url.c +++ b/dlls/shlwapi/tests/url.c @@ -234,6 +234,8 @@ static const TEST_URL_COMBINE TEST_COMBINE[] = { {"foo:today", "bar:calendar", 0, S_OK, "bar:calendar"}, {"foo:/today", "foo:calendar", 0, S_OK, "foo:/calendar"}, {"foo:/today/", "foo:calendar", 0, S_OK, "foo:/today/calendar"}, + {"mk:@MSITStore:dir/test.chm::dir/index.html", "image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"}, + {"mk:@MSITStore:dir/test.chm::dir/dir2/index.html", "../image.jpg", 0, S_OK, "mk:@MSITStore:dir/test.chm::dir/image.jpg"} };
/* ################ */ diff --git a/dlls/shlwapi/url.c b/dlls/shlwapi/url.c index 00d319d..03941a9 100644 --- a/dlls/shlwapi/url.c +++ b/dlls/shlwapi/url.c @@ -659,29 +659,29 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, base.pszSuffix += delta; base.cchSuffix -= delta; } - } - - /* get size of location field (if it exists) */ - work = (LPWSTR)base.pszSuffix; - sizeloc = 0; - if (*work++ == '/') { + }else { + /* get size of location field (if it exists) */ + work = (LPWSTR)base.pszSuffix; + sizeloc = 0; if (*work++ == '/') { - /* At this point have start of location and - * it ends at next '/' or end of string. - */ - while(*work && (*work != '/')) work++; - sizeloc = (DWORD)(work - base.pszSuffix); - } - } + if (*work++ == '/') { + /* At this point have start of location and + * it ends at next '/' or end of string. + */ + while(*work && (*work != '/')) work++; + sizeloc = (DWORD)(work - base.pszSuffix); + } + } + }
- /* Change .sizep2 to not have the last leaf in it, - * Note: we need to start after the location (if it exists) - */ + /* Change .sizep2 to not have the last leaf in it, + * Note: we need to start after the location (if it exists) + */ work = strrchrW((base.pszSuffix+sizeloc), '/'); - if (work) { - len = (DWORD)(work - base.pszSuffix + 1); - base.cchSuffix = len; - } + if (work) { + len = (DWORD)(work - base.pszSuffix + 1); + base.cchSuffix = len; + }
/* * At this point: @@ -723,7 +723,7 @@ HRESULT WINAPI UrlCombineW(LPCWSTR pszBase, LPCWSTR pszRelative, process_case = 4; break; } - process_case = (*base.pszSuffix == '/') ? 5 : 3; + process_case = (*base.pszSuffix == '/' || base.nScheme == URL_SCHEME_MK) ? 5 : 3; break; }