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
b59defb2
Commit
b59defb2
authored
Nov 22, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi/tests: Use standard C functions for memory allocation in path.c.
parent
777383b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
25 deletions
+11
-25
path.c
dlls/shlwapi/tests/path.c
+11
-25
No files found.
dlls/shlwapi/tests/path.c
View file @
b59defb2
...
...
@@ -190,27 +190,13 @@ static LPWSTR GetWideString(const char *src)
if
(
!
src
)
return
NULL
;
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
2
*
INTERNET_MAX_URL_LENGTH
)
*
sizeof
(
WCHAR
));
ret
=
malloc
(
2
*
INTERNET_MAX_URL_LENGTH
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
src
,
-
1
,
ret
,
INTERNET_MAX_URL_LENGTH
);
return
ret
;
}
static
void
FreeWideString
(
LPWSTR
wszString
)
{
HeapFree
(
GetProcessHeap
(),
0
,
wszString
);
}
static
LPSTR
strdupA
(
LPCSTR
p
)
{
LPSTR
ret
;
DWORD
len
=
(
strlen
(
p
)
+
1
);
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
memcpy
(
ret
,
p
,
len
);
return
ret
;
}
/* ################ */
static
void
test_PathSearchAndQualify
(
void
)
...
...
@@ -326,8 +312,8 @@ static void test_PathCreateFromUrl(void)
ok
(
len2
==
len
+
1
,
"got len = %ld expected %ld from url %s
\n
"
,
len2
,
len
+
1
,
TEST_PATHFROMURL
[
i
].
url
);
}
FreeWideString
(
urlW
);
FreeWideString
(
pathW
);
free
(
urlW
);
free
(
pathW
);
}
}
...
...
@@ -340,7 +326,7 @@ static void test_PathCreateFromUrl(void)
ret
=
pPathCreateFromUrlAlloc
(
fileW
,
&
pathW
,
0
);
ok
(
ret
==
S_OK
,
"got 0x%08lx expected S_OK
\n
"
,
ret
);
ok
(
lstrcmpiW
(
pathW
,
fooW
)
==
0
,
"got %s expected %s
\n
"
,
wine_dbgstr_w
(
pathW
),
wine_dbgstr_w
(
fooW
));
HeapFree
(
GetProcessHeap
(),
0
,
pathW
);
LocalFree
(
pathW
);
}
}
...
...
@@ -513,7 +499,7 @@ static void test_PathCombineW(void)
return
;
}
wszString2
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
*
sizeof
(
WCHAR
));
wszString2
=
malloc
(
MAX_PATH
*
sizeof
(
WCHAR
));
/* NULL test */
wszString
=
pPathCombineW
(
NULL
,
NULL
,
NULL
);
...
...
@@ -529,7 +515,7 @@ static void test_PathCombineW(void)
broken
(
wszString2
[
0
]
==
'a'
),
/* Win95 and some W2K */
"Destination string not empty
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
wszString2
);
free
(
wszString2
);
/* overflow test */
wstr2
[
0
]
=
wstr2
[
1
]
=
wstr2
[
2
]
=
'A'
;
...
...
@@ -1430,7 +1416,7 @@ static void test_PathUnquoteSpaces(void)
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
TEST_PATH_UNQUOTE_SPACES
);
i
++
)
{
char
*
path
=
strdup
A
(
TEST_PATH_UNQUOTE_SPACES
[
i
].
path
);
char
*
path
=
strdup
(
TEST_PATH_UNQUOTE_SPACES
[
i
].
path
);
WCHAR
*
pathW
=
GetWideString
(
TEST_PATH_UNQUOTE_SPACES
[
i
].
path
);
WCHAR
*
resultW
=
GetWideString
(
TEST_PATH_UNQUOTE_SPACES
[
i
].
result
);
...
...
@@ -1442,9 +1428,9 @@ static void test_PathUnquoteSpaces(void)
PathUnquoteSpacesW
(
pathW
);
ok
(
!
lstrcmpW
(
pathW
,
resultW
),
"%s (W): strings differ
\n
"
,
TEST_PATH_UNQUOTE_SPACES
[
i
].
path
);
FreeWideString
(
pathW
);
FreeWideString
(
resultW
);
HeapFree
(
GetProcessHeap
(),
0
,
path
);
free
(
pathW
);
free
(
resultW
);
free
(
path
);
}
}
...
...
@@ -1680,7 +1666,7 @@ static void test_PathIsRelativeW(void)
"PathIsRelativeW(
\"
%s
\"
) expects %d, got %d.
\n
"
,
test_path_is_relative
[
i
].
path
,
test_path_is_relative
[
i
].
expect
,
ret
);
FreeWideString
(
path
);
free
(
path
);
}
}
...
...
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