[vlc-devel] [PATCH] messages.c: added logging via OutputDebugString under windows.

Rafaël Carré funman at videolan.org
Wed Dec 21 18:21:11 CET 2011


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

> > +    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é



More information about the vlc-devel mailing list