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
94d8ba78
Commit
94d8ba78
authored
Jun 15, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jun 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi/tests: Use the available ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c57b9b8d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
19 deletions
+17
-19
devinst.c
dlls/setupapi/tests/devinst.c
+2
-2
misc.c
dlls/setupapi/tests/misc.c
+2
-2
parser.c
dlls/setupapi/tests/parser.c
+4
-4
setupcab.c
dlls/setupapi/tests/setupcab.c
+9
-11
No files found.
dlls/setupapi/tests/devinst.c
View file @
94d8ba78
...
...
@@ -121,7 +121,7 @@ static LSTATUS devinst_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
dwMaxSubkeyLen
++
;
dwMaxValueLen
++
;
dwMaxLen
=
max
(
dwMaxSubkeyLen
,
dwMaxValueLen
);
if
(
dwMaxLen
>
sizeof
(
szNameBuf
)
/
sizeof
(
WCHAR
))
if
(
dwMaxLen
>
ARRAY_SIZE
(
szNameBuf
))
{
/* Name too big: alloc a buffer for it */
if
(
!
(
lpszName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwMaxLen
*
sizeof
(
WCHAR
))))
...
...
@@ -1259,7 +1259,7 @@ static void testSetupDiGetINFClassA(void)
retval
=
SetupDiGetINFClassA
(
filename
,
&
guid
,
cn
,
MAX_PATH
,
&
count
);
ok
(
!
retval
,
"expected SetupDiGetINFClassA to fail!
\n
"
);
for
(
i
=
0
;
i
<
sizeof
(
signatures
)
/
sizeof
(
char
*
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
signatures
);
i
++
)
{
trace
(
"testing signature %s
\n
"
,
signatures
[
i
]);
h
=
CreateFileA
(
filename
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
...
...
dlls/setupapi/tests/misc.c
View file @
94d8ba78
...
...
@@ -594,7 +594,7 @@ static void test_SetupDecompressOrCopyFile(void)
create_source_file
(
source
,
uncompressed
,
sizeof
(
uncompressed
));
for
(
i
=
0
;
i
<
sizeof
(
invalid_parameters
)
/
sizeof
(
invalid_parameters
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
invalid_parameters
);
i
++
)
{
type
=
FILE_COMPRESSION_NONE
;
ret
=
SetupDecompressOrCopyFileA
(
invalid_parameters
[
i
].
source
,
...
...
@@ -697,7 +697,7 @@ static void test_SetupDecompressOrCopyFile(void)
p
=
strrchr
(
target
,
'\\'
);
for
(
i
=
0
;
i
<
sizeof
(
zip_multi_tests
)
/
sizeof
(
zip_multi_tests
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
zip_multi_tests
);
i
++
)
{
lstrcpyA
(
p
+
1
,
zip_multi_tests
[
i
].
filename
);
...
...
dlls/setupapi/tests/parser.c
View file @
94d8ba78
...
...
@@ -154,7 +154,7 @@ static void test_invalid_files(void)
HINF
hinf
;
DWORD
err
;
for
(
i
=
0
;
i
<
sizeof
(
invalid_files
)
/
sizeof
(
invalid_files
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
invalid_files
);
i
++
)
{
SetLastError
(
0xdeadbeef
);
err_line
=
0xdeadbeef
;
...
...
@@ -229,7 +229,7 @@ static void test_section_names(void)
DWORD
err
;
LONG
ret
;
for
(
i
=
0
;
i
<
sizeof
(
section_names
)
/
sizeof
(
section_names
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
section_names
);
i
++
)
{
SetLastError
(
0xdeadbeef
);
hinf
=
test_file_contents
(
section_names
[
i
].
data
,
&
err_line
);
...
...
@@ -418,7 +418,7 @@ static void test_key_names(void)
BOOL
ret
;
INFCONTEXT
context
;
for
(
i
=
0
;
i
<
sizeof
(
key_names
)
/
sizeof
(
key_names
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
key_names
);
i
++
)
{
strcpy
(
buffer
,
STD_HEADER
"[Test]
\n
"
);
strcat
(
buffer
,
key_names
[
i
].
data
);
...
...
@@ -622,7 +622,7 @@ static void test_SetupGetIntField(void)
};
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
keys
)
/
sizeof
(
keys
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
keys
);
i
++
)
{
HINF
hinf
;
char
buffer
[
MAX_INF_STRING_LENGTH
];
...
...
dlls/setupapi/tests/setupcab.c
View file @
94d8ba78
...
...
@@ -109,7 +109,7 @@ static void test_invalid_parametersA(void)
create_source_fileA
(
source
,
NULL
,
0
);
for
(
i
=
0
;
i
<
sizeof
(
invalid_parameters
)
/
sizeof
(
invalid_parameters
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
invalid_parameters
);
i
++
)
{
SetLastError
(
0xdeadbeef
);
ret
=
SetupIterateCabinetA
(
invalid_parameters
[
i
].
CabinetFile
,
0
,
...
...
@@ -170,12 +170,12 @@ static void test_invalid_parametersW(void)
return
;
}
GetTempPathW
(
sizeof
(
temp
)
/
sizeof
(
WCHAR
),
temp
);
GetTempPathW
(
ARRAY_SIZE
(
temp
),
temp
);
GetTempFileNameW
(
temp
,
docW
,
0
,
source
);
create_source_fileW
(
source
,
NULL
,
0
);
for
(
i
=
0
;
i
<
sizeof
(
invalid_parameters
)
/
sizeof
(
invalid_parameters
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
invalid_parameters
);
i
++
)
{
SetLastError
(
0xdeadbeef
);
ret
=
SetupIterateCabinetW
(
invalid_parameters
[
i
].
CabinetFile
,
0
,
...
...
@@ -275,7 +275,7 @@ static void test_invalid_callbackW(void)
return
;
}
GetTempPathW
(
sizeof
(
temp
)
/
sizeof
(
WCHAR
),
temp
);
GetTempPathW
(
ARRAY_SIZE
(
temp
),
temp
);
GetTempFileNameW
(
temp
,
docW
,
0
,
source
);
create_source_fileW
(
source
,
comp_cab_zip_multi
,
sizeof
(
comp_cab_zip_multi
));
...
...
@@ -316,7 +316,7 @@ static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification,
(
*
file_count
)
++
;
if
(
index
<
sizeof
(
expected_files
)
/
sizeof
(
char
*
))
if
(
index
<
ARRAY_SIZE
(
expected_files
))
{
ok
(
!
strcmp
(
expected_files
[
index
],
info
->
NameInCabinet
),
"[%d] Expected file
\"
%s
\"
, got
\"
%s
\"\n
"
,
...
...
@@ -348,8 +348,7 @@ static void test_simple_enumerationA(void)
ret
=
SetupIterateCabinetA
(
source
,
0
,
simple_callbackA
,
&
enum_count
);
ok
(
ret
==
1
,
"Expected SetupIterateCabinetA to return 1, got %d
\n
"
,
ret
);
ok
(
enum_count
==
sizeof
(
expected_files
)
/
sizeof
(
char
*
),
"Unexpectedly enumerated %d files
\n
"
,
enum_count
);
ok
(
enum_count
==
ARRAY_SIZE
(
expected_files
),
"Unexpectedly enumerated %d files
\n
"
,
enum_count
);
DeleteFileA
(
source
);
}
...
...
@@ -376,7 +375,7 @@ static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification,
(
*
file_count
)
++
;
if
(
index
<
sizeof
(
expected_filesW
)
/
sizeof
(
WCHAR
*
))
if
(
index
<
ARRAY_SIZE
(
expected_filesW
))
{
ok
(
!
lstrcmpW
(
expected_filesW
[
index
],
info
->
NameInCabinet
),
"[%d] Expected file %s, got %s
\n
"
,
...
...
@@ -408,15 +407,14 @@ static void test_simple_enumerationW(void)
return
;
}
GetTempPathW
(
sizeof
(
temp
)
/
sizeof
(
WCHAR
),
temp
);
GetTempPathW
(
ARRAY_SIZE
(
temp
),
temp
);
GetTempFileNameW
(
temp
,
docW
,
0
,
source
);
create_source_fileW
(
source
,
comp_cab_zip_multi
,
sizeof
(
comp_cab_zip_multi
));
ret
=
SetupIterateCabinetW
(
source
,
0
,
simple_callbackW
,
&
enum_count
);
ok
(
ret
==
1
,
"Expected SetupIterateCabinetW to return 1, got %d
\n
"
,
ret
);
ok
(
enum_count
==
sizeof
(
expected_files
)
/
sizeof
(
WCHAR
*
),
"Unexpectedly enumerated %d files
\n
"
,
enum_count
);
ok
(
enum_count
==
ARRAY_SIZE
(
expected_files
),
"Unexpectedly enumerated %d files
\n
"
,
enum_count
);
DeleteFileW
(
source
);
}
...
...
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