ソースを参照
Fix or hide most compiler warnings reported by gcc 7.3 (#132)
* Share _hid_to_unix_path function
Share the rift version of _hid_to_unix_path with deepoon and nolo drivers.
This fixes the following compiler warnings:
drv_deepoon/deepoon.c: In function ‘open_device’:
drv_deepoon/deepoon.c:198:21: warning: ‘
’ directive writing 1 byte into a region of size between 0 and 4 [-Wformat-overflow=]
sprintf (bus, "%.*s\n", 4, path);
^~
drv_deepoon/deepoon.c:198:2: note: ‘sprintf’ output between 2 and 6 bytes into a destination of size 4
sprintf (bus, "%.*s\n", 4, path);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drv_deepoon/deepoon.c:199:21: warning: ‘
’ directive writing 1 byte into a region of size between 0 and 4 [-Wformat-overflow=]
sprintf (dev, "%.*s\n", 4, path + 5);
^~
drv_deepoon/deepoon.c:199:2: note: ‘sprintf’ output between 2 and 6 bytes into a destination of size 4
sprintf (dev, "%.*s\n", 4, path + 5);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drv_nolo/nolo.c: In function ‘open_device’:
drv_nolo/nolo.c:150:21: warning: ‘
’ directive writing 1 byte into a region of size between 0 and 16 [-Wformat-overflow=]
sprintf (bus, "%.*s\n", len, path);
^~
drv_nolo/nolo.c:150:2: note: ‘sprintf’ output between 2 and 18 bytes into a destination of size 16
sprintf (bus, "%.*s\n", len, path);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drv_nolo/nolo.c:151:21: warning: ‘
’ directive writing 1 byte into a region of size between 0 and 16 [-Wformat-overflow=]
sprintf (dev, "%.*s\n", len, path + 5);
^~
drv_nolo/nolo.c:151:2: note: ‘sprintf’ output between 2 and 18 bytes into a destination of size 16
sprintf (dev, "%.*s\n", len, path + 5);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* nolo: remove unused send_feature_report function
This fixes the following compiler warning:
drv_nolo/nolo.c:32:12: warning: ‘send_feature_report’ defined but not used [-Wunused-function]
static int send_feature_report(drv_priv* priv, const unsigned char *data, size_t length)
^~~~~~~~~~~~~~~~~~~
* psvr: remove unused local idx variable
This fixes the following compiler warning:
drv_psvr/psvr.c: In function ‘open_device’:
drv_psvr/psvr.c:190:6: warning: unused variable ‘idx’ [-Wunused-variable]
int idx = atoi(desc->path);
^~~
* vive: ignore misleading indentation compiler warnings for miniz.c
This hides the following compiler warnings:
In file included from drv_htc_vive/vive_config.h:8:0,
from drv_htc_vive/packet.c:2:
drv_htc_vive/../ext_deps/miniz.c: In function ‘tinfl_decompress’:
drv_htc_vive/../ext_deps/miniz.c:1500:9: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
^~~
drv_htc_vive/../ext_deps/miniz.c:1500:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
^~~
drv_htc_vive/../ext_deps/miniz.c: In function ‘tdefl_find_match’:
drv_htc_vive/../ext_deps/miniz.c:2284:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32;
^~
drv_htc_vive/../ext_deps/miniz.c:2284:23: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32;
^
* wmr: work around false positive warning on ancient gcc
Declare the raw gyro and accelerometer values passed to the vec3f conversion
helpers as non-const to avoid the following compiler warnings on ancient
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4:
drv_wmr/wmr.c: In function 'handle_tracker_sensor_msg':
drv_wmr/wmr.c:93:3: warning: passing argument 1 of 'vec3f_from_hololens_gyro' from incompatible pointer type [enabled by default]
vec3f_from_hololens_gyro(s->gyro, i, &priv->raw_gyro);
^
drv_wmr/wmr.c:38:13: note: expected 'const int16_t (*)[32]' but argument is of type 'int16_t (*)[32]'
static void vec3f_from_hololens_gyro(const int16_t smp[3][32], int i, vec3f* out_vec)
^
drv_wmr/wmr.c:94:3: warning: passing argument 1 of 'vec3f_from_hololens_accel' from incompatible pointer type [enabled by default]
vec3f_from_hololens_accel(s->accel, i, &priv->raw_accel);
^
drv_wmr/wmr.c:66:13: note: expected 'const int32_t (*)[4]' but argument is of type 'int32_t (*)[4]'
static void vec3f_from_hololens_accel(const int32_t smp[3][4], int i, vec3f* out_vec)
^