Specifically:
redundantAssignment,examples/dpfp.c:422,style,Variable 'r' is reassigned a value before the old one has been used.
redundantAssignment,libusb/os/threads_posix.c:64,style,Variable 'ret' is reassigned a value before the old one has been used.
unreadVariable,libusb/os/netbsd_usb.c:217,style,Variable 'hpriv' is assigned a value that is never used.
unreadVariable,libusb/os/netbsd_usb.c:235,style,Variable 'hpriv' is assigned a value that is never used.
unreadVariable,libusb/os/openbsd_usb.c:251,style,Variable 'hpriv' is assigned a value that is never used.
unreadVariable,libusb/os/openbsd_usb.c:275,style,Variable 'hpriv' is assigned a value that is never used.
unsignedLessThanZero,libusb/os/windows_winusb.c:259,style,Checking if unsigned variable '_index' is less than zero.
unsignedLessThanZero,libusb/os/windows_winusb.c:298,style,Checking if unsigned variable '_index' is less than zero.
unsignedLessThanZero,libusb/os/windows_winusb.c:367,style,Checking if unsigned variable '_index' is less than zero.
invalidPrintfArgType_sint,examples/xusb.c:534,warning,%d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
int main(void)
{
struct sigaction sigact;
- int r = 1;
+ int r;
r = libusb_init(NULL);
if (r < 0) {
}
// Send Read
- printf("Attempting to read %d bytes:\n", block_size);
+ printf("Attempting to read %u bytes:\n", block_size);
memset(cdb, 0, sizeof(cdb));
cdb[0] = 0x28; // Read(10)
int
netbsd_open(struct libusb_device_handle *handle)
{
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
dpriv->fd = open(dpriv->devnode, O_RDWR);
void
netbsd_close(struct libusb_device_handle *handle)
{
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
usbi_dbg("close: fd %d", dpriv->fd);
int
obsd_open(struct libusb_device_handle *handle)
{
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
char devnode[16];
void
obsd_close(struct libusb_device_handle *handle)
{
- struct handle_priv *hpriv = (struct handle_priv *)handle->os_priv;
struct device_priv *dpriv = (struct device_priv *)handle->dev->os_priv;
if (dpriv->devname) {
int usbi_get_tid(void)
{
- int ret = -1;
+ int ret;
#if defined(__ANDROID__)
ret = gettid();
#elif defined(__linux__)
mach_port_deallocate(mach_task_self(), ret);
#elif defined(__CYGWIN__)
ret = GetCurrentThreadId();
+#else
+ ret = -1;
#endif
/* TODO: NetBSD thread ID support */
return ret;
static bool get_devinfo_data(struct libusb_context *ctx,
HDEVINFO *dev_info, SP_DEVINFO_DATA *dev_info_data, const char *usb_class, unsigned _index)
{
- if (_index <= 0) {
+ if (_index == 0) {
*dev_info = pSetupDiGetClassDevsA(NULL, usb_class, NULL, DIGCF_PRESENT|DIGCF_ALLCLASSES);
if (*dev_info == INVALID_HANDLE_VALUE)
return false;
SP_DEVICE_INTERFACE_DETAIL_DATA_A *dev_interface_details;
DWORD size;
- if (_index <= 0)
+ if (_index == 0)
*dev_info = pSetupDiGetClassDevsA(guid, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);
if (dev_info_data != NULL) {
SP_DEVICE_INTERFACE_DETAIL_DATA_A *dev_interface_details;
DWORD size;
- if (_index <= 0)
+ if (_index == 0)
*dev_info = pSetupDiGetClassDevsA(guid, NULL, NULL, DIGCF_PRESENT|DIGCF_DEVICEINTERFACE);
if (dev_info_data != NULL) {
-#define LIBUSB_NANO 11238
+#define LIBUSB_NANO 11239