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
6710a048
Commit
6710a048
authored
Oct 14, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Oct 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Use the ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
be251065
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
21 deletions
+20
-21
config.c
dlls/dinput/config.c
+2
-2
device.c
dlls/dinput/device.c
+7
-8
dinput_main.c
dlls/dinput/dinput_main.c
+5
-5
joystick.c
dlls/dinput/joystick.c
+4
-4
joystick_osx.c
dlls/dinput/joystick_osx.c
+1
-1
keyboard.c
dlls/dinput/keyboard.c
+1
-1
No files found.
dlls/dinput/config.c
View file @
6710a048
...
@@ -95,7 +95,7 @@ static void init_listview_columns(HWND dialog)
...
@@ -95,7 +95,7 @@ static void init_listview_columns(HWND dialog)
GetClientRect
(
GetDlgItem
(
dialog
,
IDC_DEVICEOBJECTSLIST
),
&
viewRect
);
GetClientRect
(
GetDlgItem
(
dialog
,
IDC_DEVICEOBJECTSLIST
),
&
viewRect
);
width
=
(
viewRect
.
right
-
viewRect
.
left
)
/
2
;
width
=
(
viewRect
.
right
-
viewRect
.
left
)
/
2
;
LoadStringW
(
hinstance
,
IDS_OBJECTCOLUMN
,
column
,
sizeof
(
column
)
/
sizeof
(
column
[
0
]
));
LoadStringW
(
hinstance
,
IDS_OBJECTCOLUMN
,
column
,
ARRAY_SIZE
(
column
));
listColumn
.
mask
=
LVCF_TEXT
|
LVCF_WIDTH
|
LVCF_SUBITEM
;
listColumn
.
mask
=
LVCF_TEXT
|
LVCF_WIDTH
|
LVCF_SUBITEM
;
listColumn
.
pszText
=
column
;
listColumn
.
pszText
=
column
;
listColumn
.
cchTextMax
=
lstrlenW
(
listColumn
.
pszText
);
listColumn
.
cchTextMax
=
lstrlenW
(
listColumn
.
pszText
);
...
@@ -103,7 +103,7 @@ static void init_listview_columns(HWND dialog)
...
@@ -103,7 +103,7 @@ static void init_listview_columns(HWND dialog)
SendDlgItemMessageW
(
dialog
,
IDC_DEVICEOBJECTSLIST
,
LVM_INSERTCOLUMNW
,
0
,
(
LPARAM
)
&
listColumn
);
SendDlgItemMessageW
(
dialog
,
IDC_DEVICEOBJECTSLIST
,
LVM_INSERTCOLUMNW
,
0
,
(
LPARAM
)
&
listColumn
);
LoadStringW
(
hinstance
,
IDS_ACTIONCOLUMN
,
column
,
sizeof
(
column
)
/
sizeof
(
column
[
0
]
));
LoadStringW
(
hinstance
,
IDS_ACTIONCOLUMN
,
column
,
ARRAY_SIZE
(
column
));
listColumn
.
cx
=
width
;
listColumn
.
cx
=
width
;
listColumn
.
pszText
=
column
;
listColumn
.
pszText
=
column
;
listColumn
.
cchTextMax
=
lstrlenW
(
listColumn
.
pszText
);
listColumn
.
cchTextMax
=
lstrlenW
(
listColumn
.
pszText
);
...
...
dlls/dinput/device.c
View file @
6710a048
...
@@ -80,7 +80,7 @@ static void _dump_cooperativelevel_DI(DWORD dwFlags) {
...
@@ -80,7 +80,7 @@ static void _dump_cooperativelevel_DI(DWORD dwFlags) {
#undef FE
#undef FE
};
};
TRACE
(
" cooperative level : "
);
TRACE
(
" cooperative level : "
);
for
(
i
=
0
;
i
<
(
sizeof
(
flags
)
/
sizeof
(
flags
[
0
])
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
flags
);
i
++
)
if
(
flags
[
i
].
mask
&
dwFlags
)
if
(
flags
[
i
].
mask
&
dwFlags
)
TRACE
(
"%s "
,
flags
[
i
].
name
);
TRACE
(
"%s "
,
flags
[
i
].
name
);
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -106,7 +106,7 @@ static void _dump_ObjectDataFormat_flags(DWORD dwFlags) {
...
@@ -106,7 +106,7 @@ static void _dump_ObjectDataFormat_flags(DWORD dwFlags) {
TRACE
(
"Flags:"
);
TRACE
(
"Flags:"
);
/* First the flags */
/* First the flags */
for
(
i
=
0
;
i
<
(
sizeof
(
flags
)
/
sizeof
(
flags
[
0
])
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
flags
);
i
++
)
{
if
(
flags
[
i
].
mask
&
dwFlags
)
if
(
flags
[
i
].
mask
&
dwFlags
)
TRACE
(
" %s"
,
flags
[
i
].
name
);
TRACE
(
" %s"
,
flags
[
i
].
name
);
}
}
...
@@ -153,7 +153,7 @@ static void _dump_EnumObjects_flags(DWORD dwFlags) {
...
@@ -153,7 +153,7 @@ static void _dump_EnumObjects_flags(DWORD dwFlags) {
if
(
type
==
DIDFT_ALL
)
{
if
(
type
==
DIDFT_ALL
)
{
TRACE
(
" DIDFT_ALL"
);
TRACE
(
" DIDFT_ALL"
);
}
else
{
}
else
{
for
(
i
=
0
;
i
<
(
sizeof
(
flags
)
/
sizeof
(
flags
[
0
])
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
flags
);
i
++
)
{
if
(
flags
[
i
].
mask
&
type
)
{
if
(
flags
[
i
].
mask
&
type
)
{
type
&=
~
flags
[
i
].
mask
;
type
&=
~
flags
[
i
].
mask
;
TRACE
(
" %s"
,
flags
[
i
].
name
);
TRACE
(
" %s"
,
flags
[
i
].
name
);
...
@@ -230,7 +230,7 @@ const char *_dump_dinput_GUID(const GUID *guid) {
...
@@ -230,7 +230,7 @@ const char *_dump_dinput_GUID(const GUID *guid) {
};
};
if
(
guid
==
NULL
)
if
(
guid
==
NULL
)
return
"null GUID"
;
return
"null GUID"
;
for
(
i
=
0
;
i
<
(
sizeof
(
guids
)
/
sizeof
(
guids
[
0
])
);
i
++
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
guids
);
i
++
)
{
if
(
IsEqualGUID
(
guids
[
i
].
guid
,
guid
))
{
if
(
IsEqualGUID
(
guids
[
i
].
guid
,
guid
))
{
return
guids
[
i
].
name
;
return
guids
[
i
].
name
;
}
}
...
@@ -916,7 +916,7 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
...
@@ -916,7 +916,7 @@ HRESULT _set_action_map(LPDIRECTINPUTDEVICE8W iface, LPDIACTIONFORMATW lpdiaf, L
if
(
dwFlags
&
DIDSAM_NOUSER
)
if
(
dwFlags
&
DIDSAM_NOUSER
)
dps
.
wsz
[
0
]
=
'\0'
;
dps
.
wsz
[
0
]
=
'\0'
;
else
else
lstrcpynW
(
dps
.
wsz
,
username
,
sizeof
(
dps
.
wsz
)
/
sizeof
(
WCHAR
));
lstrcpynW
(
dps
.
wsz
,
username
,
ARRAY_SIZE
(
dps
.
wsz
));
IDirectInputDevice8_SetProperty
(
iface
,
DIPROP_USERNAME
,
&
dps
.
diph
);
IDirectInputDevice8_SetProperty
(
iface
,
DIPROP_USERNAME
,
&
dps
.
diph
);
/* Save the settings to disk */
/* Save the settings to disk */
...
@@ -1323,7 +1323,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
...
@@ -1323,7 +1323,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface,
{
{
if
(
*
device_player
->
username
)
if
(
*
device_player
->
username
)
{
{
lstrcpynW
(
ps
->
wsz
,
device_player
->
username
,
sizeof
(
ps
->
wsz
)
/
sizeof
(
WCHAR
));
lstrcpynW
(
ps
->
wsz
,
device_player
->
username
,
ARRAY_SIZE
(
ps
->
wsz
));
return
DI_OK
;
return
DI_OK
;
}
}
else
break
;
else
break
;
...
@@ -1428,8 +1428,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(
...
@@ -1428,8 +1428,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_SetProperty(
device_player
->
instance_guid
=
This
->
guid
;
device_player
->
instance_guid
=
This
->
guid
;
}
}
if
(
device_player
)
if
(
device_player
)
lstrcpynW
(
device_player
->
username
,
ps
->
wsz
,
lstrcpynW
(
device_player
->
username
,
ps
->
wsz
,
ARRAY_SIZE
(
device_player
->
username
));
sizeof
(
device_player
->
username
)
/
sizeof
(
WCHAR
));
break
;
break
;
}
}
default:
default:
...
...
dlls/dinput/dinput_main.c
View file @
6710a048
...
@@ -282,7 +282,7 @@ static void _dump_EnumDevices_dwFlags(DWORD dwFlags)
...
@@ -282,7 +282,7 @@ static void _dump_EnumDevices_dwFlags(DWORD dwFlags)
TRACE
(
"DIEDFL_ALLDEVICES
\n
"
);
TRACE
(
"DIEDFL_ALLDEVICES
\n
"
);
return
;
return
;
}
}
for
(
i
=
0
;
i
<
(
sizeof
(
flags
)
/
sizeof
(
flags
[
0
])
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
flags
);
i
++
)
if
(
flags
[
i
].
mask
&
dwFlags
)
if
(
flags
[
i
].
mask
&
dwFlags
)
TRACE
(
"%s "
,
flags
[
i
].
name
);
TRACE
(
"%s "
,
flags
[
i
].
name
);
}
}
...
@@ -1090,7 +1090,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
...
@@ -1090,7 +1090,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
/* Add keyboard and mouse to remaining device count */
/* Add keyboard and mouse to remaining device count */
if
(
!
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
))
if
(
!
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
))
{
{
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
guids
);
i
++
)
{
{
if
(
should_enumerate_device
(
username_w
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
if
(
should_enumerate_device
(
username_w
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
remain
++
;
remain
++
;
...
@@ -1119,7 +1119,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
...
@@ -1119,7 +1119,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
}
}
/* Enumerate keyboard and mouse */
/* Enumerate keyboard and mouse */
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
guids
);
i
++
)
{
{
if
(
should_enumerate_device
(
username_w
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
if
(
should_enumerate_device
(
username_w
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
{
{
...
@@ -1191,7 +1191,7 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
...
@@ -1191,7 +1191,7 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
/* Add keyboard and mouse to remaining device count */
/* Add keyboard and mouse to remaining device count */
if
(
!
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
))
if
(
!
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
))
{
{
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
guids
);
i
++
)
{
{
if
(
should_enumerate_device
(
ptszUserName
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
if
(
should_enumerate_device
(
ptszUserName
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
remain
++
;
remain
++
;
...
@@ -1215,7 +1215,7 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
...
@@ -1215,7 +1215,7 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
if
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
)
return
DI_OK
;
if
(
dwFlags
&
DIEDBSFL_FORCEFEEDBACK
)
return
DI_OK
;
/* Enumerate keyboard and mouse */
/* Enumerate keyboard and mouse */
for
(
i
=
0
;
i
<
sizeof
(
guids
)
/
sizeof
(
guids
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
guids
);
i
++
)
{
{
if
(
should_enumerate_device
(
ptszUserName
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
if
(
should_enumerate_device
(
ptszUserName
,
dwFlags
,
&
This
->
device_players
,
guids
[
i
]))
{
{
...
...
dlls/dinput/joystick.c
View file @
6710a048
...
@@ -92,7 +92,7 @@ static void _dump_DIEFFECT_flags(DWORD dwFlags)
...
@@ -92,7 +92,7 @@ static void _dump_DIEFFECT_flags(DWORD dwFlags)
FE
(
DIEFF_SPHERICAL
)
FE
(
DIEFF_SPHERICAL
)
#undef FE
#undef FE
};
};
for
(
i
=
0
;
i
<
(
sizeof
(
flags
)
/
sizeof
(
flags
[
0
])
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
flags
);
i
++
)
if
(
flags
[
i
].
mask
&
dwFlags
)
if
(
flags
[
i
].
mask
&
dwFlags
)
TRACE
(
"%s "
,
flags
[
i
].
name
);
TRACE
(
"%s "
,
flags
[
i
].
name
);
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
...
@@ -786,7 +786,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
...
@@ -786,7 +786,7 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
/* Only consider actions of the right genre */
/* Only consider actions of the right genre */
if
(
lpdiaf
->
dwGenre
!=
genre
&&
genre
!=
DIGENRE_ANY
)
continue
;
if
(
lpdiaf
->
dwGenre
!=
genre
&&
genre
!=
DIGENRE_ANY
)
continue
;
for
(
j
=
0
;
j
<
sizeof
(
object_types
)
/
sizeof
(
object_types
[
0
]
);
j
++
)
for
(
j
=
0
;
j
<
ARRAY_SIZE
(
object_types
);
j
++
)
{
{
if
(
type
&
object_types
[
j
])
if
(
type
&
object_types
[
j
])
{
{
...
@@ -979,7 +979,7 @@ HRESULT setup_dinput_options(JoystickGenericImpl *This, const int *default_axis_
...
@@ -979,7 +979,7 @@ HRESULT setup_dinput_options(JoystickGenericImpl *This, const int *default_axis_
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
axis_names
)
/
sizeof
(
axis_names
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
axis_names
);
i
++
)
{
{
if
(
!
strcmp
(
ptr
,
axis_names
[
i
]))
if
(
!
strcmp
(
ptr
,
axis_names
[
i
]))
{
{
...
@@ -1011,7 +1011,7 @@ HRESULT setup_dinput_options(JoystickGenericImpl *This, const int *default_axis_
...
@@ -1011,7 +1011,7 @@ HRESULT setup_dinput_options(JoystickGenericImpl *This, const int *default_axis_
}
}
}
}
if
(
i
==
sizeof
(
axis_names
)
/
sizeof
(
axis_names
[
0
]
))
if
(
i
==
ARRAY_SIZE
(
axis_names
))
{
{
ERR
(
"invalid joystick axis type:
\"
%s
\"\n
"
,
ptr
);
ERR
(
"invalid joystick axis type:
\"
%s
\"\n
"
,
ptr
);
i
=
-
1
;
i
=
-
1
;
...
...
dlls/dinput/joystick_osx.c
View file @
6710a048
...
@@ -279,7 +279,7 @@ static const char* debugstr_cf(CFTypeRef t)
...
@@ -279,7 +279,7 @@ static const char* debugstr_cf(CFTypeRef t)
if
(
!
ret
)
if
(
!
ret
)
{
{
UniChar
buf
[
200
];
UniChar
buf
[
200
];
int
len
=
min
(
CFStringGetLength
(
s
),
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]
));
int
len
=
min
(
CFStringGetLength
(
s
),
ARRAY_SIZE
(
buf
));
CFStringGetCharacters
(
s
,
CFRangeMake
(
0
,
len
),
buf
);
CFStringGetCharacters
(
s
,
CFRangeMake
(
0
,
len
),
buf
);
ret
=
debugstr_wn
(
buf
,
len
);
ret
=
debugstr_wn
(
buf
,
len
);
}
}
...
...
dlls/dinput/keyboard.c
View file @
6710a048
...
@@ -508,7 +508,7 @@ static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface
...
@@ -508,7 +508,7 @@ static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface
scan
=
map_dik_to_scan
(
DIDFT_GETINSTANCE
(
pdidoi
->
dwType
),
This
->
subtype
);
scan
=
map_dik_to_scan
(
DIDFT_GETINSTANCE
(
pdidoi
->
dwType
),
This
->
subtype
);
if
(
!
GetKeyNameTextW
((
scan
&
0x80
)
<<
17
|
(
scan
&
0x7f
)
<<
16
,
if
(
!
GetKeyNameTextW
((
scan
&
0x80
)
<<
17
|
(
scan
&
0x7f
)
<<
16
,
pdidoi
->
tszName
,
sizeof
(
pdidoi
->
tszName
)
/
sizeof
(
pdidoi
->
tszName
[
0
]
)))
pdidoi
->
tszName
,
ARRAY_SIZE
(
pdidoi
->
tszName
)))
return
DIERR_OBJECTNOTFOUND
;
return
DIERR_OBJECTNOTFOUND
;
_dump_OBJECTINSTANCEW
(
pdidoi
);
_dump_OBJECTINSTANCEW
(
pdidoi
);
...
...
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