g_strdup_printf fails with VS2015 - snprintf doesn't support %n?



Hi Fan,

In your commit 53d487e31bc41cca9bca147e02e81b69e404fe07 to glib you
enabled glib to use VS2015's snprintf. Did you confirm it works?

I'm updating our gtk-win32 repo to use glib 2.46.0 (from 2.44.1) and
ATK fails to build - it runs glib-genmarshal as part of build when
calling g_strdup_printf. I narrowed it down to
glib/glib/gnulib/vasnprintf.c 's vasnprintf() function at the place
where it effectively calls

    snprintf("%s%n", 12, "atkmarshal.list", &count);

This aborts with exit code 0xc0000417 (invalid parameters to a CRT function).

The Windows printf family of functions has historically not supported
%n (see http://blogs.msdn.com/b/michael_howard/archive/2006/09/28/775780.aspx
) so that is probably the reason.

I see code below that call that tries to see if snprintf failed to use
%n and recover from it, but this of course doesn't work when the
implementation has already aborted inside snprintf.

-Arnav


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]