[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/3] mingw32: avoid using %zd etc. formats which are
From: |
Blue Swirl |
Subject: |
[Qemu-devel] [PATCH 3/3] mingw32: avoid using %zd etc. formats which are not known by the compiler |
Date: |
Sat, 15 May 2010 23:49:38 +0300 |
Signed-off-by: Blue Swirl <address@hidden>
---
audio/audio.c | 11 ++++++-----
audio/audio_template.h | 2 +-
audio/esdaudio.c | 8 ++++----
audio/mixeng.c | 3 ++-
audio/ossaudio.c | 8 ++++----
block/curl.c | 4 ++--
block/qcow2.c | 2 +-
buffered_file.c | 13 +++++++------
hw/ac97.c | 4 ++--
hw/eepro100.c | 22 +++++++++++++---------
hw/loader.c | 8 ++++----
hw/scsi-bus.c | 4 ++--
hw/scsi-disk.c | 16 ++++++++--------
hw/usb-ohci.c | 7 ++++---
hw/virtio-9p-debug.c | 2 +-
hw/virtio-9p.c | 2 +-
hw/xen_console.c | 3 ++-
hw/xen_disk.c | 6 ++++--
hw/xenfb.c | 9 ++++++---
osdep.c | 2 +-
qemu-common.h | 7 +++++++
qemu-io.c | 4 ++--
target-cris/translate.c | 2 +-
target-microblaze/translate.c | 2 +-
usb-linux.c | 2 +-
vnc-auth-sasl.c | 2 +-
vnc.c | 9 +++++----
27 files changed, 93 insertions(+), 71 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index dbf0b96..fdb6f5e 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -189,7 +189,8 @@ void *audio_calloc (const char *funcname, int
nmemb, size_t size)
if (audio_bug ("audio_calloc", cond)) {
AUD_log (NULL, "%s passed invalid arguments to audio_calloc\n",
funcname);
- AUD_log (NULL, "nmemb=%d size=%zu (len=%zu)\n", nmemb, size, len);
+ AUD_log (NULL, "nmemb=%d size=%" PRIzu " (len=%" PRIzu ")\n",
+ nmemb, size, len);
return NULL;
}
@@ -801,7 +802,7 @@ static int audio_attach_capture (HWVoiceOut *hw)
sc = audio_calloc (AUDIO_FUNC, 1, sizeof (*sc));
if (!sc) {
- dolog ("Could not allocate soft capture voice (%zu bytes)\n",
+ dolog ("Could not allocate soft capture voice (%" PRIzu "
bytes)\n",
sizeof (*sc));
return -1;
}
@@ -1937,8 +1938,8 @@ CaptureVoiceOut *AUD_add_capture (
cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb));
if (!cb) {
- dolog ("Could not allocate capture callback information, size %zu\n",
- sizeof (*cb));
+ dolog ("Could not allocate capture callback information, size %" PRIzu
+ "\n", sizeof (*cb));
goto err0;
}
cb->ops = *ops;
@@ -1955,7 +1956,7 @@ CaptureVoiceOut *AUD_add_capture (
cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap));
if (!cap) {
- dolog ("Could not allocate capture voice, size %zu\n",
+ dolog ("Could not allocate capture voice, size %" PRIzu "\n",
sizeof (*cap));
goto err1;
}
diff --git a/audio/audio_template.h b/audio/audio_template.h
index 2f5224b..c89af94 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -350,7 +350,7 @@ static SW *glue (audio_pcm_create_voice_pair_, TYPE) (
sw = audio_calloc (AUDIO_FUNC, 1, sizeof (*sw));
if (!sw) {
- dolog ("Could not allocate soft voice `%s' (%zu bytes)\n",
+ dolog ("Could not allocate soft voice `%s' (%" PRIzu " bytes)\n",
sw_name ? sw_name : "unknown", sizeof (*sw));
goto err1;
}
diff --git a/audio/esdaudio.c b/audio/esdaudio.c
index 79142d1..c46ff63 100644
--- a/audio/esdaudio.c
+++ b/audio/esdaudio.c
@@ -131,8 +131,8 @@ static void *qesd_thread_out (void *arg)
int wsamples = written >> hw->info.shift;
int wbytes = wsamples << hw->info.shift;
if (wbytes != written) {
- dolog ("warning: Misaligned write %d (requested %zd), "
- "alignment %d\n",
+ dolog ("warning: Misaligned write %d (requested %" PRIzd
+ "), alignment %d\n",
wbytes, written, hw->info.align + 1);
}
to_mix -= wsamples;
@@ -360,8 +360,8 @@ static void *qesd_thread_in (void *arg)
int rsamples = nread >> hw->info.shift;
int rbytes = rsamples << hw->info.shift;
if (rbytes != nread) {
- dolog ("warning: Misaligned write %d (requested %zd), "
- "alignment %d\n",
+ dolog ("warning: Misaligned write %d (requested %" PRIzd
+ "), alignment %d\n",
rbytes, nread, hw->info.align + 1);
}
to_grab -= rsamples;
diff --git a/audio/mixeng.c b/audio/mixeng.c
index 9f1d93f..27b544a 100644
--- a/audio/mixeng.c
+++ b/audio/mixeng.c
@@ -301,7 +301,8 @@ void *st_rate_start (int inrate, int outrate)
struct rate *rate = audio_calloc (AUDIO_FUNC, 1, sizeof (*rate));
if (!rate) {
- dolog ("Could not allocate resampler (%zu bytes)\n", sizeof (*rate));
+ dolog ("Could not allocate resampler (%" PRIzu " bytes)\n",
+ sizeof (*rate));
return NULL;
}
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index 42bffae..7b0d097 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -407,7 +407,7 @@ static void oss_write_pending (OSSVoiceOut *oss)
}
if (bytes_written & hw->info.align) {
- dolog ("misaligned write asked for %d, but got %zd\n",
+ dolog ("misaligned write asked for %d, but got %" PRIzd "\n",
bytes_to_write, bytes_written);
return;
}
@@ -773,9 +773,9 @@ static int oss_run_in (HWVoiceIn *hw)
if (nread > 0) {
if (nread & hw->info.align) {
- dolog ("warning: Misaligned read %zd (requested %d), "
- "alignment %d\n", nread, bufs[i].add << hwshift,
- hw->info.align + 1);
+ dolog ("warning: Misaligned read %" PRIzd
+ " (requested %d), alignment %d\n", nread,
+ bufs[i].add << hwshift, hw->info.align + 1);
}
read_samples += nread >> hwshift;
hw->conv (hw->conv_buf + bufs[i].add, p, nread >> hwshift,
diff --git a/block/curl.c b/block/curl.c
index 94b451c..a2c8f75 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -339,8 +339,8 @@ static int curl_open(BlockDriverState *bs, const
char *filename, int flags)
}
if ((s->readahead_size & 0x1ff) != 0) {
- fprintf(stderr, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512\n",
- s->readahead_size);
+ fprintf(stderr, "HTTP_READAHEAD_SIZE %" PRIzd
+ " is not a multiple of 512\n", s->readahead_size);
goto out_noclean;
}
diff --git a/block/qcow2.c b/block/qcow2.c
index e7d0676..843170b 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -111,7 +111,7 @@ static int qcow_read_extensions(BlockDriverState
*bs, uint64_t start_offset,
case QCOW_EXT_MAGIC_BACKING_FORMAT:
if (ext.len >= sizeof(bs->backing_format)) {
fprintf(stderr, "ERROR: ext_backing_format: len=%u too large"
- " (>=%zu)\n",
+ " (>=%" PRIzu ")\n",
ext.len, sizeof(bs->backing_format));
return 2;
}
diff --git a/buffered_file.c b/buffered_file.c
index 54dc6c2..1129f1b 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -52,7 +52,7 @@ static void buffered_append(QEMUFileBuffered *s,
if (size > (s->buffer_capacity - s->buffer_size)) {
void *tmp;
- DPRINTF("increasing buffer capacity from %zu by %zu\n",
+ DPRINTF("increasing buffer capacity from %" PRIzu " by %" PRIzu "\n",
s->buffer_capacity, size + 1024);
s->buffer_capacity += size + 1024;
@@ -79,7 +79,7 @@ static void buffered_flush(QEMUFileBuffered *s)
return;
}
- DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size);
+ DPRINTF("flushing %" PRIzu " byte(s) of data\n", s->buffer_size);
while (offset < s->buffer_size) {
ssize_t ret;
@@ -93,16 +93,17 @@ static void buffered_flush(QEMUFileBuffered *s)
}
if (ret <= 0) {
- DPRINTF("error flushing data, %zd\n", ret);
+ DPRINTF("error flushing data, %" PRIzd "\n", ret);
s->has_error = 1;
break;
} else {
- DPRINTF("flushed %zd byte(s)\n", ret);
+ DPRINTF("flushed %" PRIzd " byte(s)\n", ret);
offset += ret;
}
}
- DPRINTF("flushed %zu of %zu byte(s)\n", offset, s->buffer_size);
+ DPRINTF("flushed %" PRIzu " of %" PRIzu " byte(s)\n", offset,
+ s->buffer_size);
memmove(s->buffer, s->buffer + offset, s->buffer_size - offset);
s->buffer_size -= offset;
}
@@ -145,7 +146,7 @@ static int buffered_put_buffer(void *opaque, const
uint8_t *buf, int64_t pos, in
break;
}
- DPRINTF("put %zd byte(s)\n", ret);
+ DPRINTF("put %" PRIzd " byte(s)\n", ret);
offset += ret;
s->bytes_xfer += ret;
}
diff --git a/hw/ac97.c b/hw/ac97.c
index 4319bc8..62a9547 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -323,7 +323,7 @@ static void reset_bm_regs (AC97LinkState *s,
AC97BusMasterRegs *r)
static void mixer_store (AC97LinkState *s, uint32_t i, uint16_t v)
{
if (i + 2 > sizeof (s->mixer_data)) {
- dolog ("mixer_store: index %d out of bounds %zd\n",
+ dolog ("mixer_store: index %d out of bounds %" PRIzd "\n",
i, sizeof (s->mixer_data));
return;
}
@@ -337,7 +337,7 @@ static uint16_t mixer_load (AC97LinkState *s, uint32_t i)
uint16_t val = 0xffff;
if (i + 2 > sizeof (s->mixer_data)) {
- dolog ("mixer_store: index %d out of bounds %zd\n",
+ dolog ("mixer_store: index %d out of bounds %" PRIzd "\n",
i, sizeof (s->mixer_data));
}
else {
diff --git a/hw/eepro100.c b/hw/eepro100.c
index a74d834..ba39428 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1661,7 +1661,7 @@ static ssize_t nic_receive(VLANClientState *nc,
const uint8_t * buf, size_t size
} else if (size < 64 && (s->configuration[7] & BIT(0))) {
/* Short frame and configuration byte 7/0 (discard short receive) set:
* Short frame is discarded */
- logout("%p received short frame (%zu byte)\n", s, size);
+ logout("%p received short frame (%" PRIzu " byte)\n", s, size);
s->statistics.rx_short_frame_errors++;
#if 0
return -1;
@@ -1669,19 +1669,22 @@ static ssize_t nic_receive(VLANClientState
*nc, const uint8_t * buf, size_t size
} else if ((size > MAX_ETH_FRAME_SIZE + 4) &&
!(s->configuration[18] & BIT(3))) {
/* Long frame and configuration byte 18/3 (long receive ok) not set:
* Long frames are discarded. */
- logout("%p received long frame (%zu byte), ignored\n", s, size);
+ logout("%p received long frame (%" PRIzu " byte), ignored\n", s, size);
return -1;
} else if (memcmp(buf, s->conf.macaddr.a, 6) == 0) { /* !!! */
/* Frame matches individual address. */
/* TODO: check configuration byte 15/4 (ignore U/L). */
- TRACE(RXTX, logout("%p received frame for me, len=%zu\n", s, size));
+ TRACE(RXTX, logout("%p received frame for me, len=%" PRIzu "\n",
+ s, size));
} else if (memcmp(buf, broadcast_macaddr, 6) == 0) {
/* Broadcast frame. */
- TRACE(RXTX, logout("%p received broadcast, len=%zu\n", s, size));
+ TRACE(RXTX, logout("%p received broadcast, len=%" PRIzu "\n",
+ s, size));
rfd_status |= 0x0002;
} else if (buf[0] & 0x01) {
/* Multicast frame. */
- TRACE(RXTX, logout("%p received multicast, len=%zu,%s\n", s,
size, nic_dump(buf, size)));
+ TRACE(RXTX, logout("%p received multicast, len=%" PRIzu ",%s\n",
+ s, size, nic_dump(buf, size)));
if (s->configuration[21] & BIT(3)) {
/* Multicast all bit is set, receive all multicast frames. */
} else {
@@ -1701,11 +1704,12 @@ static ssize_t nic_receive(VLANClientState
*nc, const uint8_t * buf, size_t size
rfd_status |= 0x0002;
} else if (s->configuration[15] & BIT(0)) {
/* Promiscuous: receive all. */
- TRACE(RXTX, logout("%p received frame in promiscuous mode,
len=%zu\n", s, size));
+ TRACE(RXTX, logout("%p received frame in promiscuous mode, len=%"
+ PRIzu "\n", s, size));
rfd_status |= 0x0004;
} else {
- TRACE(RXTX, logout("%p received frame, ignored, len=%zu,%s\n", s, size,
- nic_dump(buf, size)));
+ TRACE(RXTX, logout("%p received frame, ignored, len=%" PRIzu ",%s\n",
+ s, size, nic_dump(buf, size)));
return size;
}
@@ -1729,7 +1733,7 @@ static ssize_t nic_receive(VLANClientState *nc,
const uint8_t * buf, size_t size
if (size > rfd_size) {
logout("Receive buffer (%" PRId16 " bytes) too small for data "
- "(%zu bytes); data truncated\n", rfd_size, size);
+ "(%" PRIzu " bytes); data truncated\n", rfd_size, size);
size = rfd_size;
}
if (size < 64) {
diff --git a/hw/loader.c b/hw/loader.c
index 79a6f95..00bf478 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -586,8 +586,8 @@ int rom_add_file(const char *file, const char *fw_dir,
lseek(fd, 0, SEEK_SET);
rc = read(fd, rom->data, rom->romsize);
if (rc != rom->romsize) {
- fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %zd)\n",
- rom->name, rc, rom->romsize);
+ fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %"
+ PRIzd ")\n", rom->name, rc, rom->romsize);
goto err;
}
close(fd);
@@ -765,13 +765,13 @@ void do_info_roms(Monitor *mon)
QTAILQ_FOREACH(rom, &roms, next) {
if (!rom->fw_file) {
monitor_printf(mon, "addr=" TARGET_FMT_plx
- " size=0x%06zx mem=%s name=\"%s\" \n",
+ " size=0x%06" PRIzx " mem=%s name=\"%s\" \n",
rom->addr, rom->romsize,
rom->isrom ? "rom" : "ram",
rom->name);
} else {
monitor_printf(mon, "fw=%s/%s"
- " size=0x%06zx name=\"%s\" \n",
+ " size=0x%06" PRIzx " name=\"%s\" \n",
rom->fw_dir,
rom->fw_file,
rom->romsize,
diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c
index 383240b..8c431ca 100644
--- a/hw/scsi-bus.c
+++ b/hw/scsi-bus.c
@@ -478,10 +478,10 @@ void scsi_req_print(SCSIRequest *req)
fprintf(fp, " - none\n");
break;
case SCSI_XFER_FROM_DEV:
- fprintf(fp, " - from-dev len=%zd\n", req->cmd.xfer);
+ fprintf(fp, " - from-dev len=%" PRIzd "\n", req->cmd.xfer);
break;
case SCSI_XFER_TO_DEV:
- fprintf(fp, " - to-dev len=%zd\n", req->cmd.xfer);
+ fprintf(fp, " - to-dev len=%" PRIzd "\n", req->cmd.xfer);
break;
default:
fprintf(fp, " - Oops\n");
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 4d20919..d145939 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -333,7 +333,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest
*req, uint8_t *outbuf)
/* Vital product data */
uint8_t page_code = req->cmd.buf[2];
if (req->cmd.xfer < 4) {
- BADF("Error: Inquiry (EVPD[%02X]) buffer size %zd is "
+ BADF("Error: Inquiry (EVPD[%02X]) buffer size %" PRIzd " is "
"less than 4\n", page_code, req->cmd.xfer);
return -1;
}
@@ -349,7 +349,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest
*req, uint8_t *outbuf)
switch (page_code) {
case 0x00: /* Supported page codes, mandatory */
DPRINTF("Inquiry EVPD[Supported pages] "
- "buffer size %zd\n", req->cmd.xfer);
+ "buffer size %" PRIzd "\n", req->cmd.xfer);
outbuf[buflen++] = 4; // number of pages
outbuf[buflen++] = 0x00; // list of supported pages (this page)
outbuf[buflen++] = 0x80; // unit serial number
@@ -369,7 +369,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest
*req, uint8_t *outbuf)
l = 20;
DPRINTF("Inquiry EVPD[Serial number] "
- "buffer size %zd\n", req->cmd.xfer);
+ "buffer size %" PRIzd "\n", req->cmd.xfer);
outbuf[buflen++] = l;
memcpy(outbuf+buflen, serial, l);
buflen += l;
@@ -384,7 +384,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest
*req, uint8_t *outbuf)
if (id_len > max_len)
id_len = max_len;
DPRINTF("Inquiry EVPD[Device identification] "
- "buffer size %zd\n", req->cmd.xfer);
+ "buffer size %" PRIzd "\n", req->cmd.xfer);
outbuf[buflen++] = 3 + id_len;
outbuf[buflen++] = 0x2; // ASCII
@@ -421,7 +421,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest
*req, uint8_t *outbuf)
}
default:
BADF("Error: unsupported Inquiry (EVPD[%02X]) "
- "buffer size %zd\n", page_code, req->cmd.xfer);
+ "buffer size %" PRIzd "\n", page_code, req->cmd.xfer);
return -1;
}
/* done with EVPD */
@@ -437,8 +437,8 @@ static int scsi_disk_emulate_inquiry(SCSIRequest
*req, uint8_t *outbuf)
/* PAGE CODE == 0 */
if (req->cmd.xfer < 5) {
- BADF("Error: Inquiry (STANDARD) buffer size %zd "
- "is less than 5\n", req->cmd.xfer);
+ BADF("Error: Inquiry (STANDARD) buffer size %" PRIzd
+ " is less than 5\n", req->cmd.xfer);
return -1;
}
@@ -611,7 +611,7 @@ static int
scsi_disk_emulate_mode_sense(SCSIRequest *req, uint8_t *outbuf)
dbd = req->cmd.buf[1] & 0x8;
page = req->cmd.buf[2] & 0x3f;
- DPRINTF("Mode Sense (page %d, len %zd)\n", page, req->cmd.xfer);
+ DPRINTF("Mode Sense (page %d, len %" PRIzd ")\n", page, req->cmd.xfer);
memset(outbuf, 0, req->cmd.xfer);
p = outbuf;
diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index 9f80e15..781ab27 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -768,8 +768,9 @@ static int ohci_service_iso_td(OHCIState *ohci,
struct ohci_ed *ed,
}
#ifdef DEBUG_ISOCH
- printf("so 0x%.8x eo 0x%.8x\nsa 0x%.8x ea 0x%.8x\ndir %s len %zu ret %d\n",
- start_offset, end_offset, start_addr, end_addr, str, len, ret);
+ printf("so 0x%.8x eo 0x%.8x\nsa 0x%.8x ea 0x%.8x\ndir %s len %" PRIzu
+ " ret %d\n", start_offset, end_offset, start_addr, end_addr, str,
+ len, ret);
#endif
/* Writeback */
@@ -786,7 +787,7 @@ static int ohci_service_iso_td(OHCIState *ohci,
struct ohci_ed *ed,
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, 0);
} else {
if (ret > (ssize_t) len) {
- printf("usb-ohci: DataOverrun %d > %zu\n", ret, len);
+ printf("usb-ohci: DataOverrun %d > %" PRIzu "\n", ret, len);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_DATAOVERRUN);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE,
diff --git a/hw/virtio-9p-debug.c b/hw/virtio-9p-debug.c
index 2fb2673..4728fa1 100644
--- a/hw/virtio-9p-debug.c
+++ b/hw/virtio-9p-debug.c
@@ -254,7 +254,7 @@ static void pprint_sg(V9fsPDU *pdu, int rx, size_t
*offsetp, const char *name)
if (i) {
fprintf(llogfile, ", ");
}
- fprintf(llogfile, "(%p, 0x%zx)", sg[i].iov_base, sg[i].iov_len);
+ fprintf(llogfile, "(%p, 0x%" PRIzx ")", sg[i].iov_base, sg[i].iov_len);
}
fprintf(llogfile, "}");
}
diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
index e5d0112..7bc14bb 100644
--- a/hw/virtio-9p.c
+++ b/hw/virtio-9p.c
@@ -927,7 +927,7 @@ static void print_sg(struct iovec *sg, int cnt)
if (i) {
printf(", ");
}
- printf("(%p, %zd)", sg[i].iov_base, sg[i].iov_len);
+ printf("(%p, %" PRIzd ")", sg[i].iov_base, sg[i].iov_len);
}
printf("}\n");
}
diff --git a/hw/xen_console.c b/hw/xen_console.c
index d2261f4..0d57322 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -226,7 +226,8 @@ static int con_connect(struct XenDevice *xendev)
qemu_chr_add_handlers(con->chr, xencons_can_receive, xencons_receive,
NULL, con);
- xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port
%d, limit %zd\n",
+ xen_be_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d,"
+ " limit %" PRIzd "\n",
con->ring_ref,
con->xendev.remote_port,
con->xendev.local_port,
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 9a466f3..08547f4 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -317,7 +317,8 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq)
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len / BLOCK_SIZE);
if (rc != 0) {
- xen_be_printf(&blkdev->xendev, 0, "rd I/O error (%p, len
%zd)\n",
+ xen_be_printf(&blkdev->xendev, 0, "rd I/O error (%p, len %"
+ PRIzd ")\n",
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len);
goto err;
@@ -334,7 +335,8 @@ static int ioreq_runio_qemu_sync(struct ioreq *ioreq)
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len / BLOCK_SIZE);
if (rc != 0) {
- xen_be_printf(&blkdev->xendev, 0, "wr I/O error (%p, len
%zd)\n",
+ xen_be_printf(&blkdev->xendev, 0, "wr I/O error (%p, len %"
+ PRIzd ")\n",
ioreq->v.iov[i].iov_base,
ioreq->v.iov[i].iov_len);
goto err;
diff --git a/hw/xenfb.c b/hw/xenfb.c
index 422cd53..fc2f779 100644
--- a/hw/xenfb.c
+++ b/hw/xenfb.c
@@ -515,12 +515,14 @@ static int xenfb_configure_fb(struct XenFB
*xenfb, size_t fb_len_lim,
int max_width, max_height;
if (fb_len_lim > fb_len_max) {
- xen_be_printf(&xenfb->c.xendev, 0, "fb size limit %zu exceeds %zu,
corrected\n",
+ xen_be_printf(&xenfb->c.xendev, 0, "fb size limit %" PRIzu " exceeds %"
+ PRIzu ", corrected\n",
fb_len_lim, fb_len_max);
fb_len_lim = fb_len_max;
}
if (fb_len_lim && fb_len > fb_len_lim) {
- xen_be_printf(&xenfb->c.xendev, 0, "frontend fb size %zu limited to
%zu\n",
+ xen_be_printf(&xenfb->c.xendev, 0, "frontend fb size %" PRIzu
+ " limited to %" PRIzu "\n",
fb_len, fb_len_lim);
fb_len = fb_len_lim;
}
@@ -540,7 +542,8 @@ static int xenfb_configure_fb(struct XenFB *xenfb,
size_t fb_len_lim,
width = max_width;
}
if (offset < 0 || offset >= fb_len) {
- xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend offset %d (max
%zu)\n",
+ xen_be_printf(&xenfb->c.xendev, 0, "invalid frontend offset %d (max %"
+ PRIzu ")\n",
offset, fb_len - 1);
return -1;
}
diff --git a/osdep.c b/osdep.c
index abbc8a2..bbdadfe 100644
--- a/osdep.c
+++ b/osdep.c
@@ -102,7 +102,7 @@ void *qemu_memalign(size_t alignment, size_t size)
void *ptr;
ret = posix_memalign(&ptr, alignment, size);
if (ret != 0) {
- fprintf(stderr, "Failed to allocate %zu B: %s\n",
+ fprintf(stderr, "Failed to allocate %" PRIzu " B: %s\n",
size, strerror(ret));
abort();
}
diff --git a/qemu-common.h b/qemu-common.h
index a4888e5..f454333 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -84,6 +84,13 @@ static inline char *realpath(const char *path, char
*resolved_path)
#define PRIx64 "I64x"
#define PRIu64 "I64u"
#define PRIo64 "I64o"
+#define PRIzd "d"
+#define PRIzx "x"
+#define PRIzu "u"
+#else
+#define PRIzd "zd"
+#define PRIzx "zx"
+#define PRIzu "zu"
#endif
/* FIXME: Remove NEED_CPU_H. */
diff --git a/qemu-io.c b/qemu-io.c
index 030dedd..00f9aa0 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -556,7 +556,7 @@ readv_f(int argc, char **argv)
memset(cmp_buf, pattern, qiov.size);
if (memcmp(buf, cmp_buf, qiov.size)) {
printf("Pattern verification failed at offset %"
- PRId64 ", %zd bytes\n",
+ PRId64 ", %" PRIzd " bytes\n",
offset, qiov.size);
}
free(cmp_buf);
@@ -870,7 +870,7 @@ aio_read_done(void *opaque, int ret)
memset(cmp_buf, ctx->pattern, ctx->qiov.size);
if (memcmp(ctx->buf, cmp_buf, ctx->qiov.size)) {
printf("Pattern verification failed at offset %"
- PRId64 ", %zd bytes\n",
+ PRId64 ", %" PRIzd " bytes\n",
ctx->offset, ctx->qiov.size);
}
free(cmp_buf);
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 6c1d9e0..df98b93 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3387,7 +3387,7 @@ gen_intermediate_code_internal(CPUState *env,
TranslationBlock *tb,
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
log_target_disas(pc_start, dc->pc - pc_start,
dc->env->pregs[PR_VR]);
- qemu_log("\nisize=%d osize=%zd\n",
+ qemu_log("\nisize=%d osize=%" PRIzd "\n",
dc->pc - pc_start, gen_opc_ptr - gen_opc_buf);
}
#endif
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index ca54e2c..a7d43b8 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -1428,7 +1428,7 @@ gen_intermediate_code_internal(CPUState *env,
TranslationBlock *tb,
#if DISAS_GNU
log_target_disas(pc_start, dc->pc - pc_start, 0);
#endif
- qemu_log("\nisize=%d osize=%zd\n",
+ qemu_log("\nisize=%d osize=%" PRIzd "\n",
dc->pc - pc_start, gen_opc_ptr - gen_opc_buf);
}
#endif
diff --git a/usb-linux.c b/usb-linux.c
index 88273ff..b62be7c 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -561,7 +561,7 @@ static int usb_host_handle_control(USBHostDevice
*s, USBPacket *p)
buffer_len = 8 + s->ctrl.len;
if (buffer_len > sizeof(s->ctrl.buffer)) {
- fprintf(stderr, "husb: ctrl buffer too small (%u > %zu)\n",
+ fprintf(stderr, "husb: ctrl buffer too small (%u > %" PRIzu ")\n",
buffer_len, sizeof(s->ctrl.buffer));
return USB_RET_STALL;
}
diff --git a/vnc-auth-sasl.c b/vnc-auth-sasl.c
index a51ddc8..73b8ba0 100644
--- a/vnc-auth-sasl.c
+++ b/vnc-auth-sasl.c
@@ -47,7 +47,7 @@ long vnc_client_write_sasl(VncState *vs)
{
long ret;
- VNC_DEBUG("Write SASL: Pending output %p size %zd offset %zd "
+ VNC_DEBUG("Write SASL: Pending output %p size %zd offset %" PRIzd " "
"Encoded: %p size %d offset %d\n",
vs->output.buffer, vs->output.capacity, vs->output.offset,
vs->sasl.encoded, vs->sasl.encodedLength,
vs->sasl.encodedOffset);
diff --git a/vnc.c b/vnc.c
index 1f7ad73..97baf5f 100644
--- a/vnc.c
+++ b/vnc.c
@@ -1007,7 +1007,7 @@ long vnc_client_write_buf(VncState *vs, const
uint8_t *data, size_t datalen)
} else
#endif /* CONFIG_VNC_TLS */
ret = send(vs->csock, (const void *)data, datalen, 0);
- VNC_DEBUG("Wrote wire %p %zd -> %ld\n", data, datalen, ret);
+ VNC_DEBUG("Wrote wire %p %" PRIzd " -> %ld\n", data, datalen, ret);
return vnc_client_io_error(vs, ret, socket_error());
}
@@ -1027,7 +1027,8 @@ static long vnc_client_write_plain(VncState *vs)
long ret;
#ifdef CONFIG_VNC_SASL
- VNC_DEBUG("Write Plain: Pending output %p size %zd offset %zd.
Wait SSF %d\n",
+ VNC_DEBUG("Write Plain: Pending output %p size %zd offset %" PRIzd
+ ". Wait SSF %d\n",
vs->output.buffer, vs->output.capacity, vs->output.offset,
vs->sasl.waitWriteSSF);
@@ -1111,7 +1112,7 @@ long vnc_client_read_buf(VncState *vs, uint8_t
*data, size_t datalen)
} else
#endif /* CONFIG_VNC_TLS */
ret = recv(vs->csock, (void *)data, datalen, 0);
- VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret);
+ VNC_DEBUG("Read wire %p %" PRIzd " -> %ld\n", data, datalen, ret);
return vnc_client_io_error(vs, ret, socket_error());
}
@@ -1127,7 +1128,7 @@ long vnc_client_read_buf(VncState *vs, uint8_t
*data, size_t datalen)
static long vnc_client_read_plain(VncState *vs)
{
int ret;
- VNC_DEBUG("Read plain %p size %zd offset %zd\n",
+ VNC_DEBUG("Read plain %p size %" PRIzd " offset %zd\n",
vs->input.buffer, vs->input.capacity, vs->input.offset);
buffer_reserve(&vs->input, 4096);
ret = vnc_client_read_buf(vs, buffer_end(&vs->input), 4096);
--
1.6.2.4
- [Qemu-devel] [PATCH 3/3] mingw32: avoid using %zd etc. formats which are not known by the compiler,
Blue Swirl <=