<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] printf size_t in imap_append_message



* David Shaw wrote on Mon, Nov 08, 2004 at 03:35:31PM CET:
> On Sun, Nov 07, 2004 at 05:59:07PM +0100, Ralf Wildenhues wrote:
> > 
> > --- imap/message.c  30 Oct 2004 21:59:00 -0000      3.10
> > +++ imap/message.c  7 Nov 2004 16:50:40 -0000
> > @@ -439,7 +439,7 @@
> >    rewind (fp);
> >    
> >    imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
> > -  snprintf (buf, sizeof (buf), "APPEND %s (\\Seen) {%d}", mbox, len);
> > +  snprintf (buf, sizeof (buf), "APPEND %s (\\Seen) {%lu}", mbox, (unsigned 
> > long)len);
> 
> For maximum portability (and skipping a typecast), shouldn't that be
> %zu if len is a size_t?  I seem to recall that the 'z' flag is in
> POSIX.

Yes, if everything conformed to POSIX resp. C89.  My change also works
on systems where the z flag does not exist, and is C89-portable.  It's
not strictly C99-portable (since there a size_t may be of strict higher
rank than an unsigned long).  Does anyone know such a system?
Is supporting it more or less important than supporting pre-C89?

Regards,
Ralf