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
fb783bc6
Commit
fb783bc6
authored
Jun 07, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jun 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput/tests: Use the available ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
91c3e8eb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
22 deletions
+20
-22
device.c
dlls/dinput/tests/device.c
+2
-2
dinput.c
dlls/dinput/tests/dinput.c
+10
-10
joystick.c
dlls/dinput/tests/joystick.c
+3
-5
keyboard.c
dlls/dinput/tests/keyboard.c
+5
-5
No files found.
dlls/dinput/tests/device.c
View file @
fb783bc6
...
@@ -51,7 +51,7 @@ static const DIDATAFORMAT data_format = {
...
@@ -51,7 +51,7 @@ static const DIDATAFORMAT data_format = {
sizeof
(
DIOBJECTDATAFORMAT
),
sizeof
(
DIOBJECTDATAFORMAT
),
DIDF_ABSAXIS
,
DIDF_ABSAXIS
,
32
,
32
,
sizeof
(
obj_data_format
)
/
sizeof
(
obj_data_format
[
0
]
),
ARRAY_SIZE
(
obj_data_format
),
(
LPDIOBJECTDATAFORMAT
)
obj_data_format
(
LPDIOBJECTDATAFORMAT
)
obj_data_format
};
};
...
@@ -94,7 +94,7 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
...
@@ -94,7 +94,7 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
ok
(
cnt
==
cnt1
,
"Enum count changed from %d to %d
\n
"
,
cnt
,
cnt1
);
ok
(
cnt
==
cnt1
,
"Enum count changed from %d to %d
\n
"
,
cnt
,
cnt1
);
/* Testing EnumObjects with different types of device objects */
/* Testing EnumObjects with different types of device objects */
for
(
type_index
=
0
;
type_index
<
sizeof
(
obj_types
)
/
sizeof
(
obj_types
[
0
]
);
type_index
++
)
for
(
type_index
=
0
;
type_index
<
ARRAY_SIZE
(
obj_types
);
type_index
++
)
{
{
hr
=
IDirectInputDevice_EnumObjects
(
device
,
enum_type_callback
,
&
obj_types
[
type_index
],
obj_types
[
type_index
]);
hr
=
IDirectInputDevice_EnumObjects
(
device
,
enum_type_callback
,
&
obj_types
[
type_index
],
obj_types
[
type_index
]);
ok
(
SUCCEEDED
(
hr
),
"EnumObjects() failed: %08x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"EnumObjects() failed: %08x
\n
"
,
hr
);
...
...
dlls/dinput/tests/dinput.c
View file @
fb783bc6
...
@@ -106,7 +106,7 @@ static void test_preinitialization(void)
...
@@ -106,7 +106,7 @@ static void test_preinitialization(void)
return
;
return
;
}
}
for
(
i
=
0
;
i
<
sizeof
(
create_device_tests
)
/
sizeof
(
create_device_tests
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
create_device_tests
);
i
++
)
{
{
if
(
create_device_tests
[
i
].
pdev
)
pDID
=
(
void
*
)
0xdeadbeef
;
if
(
create_device_tests
[
i
].
pdev
)
pDID
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
create_device_tests
[
i
].
rguid
,
hr
=
IDirectInput_CreateDevice
(
pDI
,
create_device_tests
[
i
].
rguid
,
...
@@ -117,7 +117,7 @@ static void test_preinitialization(void)
...
@@ -117,7 +117,7 @@ static void test_preinitialization(void)
ok
(
pDID
==
NULL
,
"[%d] Output interface pointer is %p
\n
"
,
i
,
pDID
);
ok
(
pDID
==
NULL
,
"[%d] Output interface pointer is %p
\n
"
,
i
,
pDID
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
enum_devices_tests
)
/
sizeof
(
enum_devices_tests
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
enum_devices_tests
);
i
++
)
{
{
hr
=
IDirectInput_EnumDevices
(
pDI
,
enum_devices_tests
[
i
].
dwDevType
,
hr
=
IDirectInput_EnumDevices
(
pDI
,
enum_devices_tests
[
i
].
dwDevType
,
enum_devices_tests
[
i
].
lpCallback
,
enum_devices_tests
[
i
].
lpCallback
,
...
@@ -217,7 +217,7 @@ static void test_DirectInputCreateEx(void)
...
@@ -217,7 +217,7 @@ static void test_DirectInputCreateEx(void)
return
;
return
;
}
}
for
(
i
=
0
;
i
<
sizeof
(
invalid_param_list
)
/
sizeof
(
invalid_param_list
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
invalid_param_list
);
i
++
)
{
{
if
(
invalid_param_list
[
i
].
ppdi
)
pUnk
=
(
void
*
)
0xdeadbeef
;
if
(
invalid_param_list
[
i
].
ppdi
)
pUnk
=
(
void
*
)
0xdeadbeef
;
hr
=
pDirectInputCreateEx
(
invalid_param_list
[
i
].
hinst
?
hInstance
:
NULL
,
hr
=
pDirectInputCreateEx
(
invalid_param_list
[
i
].
hinst
?
hInstance
:
NULL
,
...
@@ -230,7 +230,7 @@ static void test_DirectInputCreateEx(void)
...
@@ -230,7 +230,7 @@ static void test_DirectInputCreateEx(void)
ok
(
pUnk
==
invalid_param_list
[
i
].
expected_ppdi
,
"[%d] Output interface pointer is %p
\n
"
,
i
,
pUnk
);
ok
(
pUnk
==
invalid_param_list
[
i
].
expected_ppdi
,
"[%d] Output interface pointer is %p
\n
"
,
i
,
pUnk
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
no_interface_list
)
/
sizeof
(
no_interface_list
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
no_interface_list
);
i
++
)
{
{
pUnk
=
(
void
*
)
0xdeadbeef
;
pUnk
=
(
void
*
)
0xdeadbeef
;
hr
=
pDirectInputCreateEx
(
hInstance
,
DIRECTINPUT_VERSION
,
no_interface_list
[
i
],
(
void
**
)
&
pUnk
,
NULL
);
hr
=
pDirectInputCreateEx
(
hInstance
,
DIRECTINPUT_VERSION
,
no_interface_list
[
i
],
(
void
**
)
&
pUnk
,
NULL
);
...
@@ -238,7 +238,7 @@ static void test_DirectInputCreateEx(void)
...
@@ -238,7 +238,7 @@ static void test_DirectInputCreateEx(void)
ok
(
pUnk
==
(
void
*
)
0xdeadbeef
,
"[%d] Output interface pointer is %p
\n
"
,
i
,
pUnk
);
ok
(
pUnk
==
(
void
*
)
0xdeadbeef
,
"[%d] Output interface pointer is %p
\n
"
,
i
,
pUnk
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
iid_list
)
/
sizeof
(
iid_list
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
iid_list
);
i
++
)
{
{
pUnk
=
NULL
;
pUnk
=
NULL
;
hr
=
pDirectInputCreateEx
(
hInstance
,
DIRECTINPUT_VERSION
,
iid_list
[
i
],
(
void
**
)
&
pUnk
,
NULL
);
hr
=
pDirectInputCreateEx
(
hInstance
,
DIRECTINPUT_VERSION
,
iid_list
[
i
],
(
void
**
)
&
pUnk
,
NULL
);
...
@@ -249,9 +249,9 @@ static void test_DirectInputCreateEx(void)
...
@@ -249,9 +249,9 @@ static void test_DirectInputCreateEx(void)
}
}
/* Examine combinations of requested interfaces and version numbers. */
/* Examine combinations of requested interfaces and version numbers. */
for
(
i
=
0
;
i
<
sizeof
(
directinput_version_list
)
/
sizeof
(
directinput_version_list
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
directinput_version_list
);
i
++
)
{
{
for
(
j
=
0
;
j
<
sizeof
(
iid_list
)
/
sizeof
(
iid_list
[
0
]
);
j
++
)
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
iid_list
);
j
++
)
{
{
pUnk
=
NULL
;
pUnk
=
NULL
;
hr
=
pDirectInputCreateEx
(
hInstance
,
directinput_version_list
[
i
],
iid_list
[
j
],
(
void
**
)
&
pUnk
,
NULL
);
hr
=
pDirectInputCreateEx
(
hInstance
,
directinput_version_list
[
i
],
iid_list
[
j
],
(
void
**
)
&
pUnk
,
NULL
);
...
@@ -311,7 +311,7 @@ static void test_QueryInterface(void)
...
@@ -311,7 +311,7 @@ static void test_QueryInterface(void)
hr
=
IDirectInput_QueryInterface
(
pDI
,
&
IID_IUnknown
,
NULL
);
hr
=
IDirectInput_QueryInterface
(
pDI
,
&
IID_IUnknown
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_QueryInterface returned 0x%08x
\n
"
,
hr
);
ok
(
hr
==
E_POINTER
,
"IDirectInput_QueryInterface returned 0x%08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
iid_list
)
/
sizeof
(
iid_list
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
iid_list
);
i
++
)
{
{
pUnk
=
NULL
;
pUnk
=
NULL
;
hr
=
IDirectInput_QueryInterface
(
pDI
,
iid_list
[
i
],
(
void
**
)
&
pUnk
);
hr
=
IDirectInput_QueryInterface
(
pDI
,
iid_list
[
i
],
(
void
**
)
&
pUnk
);
...
@@ -320,7 +320,7 @@ static void test_QueryInterface(void)
...
@@ -320,7 +320,7 @@ static void test_QueryInterface(void)
if
(
pUnk
)
IUnknown_Release
(
pUnk
);
if
(
pUnk
)
IUnknown_Release
(
pUnk
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
no_interface_list
)
/
sizeof
(
no_interface_list
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
no_interface_list
);
i
++
)
{
{
pUnk
=
(
void
*
)
0xdeadbeef
;
pUnk
=
(
void
*
)
0xdeadbeef
;
hr
=
IDirectInput_QueryInterface
(
pDI
,
no_interface_list
[
i
].
riid
,
(
void
**
)
&
pUnk
);
hr
=
IDirectInput_QueryInterface
(
pDI
,
no_interface_list
[
i
].
riid
,
(
void
**
)
&
pUnk
);
...
@@ -512,7 +512,7 @@ static void test_Initialize(void)
...
@@ -512,7 +512,7 @@ static void test_Initialize(void)
hr
=
IDirectInput_Initialize
(
pDI
,
hInstance
,
0xcafe
);
hr
=
IDirectInput_Initialize
(
pDI
,
hInstance
,
0xcafe
);
ok
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
,
"IDirectInput_Initialize returned 0x%08x
\n
"
,
hr
);
ok
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
,
"IDirectInput_Initialize returned 0x%08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
directinput_version_list
)
/
sizeof
(
directinput_version_list
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
directinput_version_list
);
i
++
)
{
{
hr
=
IDirectInput_Initialize
(
pDI
,
hInstance
,
directinput_version_list
[
i
]);
hr
=
IDirectInput_Initialize
(
pDI
,
hInstance
,
directinput_version_list
[
i
]);
ok
(
hr
==
DI_OK
,
"IDirectInput_Initialize returned 0x%08x
\n
"
,
hr
);
ok
(
hr
==
DI_OK
,
"IDirectInput_Initialize returned 0x%08x
\n
"
,
hr
);
...
...
dlls/dinput/tests/joystick.c
View file @
fb783bc6
...
@@ -30,8 +30,6 @@
...
@@ -30,8 +30,6 @@
#include "wingdi.h"
#include "wingdi.h"
#include "dinput.h"
#include "dinput.h"
#define numObjects(x) (sizeof(x) / sizeof(x[0]))
typedef
struct
tagUserData
{
typedef
struct
tagUserData
{
IDirectInputA
*
pDI
;
IDirectInputA
*
pDI
;
DWORD
version
;
DWORD
version
;
...
@@ -62,7 +60,7 @@ static const DIDATAFORMAT c_dfDIJoystickTest = {
...
@@ -62,7 +60,7 @@ static const DIDATAFORMAT c_dfDIJoystickTest = {
sizeof
(
DIOBJECTDATAFORMAT
),
sizeof
(
DIOBJECTDATAFORMAT
),
DIDF_ABSAXIS
,
DIDF_ABSAXIS
,
sizeof
(
DIJOYSTATE2
),
sizeof
(
DIJOYSTATE2
),
numObjects
(
dfDIJoystickTest
),
ARRAY_SIZE
(
dfDIJoystickTest
),
(
LPDIOBJECTDATAFORMAT
)
dfDIJoystickTest
(
LPDIOBJECTDATAFORMAT
)
dfDIJoystickTest
};
};
...
@@ -178,7 +176,7 @@ static const struct effect_id
...
@@ -178,7 +176,7 @@ static const struct effect_id
static
const
struct
effect_id
*
effect_from_guid
(
const
GUID
*
guid
)
static
const
struct
effect_id
*
effect_from_guid
(
const
GUID
*
guid
)
{
{
unsigned
int
i
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
effect_conversion
)
/
sizeof
(
effect_conversion
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
effect_conversion
);
i
++
)
if
(
IsEqualGUID
(
guid
,
effect_conversion
[
i
].
guid
))
if
(
IsEqualGUID
(
guid
,
effect_conversion
[
i
].
guid
))
return
&
effect_conversion
[
i
];
return
&
effect_conversion
[
i
];
return
NULL
;
return
NULL
;
...
@@ -504,7 +502,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
...
@@ -504,7 +502,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
effect_data
.
eff
.
dwDuration
=
INFINITE
;
effect_data
.
eff
.
dwDuration
=
INFINITE
;
effect_data
.
eff
.
dwGain
=
DI_FFNOMINALMAX
;
effect_data
.
eff
.
dwGain
=
DI_FFNOMINALMAX
;
effect_data
.
eff
.
dwTriggerButton
=
DIEB_NOTRIGGER
;
effect_data
.
eff
.
dwTriggerButton
=
DIEB_NOTRIGGER
;
effect_data
.
eff
.
cAxes
=
sizeof
(
axes
)
/
sizeof
(
axes
[
0
]
);
effect_data
.
eff
.
cAxes
=
ARRAY_SIZE
(
axes
);
effect_data
.
eff
.
rgdwAxes
=
axes
;
effect_data
.
eff
.
rgdwAxes
=
axes
;
effect_data
.
eff
.
rglDirection
=
direction
;
effect_data
.
eff
.
rglDirection
=
direction
;
...
...
dlls/dinput/tests/keyboard.c
View file @
fb783bc6
...
@@ -101,7 +101,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
...
@@ -101,7 +101,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
df
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
df
.
dwObjSize
=
sizeof
(
DIOBJECTDATAFORMAT
);
df
.
dwFlags
=
DIDF_RELAXIS
;
df
.
dwFlags
=
DIDF_RELAXIS
;
df
.
dwDataSize
=
sizeof
(
custom_state
);
df
.
dwDataSize
=
sizeof
(
custom_state
);
df
.
dwNumObjs
=
sizeof
(
dodf
)
/
sizeof
(
dodf
[
0
]
);
df
.
dwNumObjs
=
ARRAY_SIZE
(
dodf
);
df
.
rgodf
=
dodf
;
df
.
rgodf
=
dodf
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysKeyboard
,
&
pKeyboard
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysKeyboard
,
&
pKeyboard
,
NULL
);
...
@@ -139,7 +139,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
...
@@ -139,7 +139,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
memset
(
custom_state
,
0x56
,
sizeof
(
custom_state
));
memset
(
custom_state
,
0x56
,
sizeof
(
custom_state
));
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
for
(
i
=
0
;
i
<
sizeof
(
custom_state
)
/
sizeof
(
custom_state
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
custom_state
);
i
++
)
ok
(
custom_state
[
i
]
==
0
,
"Should be zeroed, got 0x%08x
\n
"
,
custom_state
[
i
]);
ok
(
custom_state
[
i
]
==
0
,
"Should be zeroed, got 0x%08x
\n
"
,
custom_state
[
i
]);
/* simulate some keyboard input */
/* simulate some keyboard input */
...
@@ -160,7 +160,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
...
@@ -160,7 +160,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %08x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState failed: %08x
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState failed: %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
custom_state
)
/
sizeof
(
custom_state
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
custom_state
);
i
++
)
ok
(
custom_state
[
i
]
==
0
,
"Should be zeroed, got 0x%08x
\n
"
,
custom_state
[
i
]);
ok
(
custom_state
[
i
]
==
0
,
"Should be zeroed, got 0x%08x
\n
"
,
custom_state
[
i
]);
}
}
keybd_event
(
'Q'
,
0
,
KEYEVENTF_KEYUP
,
0
);
keybd_event
(
'Q'
,
0
,
KEYEVENTF_KEYUP
,
0
);
...
@@ -316,7 +316,7 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
...
@@ -316,7 +316,7 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
HKL
hkl
,
hkl_orig
;
HKL
hkl
,
hkl_orig
;
MSG
msg
;
MSG
msg
;
for
(
i
=
0
;
i
<
sizeof
(
expected
)
/
sizeof
(
expected
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
expected
);
i
++
)
{
{
if
(
expected
[
i
].
langid
==
langid
)
if
(
expected
[
i
].
langid
==
langid
)
{
{
...
@@ -340,7 +340,7 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
...
@@ -340,7 +340,7 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
SetFocus
(
hwnd
);
SetFocus
(
hwnd
);
pump_messages
();
pump_messages
();
for
(
i
=
0
;
i
<
sizeof
(
key2dik_en
)
/
sizeof
(
key2dik_en
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
key2dik_en
);
i
++
)
{
{
BYTE
kbd_state
[
256
];
BYTE
kbd_state
[
256
];
UINT
n
;
UINT
n
;
...
...
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