[vlc-devel] [PATCH v2 1/2] logger/console: print messages in system locale on OS/2

KO Myung-Hun komh78 at gmail.com
Thu Apr 19 03:32:34 CEST 2018


Hi/2.

Zhao Zhili wrote:
> 
> 
> On 2018年04月17日 19:41, KO Myung-Hun wrote:
>> ---
>>   modules/logger/console.c | 29 +++++++++++++++++++++++++++++
>>   1 file changed, 29 insertions(+)
>>
>> diff --git a/modules/logger/console.c b/modules/logger/console.c
>> index 14627479c9..525a3b5e4e 100644
>> --- a/modules/logger/console.c
>> +++ b/modules/logger/console.c
>> @@ -34,6 +34,29 @@
>>   static const int ptr_width = 2 * /* hex digits */ sizeof (uintptr_t);
>>   static const char msg_type[4][9] = { "", " error", " warning", "
>> debug" };
>>   +#ifdef __OS2__
>> +#include <vlc_charset.h>
>> +
>> +static int OS2ConsoleOutput(FILE *stream, const char *format, va_list
>> ap)
>> +{
>> +    char *msg = NULL;
>> +    char *os2msg = NULL;
>> +    int ret = -1;
>> +
>> +    if (vasprintf(&msg, format, ap) != -1 && (os2msg = ToLocale(msg))
>> != NULL)
>> +    {
>> +        fputs(os2msg, stream);
>> +
>> +        ret = 0;
>> +    }
>> +
>> +    LocaleFree(os2msg);
>> +    free(msg);
>> +
> 
> if vasprintf failed, msg is undefined, so it cannot be freed.
> 

Ok, fixed.

>> +    return ret;
>> +}
>> +#endif
>> +
>>   #ifndef _WIN32
>>   # define COL(x,y) "\033[" #x ";" #y "m"
>>   # define RED      COL(31,1)
>> @@ -59,6 +82,9 @@ static void LogConsoleColor(void *opaque, int type,
>> const vlc_log_t *meta,
>>           fprintf(stream, "[%s] ", meta->psz_header);
>>       fprintf(stream, "%s %s%s: %s", meta->psz_module,
>> meta->psz_object_type,
>>               msg_type[type], msg_color[type]);
>> +#ifdef __OS2__
>> +    if (OS2ConsoleOutput(stream, format, ap) == -1)
>> +#endif
>>       vfprintf(stream, format, ap);
>>       fputs(GRAY"\n", stream);
>>       funlockfile(stream);
>> @@ -80,6 +106,9 @@ static void LogConsoleGray(void *opaque, int type,
>> const vlc_log_t *meta,
>>           fprintf(stream, "[%s] ", meta->psz_header);
>>       fprintf(stream, "%s %s%s: ", meta->psz_module,
>> meta->psz_object_type,
>>               msg_type[type]);
>> +#ifdef __OS2__
>> +    if (OS2ConsoleOutput(stream, format, ap) == -1)
>> +#endif
>>       vfprintf(stream, format, ap);
>>       putc_unlocked('\n', stream);
>>       funlockfile(stream);
> 
> 
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.os2.kr/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: v3-0001-logger-console-print-messages-in-system-locale-on.patch
Type: application/x-patch
Size: 2047 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180419/fadae814/attachment.bin>


More information about the vlc-devel mailing list