libfprint/drivers/elan.c:351:4: warning: 2nd function call argument is an uninitialized value
dbg_buf(elandev->last_read, transfer->actual_length);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libfprint/drivers/elan.c:46:5: note: expanded from macro 'dbg_buf'
fp_dbg("%02x", buf[0]); \
^~~~~~~~~~~~~~~~~~~~~~
../../../../../../Projects/jhbuild/libfprint/libfprint/fpi-log.h:52:16: note: expanded from macro 'fp_dbg'
#define fp_dbg g_debug
^
libfprint/drivers/elan.c:351:4: warning: The left operand of '<<' is a garbage value
dbg_buf(elandev->last_read, transfer->actual_length);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libfprint/drivers/elan.c:48:27: note: expanded from macro 'dbg_buf'
fp_dbg("%04x", buf[0] << 8 | buf[1]); \
~~~~~~ ^
libfprint/drivers/elan.c:351:4: warning: The left operand of '<<' is a garbage value
dbg_buf(elandev->last_read, transfer->actual_length);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libfprint/drivers/elan.c:50:41: note: expanded from macro 'dbg_buf'
fp_dbg("%04x... (%d bytes)", buf[0] << 8 | buf[1], len)
~~~~~~ ^
By asserting if we have a zero line width.
libfprint/drivers/upeksonly.c:118:7: warning: Division by zero
mean /= (ctx->line_width / 2);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
We don't need to assign urudev if we only want the size of one of its
members.
libfprint/drivers/uru4000.c:554:20: warning: Value stored to 'urudev' during its initialization is never read
struct uru4k_dev *urudev = FP_INSTANCE_DATA(FP_DEV(dev));
^~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use GPtrArray to simplify the implementation.
libfprint/fpi-data.c:777:13: warning: Access to field 'data' results in a dereference of a null pointer (loaded from variable 'elem')
list[i] = elem->data;
^~~~~~~~~~
libfprint/fpi-data.c:497:7: warning: 2nd function call argument is an uninitialized value
if (!fp_dev_supports_print_data(dev, fdata)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libfprint/fpi-poll.c:398:11: warning: The left operand of '==' is a garbage value
else if (timercmp(&fprint_timeout, &libusb_timeout, <))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/sys/time.h:162:17: note: expanded from macro 'timercmp'
(((a)->tv_sec == (b)->tv_sec) ? \
~~~~~~~~~~~ ^
libfprint/fpi-ssm.c:244:9: warning: Access to field 'completed' results in a dereference of a null pointer (loaded from variable 'machine')
BUG_ON(machine->completed);
^~~~~~~~~~~~~~~~~~
libfprint/fpi-log.h:84:6: note: expanded from macro 'BUG_ON'
if (condition) { \
^~~~~~~~~
See dda6857fee
and https://bugzilla.redhat.com/show_bug.cgi?id=1656518
When the number of lines to assemble is 1, the median_filter() function
would be passed -1 as its size as it was calculated with:
(num_lines / 2) - 1
so (1 / 2) - 1 = 0 - 1 = -1
Add a guard to stop drivers trying to assemble single lines. This
doesn't however fix the vfs5011 driver that tried to do that.
...and add "Returns" docs to fpi-dev.c
We might need to do this more, documenting what the function does in
prose, as well as a short explanation of the returned data.
In commit 231b8f9, when porting from doxygen to gtk-doc, we created a
section for "poll" functions, but we renamed that section to "events"
during the porting process. We ended up with an empty "poll" section,
and a correctly migrated "events" section.
If get_next_timeout_expiry() fails, and libusb_get_next_timeout()
has no timeouts or failed, fprint_timeout will not be set, and
we cannot compare it to libusb_timeout.
Exit early if both failed or have empty queues.
libfprint/drivers/elan.c:351:12: warning: format specifies type 'unsigned short' but the argument has type 'unsigned char' [-Wformat]
dbg_buf(elandev->last_read, transfer->actual_length);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libfprint/drivers/elan.c:46:21: note: expanded from macro 'dbg_buf'
fp_dbg("%02hx", buf[0]); \
~~~~~~~~~~~~~~~~^~~~~~~
include/glib-2.0/glib/gmessages.h:345:32: note: expanded from macro 'g_debug'
__VA_ARGS__)
^~~~~~~~~~~
libfprint/drivers/elan.c:351:12: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
dbg_buf(elandev->last_read, transfer->actual_length);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libfprint/drivers/elan.c:48:21: note: expanded from macro 'dbg_buf'
fp_dbg("%04hx", buf[0] << 8 | buf[1]); \
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/glib-2.0/glib/gmessages.h:345:32: note: expanded from macro 'g_debug'
__VA_ARGS__)
^~~~~~~~~~~
libfprint/drivers/elan.c:351:12: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
dbg_buf(elandev->last_read, transfer->actual_length);
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libfprint/drivers/elan.c:50:35: note: expanded from macro 'dbg_buf'
fp_dbg("%04hx... (%d bytes)", buf[0] << 8 | buf[1], len)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/glib-2.0/glib/gmessages.h:345:32: note: expanded from macro 'g_debug'
__VA_ARGS__)
^~~~~~~~~~~
libfprint/drivers/elan.c:413:10: warning: format specifies type 'unsigned short' but the argument has type 'unsigned char' [-Wformat]
dbg_buf(cmd->cmd, 2);
~~~~~~~~^~~~~~~~~~~~
libfprint/drivers/elan.c:46:21: note: expanded from macro 'dbg_buf'
fp_dbg("%02hx", buf[0]); \
~~~~~~~~~~~~~~~~^~~~~~~
include/glib-2.0/glib/gmessages.h:345:32: note: expanded from macro 'g_debug'
__VA_ARGS__)
^~~~~~~~~~~
libfprint/drivers/elan.c:413:10: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
dbg_buf(cmd->cmd, 2);
~~~~~~~~^~~~~~~~~~~~
libfprint/drivers/elan.c:48:21: note: expanded from macro 'dbg_buf'
fp_dbg("%04hx", buf[0] << 8 | buf[1]); \
~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
include/glib-2.0/glib/gmessages.h:345:32: note: expanded from macro 'g_debug'
__VA_ARGS__)
^~~~~~~~~~~
libfprint/drivers/elan.c:413:10: warning: format specifies type 'unsigned short' but the argument has type 'int' [-Wformat]
dbg_buf(cmd->cmd, 2);
~~~~~~~~^~~~~~~~~~~~
libfprint/drivers/elan.c:50:35: note: expanded from macro 'dbg_buf'
fp_dbg("%04hx... (%d bytes)", buf[0] << 8 | buf[1], len)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/glib-2.0/glib/gmessages.h:345:32: note: expanded from macro 'g_debug'
__VA_ARGS__)
^~~~~~~~~~~
libfprint/drivers/vfs101.c:854:6: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
if (abs(count - VFS_IMG_BEST_CONTRAST) < abs(vdev->best_clevel - VFS_IMG_BEST_CONTRAST))
^
libfprint/drivers/vfs101.c:854:6: note: use function 'labs' instead
if (abs(count - VFS_IMG_BEST_CONTRAST) < abs(vdev->best_clevel - VFS_IMG_BEST_CONTRAST))
^~~
labs