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

Tobias Güntner fatbull at web.de
Wed Dec 21 14:00:18 CET 2011


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?

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

> +    char *msg;
> +    if (vasprintf(&msg, fmt_cr, dol))
> +        msg = NULL;

vasprintf returns -1 on error.

Regards,
Tobias




More information about the vlc-devel mailing list