Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
bb8a0580
Commit
bb8a0580
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: Reduce indention in are_equal_simple and move it.
parent
f38e0be5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
98 deletions
+96
-98
uri.c
dlls/urlmon/uri.c
+96
-98
No files found.
dlls/urlmon/uri.c
View file @
bb8a0580
...
@@ -428,104 +428,6 @@ static inline BOOL is_hierarchical_uri(const WCHAR **ptr, const parse_data *data
...
@@ -428,104 +428,6 @@ static inline BOOL is_hierarchical_uri(const WCHAR **ptr, const parse_data *data
return
FALSE
;
return
FALSE
;
}
}
/* 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
* through the "IUri_Get*" interface calls.
*/
static
BOOL
are_equal_simple
(
const
Uri
*
a
,
const
Uri
*
b
)
{
if
(
a
->
scheme_type
==
b
->
scheme_type
)
{
const
BOOL
known_scheme
=
a
->
scheme_type
!=
URL_SCHEME_UNKNOWN
;
const
BOOL
are_hierarchical
=
(
a
->
authority_start
>
-
1
&&
b
->
authority_start
>
-
1
);
if
(
a
->
scheme_type
==
URL_SCHEME_FILE
)
{
if
(
a
->
canon_len
==
b
->
canon_len
)
return
!
StrCmpIW
(
a
->
canon_uri
,
b
->
canon_uri
);
}
/* Only compare the scheme names (if any) if their unknown scheme types. */
if
(
!
known_scheme
)
{
if
((
a
->
scheme_start
>
-
1
&&
b
->
scheme_start
>
-
1
)
&&
(
a
->
scheme_len
==
b
->
scheme_len
))
{
/* Make sure the schemes are the same. */
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
scheme_start
,
b
->
canon_uri
+
b
->
scheme_start
,
a
->
scheme_len
))
return
FALSE
;
}
else
if
(
a
->
scheme_len
!=
b
->
scheme_len
)
/* One of the Uri's has a scheme name, while the other doesn't. */
return
FALSE
;
}
/* If they have a userinfo component, perform case sensitive compare. */
if
((
a
->
userinfo_start
>
-
1
&&
b
->
userinfo_start
>
-
1
)
&&
(
a
->
userinfo_len
==
b
->
userinfo_len
))
{
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
userinfo_start
,
b
->
canon_uri
+
b
->
userinfo_start
,
a
->
userinfo_len
))
return
FALSE
;
}
else
if
(
a
->
userinfo_len
!=
b
->
userinfo_len
)
/* One of the Uri's had a userinfo, while the other one doesn't. */
return
FALSE
;
/* Check if they have a host name. */
if
((
a
->
host_start
>
-
1
&&
b
->
host_start
>
-
1
)
&&
(
a
->
host_len
==
b
->
host_len
))
{
/* Perform a case insensitive compare if they are a known scheme type. */
if
(
known_scheme
)
{
if
(
StrCmpNIW
(
a
->
canon_uri
+
a
->
host_start
,
b
->
canon_uri
+
b
->
host_start
,
a
->
host_len
))
return
FALSE
;
}
else
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
host_start
,
b
->
canon_uri
+
b
->
host_start
,
a
->
host_len
))
return
FALSE
;
}
else
if
(
a
->
host_len
!=
b
->
host_len
)
/* One of the Uri's had a host, while the other one didn't. */
return
FALSE
;
if
(
a
->
has_port
&&
b
->
has_port
)
{
if
(
a
->
port
!=
b
->
port
)
return
FALSE
;
}
else
if
(
a
->
has_port
||
b
->
has_port
)
/* One had a port, while the other one didn't. */
return
FALSE
;
/* Windows is weird with how it handles paths. For example
* One URI could be "http://google.com" (after canonicalization)
* and one could be "http://google.com/" and the IsEqual function
* would still evaluate to TRUE, but, only if they are both hierarchical
* URIs.
*/
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
FALSE
;
}
else
if
(
are_hierarchical
&&
a
->
path_len
==
-
1
&&
b
->
path_len
==
0
)
{
if
(
*
(
a
->
canon_uri
+
a
->
path_start
)
!=
'/'
)
return
FALSE
;
}
else
if
(
are_hierarchical
&&
b
->
path_len
==
1
&&
a
->
path_len
==
0
)
{
if
(
*
(
b
->
canon_uri
+
b
->
path_start
)
!=
'/'
)
return
FALSE
;
}
else
if
(
a
->
path_len
!=
b
->
path_len
)
return
FALSE
;
/* Compare the query strings of the two URIs. */
if
((
a
->
query_start
>
-
1
&&
b
->
query_start
>
-
1
)
&&
(
a
->
query_len
==
b
->
query_len
))
{
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
query_start
,
b
->
canon_uri
+
b
->
query_start
,
a
->
query_len
))
return
FALSE
;
}
else
if
(
a
->
query_len
!=
b
->
query_len
)
return
FALSE
;
if
((
a
->
fragment_start
>
-
1
&&
b
->
fragment_start
>
-
1
)
&&
(
a
->
fragment_len
==
b
->
fragment_len
))
{
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
fragment_start
,
b
->
canon_uri
+
b
->
fragment_start
,
a
->
fragment_len
))
return
FALSE
;
}
else
if
(
a
->
fragment_len
!=
b
->
fragment_len
)
return
FALSE
;
/* If we get here, the two URIs are equivalent. */
return
TRUE
;
}
return
FALSE
;
}
/* Computes the size of the given IPv6 address.
/* Computes the size of the given IPv6 address.
* Each h16 component is 16 bits. If there is an IPv4 address, it's
* Each h16 component is 16 bits. If there is an IPv4 address, it's
* 32 bits. If there's an elision it can be 16 to 128 bits, depending
* 32 bits. If there's an elision it can be 16 to 128 bits, depending
...
@@ -3963,6 +3865,102 @@ static HRESULT validate_components(const UriBuilder *builder, parse_data *data,
...
@@ -3963,6 +3865,102 @@ static HRESULT validate_components(const UriBuilder *builder, parse_data *data,
return
S_OK
;
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
* through the "IUri_Get*" interface calls.
*/
static
BOOL
are_equal_simple
(
const
Uri
*
a
,
const
Uri
*
b
)
{
const
BOOL
known_scheme
=
a
->
scheme_type
!=
URL_SCHEME_UNKNOWN
;
const
BOOL
are_hierarchical
=
a
->
authority_start
>
-
1
&&
b
->
authority_start
>
-
1
;
if
(
a
->
scheme_type
!=
b
->
scheme_type
)
return
FALSE
;
if
(
a
->
scheme_type
==
URL_SCHEME_FILE
)
{
if
(
a
->
canon_len
==
b
->
canon_len
)
return
!
StrCmpIW
(
a
->
canon_uri
,
b
->
canon_uri
);
}
/* Only compare the scheme names (if any) if their unknown scheme types. */
if
(
!
known_scheme
)
{
if
((
a
->
scheme_start
>
-
1
&&
b
->
scheme_start
>
-
1
)
&&
(
a
->
scheme_len
==
b
->
scheme_len
))
{
/* Make sure the schemes are the same. */
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
scheme_start
,
b
->
canon_uri
+
b
->
scheme_start
,
a
->
scheme_len
))
return
FALSE
;
}
else
if
(
a
->
scheme_len
!=
b
->
scheme_len
)
/* One of the Uri's has a scheme name, while the other doesn't. */
return
FALSE
;
}
/* If they have a userinfo component, perform case sensitive compare. */
if
((
a
->
userinfo_start
>
-
1
&&
b
->
userinfo_start
>
-
1
)
&&
(
a
->
userinfo_len
==
b
->
userinfo_len
))
{
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
userinfo_start
,
b
->
canon_uri
+
b
->
userinfo_start
,
a
->
userinfo_len
))
return
FALSE
;
}
else
if
(
a
->
userinfo_len
!=
b
->
userinfo_len
)
/* One of the Uri's had a userinfo, while the other one doesn't. */
return
FALSE
;
/* Check if they have a host name. */
if
((
a
->
host_start
>
-
1
&&
b
->
host_start
>
-
1
)
&&
(
a
->
host_len
==
b
->
host_len
))
{
/* Perform a case insensitive compare if they are a known scheme type. */
if
(
known_scheme
)
{
if
(
StrCmpNIW
(
a
->
canon_uri
+
a
->
host_start
,
b
->
canon_uri
+
b
->
host_start
,
a
->
host_len
))
return
FALSE
;
}
else
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
host_start
,
b
->
canon_uri
+
b
->
host_start
,
a
->
host_len
))
return
FALSE
;
}
else
if
(
a
->
host_len
!=
b
->
host_len
)
/* One of the Uri's had a host, while the other one didn't. */
return
FALSE
;
if
(
a
->
has_port
&&
b
->
has_port
)
{
if
(
a
->
port
!=
b
->
port
)
return
FALSE
;
}
else
if
(
a
->
has_port
||
b
->
has_port
)
/* One had a port, while the other one didn't. */
return
FALSE
;
/* Windows is weird with how it handles paths. For example
* One URI could be "http://google.com" (after canonicalization)
* and one could be "http://google.com/" and the IsEqual function
* would still evaluate to TRUE, but, only if they are both hierarchical
* URIs.
*/
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
FALSE
;
}
else
if
(
are_hierarchical
&&
a
->
path_len
==
-
1
&&
b
->
path_len
==
0
)
{
if
(
*
(
a
->
canon_uri
+
a
->
path_start
)
!=
'/'
)
return
FALSE
;
}
else
if
(
are_hierarchical
&&
b
->
path_len
==
1
&&
a
->
path_len
==
0
)
{
if
(
*
(
b
->
canon_uri
+
b
->
path_start
)
!=
'/'
)
return
FALSE
;
}
else
if
(
a
->
path_len
!=
b
->
path_len
)
return
FALSE
;
/* Compare the query strings of the two URIs. */
if
((
a
->
query_start
>
-
1
&&
b
->
query_start
>
-
1
)
&&
(
a
->
query_len
==
b
->
query_len
))
{
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
query_start
,
b
->
canon_uri
+
b
->
query_start
,
a
->
query_len
))
return
FALSE
;
}
else
if
(
a
->
query_len
!=
b
->
query_len
)
return
FALSE
;
if
((
a
->
fragment_start
>
-
1
&&
b
->
fragment_start
>
-
1
)
&&
(
a
->
fragment_len
==
b
->
fragment_len
))
{
if
(
StrCmpNW
(
a
->
canon_uri
+
a
->
fragment_start
,
b
->
canon_uri
+
b
->
fragment_start
,
a
->
fragment_len
))
return
FALSE
;
}
else
if
(
a
->
fragment_len
!=
b
->
fragment_len
)
return
FALSE
;
/* If we get here, the two URIs are equivalent. */
return
TRUE
;
}
static
void
convert_to_dos_path
(
const
WCHAR
*
path
,
DWORD
path_len
,
static
void
convert_to_dos_path
(
const
WCHAR
*
path
,
DWORD
path_len
,
WCHAR
*
output
,
DWORD
*
output_len
)
WCHAR
*
output
,
DWORD
*
output_len
)
{
{
...
...
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