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
f0bc6032
Commit
f0bc6032
authored
Sep 05, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 07, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Improved UrlEscapeW implementation.
parent
8b7fae35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
url.c
dlls/shlwapi/tests/url.c
+11
-0
url.c
dlls/shlwapi/url.c
+16
-4
No files found.
dlls/shlwapi/tests/url.c
View file @
f0bc6032
...
...
@@ -762,10 +762,13 @@ static void test_url_canonicalize(int index, const char *szUrl, DWORD dwFlags, H
static
void
test_UrlEscape
(
void
)
{
static
const
WCHAR
out
[]
=
{
'f'
,
'o'
,
'o'
,
'%'
,
'2'
,
'0'
,
'b'
,
'a'
,
'r'
,
0
};
DWORD
size
=
0
;
HRESULT
ret
;
unsigned
int
i
;
char
empty_string
[]
=
""
;
WCHAR
overwrite
[]
=
{
'f'
,
'o'
,
'o'
,
' '
,
'b'
,
'a'
,
'r'
,
0
,
0
,
0
};
if
(
!
pUrlEscapeA
)
{
win_skip
(
"UrlEscapeA noz found
\n
"
);
...
...
@@ -796,6 +799,14 @@ static void test_UrlEscape(void)
ok
(
ret
==
E_POINTER
,
"got %x, expected %x
\n
"
,
ret
,
E_POINTER
);
ok
(
size
==
34
,
"got %d, expected %d
\n
"
,
size
,
34
);
if
(
pUrlEscapeW
)
{
size
=
sizeof
(
overwrite
)
/
sizeof
(
WCHAR
);
ret
=
pUrlEscapeW
(
overwrite
,
overwrite
,
&
size
,
URL_ESCAPE_SPACES_ONLY
);
ok
(
ret
==
S_OK
,
"got %x, expected S_OK
\n
"
,
ret
);
ok
(
size
==
9
,
"got %d, expected 9
\n
"
,
size
);
ok
(
!
lstrcmpW
(
overwrite
,
out
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
overwrite
),
wine_dbgstr_w
(
out
));
}
for
(
i
=
0
;
i
<
sizeof
(
TEST_ESCAPE
)
/
sizeof
(
TEST_ESCAPE
[
0
]);
i
++
)
{
test_url_escape
(
TEST_ESCAPE
[
i
].
url
,
TEST_ESCAPE
[
i
].
flags
,
TEST_ESCAPE
[
i
].
expectret
,
TEST_ESCAPE
[
i
].
expecturl
);
...
...
dlls/shlwapi/url.c
View file @
f0bc6032
...
...
@@ -1022,8 +1022,8 @@ HRESULT WINAPI UrlEscapeW(
DWORD
slashes
=
0
;
static
const
WCHAR
localhost
[]
=
{
'l'
,
'o'
,
'c'
,
'a'
,
'l'
,
'h'
,
'o'
,
's'
,
't'
,
0
};
TRACE
(
"(%
s %p %p 0x%08x)
\n
"
,
debugstr_w
(
pszUrl
),
pszEscaped
,
pcchEscaped
,
dwFlags
);
TRACE
(
"(%
p(%s) %p %p 0x%08x)
\n
"
,
pszUrl
,
debugstr_w
(
pszUrl
)
,
pszEscaped
,
pcchEscaped
,
dwFlags
);
if
(
!
pszUrl
||
!
pcchEscaped
)
return
E_INVALIDARG
;
...
...
@@ -1034,6 +1034,12 @@ HRESULT WINAPI UrlEscapeW(
URL_ESCAPE_PERCENT
))
FIXME
(
"Unimplemented flags: %08x
\n
"
,
dwFlags
);
if
(
pszUrl
==
pszEscaped
)
{
dst
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
pcchEscaped
*
sizeof
(
WCHAR
));
if
(
!
dst
)
return
E_OUTOFMEMORY
;
}
/* fix up flags */
if
(
dwFlags
&
URL_ESCAPE_SPACES_ONLY
)
/* if SPACES_ONLY specified, reset the other controls */
...
...
@@ -1150,12 +1156,18 @@ HRESULT WINAPI UrlEscapeW(
if
(
needed
<
*
pcchEscaped
)
{
*
dst
=
'\0'
;
ret
=
S_OK
;
if
(
pszUrl
==
pszEscaped
)
memcpy
(
pszEscaped
,
dst
-
needed
,
(
needed
+
1
)
*
sizeof
(
WCHAR
));
ret
=
S_OK
;
}
else
{
needed
++
;
/* add one for the '\0' */
ret
=
E_POINTER
;
ret
=
E_POINTER
;
}
*
pcchEscaped
=
needed
;
if
(
pszUrl
==
pszEscaped
)
HeapFree
(
GetProcessHeap
(),
0
,
dst
);
return
ret
;
}
...
...
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