[vlc-devel] [PATCH] p_languages: avoid relocation
Rafaël Carré
funman at videolan.org
Mon Sep 10 15:06:37 CEST 2012
---
include/vlc_iso_lang.h | 2 +-
modules/access/dvdnav.c | 4 ++--
src/input/es_out.c | 2 +-
src/text/iso-639_def.h | 4 ++--
src/text/iso_lang.c | 6 +++---
5 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/vlc_iso_lang.h b/include/vlc_iso_lang.h
index f27fb66..0da45fb 100644
--- a/include/vlc_iso_lang.h
+++ b/include/vlc_iso_lang.h
@@ -29,7 +29,7 @@
struct iso639_lang_t
{
- const char *psz_eng_name; /* Description in English */
+ const char psz_eng_name[26]; /* Description in English */
const char psz_iso639_1[3]; /* ISO-639-1 (2 characters) code */
const char psz_iso639_2T[4]; /* ISO-639-2/T (3 characters) English code */
const char psz_iso639_2B[4]; /* ISO-639-2/B (3 characters) native code */
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index e808f0e..f454b4f 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -935,7 +935,7 @@ static char *DemuxGetLanguageCode( demux_t *p_demux, const char *psz_var )
if( ( p = strchr( psz_lang, ',' ) ) )
*p = '\0';
- for( pl = p_languages; pl->psz_eng_name != NULL; pl++ )
+ for( pl = p_languages; *pl->psz_eng_name; pl++ )
{
if( *psz_lang == '\0' )
continue;
@@ -948,7 +948,7 @@ static char *DemuxGetLanguageCode( demux_t *p_demux, const char *psz_var )
free( psz_lang );
- if( pl->psz_eng_name != NULL )
+ if( *pl->psz_eng_name )
return strdup( pl->psz_iso639_1 );
return strdup(LANGUAGE_DEFAULT);
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 1a0053d..b04a8be 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -2732,7 +2732,7 @@ static char *LanguageGetCode( const char *psz_lang )
if( psz_lang == NULL || *psz_lang == '\0' )
return strdup("??");
- for( pl = p_languages; pl->psz_eng_name != NULL; pl++ )
+ for( pl = p_languages; *pl->psz_eng_name; pl++ )
{
if( !strcasecmp( pl->psz_eng_name, psz_lang ) ||
!strcasecmp( pl->psz_iso639_1, psz_lang ) ||
diff --git a/src/text/iso-639_def.h b/src/text/iso-639_def.h
index ca199ee..928cc25 100644
--- a/src/text/iso-639_def.h
+++ b/src/text/iso-639_def.h
@@ -203,7 +203,7 @@ static const iso639_lang_t p_languages[] =
{ N_( "Yoruba" ), "yo", "yor", "yor" },
{ N_( "Zhuang" ), "za", "zha", "zha" },
{ N_( "Zulu" ), "zu", "zul", "zul" },
- /* XXX psz_eng_name MUST be NULL on the last item as it is the stop condition */
- { NULL, "", "", "" }
+ /* XXX psz_eng_name MUST be "" on the last item as it is the stop condition */
+ { "", "", "", "" }
};
diff --git a/src/text/iso_lang.c b/src/text/iso_lang.c
index 8c6d2ec..dada540 100644
--- a/src/text/iso_lang.c
+++ b/src/text/iso_lang.c
@@ -48,7 +48,7 @@ const iso639_lang_t * GetLang_1( const char * psz_code )
{
const iso639_lang_t *p_lang;
- for( p_lang = p_languages; p_lang->psz_eng_name; p_lang++ )
+ for( p_lang = p_languages; *p_lang->psz_eng_name; p_lang++ )
if( !strncasecmp( p_lang->psz_iso639_1, psz_code, 2 ) )
return p_lang;
@@ -59,7 +59,7 @@ const iso639_lang_t * GetLang_2T( const char * psz_code )
{
const iso639_lang_t *p_lang;
- for( p_lang = p_languages; p_lang->psz_eng_name; p_lang++ )
+ for( p_lang = p_languages; *p_lang->psz_eng_name; p_lang++ )
if( !strncasecmp( p_lang->psz_iso639_2T, psz_code, 3 ) )
return p_lang;
@@ -70,7 +70,7 @@ const iso639_lang_t * GetLang_2B( const char * psz_code )
{
const iso639_lang_t *p_lang;
- for( p_lang = p_languages; p_lang->psz_eng_name; p_lang++ )
+ for( p_lang = p_languages; *p_lang->psz_eng_name; p_lang++ )
if( !strncasecmp( p_lang->psz_iso639_2B, psz_code, 3 ) )
return p_lang;
--
1.7.9.5
More information about the vlc-devel
mailing list