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
e0f6b95d
Commit
e0f6b95d
authored
Nov 25, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Nov 25, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Properly compare file URIs.
parent
29cdb357
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
8 deletions
+51
-8
uri.c
dlls/urlmon/uri.c
+51
-8
No files found.
dlls/urlmon/uri.c
View file @
e0f6b95d
...
...
@@ -3859,6 +3859,49 @@ static HRESULT validate_components(const UriBuilder *builder, parse_data *data,
return
S_OK
;
}
static
HRESULT
compare_file_paths
(
const
Uri
*
a
,
const
Uri
*
b
,
BOOL
*
ret
)
{
WCHAR
*
canon_path_a
,
*
canon_path_b
;
DWORD
len_a
,
len_b
;
if
(
!
a
->
path_len
)
{
*
ret
=
!
b
->
path_len
;
return
S_OK
;
}
if
(
!
b
->
path_len
)
{
*
ret
=
FALSE
;
return
S_OK
;
}
/* Fast path */
if
(
a
->
path_len
==
b
->
path_len
&&
!
memicmpW
(
a
->
canon_uri
+
a
->
path_start
,
b
->
canon_uri
+
b
->
path_start
,
a
->
path_len
))
{
*
ret
=
TRUE
;
return
S_OK
;
}
len_a
=
canonicalize_path_hierarchical
(
a
->
canon_uri
+
a
->
path_start
,
a
->
path_len
,
a
->
scheme_type
,
FALSE
,
0
,
NULL
);
len_b
=
canonicalize_path_hierarchical
(
b
->
canon_uri
+
b
->
path_start
,
b
->
path_len
,
b
->
scheme_type
,
FALSE
,
0
,
NULL
);
canon_path_a
=
heap_alloc
(
len_a
*
sizeof
(
WCHAR
));
if
(
!
canon_path_a
)
return
E_OUTOFMEMORY
;
canon_path_b
=
heap_alloc
(
len_b
*
sizeof
(
WCHAR
));
if
(
!
canon_path_b
)
{
heap_free
(
canon_path_a
);
return
E_OUTOFMEMORY
;
}
len_a
=
canonicalize_path_hierarchical
(
a
->
canon_uri
+
a
->
path_start
,
a
->
path_len
,
a
->
scheme_type
,
FALSE
,
0
,
canon_path_a
);
len_b
=
canonicalize_path_hierarchical
(
b
->
canon_uri
+
b
->
path_start
,
b
->
path_len
,
b
->
scheme_type
,
FALSE
,
0
,
canon_path_b
);
*
ret
=
len_a
==
len_b
&&
!
memicmpW
(
canon_path_a
,
canon_path_b
,
len_a
);
heap_free
(
canon_path_a
);
heap_free
(
canon_path_b
);
return
S_OK
;
}
/* Checks if the two Uri's are logically equivalent. It's a simple
* comparison, since they are both of type Uri, and it can access
* the properties of each Uri directly without the need to go
...
...
@@ -3867,19 +3910,13 @@ static HRESULT validate_components(const UriBuilder *builder, parse_data *data,
static
HRESULT
compare_uris
(
const
Uri
*
a
,
const
Uri
*
b
,
BOOL
*
ret
)
{
const
BOOL
known_scheme
=
a
->
scheme_type
!=
URL_SCHEME_UNKNOWN
;
const
BOOL
are_hierarchical
=
a
->
authority_start
>
-
1
&&
b
->
authority_start
>
-
1
;
HRESULT
hres
;
*
ret
=
FALSE
;
if
(
a
->
scheme_type
!=
b
->
scheme_type
)
return
S_OK
;
if
(
a
->
scheme_type
==
URL_SCHEME_FILE
)
{
if
(
a
->
canon_len
==
b
->
canon_len
)
{
*
ret
=
!
StrCmpIW
(
a
->
canon_uri
,
b
->
canon_uri
);
return
S_OK
;
}
}
/* Only compare the scheme names (if any) if their unknown scheme types. */
if
(
!
known_scheme
)
{
if
((
a
->
scheme_start
>
-
1
&&
b
->
scheme_start
>
-
1
)
&&
...
...
@@ -3927,7 +3964,13 @@ static HRESULT compare_uris(const Uri *a, const Uri *b, BOOL *ret) {
* would still evaluate to TRUE, but, only if they are both hierarchical
* URIs.
*/
if
((
a
->
path_start
>
-
1
&&
b
->
path_start
>
-
1
)
&&
if
(
a
->
scheme_type
==
URL_SCHEME_FILE
)
{
BOOL
cmp
;
hres
=
compare_file_paths
(
a
,
b
,
&
cmp
);
if
(
FAILED
(
hres
)
||
!
cmp
)
return
hres
;
}
else
if
((
a
->
path_start
>
-
1
&&
b
->
path_start
>
-
1
)
&&
(
a
->
path_len
==
b
->
path_len
))
{
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
path_start
,
b
->
canon_uri
+
b
->
path_start
,
a
->
path_len
))
return
S_OK
;
...
...
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