[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 239 - trunk/subversion/libsvn_fs

From: <kfogel_at_collab.net>
Date: 2001-10-16 00:27:29 CEST

Hmmm. I tried "%lu" first and got compiler warnings. Suggestions?

-K

Greg Hudson <ghudson@MIT.EDU> writes:
> Karl committed:
> > + offset_str = apr_psprintf (trail->pool, "%u", ww->text_off);
> > + size_str = apr_psprintf (trail->pool, "%u", ww->text_len);
>
> This isn't correct, since text_off and text_len are of type
> apr_size_t, not int. On a 64-bit platform, apr_size_t is probably an
> unsigned long and %u will fail. More correct would be:
>
> apr_psprintf (trail->pool, "%lu", (unsigned long) ww->text_off);
>
> although if apr_size_t is larger than a long, that won't print the
> full range; there's no portable way to convert an arbitrary integer
> type to a string except by hand. Yay C.
>
> (In practice, apr_size_t will never be larger than a long, but
> apr_off_t frequently will be. APR provides an apr_off_t_toa to handle
> this specific issue, but doesn't handle the general issue of
> converting integral typedefs to strings. Not that I think there's a
> good way to do so.)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:44 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.