Skip to content

Commit 659d834

Browse files
author
Daniel Drake
committed
Compiler flags update
Dropped -Wextra as it is not that useful. Set compiler flags to be more like the kernel's. Set std=gnu99 Fixed some warnings.
1 parent c8aa33d commit 659d834

File tree

8 files changed

+24
-22
lines changed

8 files changed

+24
-22
lines changed

TODO

+4
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ aes4000 resampling
2424
PPMM parameter to get_minutiae seems to have no effect
2525
nbis minutiae should be stored in endian-independent format
2626

27+
PORTABILITY
28+
===========
29+
OpenBSD can't do -Wshadow or visibility
30+
OpenBSD: add compat codes for ENOTSUP ENODATA and EPROTO

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fi
9191

9292

9393
AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
94-
AM_CFLAGS="-Werror-implicit-function-declaration -Wimplicit-int -Wunreachable-code -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wnonnull -Wreturn-type -Wextra -Wshadow"
94+
AM_CFLAGS="-std=gnu99 -fgnu89-inline -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
9595
AC_SUBST(AM_CFLAGS)
9696

9797
AC_CONFIG_FILES([libfprint.pc] [Makefile] [libfprint/Makefile] [examples/Makefile] [doc/Makefile])

libfprint/aeslib.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
#define EP_IN (1 | USB_ENDPOINT_IN)
3333
#define EP_OUT (2 | USB_ENDPOINT_OUT)
3434

35-
static int do_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
36-
unsigned int num)
35+
static int do_write_regv(struct fp_img_dev *dev,
36+
const struct aes_regwrite *regs, unsigned int num)
3737
{
3838
size_t alloc_size = num * 2;
3939
unsigned char *data = g_malloc(alloc_size);
@@ -59,7 +59,7 @@ static int do_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
5959
return 0;
6060
}
6161

62-
int aes_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
62+
int aes_write_regv(struct fp_img_dev *dev, const struct aes_regwrite *regs,
6363
unsigned int num)
6464
{
6565
unsigned int i;
@@ -93,10 +93,9 @@ int aes_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
9393
return 0;
9494
}
9595

96-
int aes_assemble_image(unsigned char *input, size_t width, size_t height,
96+
void aes_assemble_image(unsigned char *input, size_t width, size_t height,
9797
unsigned char *output)
9898
{
99-
size_t frame_size = width * height;
10099
size_t row, column;
101100

102101
for (column = 0; column < width; column++) {

libfprint/aeslib.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ struct aes_regwrite {
2727
unsigned char value;
2828
};
2929

30-
int aes_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
30+
int aes_write_regv(struct fp_img_dev *dev, const struct aes_regwrite *regs,
3131
unsigned int num);
3232

33-
int aes_assemble_image(unsigned char *input, size_t width, size_t height,
33+
void aes_assemble_image(unsigned char *input, size_t width, size_t height,
3434
unsigned char *output);
3535

3636
#endif

libfprint/core.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static struct fp_driver *find_supporting_driver(struct usb_device *udev,
367367
*usb_id = id;
368368
return drv;
369369
}
370-
} while (elem = g_slist_next(elem));
370+
} while ((elem = g_slist_next(elem)));
371371
return NULL;
372372
}
373373

@@ -439,7 +439,7 @@ API_EXPORTED struct fp_dscv_dev **fp_discover_devs(void)
439439
int i = 0;
440440
do {
441441
list[i++] = elem->data;
442-
} while (elem = g_slist_next(elem));
442+
} while ((elem = g_slist_next(elem)));
443443
}
444444
list[dscv_count] = NULL; /* NULL-terminate */
445445

@@ -541,7 +541,7 @@ API_EXPORTED struct fp_dscv_dev *fp_dscv_dev_for_print_data(struct fp_dscv_dev *
541541
struct fp_dscv_dev *ddev;
542542
int i;
543543

544-
for (i = 0; ddev = devs[i]; i++)
544+
for (i = 0; (ddev = devs[i]); i++)
545545
if (fp_dscv_dev_supports_print_data(ddev, data))
546546
return ddev;
547547
return NULL;
@@ -561,7 +561,7 @@ API_EXPORTED struct fp_dscv_dev *fp_dscv_dev_for_dscv_print(struct fp_dscv_dev *
561561
struct fp_dscv_dev *ddev;
562562
int i;
563563

564-
for (i = 0; ddev = devs[i]; i++)
564+
for (i = 0; (ddev = devs[i]); i++)
565565
if (fp_dscv_dev_supports_dscv_print(ddev, print))
566566
return ddev;
567567
return NULL;
@@ -1138,7 +1138,7 @@ API_EXPORTED void fp_exit(void)
11381138
do {
11391139
fp_dbg("naughty app left a device open on exit!");
11401140
do_close((struct fp_dev *) elem->data);
1141-
} while (elem = g_slist_next(elem));
1141+
} while ((elem = g_slist_next(elem)));
11421142
g_slist_free(opened_devices);
11431143
opened_devices = NULL;
11441144
}

