libusbx52: Clean up compiler warnings

pull/22/head
nirenjan 2020-06-11 23:36:32 -07:00
parent 1e2dd5699f
commit dbacc27164
4 changed files with 7 additions and 3 deletions

View File

@ -9,6 +9,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "libusbx52.h"
FILE * fopen_env(const char *env, const char *env_default, const char *mode) FILE * fopen_env(const char *env, const char *env_default, const char *mode)
{ {

View File

@ -21,7 +21,7 @@ int libusb_init(libusb_context **ctx)
unsigned int vid; unsigned int vid;
unsigned int pid; unsigned int pid;
int parsed; int parsed;
FILE *dev_list; FILE *dev_list = NULL;
int i; int i;
/* /*
@ -236,10 +236,11 @@ int libusb_open(libusb_device *dev, libusb_device_handle **handle)
void libusb_close(libusb_device_handle *dev_handle) void libusb_close(libusb_device_handle *dev_handle)
{ {
libusb_device *dev;
/* Decrement the refcount for the underlying device */ /* Decrement the refcount for the underlying device */
dev_handle->dev->ref_count -= 1; dev_handle->dev->ref_count -= 1;
libusb_device *dev = dev_handle->dev; dev = dev_handle->dev;
LIBUSB_DUMP_LOG_FILE(dev_handle, LIBUSB_LOG_LEVEL_DEBUG, LIBUSB_DUMP_LOG_FILE(dev_handle, LIBUSB_LOG_LEVEL_DEBUG,
"VID: %04x PID: %04x idx: %d ref: %d\n", "VID: %04x PID: %04x idx: %d ref: %d\n",
dev->desc.idVendor, dev->desc.idProduct, dev->index, dev->ref_count); dev->desc.idVendor, dev->desc.idProduct, dev->index, dev->ref_count);

View File

@ -17,7 +17,6 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
FILE *data; FILE *data;
char **id_pair;
unsigned int vid; unsigned int vid;
unsigned int pid; unsigned int pid;
int i; int i;

View File

@ -82,6 +82,9 @@ int main(int argc, char *argv[])
libusb_context *ctx; libusb_context *ctx;
hdl = libusbx52_init(); hdl = libusbx52_init();
if (hdl == NULL) {
return 1;
}
ctx = hdl->ctx; ctx = hdl->ctx;
/* Process arguments until there are fewer than 2 remaining */ /* Process arguments until there are fewer than 2 remaining */