The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/wmr: avoid using non-self-explanatory numbers for input allocations

By using an extra, final entry in the according inputs enum instead
of using a hard coded number it should be slightly safer and easier
to verify that the to be allocated inputs array is of correct size.

No functional change.

Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>

authored by

Linus Lüssing and committed by
Jakob Bornecrantz
fca4ac41 785e99f1

+4 -1
+4 -1
src/xrt/drivers/wmr/wmr_controller_hp.c
··· 50 50 WMR_CONTROLLER_INDEX_AIM_POSE, 51 51 WMR_CONTROLLER_INDEX_X_A_CLICK, 52 52 WMR_CONTROLLER_INDEX_Y_B_CLICK, 53 + /* keep as last: */ 54 + WMR_CONTROLLER_INDEX_COUNT 53 55 }; 54 56 55 57 #define SET_INPUT(wcb, INDEX, NAME) \ ··· 315 317 DRV_TRACE_MARKER(); 316 318 317 319 enum u_device_alloc_flags flags = U_DEVICE_ALLOC_TRACKING_NONE; 318 - struct wmr_controller_hp *ctrl = U_DEVICE_ALLOCATE(struct wmr_controller_hp, flags, 11, 1); 320 + struct wmr_controller_hp *ctrl = 321 + U_DEVICE_ALLOCATE(struct wmr_controller_hp, flags, WMR_CONTROLLER_INDEX_COUNT, 1); 319 322 struct wmr_controller_base *wcb = (struct wmr_controller_base *)(ctrl); 320 323 321 324 if (!wmr_controller_base_init(wcb, conn, controller_type, log_level)) {