[fprint] compiler warnings

edgar edgar.mueller at web.de
Wed Dec 21 14:57:08 UTC 2016


Hello,

The compilation of libfprint (snapshot from 21. Dec 2016) on debian stretch leads to a 
couple of warnings. I created some patches to remove these warnings.

1. autogen.sh complains:

configure: WARNING: unrecognized options: --enable-maintainer-mode


The patch shown below will remove this warning:

Description: remove warning 'unrecognised options: --enable-maintainer-mode'
Signed-off-by: edgar mueller <edgar.mueller at web.de>
--- a/configure.ac	2016-12-15 07:52:28.175207500 +0100
+++ b/configure.ac	2016-12-20 13:03:54.436342095 +0100
@@ -3,6 +3,7 @@ AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR([libfprint/core.c])
 AC_CONFIG_HEADERS([config.h])
+AM_MAINTAINER_MODE([enable])
 
 # Enable silent build when available (Automake 1.11)
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])



2. make complains:

  CC       drivers/libfprint_la-aes1610.lo
../../orig/libfprint/drivers/aes1610.c:736:34: warning: ‘stop_reader’ defined but not used [-Wunused-const-variable=]
 static const struct aes_regwrite stop_reader[] = {
                                  ^~~~~~~~~~~

The patch shown below will remove this warning:

Description: remove unused function stop_reader
Signed-off-by: edgar mueller <edgar.mueller at web.de>
--- a/libfprint/drivers/aes1610.c	2016-12-20 17:57:28.899732719 +0100
+++ b/libfprint/drivers/aes1610.c	2016-12-20 19:01:08.647745262 +0100
@@ -733,11 +733,6 @@ static const struct aes_regwrite init[]
 	{ 0x82, 0x00 }
 };
 
-static const struct aes_regwrite stop_reader[] = {
-	{ 0xFF, 0x00 }
-};
-
-
 enum activate_states {
 	WRITE_INIT,
 	ACTIVATE_NUM_STATES,



3. make complains:

  CC       drivers/libfprint_la-aes2501.lo
../../orig/libfprint/drivers/aes2501.c:671:34: warning: ‘init_3’ defined but not used [-Wunused-const-variable=]
 static const struct aes_regwrite init_3[] = {


The patch shown below will remove this warning:

Description: remove unsused function init_3
Signed-off-by: edgar mueller <edgar.mueller at web.de>
--- a/libfprint/drivers/aes2501.c	2016-12-20 17:57:28.899732719 +0100
+++ b/libfprint/drivers/aes2501.c	2016-12-20 19:06:39.228053252 +0100
@@ -668,15 +668,6 @@ static const struct aes_regwrite init_2[
 	{ AES2501_REG_CTRL1, AES2501_CTRL1_REG_UPDATE },
 };
 
-static const struct aes_regwrite init_3[] = {
-	{ 0xff, 0x00 },
-	{ AES2501_REG_CTRL1, AES2501_CTRL1_MASTER_RESET },
-	{ AES2501_REG_AUTOCALOFFSET, 0x41 },
-	{ AES2501_REG_EXCITCTRL, 0x42 },
-	{ AES2501_REG_DETCTRL, 0x53 },
-	{ AES2501_REG_CTRL1, AES2501_CTRL1_REG_UPDATE },
-};
-
 static const struct aes_regwrite init_4[] = {
 	{ AES2501_REG_CTRL1, AES2501_CTRL1_MASTER_RESET },
 	{ AES2501_REG_EXCITCTRL, 0x40 },


4. make complains:

  CC       nbis/mindtct/libfprint_la-morph.lo
../../orig/libfprint/nbis/mindtct/morph.c: In function ‘get_south8_2’:
../../orig/libfprint/nbis/mindtct/morph.c:152:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    if (row >= ih-1) /* catch case where image is undefined southwards   */
    ^~
../../orig/libfprint/nbis/mindtct/morph.c:155:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
       return *(ptr+iw);
       ^~~~~~
../../orig/libfprint/nbis/mindtct/morph.c: In function ‘get_north8_2’:
../../orig/libfprint/nbis/mindtct/morph.c:176:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    if (row < 1)     /* catch case where image is undefined northwards   */
    ^~
../../orig/libfprint/nbis/mindtct/morph.c:179:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
       return *(ptr-iw);
       ^~~~~~
../../orig/libfprint/nbis/mindtct/morph.c: In function ‘get_east8_2’:
../../orig/libfprint/nbis/mindtct/morph.c:200:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    if (col >= iw-1) /* catch case where image is undefined eastwards    */
    ^~
../../orig/libfprint/nbis/mindtct/morph.c:203:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
       return *(ptr+ 1);
       ^~~~~~
../../orig/libfprint/nbis/mindtct/morph.c: In function ‘get_west8_2’:
../../orig/libfprint/nbis/mindtct/morph.c:222:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
    if (col < 1)     /* catch case where image is undefined westwards     */
    ^~
../../orig/libfprint/nbis/mindtct/morph.c:225:7: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
       return *(ptr- 1);
       ^~~~~~


The patch shown below will remove these warnings:

Description: adjust missleading indentation
Signed-off-by: edgar mueller <edgar.mueller at web.de>
--- a/libfprint/nbis/mindtct/morph.c	2016-12-20 17:57:28.911732743 +0100
+++ b/libfprint/nbis/mindtct/morph.c	2016-12-20 19:22:50.513222591 +0100
@@ -152,7 +152,7 @@ char get_south8_2(char *ptr, const int r
    if (row >= ih-1) /* catch case where image is undefined southwards   */
       return failcode; /* use plane geometry and return code.           */
 
-      return *(ptr+iw);
+   return *(ptr+iw);
 }
 
 /*************************************************************************
@@ -176,7 +176,7 @@ char get_north8_2(char *ptr, const int r
    if (row < 1)     /* catch case where image is undefined northwards   */
       return failcode; /* use plane geometry and return code.           */
 
-      return *(ptr-iw);
+   return *(ptr-iw);
 }
 
 /*************************************************************************
@@ -200,7 +200,7 @@ char get_east8_2(char *ptr, const int co
    if (col >= iw-1) /* catch case where image is undefined eastwards    */
       return failcode; /* use plane geometry and return code.           */
 
-      return *(ptr+ 1);
+   return *(ptr+ 1);
 }
 
 /*************************************************************************
@@ -222,5 +222,5 @@ char get_west8_2(char *ptr, const int co
    if (col < 1)     /* catch case where image is undefined westwards     */
       return failcode; /* use plane geometry and return code.            */
 
-      return *(ptr- 1);
+   return *(ptr- 1);
 }



