mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 12:46:12 +00:00
d/ht_ctrl_emu: work around truncation warning
../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp: In function ‘int cemu_devices_create(xrt_device*, xrt_device*, xrt_device**)’: ../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:102: warning: ‘ Left Hand’ directive output may be truncated writing 10 bytes into a region of size between 1 and 256 [-Wformat-truncation=] 439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str); | ^~~~~~~~~~ ../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:35: note: ‘snprintf’ output between 11 and 266 bytes into a destination of size 256 439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:84: warning: ‘ Right Hand’ directive output may be truncated writing 11 bytes into a region of size between 1 and 256 [-Wformat-truncation=] 439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str); | ^~~~~~~~~~~ ../src/xrt/drivers/ht_ctrl_emu/ht_ctrl_emu.cpp:439:35: note: ‘snprintf’ output between 12 and 267 bytes into a destination of size 256 439 | int ret = snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
2b101e6ffa
commit
b7c8a6faa5
|
@ -436,7 +436,11 @@ cemu_devices_create(struct xrt_device *head, struct xrt_device *hands, struct xr
|
|||
i ? XRT_DEVICE_TYPE_RIGHT_HAND_CONTROLLER : XRT_DEVICE_TYPE_LEFT_HAND_CONTROLLER;
|
||||
|
||||
//!@todo What should we do with the serial numbers?
|
||||
snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str);
|
||||
int ret =
|
||||
snprintf(cemud[i]->base.str, XRT_DEVICE_NAME_LEN, i ? "%s Right Hand" : "%s Left Hand", hands->str);
|
||||
if (ret >= 0) {
|
||||
CEMU_DEBUG(cemud[i], "name truncated: %s", cemud[i]->base.str);
|
||||
}
|
||||
|
||||
cemud[i]->ht_input_name =
|
||||
i ? XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT : XRT_INPUT_GENERIC_HAND_TRACKING_LEFT;
|
||||
|
|
Loading…
Reference in a new issue