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