Re: [AD] sys_directx_trace_handler

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


vsprintf is OK, becase vsnprintf isn't unfortunately supported on MSVC and it's clones.. :/ Of course, buffer exploits aren't our concern... :) I'd great appreciate it if Allegro had it's own allegro_vsnprintf implementations, such as (google for it, rip the code, rename the function and add to the CREDITS ..)

P.S.: lolz.. gmail doesn't highlight code.. but it sure does support some clipboard HTML functionality :) I got this from the CVS view

On 4/28/05, thomas fjellstrom <tfjellstrom@xxxxxxxxxx > wrote:
On 4/28/05, guilt <karthikkumar@xxxxxxxxxx > wrote:
> in wsystem.c i'm seeing this:
>
>  /* thread_safe_trace:
>  * Outputs internal trace message.
>  */
> void thread_safe_trace(
> char *msg,...)
> {
>  char buf[256];
>  va_list ap;
>
>  /* todo, some day: use vsnprintf (C99) */
>  va_start(ap, msg);
>
>  vsprintf(buf, msg, ap);
>  va_end(ap);
>
>  OutputDebugString(buf); /* thread safe */
> }
>  :)
>
>  could help ...
>

This is a little OT, but wouldn't vasprintf be a better choice? Its
simple enough to write yourself if a system doesn't support it
(*cough* windows *cough*), I actually did just that. See sprintf(NULL,
...); is speced to return the length of the string it would have
created had there been a place to write it to. Then you just malloc
some memory, and sprintf it in, or snprintf, but since we are sure of
the length, sprintf won't hurt anything.

And this is completely OT: is it just me,  or does gmail syntax
highlight code? :o

--
Thomas Fjellstrom
http://www.strangesoft.net
tfjellstrom@xxxxxxxxxx


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id5hix
--
https://lists.sourceforge.net/lists/listinfo/alleg-developers



--
Karthik
http://guilt.bafsoft.net

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