silence some warnings

This commit is contained in:
Nick Chan committed 2023-01-27 22:06:43 +08:00
1 parent 178123c222
commit 3e6382f65e
5 files changed
+12 -16

No files matched your search

+1 -1
View File
@@ -87,7 +87,7 @@ typedef libusb_device_handle *usb_device_handle_t;
extern void* pongo_usb_callback(void* arg); extern void* pongo_usb_callback(void* arg);
usb_ret_t USBControlTransfer(usb_device_handle_t handle, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint32_t wLength, void *data, uint32_t *wLenDone); usb_ret_t USBControlTransfer(usb_device_handle_t handle, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint32_t wLength, void *data, uint32_t *wLenDone);
usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, uint32_t len); usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, int len);
const char *usb_strerror(usb_ret_t err); const char *usb_strerror(usb_ret_t err);
int wait_for_pongo(); int wait_for_pongo();
int issue_pongo_command(); int issue_pongo_command();
+1 -1
View File
@@ -230,7 +230,7 @@ int enter_recovery_cmd(const char* udid) {
int reboot_cmd(const char* udid) { int reboot_cmd(const char* udid) {
idevice_t device = NULL; idevice_t device = NULL;
lockdownd_client_t lockdown = NULL; lockdownd_client_t __unused lockdown = NULL;
if (idevice_new(&device, udid) != IDEVICE_E_SUCCESS) { if (idevice_new(&device, udid) != IDEVICE_E_SUCCESS) {
LOG(LOG_ERROR, "Could not connect to device"); LOG(LOG_ERROR, "Could not connect to device");
return -1; return -1;
+3 -5
View File
@@ -143,7 +143,7 @@ void* connected_dfu_mode(struct irecv_device_info* info) {
return NULL; return NULL;
} }
void device_event_cb(const usbmuxd_event_t *event, void *userdata) { void device_event_cb(const usbmuxd_event_t *event, void* __unused userdata) {
if (event->device.conn_type != CONNECTION_TYPE_USB) return; if (event->device.conn_type != CONNECTION_TYPE_USB) return;
switch (event->event) { switch (event->event) {
case UE_DEVICE_ADD: case UE_DEVICE_ADD:
@@ -156,7 +156,7 @@ void device_event_cb(const usbmuxd_event_t *event, void *userdata) {
} }
} }
void irecv_device_event_cb(const irecv_device_event_t *event, void *userdata) { void irecv_device_event_cb(const irecv_device_event_t *event, void* __unused userdata) {
pthread_t recovery_thread, dfu_thread; pthread_t recovery_thread, dfu_thread;
switch(event->type) { switch(event->type) {
@@ -177,9 +177,7 @@ void irecv_device_event_cb(const irecv_device_event_t *event, void *userdata) {
} }
} }
void *dfuhelper(void *ptr) { void *dfuhelper(void* __unused ptr) {
// idevice_set_debug_level(1);
// irecv_set_debug_level(1);
subscribe_cmd(device_event_cb, irecv_device_event_cb); subscribe_cmd(device_event_cb, irecv_device_event_cb);
while (spin) { while (spin) {
sleep(1); sleep(1);
+1 -1
View File
@@ -400,7 +400,7 @@ int main(int argc, char *argv[])
pongo: pongo:
spin = true; spin = true;
if (do_pongo_sleep) if (do_pongo_sleep)
sleep(2); sleep(1);
else else
LOG(LOG_INFO, "Waiting for PongoOS devices..."); LOG(LOG_INFO, "Waiting for PongoOS devices...");
wait_for_pongo(); wait_for_pongo();
+6 -8
View File
@@ -46,8 +46,6 @@
#define CMD_LEN_MAX 512 #define CMD_LEN_MAX 512
#define UPLOADSZ_MAX (1024 * 1024 * 128) #define UPLOADSZ_MAX (1024 * 1024 * 128)
static uint8_t gBlockIO = 1;
typedef struct stuff stuff_t; typedef struct stuff stuff_t;
static void io_start(stuff_t *stuff); static void io_start(stuff_t *stuff);
@@ -67,7 +65,7 @@ usb_ret_t USBControlTransfer(usb_device_handle_t handle, uint8_t bmRequestType,
return USB_RET_SUCCESS; return USB_RET_SUCCESS;
} }
usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, uint32_t len) usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, int len)
{ {
static uint32_t maxLen = 0; static uint32_t maxLen = 0;
int transferred = 0; int transferred = 0;
@@ -109,7 +107,7 @@ usb_ret_t USBBulkUpload(usb_device_handle_t handle, void *data, uint32_t len)
} }
} }
// If we get here, we have to chunk our data // If we get here, we have to chunk our data
for(uint32_t done = transferred; done < len; ) for(int done = transferred; done < len; )
{ {
uint32_t chunk = len - done; uint32_t chunk = len - done;
if(chunk > maxLen) chunk = maxLen; if(chunk > maxLen) chunk = maxLen;
@@ -130,7 +128,7 @@ struct stuff
usb_device_handle_t handle; usb_device_handle_t handle;
}; };
static int FoundDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *arg) static int FoundDevice(libusb_context __unused *ctx, libusb_device *dev, libusb_hotplug_event __unused event, void *arg)
{ {
LOG(LOG_VERBOSE, "PongoOS USB Device connected\n"); LOG(LOG_VERBOSE, "PongoOS USB Device connected\n");
stuff_t *stuff = arg; stuff_t *stuff = arg;
@@ -178,7 +176,7 @@ static int FoundDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_e
return LIBUSB_SUCCESS; return LIBUSB_SUCCESS;
} }
static int LostDevice(libusb_context *ctx, libusb_device *dev, libusb_hotplug_event event, void *arg) static int LostDevice(libusb_context __unused *ctx, libusb_device *dev, libusb_hotplug_event __unused event, void *arg)
{ {
LOG(LOG_VERBOSE, "PongoOS USB Device disconnected"); LOG(LOG_VERBOSE, "PongoOS USB Device disconnected");
stuff_t *stuff = arg; stuff_t *stuff = arg;
@@ -239,7 +237,7 @@ int wait_for_pongo(void)
return -1; return -1;
} }
for(size_t i = 0; i < sz; ++i) for(ssize_t i = 0; i < sz; ++i)
{ {
struct libusb_device_descriptor desc = {}; struct libusb_device_descriptor desc = {};
r = libusb_get_device_descriptor(list[i], &desc); r = libusb_get_device_descriptor(list[i], &desc);
@@ -254,7 +252,7 @@ int wait_for_pongo(void)
continue; continue;
} }
r = FoundDevice(NULL, list[i], LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, &stuff); r = FoundDevice(NULL, list[i], LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, &stuff);
for(size_t j = i + 1; j < sz; ++j) for(ssize_t j = i + 1; j < sz; ++j)
{ {
libusb_unref_device(list[j]); libusb_unref_device(list[j]);
} }