Misc: Fix more Clang warnings in core and darwin
* http://sourceforge.net/mailarchive/message.php?msg_id=29418038 * core.c:700:4: warning: Function call argument is an uninitialized value * darwin_usb.c:1713:11: warning: Access to field 'cfSource' results in a dereference of a null pointer (loaded from variable 'hpriv') * sync.c/dpfp.c/dpfp_threaded.c: warning: Result of 'malloc' is converted to a pointer of type 'unsigned char', which is incompatible with sizeof operand type
This commit is contained in:
parent
0e0cbb6c27
commit
63f569be66
6 changed files with 7 additions and 5 deletions
|
@ -164,7 +164,7 @@ static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
static int set_mode_async(unsigned char data)
|
static int set_mode_async(unsigned char data)
|
||||||
{
|
{
|
||||||
unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
|
unsigned char *buf = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
|
||||||
struct libusb_transfer *transfer;
|
struct libusb_transfer *transfer;
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
|
|
|
@ -193,7 +193,7 @@ static void LIBUSB_CALL cb_mode_changed(struct libusb_transfer *transfer)
|
||||||
|
|
||||||
static int set_mode_async(unsigned char data)
|
static int set_mode_async(unsigned char data)
|
||||||
{
|
{
|
||||||
unsigned char *buf = malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
|
unsigned char *buf = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + 1);
|
||||||
struct libusb_transfer *transfer;
|
struct libusb_transfer *transfer;
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
|
|
|
@ -683,7 +683,7 @@ int API_EXPORTED libusb_get_port_path(libusb_context *ctx, libusb_device *dev, u
|
||||||
{
|
{
|
||||||
int i = path_len;
|
int i = path_len;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
struct libusb_device **devs;
|
struct libusb_device **devs = NULL;
|
||||||
|
|
||||||
/* The device needs to be open, else the parents may have been destroyed */
|
/* The device needs to be open, else the parents may have been destroyed */
|
||||||
r = libusb_get_device_list(ctx, &devs);
|
r = libusb_get_device_list(ctx, &devs);
|
||||||
|
|
|
@ -1698,6 +1698,8 @@ static int op_handle_events(struct libusb_context *ctx, struct pollfd *fds, POLL
|
||||||
if (hpriv->fds[0] == pollfd->fd)
|
if (hpriv->fds[0] == pollfd->fd)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!hpriv)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (!(pollfd->revents & POLLERR)) {
|
if (!(pollfd->revents & POLLERR)) {
|
||||||
ret = read (hpriv->fds[0], &message, sizeof (message));
|
ret = read (hpriv->fds[0], &message, sizeof (message));
|
||||||
|
|
|
@ -81,7 +81,7 @@ int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
|
||||||
if (!transfer)
|
if (!transfer)
|
||||||
return LIBUSB_ERROR_NO_MEM;
|
return LIBUSB_ERROR_NO_MEM;
|
||||||
|
|
||||||
buffer = malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
|
buffer = (unsigned char*) malloc(LIBUSB_CONTROL_SETUP_SIZE + wLength);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
libusb_free_transfer(transfer);
|
libusb_free_transfer(transfer);
|
||||||
return LIBUSB_ERROR_NO_MEM;
|
return LIBUSB_ERROR_NO_MEM;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define LIBUSB_NANO 10535
|
#define LIBUSB_NANO 10536
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue