[vlc-commits] PS: check return values of ps_id_to

Jean-Baptiste Kempf git at videolan.org
Mon Jul 21 01:49:18 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jul 21 01:23:13 2014 +0200| [b20da1901946e0fd1ba58f6abb14944da8c84c1c] | committer: Jean-Baptiste Kempf

PS: check return values of ps_id_to

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b20da1901946e0fd1ba58f6abb14944da8c84c1c
---

 modules/demux/ps.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/demux/ps.h b/modules/demux/ps.h
index f85220b..11275df 100644
--- a/modules/demux/ps.h
+++ b/modules/demux/ps.h
@@ -164,6 +164,8 @@ static inline int ps_track_fill( ps_track_t *tk, ps_psm_t *p_psm, int i_id )
     else
     {
         int i_type = ps_id_to_type( p_psm , i_id );
+        if( i_type == -1 )
+            return VLC_EGENERIC;
 
         es_format_Init( &tk->fmt, UNKNOWN_ES, 0 );
 
@@ -547,7 +549,7 @@ static inline int ps_id_to_type( const ps_psm_t *p_psm, int i_id )
     {
         if( p_psm->es[i]->i_id == i_id ) return p_psm->es[i]->i_type;
     }
-    return 0;
+    return -1;
 }
 
 static inline const uint8_t *ps_id_to_lang( const ps_psm_t *p_psm, int i_id )
@@ -557,7 +559,7 @@ static inline const uint8_t *ps_id_to_lang( const ps_psm_t *p_psm, int i_id )
     {
         if( p_psm->es[i]->i_id == i_id ) return p_psm->es[i]->lang;
     }
-    return 0;
+    return NULL;
 }
 
 static inline void ps_psm_init( ps_psm_t *p_psm )



More information about the vlc-commits mailing list