[vlc-devel] [PATCH] Adds additional language support

Maximilian Madlung maxi.madlung at gmx.de
Tue Jul 29 00:07:41 CEST 2014


Nevermind, just saw your wrote more about illegal casts and stuff :D

On 29/07/14 00:02, Maximilian Madlung wrote:
> Hi,
>
> I didn't know he had to post this whole line into the subject - sorry :P
> Do you want me to create a new Patch or topic? Otherwise I hope I can 
> get rid of this long thing next time when someone finds something to 
> change :D
>
> Max
>
> On 29/07/14 00:00, Rémi Denis-Courmont wrote:
>> Le lundi 28 juillet 2014, 19:24:12 Maximilian Madlung a écrit :
>>> ---
>>>   src/input/es_out.c |   42 ++++++++++++++++++++++++++++++++----------
>>>   1 file changed, 32 insertions(+), 10 deletions(-)
>> It should be somewhat obvious that the mail subject is excessively long.
>>
>> The first line of a patch log should be only a summary (72 characterss
>> maximum). Add paragraphs if you need/want to write more details.
>>
>> Also...
>>
>>> diff --git a/src/input/es_out.c b/src/input/es_out.c
>>> index d5ac33b..53ae491 100644
>>> --- a/src/input/es_out.c
>>> +++ b/src/input/es_out.c
>>> @@ -2727,21 +2727,43 @@ static char *LanguageGetName( const char 
>>> *psz_code )
>>> return strdup( "" );
>>>       }
>>>
>>> -    if( strlen( psz_code ) == 2 )
>>> +    /* Check if the language code consists a - and only take the front
>>> +       part as language */
>>> +    if( strstr( psz_code, "-" ) != NULL)
>> strchr()
>>
>>>       {
>>> -        pl = GetLang_1( psz_code );
>>> -    }
>>> -    else if( strlen( psz_code ) == 3 )
>>> -    {
>>> -        pl = GetLang_2B( psz_code );
>>> -        if( !strcmp( pl->psz_iso639_1, "??" ) )
>>> +    char * psz_lang = strtok ( ( char * ) psz_code, "-");
>> 1) Not thread-safe. Refer to C documentation.
>> 2) Illegal cast.
>>
>>> +
>>> +    if( strlen( psz_lang ) == 2 )
>>>           {
>>> -            pl = GetLang_2T( psz_code );
>>> -        }
>>> +        pl = GetLang_1( psz_lang );
>>> +    }
>>> +    if( strlen( psz_lang ) == 3 )
>>> +    {
>>> +        pl = GetLang_2B( psz_lang );
>>> +        if( !strcmp( pl->psz_iso639_1, "??" ) )
>>> +            {
>>> +                pl = GetLang_2T( psz_lang );
>>> +            }
>>> +    }
>>>       }
>>>       else
>>>       {
>>> -        return strdup( psz_code );
>>> +        if( strlen( psz_code ) == 2 )
>>> +        {
>>> +            pl = GetLang_1( psz_code );
>>> +        }
>>> +        else if( strlen( psz_code ) == 3 )
>>> +        {
>>> +            pl = GetLang_2B( psz_code );
>>> +            if( !strcmp( pl->psz_iso639_1, "??" ) )
>>> +            {
>>> +                pl = GetLang_2T( psz_code );
>>> +            }
>>> +        }
>>> +        else
>>> +        {
>>> +            return strdup( psz_code );
>>> +        }
>>>       }
>>>
>>>       if( !strcmp( pl->psz_iso639_1, "??" ) )
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel




More information about the vlc-devel mailing list