5. make complains:

  CC       img_capture_continuous-img_capture_continuous.o
../../orig/examples/img_capture_continuous.c: In function ‘main’:
../../orig/examples/img_capture_continuous.c:231:4: warning: ‘XKeycodeToKeysym’ is deprecated [-Wdeprecated-declarations]
    switch (XKeycodeToKeysym(display, xev.xkey.keycode, 0)) {
    ^~~~~~
In file included from ../../orig/examples/img_capture_continuous.c:25:0:
/usr/include/X11/Xlib.h:1687:15: note: declared here
 extern KeySym XKeycodeToKeysym(
               ^~~~~~~~~~~~~~~~


The patch shown below will remove these warnings:

Description: replace deprecated function XKeycodeToKeysym
Signed-off-by: edgar mueller <edgar.mueller at web.de>
--- a/examples/img_capture_continuous.c	2016-12-20 17:57:28.895732712 +0100
+++ b/examples/img_capture_continuous.c	2016-12-20 19:43:58.359089499 +0100
@@ -23,6 +23,7 @@
 
 #include <libfprint/fprint.h>
 #include <X11/Xlib.h>
+#include <X11/XKBlib.h>
 #include <X11/keysym.h>
 #include <X11/extensions/Xvlib.h>
 
@@ -227,8 +228,7 @@ int main(void)
 			XNextEvent(display, &xev);
 			if (xev.type != KeyPress)
 				continue;
-
-			switch (XKeycodeToKeysym(display, xev.xkey.keycode, 0)) {
+			switch (XkbKeycodeToKeysym(display, xev.xkey.keycode, 0, 0)) {
 			case XK_q:
 			case XK_Q:
 				r = 0;



In addition to these code clean up patches, two other issues mabe fixed.

6. The commit https://cgit.freedesktop.org/libfprint/libfprint/commit/?id=a0bbbd7d32150ab6ed25f466cce05169fbbbaead added the USB error message when libusb_claim_interface() fails. 
The patch shown below will add this error message to the driver vfs0050:

Description: Print USB error when libusb_claim_interface() fails
Signed-off-by: edgar mueller <edgar.mueller at web.de>
--- a/libfprint/drivers/vfs0050.c	2016-12-20 17:57:28.903732728 +0100
+++ b/libfprint/drivers/vfs0050.c	2016-12-20 18:22:49.252206308 +0100
@@ -732,7 +732,7 @@ static int dev_open(struct fp_img_dev *i
 	int error = libusb_claim_interface(idev->udev, 0);
 	if (error < 0) {
 		/* Interface not claimed, return error */
-		fp_err("could not claim interface 0");
+		fp_err("could not claim interface 0: %s", libusb_error_name(error));
 		return error;
 	}
 


7. All drivers except vfs301 use a non-versioned libusb.h header path. 
The patch shown below will remove this exception:

Description: Use non-versioned libusb.h path
Signed-off-by: edgar mueller <edgar.mueller at web.de>
diff -uprN a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c
--- a/libfprint/drivers/vfs301.c	2016-12-20 17:57:28.903732728 +0100
+++ b/libfprint/drivers/vfs301.c	2016-12-20 18:05:52.619721254 +0100
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <stdlib.h>
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
 
 #include "vfs301_proto.h"
 #include <unistd.h>
diff -uprN a/libfprint/drivers/vfs301_proto.c b/libfprint/drivers/vfs301_proto.c
--- a/libfprint/drivers/vfs301_proto.c	2016-12-20 17:57:28.903732728 +0100
+++ b/libfprint/drivers/vfs301_proto.c	2016-12-20 18:06:08.931698526 +0100
@@ -33,7 +33,7 @@
 #include <stdio.h>
 #include <assert.h>
 #include <stdlib.h>
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
 
 #include "vfs301_proto.h"
 #include "vfs301_proto_fragments.h"
diff -uprN a/libfprint/drivers/vfs301_proto.h b/libfprint/drivers/vfs301_proto.h
--- a/libfprint/drivers/vfs301_proto.h	2016-12-20 17:57:28.903732728 +0100
+++ b/libfprint/drivers/vfs301_proto.h	2016-12-20 18:07:37.239626231 +0100
@@ -18,7 +18,7 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
 
 enum {
 	VFS301_DEFAULT_WAIT_TIMEOUT = 300,


Please check these patches and apply them if appropriate.

Regards
Edgar




More information about the fprint mailing list