Re: [AD] SF.net SVN: alleg:[11645] allegro/branches/4.9/examples/ex_utf8.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2009-02-23 at 00:28 +1100, Peter Wang wrote:
> 
> Your constness comment made me look at the man page more closely:
> 
>     The functions vprintf(), vfprintf(), vsprintf(), vsnprintf() are
>     equivalent to the functions printf(), fprintf(), sprintf(),
>     snprintf(), respectively, except that they are called with a va_list
>     instead of a variable number of arguments.  These functions do not
>     call the va_end macro.  Because they invoke the va_arg macro, the
>     value of ap is undefined after the call.  See stdarg(3).
> 
> which makes the code in al_ustr_vappendf() invalid because it reuses
> `ap' if it needs to repeat the vsnprintf call because the initial buffer
> was too small.  *That's* probably why I used to have a va_copy() call in
> there, but it was taken out because va_copy() isn't implemented by MSVC.
> 
> Try reverting this following change and see if it fixes it for you.
> We'll need to figure out how to do the same for MSVC, unfortunately.
> 

Yes, works with that. I committed it for now since apparently current
SVN was now garbling strings here instead of crashing. I guess for MSVC,
it just can be #ifdefed out, if their libc works without the va_copy
anyway?

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/