summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-09-06 10:33:00 +0000
committerVitali Lovich <vlovich@aliph.com>2011-09-06 10:41:13 +0100
commit1545bc6a402f81beb132f53b8044ad119a59e1d1 (patch)
treec13264a3c8684b8d76eda5bd99f31c1ddb4a45d6
parent1b52e6f1a14b5a8f4b735c163e57fdc586b1e232 (diff)
downloadlibusb-1545bc6a402f81beb132f53b8044ad119a59e1d1.tar.gz
Linux: Fix warnings seen when compiling with gcc-4.6
Compiling with gcc-4.6 results in the following warnings: os/linux_usbfs.c: In function 'op_get_configuration': os/linux_usbfs.c:1144:6: warning: variable 'r' set but not used ... os/linux_usbfs.c: In function 'op_handle_events': os/linux_usbfs.c:2091:40: warning: 'status' may be used uninitialized ... os/linux_usbfs.c:2044:6: note: 'status' was declared here dpfp.c: In function 'save_to_file': dpfp.c:228:9: warning: variable 'ignore' set but not used ... dpfp_threaded.c: In function 'save_to_file': dpfp_threaded.c:257:9: warning: variable 'ignore' set but not used ... This patch fixes these. (The second comes from handle_control_completion() which gcc seems to inline into op_handle_events().) Signed-off-by: Hans de Goede <hdegoede@redhat.com> [stuge: Add fixes for dpfp examples and update source references]
-rw-r--r--examples/dpfp.c3
-rw-r--r--examples/dpfp_threaded.c3
-rw-r--r--libusb/os/linux_usbfs.c4
3 files changed, 6 insertions, 4 deletions
diff --git a/examples/dpfp.c b/examples/dpfp.c
index 07ffe4d..abbe9dc 100644
--- a/examples/dpfp.c
+++ b/examples/dpfp.c
@@ -225,7 +225,6 @@ static int save_to_file(unsigned char *data)
{
FILE *fd;
char filename[64];
- size_t ignore;
sprintf(filename, "finger%d.pgm", img_idx++);
fd = fopen(filename, "w");
@@ -233,7 +232,7 @@ static int save_to_file(unsigned char *data)
return -1;
fputs("P5 384 289 255 ", fd);
- ignore = fwrite(data + 64, 1, 384*289, fd);
+ (void) fwrite(data + 64, 1, 384*289, fd);
fclose(fd);
printf("saved image to %s\n", filename);
return 0;
diff --git a/examples/dpfp_threaded.c b/examples/dpfp_threaded.c
index 7868015..71baa6a 100644
--- a/examples/dpfp_threaded.c
+++ b/examples/dpfp_threaded.c
@@ -254,7 +254,6 @@ static int save_to_file(unsigned char *data)
{
FILE *fd;
char filename[64];
- size_t ignore;
sprintf(filename, "finger%d.pgm", img_idx++);
fd = fopen(filename, "w");
@@ -262,7 +261,7 @@ static int save_to_file(unsigned char *data)
return -1;
fputs("P5 384 289 255 ", fd);
- ignore = fwrite(data + 64, 1, 384*289, fd);
+ (void) fwrite(data + 64, 1, 384*289, fd);
fclose(fd);
printf("saved image to %s\n", filename);
return 0;
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
index cce019e..b58861e 100644
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -1215,6 +1215,9 @@ static int op_get_configuration(struct libusb_device_handle *handle,
return LIBUSB_ERROR_NOT_SUPPORTED;
r = sysfs_get_active_config(handle->dev, config);
+ if (r < 0)
+ return r;
+
if (*config == -1)
*config = 0;
@@ -2132,6 +2135,7 @@ static int handle_control_completion(struct usbi_transfer *itransfer,
status = LIBUSB_TRANSFER_COMPLETED;
break;
case -ENOENT: /* cancelled */
+ status = LIBUSB_TRANSFER_CANCELLED;
break;
case -ESHUTDOWN:
usbi_dbg("device removed");