freemyipod r916 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r915‎ | r916 | r917 >
Date:17:33, 27 April 2014
Author:user890104
Status:new
Tags:
Comment:
emCOREFS: Fix integer formatting errors
Modified paths:
  • /emcore/trunk/tools/emcorefs/usb.c (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcorefs/usb.c
@@ -26,9 +26,9 @@
2727 #include "util.h"
2828 #include "usb.h"
2929
30 -libusb_context *usb_ctx = NULL;
31 -libusb_device_handle *usb_handle = NULL;
32 -uint8_t usb_iface_num = 0;
 30+libusb_context *usb_ctx;
 31+libusb_device_handle *usb_handle;
 32+uint8_t usb_iface_num;
3333
3434 int32_t usb_init(void) {
3535 int32_t res;
@@ -53,9 +53,10 @@
5454
5555 int32_t usb_find(uint16_t vendor_id, uint16_t product_id, uint8_t *reattach) {
5656 libusb_device **devs, *dev = NULL;
57 - ssize_t devs_cnt, i, j, k, l;
 57+ ssize_t devs_cnt, i;
 58+ uint8_t found = 0, j, k;
 59+ int l;
5860 int32_t res;
59 - uint8_t found = 0;
6061 struct libusb_device_descriptor dev_desc;
6162 struct libusb_config_descriptor *cfg_desc;
6263 const struct libusb_interface *iface;
@@ -72,18 +73,18 @@
7374 }
7475
7576 #ifdef DEBUG
76 - fprintf(stderr, "Found %Zd USB devices!\n", devs_cnt);
 77+ fprintf(stderr, "Found %zd USB devices!\n", devs_cnt);
7778 #endif
7879 for (i = 0; i < devs_cnt; ++i) {
7980 dev = devs[i];
8081 #ifdef DEBUG
81 - fprintf(stderr, "Getting device descriptor of USB device %d...\n", i);
 82+ fprintf(stderr, "Getting device descriptor of USB device %zd...\n", i);
8283 #endif
8384 res = libusb_get_device_descriptor(dev, &dev_desc);
8485
8586 if (res != LIBUSB_SUCCESS) {
8687 #ifdef DEBUG
87 - fprintf(stderr, "Unable to get device descriptor of device %d!\n", i);
 88+ fprintf(stderr, "Unable to get device descriptor of device %zd!\n", i);
8889 #endif
8990 continue;
9091 }
@@ -108,12 +109,12 @@
109110 }
110111
111112 #ifdef DEBUG
112 - fprintf(stderr, "Found %Zd configs...\n", dev_desc.bNumConfigurations);
 113+ fprintf(stderr, "Found %u configs...\n", dev_desc.bNumConfigurations);
113114 #endif
114115
115116 for (j = 0; j < dev_desc.bNumConfigurations; ++j) {
116117 #ifdef DEBUG
117 - fprintf(stderr, "Getting config descriptor %Zd of device...\n", j);
 118+ fprintf(stderr, "Getting config descriptor %u of device...\n", j);
118119 #endif
119120
120121 res = libusb_get_config_descriptor(dev, j, &cfg_desc);
@@ -155,7 +156,7 @@
156157 }
157158
158159 #ifdef DEBUG
159 - fprintf(stderr, "emCORE Debugger interface at %Zd\n", iface_desc->bInterfaceNumber);
 160+ fprintf(stderr, "emCORE Debugger interface at %u\n", iface_desc->bInterfaceNumber);
160161 #endif
161162
162163 usb_iface_num = iface_desc->bInterfaceNumber;