DIGImend / hidrd

HID report descriptor I/O library and conversion tool
GNU General Public License v2.0
171 stars 29 forks source link

Fix truncation warning/error in GCC 7 #17

Closed jigpu closed 7 years ago

jigpu commented 7 years ago

GCC 7 now warns about potential truncation in printf statements, causing the build to fail (due to -Werror). Expand the size of our temporary buffer to make GCC happy.

element_bitmap.c: In function ‘parse_bitmap_element.isra.0’: element_bitmap.c:96:59: error: ‘%zu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 3 [-Werror=format-truncation=] snprintf(i_name + 3, sizeof(i_name) - 3, "%zu", i); ^~~ element_bitmap.c:96:58: note: directive argument in the range [0, 18446744073709551614] snprintf(i_name + 3, sizeof(i_name) - 3, "%zu", i); ^~~~~ element_bitmap.c:96:17: note: ‘snprintf’ output between 2 and 21 bytes into a destination of size 3 snprintf(i_name + 3, sizeof(i_name) - 3, "%zu", i); ^~~~~~~~~~~~~~

spbnick commented 7 years ago

Thanks, Jason, merged :)