* [Qemu-devel] [PATCH] eepro100: Fix format strings in debug messages
@ 2009-09-19 10:37 Stefan Weil
2009-09-19 10:48 ` Reimar Döffinger
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Weil @ 2009-09-19 10:37 UTC (permalink / raw)
To: QEMU Developers
size_t arguments need %zu instead of %d.
This patch is a step to synchronize my maintainer version
of eepro100.c (git://repo.or.cz/qemu/ar7.git) with the
version integrated in QEMU.
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
hw/eepro100.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/eepro100.c b/hw/eepro100.c
index f1a9310..3f84e26 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1496,25 +1496,25 @@ static ssize_t nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size
} else if (size < 64 && (s->configuration[7] & 1)) {
/* Short frame and configuration byte 7/0 (discard short receive) set:
* Short frame is discarded */
- logout("%p received short frame (%d byte)\n", s, size);
+ logout("%p received short frame (%zu byte)\n", s, size);
s->statistics.rx_short_frame_errors++;
//~ return -1;
} else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & 8)) {
/* Long frame and configuration byte 18/3 (long receive ok) not set:
* Long frames are discarded. */
- logout("%p received long frame (%d byte), ignored\n", s, size);
+ logout("%p received long frame (%zu byte), ignored\n", s, size);
return -1;
} else if (memcmp(buf, s->macaddr, 6) == 0) { // !!!
/* Frame matches individual address. */
/* TODO: check configuration byte 15/4 (ignore U/L). */
- TRACE(RXTX, logout("%p received frame for me, len=%d\n", s, size));
+ TRACE(RXTX, logout("%p received frame for me, len=%zu\n", s, size));
} else if (memcmp(buf, broadcast_macaddr, 6) == 0) {
/* Broadcast frame. */
- TRACE(RXTX, logout("%p received broadcast, len=%d\n", s, size));
+ TRACE(RXTX, logout("%p received broadcast, len=%zu\n", s, size));
rfd_status |= 0x0002;
} else if (buf[0] & 0x01) { // !!!
/* Multicast frame. */
- TRACE(RXTX, logout("%p received multicast, len=%d\n", s, size));
+ TRACE(RXTX, logout("%p received multicast, len=%zu\n", s, size));
/* TODO: check multicast all bit. */
assert(!(s->configuration[21] & BIT(3)));
int mcast_idx = compute_mcast_idx(buf);
@@ -1524,10 +1524,10 @@ static ssize_t nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size
rfd_status |= 0x0002;
} else if (s->configuration[15] & 1) {
/* Promiscuous: receive all. */
- TRACE(RXTX, logout("%p received frame in promiscuous mode, len=%d\n", s, size));
+ TRACE(RXTX, logout("%p received frame in promiscuous mode, len=%zu\n", s, size));
rfd_status |= 0x0004;
} else {
- TRACE(RXTX, logout("%p received frame, ignored, len=%d,%s\n", s, size,
+ TRACE(RXTX, logout("%p received frame, ignored, len=%zu,%s\n", s, size,
nic_dump(buf, size)));
return size;
}
--
1.5.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] eepro100: Fix format strings in debug messages
2009-09-19 10:37 [Qemu-devel] [PATCH] eepro100: Fix format strings in debug messages Stefan Weil
@ 2009-09-19 10:48 ` Reimar Döffinger
2009-09-19 10:55 ` Stefan Weil
0 siblings, 1 reply; 3+ messages in thread
From: Reimar Döffinger @ 2009-09-19 10:48 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-devel
On Sat, Sep 19, 2009 at 12:37:51PM +0200, Stefan Weil wrote:
> size_t arguments need %zu instead of %d.
>
> This patch is a step to synchronize my maintainer version
> of eepro100.c (git://repo.or.cz/qemu/ar7.git) with the
> version integrated in QEMU.
MinGW probably won't know about "zu". Casting size to uint64_t and using
PRIu64 would be an option, as well as just ignoring MinGW.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] eepro100: Fix format strings in debug messages
2009-09-19 10:48 ` Reimar Döffinger
@ 2009-09-19 10:55 ` Stefan Weil
0 siblings, 0 replies; 3+ messages in thread
From: Stefan Weil @ 2009-09-19 10:55 UTC (permalink / raw)
To: qemu-devel
Reimar Döffinger schrieb:
> On Sat, Sep 19, 2009 at 12:37:51PM +0200, Stefan Weil wrote:
>
>> size_t arguments need %zu instead of %d.
>>
>> This patch is a step to synchronize my maintainer version
>> of eepro100.c (git://repo.or.cz/qemu/ar7.git) with the
>> version integrated in QEMU.
>>
>
> MinGW probably won't know about "zu". Casting size to uint64_t and using
> PRIu64 would be an option, as well as just ignoring MinGW.
>
Yes, this is a well known problem (a lot of QEMU code uses %zu or %zd).
Ignoring MinGW is probably the best solution here because only debugging
code is concerned. The problem will disappear as soon as Windows
provides a better printf family :-)
Regards
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-19 10:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-19 10:37 [Qemu-devel] [PATCH] eepro100: Fix format strings in debug messages Stefan Weil
2009-09-19 10:48 ` Reimar Döffinger
2009-09-19 10:55 ` Stefan Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).