From ee011a74d4b466b09143626d5866200145a191e8 Mon Sep 17 00:00:00 2001 From: Tau Date: Mon, 17 Dec 2018 17:34:15 -0500 Subject: [PATCH] Make dprintfs 64-bit clean --- board/sg-cmd.c | 4 ++-- cardhook/_com12.c | 2 +- nu/ds.c | 6 +++--- nu/eeprom.c | 8 ++++---- nu/gpio.c | 6 +++--- nu/hwmon.c | 6 +++--- nu/nusec.c | 32 ++++++++++++++++++++++++-------- nu/sram.c | 4 ++-- util/dump.c | 2 +- 9 files changed, 43 insertions(+), 27 deletions(-) diff --git a/board/sg-cmd.c b/board/sg-cmd.c index a375686..166422b 100644 --- a/board/sg-cmd.c +++ b/board/sg-cmd.c @@ -41,7 +41,7 @@ static HRESULT sg_req_validate(const void *ptr, size_t nbytes) if (req->hdr.frame_len != nbytes) { dprintf("SG Cmd: Frame length mismatch: got %i exp %i\n", req->hdr.frame_len, - nbytes); + (int) nbytes); return E_FAIL; } @@ -51,7 +51,7 @@ static HRESULT sg_req_validate(const void *ptr, size_t nbytes) if (req->payload_len != payload_len) { dprintf("SG Cmd: Payload length mismatch: got %i exp %i\n", req->payload_len, - payload_len); + (int) payload_len); return E_FAIL; } diff --git a/cardhook/_com12.c b/cardhook/_com12.c index 78aefe1..2e32547 100644 --- a/cardhook/_com12.c +++ b/cardhook/_com12.c @@ -145,7 +145,7 @@ static HRESULT com12_mifare_poll(void *ctx, uint32_t *uid) r = fscanf(f, "%02x ", &byte); if (r != 1) { - dprintf("Aime reader: fscanf[%i] failed: %i\n", i, r); + dprintf("Aime reader: fscanf[%i] failed: %i\n", (int) i, r); goto end; } diff --git a/nu/ds.c b/nu/ds.c index d62dc6b..c7f3445 100644 --- a/nu/ds.c +++ b/nu/ds.c @@ -159,10 +159,10 @@ static HRESULT ds_handle_ioctl(struct irp *irp) return ds_ioctl_read_sector(irp); default: - dprintf("DS: Unknown ioctl %x, write %i read %i\n", + dprintf("DS: Unknown ioctl %08x, write %i read %i\n", irp->ioctl, - irp->write.nbytes, - irp->read.nbytes); + (int) irp->write.nbytes, + (int) irp->read.nbytes); return HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION); } diff --git a/nu/eeprom.c b/nu/eeprom.c index 80971b1..807b2d4 100644 --- a/nu/eeprom.c +++ b/nu/eeprom.c @@ -100,8 +100,8 @@ static HRESULT eeprom_handle_ioctl(struct irp *irp) default: dprintf("EEPROM: Unknown ioctl %x, write %i read %i\n", irp->ioctl, - irp->write.nbytes, - irp->read.nbytes); + (int) irp->write.nbytes, + (int) irp->read.nbytes); return HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION); } @@ -143,7 +143,7 @@ static HRESULT eeprom_handle_read(struct irp *irp) dprintf("EEPROM: Read off %x len %x\n", (int) irp->ovl->Offset, - irp->read.nbytes); + (int) irp->read.nbytes); return iohook_invoke_next(irp); } @@ -158,7 +158,7 @@ static HRESULT eeprom_handle_write(struct irp *irp) dprintf("EEPROM: Write off %x len %x\n", (int) irp->ovl->Offset, - irp->write.nbytes); + (int) irp->write.nbytes); return iohook_invoke_next(irp); } diff --git a/nu/gpio.c b/nu/gpio.c index be4960e..0eee74a 100644 --- a/nu/gpio.c +++ b/nu/gpio.c @@ -131,10 +131,10 @@ static HRESULT gpio_handle_ioctl(struct irp *irp) return gpio_ioctl_describe(irp); default: - dprintf("GPIO: IOCTL %08x write %i read %i\n", + dprintf("GPIO: Unknown ioctl %08x, write %i read %i\n", irp->ioctl, - irp->write.nbytes, - irp->read.nbytes); + (int) irp->write.nbytes, + (int) irp->read.nbytes); return HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION); } diff --git a/nu/hwmon.c b/nu/hwmon.c index 2e34f1c..ded2d48 100644 --- a/nu/hwmon.c +++ b/nu/hwmon.c @@ -70,10 +70,10 @@ static HRESULT hwmon_handle_ioctl(struct irp *irp) return hwmon_ioctl_read_cpu_temp(irp); default: - dprintf("Hwmon: Unknown ioctl %08x write %i read %i\n", + dprintf("Hwmon: Unknown ioctl %08x, write %i read %i\n", irp->ioctl, - irp->write.nbytes, - irp->read.nbytes); + (int) irp->write.nbytes, + (int) irp->read.nbytes); return HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION); } diff --git a/nu/nusec.c b/nu/nusec.c index 19ae177..c1ddf82 100644 --- a/nu/nusec.c +++ b/nu/nusec.c @@ -151,10 +151,10 @@ static HRESULT nusec_handle_ioctl(struct irp *irp) return nusec_ioctl_put_trace_log_data(irp); default: - dprintf("Security: Unhandled ioctl %#08x: read %i write %i\n", + dprintf("Security: Unknown ioctl %#08x, write %i read %i\n", irp->ioctl, - irp->read.nbytes, - irp->write.nbytes); + (int) irp->write.nbytes, + (int) irp->read.nbytes); return HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION); } @@ -241,9 +241,17 @@ static HRESULT nusec_ioctl_get_billing_ca_cert(struct irp *irp) irp->op = IRP_OP_READ; irp->fd = fd; - dprintf(">>> %p:%i/%i\n", irp->read.bytes, irp->read.pos, irp->read.nbytes); + dprintf(">>> %p:%i/%i\n", + irp->read.bytes, + (int) irp->read.pos, + (int) irp->read.nbytes); + hr = iohook_invoke_next(irp); - dprintf("<<< %p:%i/%i\n", irp->read.bytes, irp->read.pos, irp->read.nbytes); + + dprintf("<<< %p:%i/%i\n", + irp->read.bytes, + (int) irp->read.pos, + (int) irp->read.nbytes); if (FAILED(hr)) { dprintf("ReadFile transformation failed: %x\n", (int) hr); @@ -280,9 +288,17 @@ static HRESULT nusec_ioctl_get_billing_pubkey(struct irp *irp) irp->op = IRP_OP_READ; irp->fd = fd; - dprintf(">>> %p:%i/%i\n", irp->read.bytes, irp->read.pos, irp->read.nbytes); + dprintf(">>> %p:%i/%i\n", + irp->read.bytes, + (int) irp->read.pos, + (int) irp->read.nbytes); + hr = iohook_invoke_next(irp); - dprintf("<<< %p:%i/%i\n", irp->read.bytes, irp->read.pos, irp->read.nbytes); + + dprintf("<<< %p:%i/%i\n", + irp->read.bytes, + (int) irp->read.pos, + (int) irp->read.nbytes); if (FAILED(hr)) { dprintf("ReadFile transformation failed: %x\n", (int) hr); @@ -362,7 +378,7 @@ static HRESULT nusec_ioctl_get_trace_log_data(struct irp *irp) return hr; } - dprintf(" Params: %i %i Buf: %i\n", pos, count, irp->read.nbytes); + dprintf(" Params: %i %i Buf: %i\n", pos, count, (int) irp->read.nbytes); avail = irp->read.nbytes - irp->read.pos; diff --git a/nu/sram.c b/nu/sram.c index 9da5152..8424eac 100644 --- a/nu/sram.c +++ b/nu/sram.c @@ -96,8 +96,8 @@ static HRESULT sram_handle_ioctl(struct irp *irp) default: dprintf("SRAM: Unknown ioctl %x, write %i read %i\n", irp->ioctl, - irp->write.nbytes, - irp->read.nbytes); + (int) irp->write.nbytes, + (int) irp->read.nbytes); return HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION); } diff --git a/util/dump.c b/util/dump.c index 6e85c89..79a3cb1 100644 --- a/util/dump.c +++ b/util/dump.c @@ -24,7 +24,7 @@ void dump(const void *ptr, size_t nbytes) bytes = ptr; for (i = 0 ; i < nbytes ; i += 16) { - dprintf(" %08x:", i); + dprintf(" %08x:", (int) i); for (j = 0 ; i + j < nbytes && j < 16 ; j++) { dprintf(" %02x", bytes[i + j]);