diff options
author | John Stebbins <[email protected]> | 2016-01-29 09:05:44 -0700 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-01-29 09:05:44 -0700 |
commit | da7b1d29c60f740037883f44e07415580fc5d9a9 (patch) | |
tree | 9af15daec5e79d5173191823e655c27ba2e0e1b8 | |
parent | 09afa66f873a456ae41b7149a5b741be34bfaec8 (diff) |
libhb: fix use of uninitialized variable in lang.c
It caused crashes in some builds
-rw-r--r-- | libhb/lang.c | 6 | ||||
-rw-r--r-- | libhb/lang.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libhb/lang.c b/libhb/lang.c index a8ed2e8c8..c51c80ad5 100644 --- a/libhb/lang.c +++ b/libhb/lang.c @@ -205,7 +205,7 @@ static const int lang_count = sizeof(languages) / sizeof(languages[0]); const int lang_lookup_index( const char * str ) { int ii = 0; - iso639_lang_t * lang; + const iso639_lang_t * lang; // We use "Any" as a synonym for undefined if (!strcasecmp("any", str)) @@ -213,7 +213,7 @@ const int lang_lookup_index( const char * str ) return 0; } - for (ii = 0; lang->eng_name; ii++) + for (ii = 0; languages[ii].eng_name; ii++) { lang = &languages[ii]; if ((lang->iso639_1 != NULL && !strcasecmp(lang->iso639_1, str)) || @@ -234,7 +234,7 @@ const iso639_lang_t * lang_lookup( const char * str ) return lang_for_index(lang_lookup_index(str)); } -iso639_lang_t * lang_for_index( int index ) +const iso639_lang_t * lang_for_index( int index ) { if (index < 0 || index >= lang_count) return NULL; diff --git a/libhb/lang.h b/libhb/lang.h index 7d794910c..a0db17162 100644 --- a/libhb/lang.h +++ b/libhb/lang.h @@ -30,7 +30,7 @@ const iso639_lang_t * lang_lookup( const char * str ); const int lang_lookup_index( const char * str ); /* return language for an index into the language table */ -iso639_lang_t * lang_for_index( int index ); +const iso639_lang_t * lang_for_index( int index ); /* find language associated with ISO-639-1 language code */ iso639_lang_t * lang_for_code( int code ); |