libfprint/data.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ static GSList *scan_dev_store_dir(char *devpath, uint16_t driver_id,
477477
return list;
478478
}
479479

480-
while (ent = g_dir_read_name(dir)) {
480+
while ((ent = g_dir_read_name(dir))) {
481481
/* ent is an 1 hex character fp_finger code */
482482
guint64 val;
483483
enum fp_finger finger;
@@ -518,7 +518,7 @@ static GSList *scan_driver_store_dir(char *drvpath, uint16_t driver_id,
518518
return list;
519519
}
520520

521-
while (ent = g_dir_read_name(dir)) {
521+
while ((ent = g_dir_read_name(dir))) {
522522
/* ent is an 8 hex character devtype */
523523
guint64 val;
524524
uint32_t devtype;
@@ -571,7 +571,7 @@ API_EXPORTED struct fp_dscv_print **fp_discover_prints(void)
571571
return NULL;
572572
}
573573

574-
while (ent = g_dir_read_name(dir)) {
574+
while ((ent = g_dir_read_name(dir))) {
575575
/* ent is a 4 hex digit driver_id */
576576
gchar *endptr;
577577
gchar *path;
@@ -620,7 +620,7 @@ API_EXPORTED void fp_dscv_prints_free(struct fp_dscv_print **prints)
620620
if (!prints)
621621
return;
622622

623-
for (i = 0; print = prints[i]; i++) {
623+
for (i = 0; (print = prints[i]); i++) {
624624
if (print)
625625
g_free(print->path);
626626
g_free(print);

libfprint/drivers/upektc.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ typedef int sint32;
3636
typedef unsigned int uint32;
3737

3838
/** scan command */
39-
static const sint8 anScanCommand[ 0x40 ] = {
39+
static const unsigned char anScanCommand[ 0x40 ] = {
4040
0x0e, 0x00, 0x03, 0xa8, 0x00, 0xb6, 0xbb, 0xbb,
4141
0xb8, 0xb7, 0xb8, 0xb5, 0xb8, 0xb9, 0xb8, 0xb9,
4242
0xbb, 0xbb, 0xbe, 0xbb, 0x4e, 0x16, 0xf4, 0x77,
@@ -48,7 +48,7 @@ static const sint8 anScanCommand[ 0x40 ] = {
4848
};
4949

5050
/** init command */
51-
static const sint8 anInitCommand[ 0x40 ] = {
51+
static const unsigned char anInitCommand[ 0x40 ] = {
5252
0x03, 0x00, 0x00, 0x00, 0x02, 0xfb, 0x0f, 0x00,
5353
0xc4, 0xf9, 0x2f, 0x01, 0x6d, 0x4f, 0x01, 0x10,
5454
0x44, 0xf9, 0x2f, 0x01, 0x40, 0x00, 0x00, 0x00,
@@ -67,7 +67,7 @@ static const sint8 anInitCommand[ 0x40 ] = {
6767
* \param pnBuffer buffer pointer we want to store the read buffer
6868
* \return error code
6969
*/
70-
static sint32 askScanner( struct fp_img_dev *dev, sint8 *pnRawString, sint32 nLen, sint8 *pnBuffer ) {
70+
static sint32 askScanner( struct fp_img_dev *dev, const unsigned char *pnRawString, sint32 nLen, sint8 *pnBuffer ) {
7171
sint8 anBuf[ 65535 ];
7272
sint32 nRet;
7373

@@ -357,7 +357,6 @@ static int capture( struct fp_img_dev *dev, gboolean unconditional, struct fp_im
357357
nRet = -1;
358358
}
359359

360-
end:
361360
g_free( pnData );
362361

363362
return nRet;

libfprint/img.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print,
372372
int probe_len = bozorth_probe_init(pstruct);
373373
size_t i = 0;
374374

375-
while (gallery_print = gallery[i++]) {
375+
while ((gallery_print = gallery[i++])) {
376376
struct xyt_struct *gstruct = (struct xyt_struct *) gallery_print->data;
377377
int r = bozorth_to_gallery(probe_len, pstruct, gstruct);
378378
if (r >= match_threshold) {

0 commit comments

Comments
 (0)