Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
6e4ead77
Commit
6e4ead77
authored
Aug 07, 2010
by
Thomas Mullaly
Committed by
Alexandre Julliard
Aug 18, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Implemented CreateUriWithFragment.
parent
39001c30
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
26 deletions
+66
-26
uri.c
dlls/urlmon/tests/uri.c
+16
-24
uri.c
dlls/urlmon/uri.c
+50
-2
No files found.
dlls/urlmon/tests/uri.c
View file @
6e4ead77
...
...
@@ -3715,21 +3715,21 @@ typedef struct _uri_with_fragment {
static
const
uri_with_fragment
uri_fragment_tests
[]
=
{
{
"http://google.com/"
,
"#fragment"
,
0
,
S_OK
,
TRU
E
,
"http://google.com/#fragment"
,
TRU
E
"http://google.com/"
,
"#fragment"
,
0
,
S_OK
,
FALS
E
,
"http://google.com/#fragment"
,
FALS
E
},
{
"http://google.com/"
,
"fragment"
,
0
,
S_OK
,
TRU
E
,
"http://google.com/#fragment"
,
TRU
E
"http://google.com/"
,
"fragment"
,
0
,
S_OK
,
FALS
E
,
"http://google.com/#fragment"
,
FALS
E
},
{
"zip://test.com/"
,
"?test"
,
0
,
S_OK
,
TRU
E
,
"zip://test.com/#?test"
,
TRU
E
"zip://test.com/"
,
"?test"
,
0
,
S_OK
,
FALS
E
,
"zip://test.com/#?test"
,
FALS
E
},
/* The fragment can be empty. */
{
"ftp://ftp.google.com/"
,
""
,
0
,
S_OK
,
TRU
E
,
"ftp://ftp.google.com/#"
,
TRU
E
"ftp://ftp.google.com/"
,
""
,
0
,
S_OK
,
FALS
E
,
"ftp://ftp.google.com/#"
,
FALS
E
}
};
...
...
@@ -4802,23 +4802,17 @@ static void test_CreateUriWithFragment_InvalidArgs(void) {
const
WCHAR
fragmentW
[]
=
{
'#'
,
'f'
,
'r'
,
'a'
,
'g'
,
'm'
,
'e'
,
'n'
,
't'
,
0
};
hr
=
pCreateUriWithFragment
(
NULL
,
fragmentW
,
0
,
0
,
&
uri
);
todo_wine
{
ok
(
hr
==
E_INVALIDARG
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
E_INVALIDARG
);
}
todo_wine
{
ok
(
uri
==
NULL
,
"Error: Expected uri to be NULL, but was %p instead.
\n
"
,
uri
);
}
ok
(
hr
==
E_INVALIDARG
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
E_INVALIDARG
);
ok
(
uri
==
NULL
,
"Error: Expected uri to be NULL, but was %p instead.
\n
"
,
uri
);
hr
=
pCreateUriWithFragment
(
http_urlW
,
fragmentW
,
0
,
0
,
NULL
);
todo_wine
{
ok
(
hr
==
E_INVALIDARG
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
E_INVALIDARG
);
}
ok
(
hr
==
E_INVALIDARG
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
E_INVALIDARG
);
/* Original URI can't already contain a fragment component. */
uri
=
(
void
*
)
0xdeadbeef
;
hr
=
pCreateUriWithFragment
(
http_url_fragW
,
fragmentW
,
0
,
0
,
&
uri
);
todo_wine
{
ok
(
hr
==
E_INVALIDARG
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
E_INVALIDARG
);
}
todo_wine
{
ok
(
uri
==
NULL
,
"Error: Expected uri to be NULL, but was %p instead.
\n
"
,
uri
);
}
ok
(
hr
==
E_INVALIDARG
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.
\n
"
,
hr
,
E_INVALIDARG
);
ok
(
uri
==
NULL
,
"Error: Expected uri to be NULL, but was %p instead.
\n
"
,
uri
);
}
/* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
...
...
@@ -4830,11 +4824,9 @@ static void test_CreateUriWithFragment_InvalidFlags(void) {
IUri
*
uri
=
(
void
*
)
0xdeadbeef
;
hr
=
pCreateUriWithFragment
(
http_urlW
,
NULL
,
invalid_flag_tests
[
i
].
flags
,
0
,
&
uri
);
todo_wine
{
ok
(
hr
==
invalid_flag_tests
[
i
].
expected
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.
\n
"
,
hr
,
invalid_flag_tests
[
i
].
expected
,
invalid_flag_tests
[
i
].
flags
);
}
todo_wine
{
ok
(
uri
==
NULL
,
"Error: Expected uri to be NULL, but was %p instead.
\n
"
,
uri
);
}
ok
(
hr
==
invalid_flag_tests
[
i
].
expected
,
"Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.
\n
"
,
hr
,
invalid_flag_tests
[
i
].
expected
,
invalid_flag_tests
[
i
].
flags
);
ok
(
uri
==
NULL
,
"Error: Expected uri to be NULL, but was %p instead.
\n
"
,
uri
);
}
}
...
...
dlls/urlmon/uri.c
View file @
6e4ead77
...
...
@@ -3952,8 +3952,56 @@ HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IU
HRESULT
WINAPI
CreateUriWithFragment
(
LPCWSTR
pwzURI
,
LPCWSTR
pwzFragment
,
DWORD
dwFlags
,
DWORD_PTR
dwReserved
,
IUri
**
ppURI
)
{
FIXME
(
"(%s %s %x %x %p)
\n
"
,
debugstr_w
(
pwzURI
),
debugstr_w
(
pwzFragment
),
dwFlags
,
(
DWORD
)
dwReserved
,
ppURI
);
return
E_NOTIMPL
;
HRESULT
hres
;
TRACE
(
"(%s %s %x %x %p)
\n
"
,
debugstr_w
(
pwzURI
),
debugstr_w
(
pwzFragment
),
dwFlags
,
(
DWORD
)
dwReserved
,
ppURI
);
if
(
!
ppURI
)
return
E_INVALIDARG
;
if
(
!
pwzURI
)
{
*
ppURI
=
NULL
;
return
E_INVALIDARG
;
}
/* Check if a fragment should be appended to the URI string. */
if
(
pwzFragment
)
{
WCHAR
*
uriW
;
DWORD
uri_len
,
frag_len
;
BOOL
add_pound
;
/* Check if the original URI already has a fragment component. */
if
(
StrChrW
(
pwzURI
,
'#'
))
{
*
ppURI
=
NULL
;
return
E_INVALIDARG
;
}
uri_len
=
lstrlenW
(
pwzURI
);
frag_len
=
lstrlenW
(
pwzFragment
);
/* If the fragment doesn't start with a '#', one will be added. */
add_pound
=
*
pwzFragment
!=
'#'
;
if
(
add_pound
)
uriW
=
heap_alloc
((
uri_len
+
frag_len
+
2
)
*
sizeof
(
WCHAR
));
else
uriW
=
heap_alloc
((
uri_len
+
frag_len
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
uriW
)
return
E_OUTOFMEMORY
;
memcpy
(
uriW
,
pwzURI
,
uri_len
*
sizeof
(
WCHAR
));
if
(
add_pound
)
uriW
[
uri_len
++
]
=
'#'
;
memcpy
(
uriW
+
uri_len
,
pwzFragment
,
(
frag_len
+
1
)
*
sizeof
(
WCHAR
));
hres
=
CreateUri
(
uriW
,
dwFlags
,
0
,
ppURI
);
heap_free
(
uriW
);
}
else
/* A fragment string wasn't specified, so just forward the call. */
hres
=
CreateUri
(
pwzURI
,
dwFlags
,
0
,
ppURI
);
return
hres
;
}
#define URIBUILDER_THIS(iface) DEFINE_THIS(UriBuilder, IUriBuilder, iface)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment