[vlc-devel] [PATCH] Temporarily work around crashing on Windows due to %zu

David Flynn davidf+nntp at woaf.net
Mon Nov 17 17:59:21 CET 2008

On 2008-11-17, Rémi Denis-Courmont <rem at videolan.org> wrote:
> On Monday 17 November 2008 13:08:28 Pierre Ynard, you wrote:
>> The printf functions on Windows don't support the z length modifier,
>> which can shift field arguments, and causes an unconditional crash in
>> modules.c on start-up. For now, strip it on Windows and have vlc work
>> again, until a better solution is found and applied.
> In this particular case, storing an unsigned instead of a size_t would be 
> simpler. But my concern remain that this fix is pointless as it only 
> addresses the tip of the iceberg. We have quite a bunch of other %z and %j 
> throughout and not all of them can/should be turned into ints.

I had a quick grep for the %zu, and this was the only place where it
caused a severe issue (came before %s).

Just to write it up, there have been two suggestions sofar:

1) invent PRzu or whatever
   Some have complained that this causes gettext issues, however, there
   are no instances [that i could quickly find] that %zu is used with

   So, is the gettext objection a non-issue? (see also PRId64)

2) accept the fact that windows sucks and modify the wrappers that call
   vsnprintf, to first fmt' = strdup(fmt), then scan fmt for offending
   formats and convert them to the correct one on win32 (then

3) steal the *printf fro gnu libc


More information about the vlc-devel mailing list