[vlc-commits] es_format_t: make i_extra_languages unsigned
Rémi Denis-Courmont
git at videolan.org
Sat Feb 21 11:24:21 CET 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 21 10:40:17 2015 +0200| [88d300617a9977b18314806198d7f4983e0267b6] | committer: Rémi Denis-Courmont
es_format_t: make i_extra_languages unsigned
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=88d300617a9977b18314806198d7f4983e0267b6
---
include/vlc_es.h | 2 +-
modules/demux/ts.c | 2 +-
src/misc/es_format.c | 15 +++++----------
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/include/vlc_es.h b/include/vlc_es.h
index dd87f6b..ff31b63 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -401,7 +401,7 @@ struct es_format_t
char *psz_language; /**< human readible language name */
char *psz_description; /**< human readible description of language */
- int i_extra_languages; /**< length in bytes of extra language data pointer */
+ unsigned i_extra_languages; /**< length in bytes of extra language data pointer */
extra_languages_t *p_extra_languages; /**< extra language data needed by some decoders */
audio_format_t audio; /**< description of audio format */
diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index daaa0f7..e9113d0 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -4843,7 +4843,7 @@ static void PMTParseEsIso639( demux_t *p_demux, ts_pid_t *pid,
pid->es->fmt.i_extra_languages );
if( pid->es->fmt.p_extra_languages )
{
- for( int i = 0; i < pid->es->fmt.i_extra_languages; i++ )
+ for( unsigned i = 0; i < pid->es->fmt.i_extra_languages; i++ )
{
pid->es->fmt.p_extra_languages[i].psz_language = malloc(4);
if( pid->es->fmt.p_extra_languages[i].psz_language )
diff --git a/src/misc/es_format.c b/src/misc/es_format.c
index 9060b69..215a47a 100644
--- a/src/misc/es_format.c
+++ b/src/misc/es_format.c
@@ -457,7 +457,6 @@ void es_format_InitFromVideo( es_format_t *p_es, const video_format_t *p_fmt )
int es_format_Copy( es_format_t *dst, const es_format_t *src )
{
- int i;
memcpy( dst, src, sizeof( es_format_t ) );
dst->psz_language = src->psz_language ? strdup( src->psz_language ) : NULL;
dst->psz_description = src->psz_description ? strdup( src->psz_description ) : NULL;
@@ -497,7 +496,7 @@ int es_format_Copy( es_format_t *dst, const es_format_t *src )
malloc(dst->i_extra_languages * sizeof(*dst->p_extra_languages ));
if( dst->p_extra_languages )
{
- for( i = 0; i < dst->i_extra_languages; i++ ) {
+ for( unsigned i = 0; i < dst->i_extra_languages; i++ ) {
if( src->p_extra_languages[i].psz_language )
dst->p_extra_languages[i].psz_language = strdup( src->p_extra_languages[i].psz_language );
else
@@ -528,16 +527,12 @@ void es_format_Clean( es_format_t *fmt )
if ( fmt->subs.p_style ) text_style_Delete( fmt->subs.p_style );
- if( fmt->i_extra_languages > 0 && fmt->p_extra_languages )
+ for( unsigned i = 0; i < fmt->i_extra_languages; i++ )
{
- int i;
- for( i = 0; i < fmt->i_extra_languages; i++ )
- {
- free( fmt->p_extra_languages[i].psz_language );
- free( fmt->p_extra_languages[i].psz_description );
- }
- free( fmt->p_extra_languages );
+ free( fmt->p_extra_languages[i].psz_language );
+ free( fmt->p_extra_languages[i].psz_description );
}
+ free( fmt->p_extra_languages );
/* es_format_Clean can be called multiple times */
memset( fmt, 0, sizeof(*fmt) );
More information about the vlc-commits
mailing list