[vlc-devel] [PATCH] messages.c: added logging via OutputDebugString under windows.
Sergey Radionov
rsatom at gmail.com
Thu Dec 22 01:15:21 CET 2011
2011/12/22 Rafaël Carré <funman at videolan.org>:
> Le Wed, 21 Dec 2011 14:00:18 +0100,
> Tobias Güntner <fatbull at web.de> a écrit :
>
>> Am 21.12.2011 04:09, schrieb Sergey Radionov:
>> > Signed-off-by: Rafaël Carré<funman at videolan.org>
>>
>> > +#ifdef WIN32
>> > + va_list dol;
>> > + va_copy (dol, args);
>> > + Win32DebugOutputMsg (0, type,&msg, format, dol);
>> > + va_end (dol);
>> > +#endif
>>
>> Maybe test IsDebuggerPresent() as well?
>
> I don't know about this part, I let Sergey answer
It seems not good Idea using IsDebuggerPresent, since
DebugView (http://technet.microsoft.com/en-us/sysinternals/bb896647)
is not debugger (I've check it).
>
>> > + size_t fmt_len = strlen(format);
>> > + char *fmt_cr = malloc(fmt_len + 1 + 1);
>> > + if (!fmt_cr)
>> > + return;
>> > +
>> > + strcpy(fmt_cr, format);
>> > + fmt_cr[fmt_len] = '\n';
>> > + fmt_cr[fmt_len + 1] = '\0';
>>
>> Perhaps asprintf would be easier.
>
> Yes
>
>>
>> > + char *msg;
>> > + if (vasprintf(&msg, fmt_cr, dol))
>> > + msg = NULL;
>>
>> vasprintf returns -1 on error.
>
> Yes
>
> Thanks
>
> --
> Rafaël Carré
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list