diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-07-10 14:15:53 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-07-10 14:15:53 +0000 |
commit | 916ae8e45c6bd152c979c581a46108fdfb7a9111 (patch) | |
tree | 57a73b4c88e143f696376dd2fa566249ccfe438c /lib/libusb/libusb10_desc.c | |
parent | bc06993eb4fc58e6b7b99c857dcdc29054d79d0c (diff) | |
download | FreeBSD-src-916ae8e45c6bd152c979c581a46108fdfb7a9111.zip FreeBSD-src-916ae8e45c6bd152c979c581a46108fdfb7a9111.tar.gz |
Sync the libusb 1.0 exported api to the latest GSoC code.
- Fix possible uninitialised variables and null derefs
- Support big transfers
- Various bug fixes and style changes
Submitted by: Sylvestre Gallon
Sponsored by: Google Summer of Code 2009
Approved by: re (kib)
Diffstat (limited to 'lib/libusb/libusb10_desc.c')
-rw-r--r-- | lib/libusb/libusb10_desc.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/libusb/libusb10_desc.c b/lib/libusb/libusb10_desc.c index a150f4d..b218c2e 100644 --- a/lib/libusb/libusb10_desc.c +++ b/lib/libusb/libusb10_desc.c @@ -47,7 +47,7 @@ libusb_get_device_descriptor(libusb_device * dev, ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_descriptor enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_descriptor enter"); if ((dev == NULL) || (desc == NULL)) return (LIBUSB_ERROR_INVALID_PARAM); @@ -70,7 +70,7 @@ libusb_get_device_descriptor(libusb_device * dev, desc->iSerialNumber = pdesc->iSerialNumber; desc->bNumConfigurations = pdesc->bNumConfigurations; - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_descriptor leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_descriptor leave"); return (0); } @@ -84,12 +84,12 @@ libusb_get_active_config_descriptor(libusb_device * dev, ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_active_config_descriptor enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_active_config_descriptor enter"); pdev = dev->os_priv; idx = libusb20_dev_get_config_index(pdev); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_active_config_descriptor leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_active_config_descriptor leave"); return (libusb_get_config_descriptor(dev, idx, config)); } @@ -113,7 +113,7 @@ libusb_get_config_descriptor(libusb_device * dev, uint8_t config_index, ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor enter"); if (dev == NULL || config == NULL) return (LIBUSB_ERROR_INVALID_PARAM); @@ -225,7 +225,7 @@ libusb_get_config_descriptor(libusb_device * dev, uint8_t config_index, } free(pconf); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor leave"); return (0); } @@ -241,7 +241,7 @@ libusb_get_config_descriptor_by_value(libusb_device * dev, ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor_by_value enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor_by_value enter"); if (dev == NULL || config == NULL) return (LIBUSB_ERROR_INVALID_PARAM); @@ -259,7 +259,7 @@ libusb_get_config_descriptor_by_value(libusb_device * dev, free(pconf); } - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor_by_value leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_config_descriptor_by_value leave"); return (LIBUSB_ERROR_NOT_FOUND); } @@ -270,10 +270,10 @@ libusb_free_config_descriptor(struct libusb_config_descriptor *config) ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_config_descriptor enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_config_descriptor enter"); free(config); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_config_descriptor leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_config_descriptor leave"); } int @@ -282,17 +282,16 @@ libusb_get_string_descriptor_ascii(libusb_device_handle * dev, { struct libusb20_device *pdev; libusb_context *ctx; - int ret; ctx = NULL; GET_CONTEXT(ctx); - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_string_descriptor_ascii enter"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_string_descriptor_ascii enter"); if (dev == NULL || data == NULL) return (LIBUSB20_ERROR_INVALID_PARAM); pdev = dev->os_priv; - dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_string_descriptor_ascii leave"); + DPRINTF(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_string_descriptor_ascii leave"); if (libusb20_dev_req_string_simple_sync(pdev, desc_index, data, length) == 0) return (strlen(data)); |