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.
This commit is contained in:
Daniel Drake 2007-12-27 00:46:11 +00:00
parent c8aa33da0b
commit 659d8346be
8 changed files with 24 additions and 22 deletions

4
TODO
View File

@ -24,3 +24,7 @@ aes4000 resampling
PPMM parameter to get_minutiae seems to have no effect
nbis minutiae should be stored in endian-independent format
PORTABILITY
===========
OpenBSD can't do -Wshadow or visibility
OpenBSD: add compat codes for ENOTSUP ENODATA and EPROTO

View File

@ -91,7 +91,7 @@ fi
AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
AM_CFLAGS="-Werror-implicit-function-declaration -Wimplicit-int -Wunreachable-code -Wunused-function -Wunused-label -Wunused-value -Wunused-variable -Wnonnull -Wreturn-type -Wextra -Wshadow"
AM_CFLAGS="-std=gnu99 -fgnu89-inline -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
AC_SUBST(AM_CFLAGS)
AC_CONFIG_FILES([libfprint.pc] [Makefile] [libfprint/Makefile] [examples/Makefile] [doc/Makefile])

View File

@ -32,8 +32,8 @@
#define EP_IN (1 | USB_ENDPOINT_IN)
#define EP_OUT (2 | USB_ENDPOINT_OUT)
static int do_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
unsigned int num)
static int do_write_regv(struct fp_img_dev *dev,
const struct aes_regwrite *regs, unsigned int num)
{
size_t alloc_size = num * 2;
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,
return 0;
}
int aes_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
int aes_write_regv(struct fp_img_dev *dev, const struct aes_regwrite *regs,
unsigned int num)
{
unsigned int i;
@ -93,10 +93,9 @@ int aes_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
return 0;
}
int aes_assemble_image(unsigned char *input, size_t width, size_t height,
void aes_assemble_image(unsigned char *input, size_t width, size_t height,
unsigned char *output)
{
size_t frame_size = width * height;
size_t row, column;
for (column = 0; column < width; column++) {

View File

@ -27,10 +27,10 @@ struct aes_regwrite {
unsigned char value;
};
int aes_write_regv(struct fp_img_dev *dev, struct aes_regwrite *regs,
int aes_write_regv(struct fp_img_dev *dev, const struct aes_regwrite *regs,
unsigned int num);
int aes_assemble_image(unsigned char *input, size_t width, size_t height,
void aes_assemble_image(unsigned char *input, size_t width, size_t height,
unsigned char *output);
#endif

View File

@ -367,7 +367,7 @@ static struct fp_driver *find_supporting_driver(struct usb_device *udev,
*usb_id = id;
return drv;
}
} while (elem = g_slist_next(elem));
} while ((elem = g_slist_next(elem)));
return NULL;
}
@ -439,7 +439,7 @@ API_EXPORTED struct fp_dscv_dev **fp_discover_devs(void)
int i = 0;
do {
list[i++] = elem->data;
} while (elem = g_slist_next(elem));
} while ((elem = g_slist_next(elem)));
}
list[dscv_count] = NULL; /* NULL-terminate */
@ -541,7 +541,7 @@ API_EXPORTED struct fp_dscv_dev *fp_dscv_dev_for_print_data(struct fp_dscv_dev *
struct fp_dscv_dev *ddev;
int i;
for (i = 0; ddev = devs[i]; i++)
for (i = 0; (ddev = devs[i]); i++)
if (fp_dscv_dev_supports_print_data(ddev, data))
return ddev;
return NULL;
@ -561,7 +561,7 @@ API_EXPORTED struct fp_dscv_dev *fp_dscv_dev_for_dscv_print(struct fp_dscv_dev *
struct fp_dscv_dev *ddev;
int i;
for (i = 0; ddev = devs[i]; i++)
for (i = 0; (ddev = devs[i]); i++)
if (fp_dscv_dev_supports_dscv_print(ddev, print))
return ddev;
return NULL;
@ -1138,7 +1138,7 @@ API_EXPORTED void fp_exit(void)
do {
fp_dbg("naughty app left a device open on exit!");
do_close((struct fp_dev *) elem->data);
} while (elem = g_slist_next(elem));
} while ((elem = g_slist_next(elem)));
g_slist_free(opened_devices);
opened_devices = NULL;
}

View File

@ -477,7 +477,7 @@ static GSList *scan_dev_store_dir(char *devpath, uint16_t driver_id,
return list;
}
while (ent = g_dir_read_name(dir)) {
while ((ent = g_dir_read_name(dir))) {
/* ent is an 1 hex character fp_finger code */
guint64 val;
enum fp_finger finger;
@ -518,7 +518,7 @@ static GSList *scan_driver_store_dir(char *drvpath, uint16_t driver_id,
return list;
}
while (ent = g_dir_read_name(dir)) {
while ((ent = g_dir_read_name(dir))) {
/* ent is an 8 hex character devtype */
guint64 val;
uint32_t devtype;
@ -571,7 +571,7 @@ API_EXPORTED struct fp_dscv_print **fp_discover_prints(void)
return NULL;
}
while (ent = g_dir_read_name(dir)) {
while ((ent = g_dir_read_name(dir))) {
/* ent is a 4 hex digit driver_id */
gchar *endptr;
gchar *path;
@ -620,7 +620,7 @@ API_EXPORTED void fp_dscv_prints_free(struct fp_dscv_print **prints)
if (!prints)
return;
for (i = 0; print = prints[i]; i++) {
for (i = 0; (print = prints[i]); i++) {
if (print)
g_free(print->path);
g_free(print);

View File

@ -36,7 +36,7 @@ typedef int sint32;
typedef unsigned int uint32;
/** scan command */
static const sint8 anScanCommand[ 0x40 ] = {
static const unsigned char anScanCommand[ 0x40 ] = {
0x0e, 0x00, 0x03, 0xa8, 0x00, 0xb6, 0xbb, 0xbb,
0xb8, 0xb7, 0xb8, 0xb5, 0xb8, 0xb9, 0xb8, 0xb9,
0xbb, 0xbb, 0xbe, 0xbb, 0x4e, 0x16, 0xf4, 0x77,
@ -48,7 +48,7 @@ static const sint8 anScanCommand[ 0x40 ] = {
};
/** init command */
static const sint8 anInitCommand[ 0x40 ] = {
static const unsigned char anInitCommand[ 0x40 ] = {
0x03, 0x00, 0x00, 0x00, 0x02, 0xfb, 0x0f, 0x00,
0xc4, 0xf9, 0x2f, 0x01, 0x6d, 0x4f, 0x01, 0x10,
0x44, 0xf9, 0x2f, 0x01, 0x40, 0x00, 0x00, 0x00,
@ -67,7 +67,7 @@ static const sint8 anInitCommand[ 0x40 ] = {
* \param pnBuffer buffer pointer we want to store the read buffer
* \return error code
*/
static sint32 askScanner( struct fp_img_dev *dev, sint8 *pnRawString, sint32 nLen, sint8 *pnBuffer ) {
static sint32 askScanner( struct fp_img_dev *dev, const unsigned char *pnRawString, sint32 nLen, sint8 *pnBuffer ) {
sint8 anBuf[ 65535 ];
sint32 nRet;
@ -357,7 +357,6 @@ static int capture( struct fp_img_dev *dev, gboolean unconditional, struct fp_im
nRet = -1;
}
end:
g_free( pnData );
return nRet;

View File

@ -372,7 +372,7 @@ int fpi_img_compare_print_data_to_gallery(struct fp_print_data *print,
int probe_len = bozorth_probe_init(pstruct);
size_t i = 0;
while (gallery_print = gallery[i++]) {
while ((gallery_print = gallery[i++])) {
struct xyt_struct *gstruct = (struct xyt_struct *) gallery_print->data;
int r = bozorth_to_gallery(probe_len, pstruct, gstruct);
if (r >= match_threshold) {