On Tue, Aug 17, 2010 at 04:05:03PM -0600, Eric Blake wrote: > Mingw64 lacks %zu, and has the unfortunate setup where > sizeof(long)==4 but sizeof(size_t)==8. Since gnulib's > printf-posix module is not LGPLv2+, the best we can do > is manually cast to the only portable int type known to > hold size_t, and rely on gnulib's inttypes.h. > > * src/remote/remote_driver.c (remoteStreamPacket): Rewrite size_t > formatting. > * src/storage/storage_driver.c (storageWipeExtent): Likewise. > --- > > Here's the latter option; there are many more uses of %zu, but > only in DEBUG statements. I suppose it would also be easy enough > to teach cfg.mk how to recognize and reject %z inside translated > strings, as part of 'make syntax-check'. > > src/remote/remote_driver.c | 7 +++++-- > src/storage/storage_driver.c | 7 ++++--- > 2 files changed, 9 insertions(+), 5 deletions(-) > > diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c > index cb0d8e1..d9115c8 100644 > --- a/src/remote/remote_driver.c > +++ b/src/remote/remote_driver.c > @@ -34,6 +34,7 @@ > #include <fcntl.h> > #include <arpa/inet.h> > #include <sys/wait.h> > +#include <inttypes.h> > > /* Windows socket compatibility functions. */ > #include <errno.h> > @@ -8024,8 +8025,10 @@ remoteStreamPacket(virStreamPtr st, > > if (status == REMOTE_CONTINUE) { > if (((4 + REMOTE_MESSAGE_MAX) - thiscall->bufferLength) < nbytes) { > - remoteError(VIR_ERR_RPC, _("data size %zu too large for payload %d"), > - nbytes, ((4 + REMOTE_MESSAGE_MAX) - thiscall->bufferLength)); > + remoteError(VIR_ERR_RPC, > + _("data size %" PRIuMAX " too large for payload %d"), > + (uintmax_t) nbytes, > + ((4 + REMOTE_MESSAGE_MAX) - thiscall->bufferLength)); I find the PRI* stuff rather fugly. Can't we just use %llu and cast to (unsigned long long) The question of printf-posix license doesn't appear relevant since remoteError & friends all use asprintf() which is LGPLv2+ already. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list