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
612fce30
Commit
612fce30
authored
Apr 10, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcp: Remove some redundant clearing of buffers.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8b7b4e51
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
48 deletions
+18
-48
msvcp120.c
dlls/msvcp120/tests/msvcp120.c
+8
-23
msvcp140.c
dlls/msvcp140/tests/msvcp140.c
+10
-25
No files found.
dlls/msvcp120/tests/msvcp120.c
View file @
612fce30
...
...
@@ -1264,9 +1264,7 @@ static void test_tr2_sys__Equivalent(void)
{
"tr2_test_dir/../tr2_test_dir/f1"
,
"tr2_test_dir/f1"
,
1
}
};
memset
(
current_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryA
(
MAX_PATH
,
current_path
);
memset
(
temp_path
,
0
,
MAX_PATH
);
GetTempPathA
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryA
(
temp_path
),
"SetCurrentDirectoryA to temp_path failed
\n
"
);
CreateDirectoryA
(
"tr2_test_dir"
,
NULL
);
...
...
@@ -1298,32 +1296,29 @@ static void test_tr2_sys__Equivalent(void)
static
void
test_tr2_sys__Current_get
(
void
)
{
static
const
WCHAR
backslashW
[]
=
{
'\\'
,
0
};
char
temp_path
[
MAX_PATH
],
current_path
[
MAX_PATH
],
origin_path
[
MAX_PATH
];
char
*
temp
;
WCHAR
temp_path_wchar
[
MAX_PATH
],
current_path_wchar
[
MAX_PATH
];
WCHAR
*
temp_wchar
;
memset
(
origin_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryA
(
MAX_PATH
,
origin_path
);
memset
(
temp_path
,
0
,
MAX_PATH
);
GetTempPathA
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryA
(
temp_path
),
"SetCurrentDirectoryA to temp_path failed
\n
"
);
memset
(
current_path
,
0
,
MAX_PATH
);
temp
=
p_tr2_sys__Current_get
(
current_path
);
ok
(
temp
==
current_path
,
"p_tr2_sys__Current_get returned different buffer
\n
"
);
temp
[
strlen
(
temp
)]
=
'\\'
;
strcat
(
temp
,
"
\\
"
)
;
ok
(
!
strcmp
(
temp_path
,
current_path
),
"test_tr2_sys__Current_get(): expect: %s, got %s
\n
"
,
temp_path
,
current_path
);
GetTempPathW
(
MAX_PATH
,
temp_path_wchar
);
ok
(
SetCurrentDirectoryW
(
temp_path_wchar
),
"SetCurrentDirectoryW to temp_path_wchar failed
\n
"
);
memset
(
current_path_wchar
,
0
,
MAX_PATH
);
temp_wchar
=
p_tr2_sys__Current_get_wchar
(
current_path_wchar
);
ok
(
temp_wchar
==
current_path_wchar
,
"p_tr2_sys__Current_get_wchar returned different buffer
\n
"
);
temp_wchar
[
wcslen
(
temp_wchar
)]
=
'\\'
;
wcscat
(
temp_wchar
,
backslashW
)
;
ok
(
!
wcscmp
(
temp_path_wchar
,
current_path_wchar
),
"test_tr2_sys__Current_get(): expect: %s, got %s
\n
"
,
wine_dbgstr_w
(
temp_path_wchar
),
wine_dbgstr_w
(
current_path_wchar
));
ok
(
SetCurrentDirectoryA
(
origin_path
),
"SetCurrentDirectoryA to origin_path failed
\n
"
);
memset
(
current_path
,
0
,
MAX_PATH
);
temp
=
p_tr2_sys__Current_get
(
current_path
);
ok
(
temp
==
current_path
,
"p_tr2_sys__Current_get returned different buffer
\n
"
);
ok
(
!
strcmp
(
origin_path
,
current_path
),
"test_tr2_sys__Current_get(): expect: %s, got %s
\n
"
,
origin_path
,
current_path
);
...
...
@@ -1334,25 +1329,22 @@ static void test_tr2_sys__Current_set(void)
char
temp_path
[
MAX_PATH
],
current_path
[
MAX_PATH
],
origin_path
[
MAX_PATH
];
char
*
temp
;
WCHAR
testW
[]
=
{
'.'
,
'/'
,
0
};
memset
(
temp_path
,
0
,
MAX_PATH
);
GetTempPathA
(
MAX_PATH
,
temp_path
);
memset
(
origin_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryA
(
MAX_PATH
,
origin_path
);
temp
=
p_tr2_sys__Current_get
(
origin_path
);
ok
(
temp
==
origin_path
,
"p_tr2_sys__Current_get returned different buffer
\n
"
);
ok
(
p_tr2_sys__Current_set
(
temp_path
),
"p_tr2_sys__Current_set to temp_path failed
\n
"
);
memset
(
current_path
,
0
,
MAX_PATH
);
temp
=
p_tr2_sys__Current_get
(
current_path
);
ok
(
temp
==
current_path
,
"p_tr2_sys__Current_get returned different buffer
\n
"
);
temp
[
strlen
(
temp
)]
=
'\\'
;
strcat
(
temp
,
"
\\
"
)
;
ok
(
!
strcmp
(
temp_path
,
current_path
),
"test_tr2_sys__Current_get(): expect: %s, got %s
\n
"
,
temp_path
,
current_path
);
ok
(
p_tr2_sys__Current_set_wchar
(
testW
),
"p_tr2_sys__Current_set_wchar to temp_path failed
\n
"
);
memset
(
current_path
,
0
,
MAX_PATH
);
temp
=
p_tr2_sys__Current_get
(
current_path
);
ok
(
temp
==
current_path
,
"p_tr2_sys__Current_get returned different buffer
\n
"
);
temp
[
strlen
(
temp
)]
=
'\\'
;
strcat
(
temp
,
"
\\
"
)
;
ok
(
!
strcmp
(
temp_path
,
current_path
),
"test_tr2_sys__Current_get(): expect: %s, got %s
\n
"
,
temp_path
,
current_path
);
errno
=
0xdeadbeef
;
...
...
@@ -1364,7 +1356,6 @@ static void test_tr2_sys__Current_set(void)
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
ok
(
p_tr2_sys__Current_set
(
origin_path
),
"p_tr2_sys__Current_set to origin_path failed
\n
"
);
memset
(
current_path
,
0
,
MAX_PATH
);
temp
=
p_tr2_sys__Current_get
(
current_path
);
ok
(
temp
==
current_path
,
"p_tr2_sys__Current_get returned different buffer
\n
"
);
ok
(
!
strcmp
(
origin_path
,
current_path
),
"test_tr2_sys__Current_get(): expect: %s, got %s
\n
"
,
origin_path
,
current_path
);
...
...
@@ -1521,9 +1512,7 @@ static void test_tr2_sys__Rename(void)
{
not_existW
,
invalidW
,
ERROR_FILE_NOT_FOUND
}
};
memset
(
current_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryA
(
MAX_PATH
,
current_path
);
memset
(
temp_path
,
0
,
MAX_PATH
);
GetTempPathA
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryA
(
temp_path
),
"SetCurrentDirectoryA to temp_path failed
\n
"
);
ret
=
p_tr2_sys__Make_dir
(
"tr2_test_dir"
);
...
...
@@ -1609,9 +1598,8 @@ static void test_tr2_sys__Statvfs(void)
struct
space_info
info
;
char
current_path
[
MAX_PATH
];
WCHAR
current_path_wchar
[
MAX_PATH
];
memset
(
current_path
,
0
,
MAX_PATH
);
p_tr2_sys__Current_get
(
current_path
);
memset
(
current_path_wchar
,
0
,
MAX_PATH
);
p_tr2_sys__Current_get_wchar
(
current_path_wchar
);
p_tr2_sys__Statvfs
(
&
info
,
current_path
);
...
...
@@ -1791,7 +1779,6 @@ static void test_tr2_sys__dir_operation(void)
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"create file failed: INVALID_HANDLE_VALUE
\n
"
);
CloseHandle
(
file
);
memset
(
longer_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryA
(
MAX_PATH
,
longer_path
);
strcat
(
longer_path
,
"
\\
tr2_test_dir
\\
"
);
while
(
lstrlenA
(
longer_path
)
<
MAX_PATH
-
1
)
...
...
@@ -1889,9 +1876,7 @@ static void test_tr2_sys__Link(void)
{
"f1"
,
"not_exist_dir
\\
f1_link"
,
TRUE
,
ERROR_PATH_NOT_FOUND
}
};
memset
(
current_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryA
(
MAX_PATH
,
current_path
);
memset
(
temp_path
,
0
,
MAX_PATH
);
GetTempPathA
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryA
(
temp_path
),
"SetCurrentDirectoryA to temp_path failed
\n
"
);
...
...
dlls/msvcp140/tests/msvcp140.c
View file @
612fce30
...
...
@@ -658,8 +658,6 @@ static void test_File_size(void)
WCHAR
test_ne_W
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'_'
,
't'
,
'e'
,
's'
,
't'
,
'_'
,
'd'
,
'i'
,
'r'
,
'/'
,
'n'
,
'e'
,
0
};
WCHAR
temp_path
[
MAX_PATH
],
origin_path
[
MAX_PATH
];
memset
(
origin_path
,
0
,
sizeof
(
origin_path
));
memset
(
origin_path
,
0
,
sizeof
(
temp_path
));
GetCurrentDirectoryW
(
MAX_PATH
,
origin_path
);
GetTempPathW
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryW
(
temp_path
),
"SetCurrentDirectoryW to temp_path failed
\n
"
);
...
...
@@ -702,23 +700,21 @@ static void test_File_size(void)
static
void
test_Current_get
(
void
)
{
static
const
WCHAR
backslashW
[]
=
{
'\\'
,
0
};
WCHAR
temp_path
[
MAX_PATH
],
current_path
[
MAX_PATH
],
origin_path
[
MAX_PATH
];
BOOL
ret
;
memset
(
origin_path
,
0
,
sizeof
(
origin_path
));
GetCurrentDirectoryW
(
MAX_PATH
,
origin_path
);
memset
(
temp_path
,
0
,
sizeof
(
temp_path
));
GetTempPathW
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryW
(
temp_path
),
"SetCurrentDirectoryW to temp_path failed
\n
"
);
memset
(
current_path
,
0
,
sizeof
(
current_path
));
ret
=
p_Current_get
(
current_path
);
ok
(
ret
==
TRUE
,
"p_Current_get returned %u
\n
"
,
ret
);
current_path
[
wcslen
(
current_path
)]
=
'\\'
;
wcscat
(
current_path
,
backslashW
)
;
ok
(
!
wcscmp
(
temp_path
,
current_path
),
"p_Current_get(): expect: %s, got %s
\n
"
,
wine_dbgstr_w
(
temp_path
),
wine_dbgstr_w
(
current_path
));
ok
(
SetCurrentDirectoryW
(
origin_path
),
"SetCurrentDirectoryW to origin_path failed
\n
"
);
memset
(
current_path
,
0
,
sizeof
(
current_path
));
ret
=
p_Current_get
(
current_path
);
ok
(
ret
==
TRUE
,
"p_Current_get returned %u
\n
"
,
ret
);
ok
(
!
wcscmp
(
origin_path
,
current_path
),
"p_Current_get(): expect: %s, got %s
\n
"
,
...
...
@@ -729,27 +725,25 @@ static void test_Current_set(void)
{
WCHAR
temp_path
[
MAX_PATH
],
current_path
[
MAX_PATH
],
origin_path
[
MAX_PATH
];
MSVCP_bool
ret
;
WCHAR
testW
[]
=
{
'.'
,
'/'
,
0
};
WCHAR
not_exit_dirW
[]
=
{
'n'
,
'o'
,
't'
,
'_'
,
'e'
,
'x'
,
'i'
,
's'
,
't'
,
'_'
,
'd'
,
'i'
,
'r'
,
0
};
WCHAR
invalid_nameW
[]
=
{
'?'
,
'?'
,
'i'
,
'n'
,
'v'
,
'a'
,
'l'
,
'i'
,
'd'
,
'_'
,
'n'
,
'a'
,
'm'
,
'e'
,
'>'
,
'>'
,
0
};
memset
(
temp_path
,
0
,
sizeof
(
temp_path
));
static
const
WCHAR
backslashW
[]
=
{
'\\'
,
0
};
static
const
WCHAR
testW
[]
=
{
'.'
,
'/'
,
0
};
static
const
WCHAR
not_exit_dirW
[]
=
{
'n'
,
'o'
,
't'
,
'_'
,
'e'
,
'x'
,
'i'
,
's'
,
't'
,
'_'
,
'd'
,
'i'
,
'r'
,
0
};
static
const
WCHAR
invalid_nameW
[]
=
{
'?'
,
'?'
,
'i'
,
'n'
,
'v'
,
'a'
,
'l'
,
'i'
,
'd'
,
'_'
,
'n'
,
'a'
,
'm'
,
'e'
,
'>'
,
'>'
,
0
};
GetTempPathW
(
MAX_PATH
,
temp_path
);
memset
(
origin_path
,
0
,
sizeof
(
origin_path
));
GetCurrentDirectoryW
(
MAX_PATH
,
origin_path
);
ok
(
p_Current_set
(
temp_path
),
"p_Current_set to temp_path failed
\n
"
);
memset
(
current_path
,
0
,
sizeof
(
current_path
));
ret
=
p_Current_get
(
current_path
);
ok
(
ret
==
TRUE
,
"p_Current_get returned %u
\n
"
,
ret
);
current_path
[
wcslen
(
current_path
)]
=
'\\'
;
wcscat
(
current_path
,
backslashW
)
;
ok
(
!
wcscmp
(
temp_path
,
current_path
),
"p_Current_get(): expect: %s, got %s
\n
"
,
wine_dbgstr_w
(
temp_path
),
wine_dbgstr_w
(
current_path
));
ok
(
p_Current_set
(
testW
),
"p_Current_set to temp_path failed
\n
"
);
memset
(
current_path
,
0
,
sizeof
(
current_path
));
ret
=
p_Current_get
(
current_path
);
ok
(
ret
==
TRUE
,
"p_Current_get returned %u
\n
"
,
ret
);
current_path
[
wcslen
(
current_path
)]
=
'\\'
;
wcscat
(
current_path
,
backslashW
)
;
ok
(
!
wcscmp
(
temp_path
,
current_path
),
"p_Current_get(): expect: %s, got %s
\n
"
,
wine_dbgstr_w
(
temp_path
),
wine_dbgstr_w
(
current_path
));
...
...
@@ -762,7 +756,6 @@ static void test_Current_set(void)
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
ok
(
p_Current_set
(
origin_path
),
"p_Current_set to origin_path failed
\n
"
);
memset
(
current_path
,
0
,
sizeof
(
current_path
));
ret
=
p_Current_get
(
current_path
);
ok
(
ret
==
TRUE
,
"p_Current_get returned %u
\n
"
,
ret
);
ok
(
!
wcscmp
(
origin_path
,
current_path
),
"p_Current_get(): expect: %s, got %s
\n
"
,
...
...
@@ -799,8 +792,6 @@ static void test_Stat(void)
{
test_dir_linkW
,
directory_file
,
0777
,
TRUE
},
};
memset
(
origin_path
,
0
,
sizeof
(
origin_path
));
memset
(
origin_path
,
0
,
sizeof
(
temp_path
));
GetCurrentDirectoryW
(
MAX_PATH
,
origin_path
);
GetTempPathW
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryW
(
temp_path
),
"SetCurrentDirectoryW to temp_path failed
\n
"
);
...
...
@@ -914,8 +905,6 @@ static void test_dir_operation(void)
WCHAR
not_existW
[]
=
{
'n'
,
'o'
,
't'
,
'_'
,
'e'
,
'x'
,
'i'
,
's'
,
't'
,
0
};
WCHAR
empty_dirW
[]
=
{
'e'
,
'm'
,
'p'
,
't'
,
'y'
,
'_'
,
'd'
,
'i'
,
'r'
,
0
};
memset
(
origin_path
,
0
,
sizeof
(
origin_path
));
memset
(
origin_path
,
0
,
sizeof
(
temp_path
));
GetCurrentDirectoryW
(
MAX_PATH
,
origin_path
);
GetTempPathW
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryW
(
temp_path
),
"SetCurrentDirectoryW to temp_path failed
\n
"
);
...
...
@@ -1140,9 +1129,7 @@ static void test_Rename(void)
{
not_existW
,
invalidW
,
ERROR_FILE_NOT_FOUND
}
};
memset
(
current_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryW
(
MAX_PATH
,
current_path
);
memset
(
temp_path
,
0
,
MAX_PATH
);
GetTempPathW
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryW
(
temp_path
),
"SetCurrentDirectoryW to temp_path failed
\n
"
);
ret
=
p_Make_dir
(
wine_test_dirW
);
...
...
@@ -1401,9 +1388,7 @@ static void test_Equivalent(void)
{
f1W_long
,
f1W
,
1
}
};
memset
(
current_path
,
0
,
MAX_PATH
);
GetCurrentDirectoryW
(
MAX_PATH
,
current_path
);
memset
(
temp_path
,
0
,
MAX_PATH
);
GetTempPathW
(
MAX_PATH
,
temp_path
);
ok
(
SetCurrentDirectoryW
(
temp_path
),
"SetCurrentDirectoryW to temp_path failed
\n
"
);
CreateDirectoryW
(
wine_test_dirW
,
NULL
);
...
...
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