vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sun Sep 3 10:50:41 2017 +0300| [b5f4af99142f31c8f50f08edaaee6dc5e643132c] | committer: Rémi Denis-Courmont
es_out: remove invalid NULL pointer arithmetic > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b5f4af99142f31c8f50f08edaaee6dc5e643132c --- src/input/es_out.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/input/es_out.c b/src/input/es_out.c index 0ec29b25a9..33e10eed87 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -413,12 +413,14 @@ static mtime_t EsOutGetWakeup( es_out_t *out ) return input_clock_GetWakeup( p_sys->p_pgrm->p_clock ); } +static es_out_id_t es_cat[DATA_ES]; + static es_out_id_t *EsOutGetFromID( es_out_t *out, int i_id ) { if( i_id < 0 ) { /* Special HACK, -i_id is the cat of the stream */ - return (es_out_id_t*)((uint8_t*)NULL-i_id); + return es_cat - i_id; } for( int i = 0; i < out->p_sys->i_es; i++ ) @@ -2288,11 +2290,11 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args ) enum es_format_category_e i_cat; if( es == NULL ) i_cat = UNKNOWN_ES; - else if( es == (es_out_id_t*)((uint8_t*)NULL+AUDIO_ES) ) + else if( es == es_cat + AUDIO_ES ) i_cat = AUDIO_ES; - else if( es == (es_out_id_t*)((uint8_t*)NULL+VIDEO_ES) ) + else if( es == es_cat + VIDEO_ES ) i_cat = VIDEO_ES; - else if( es == (es_out_id_t*)((uint8_t*)NULL+SPU_ES) ) + else if( es == es_cat + SPU_ES ) i_cat = SPU_ES; else i_cat = IGNORE_ES; @@ -2351,15 +2353,15 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args ) /*p_sys->i_default_audio_id = -1;*/ p_sys->sub.i_demux_id = -1; } - else if( es == (es_out_id_t*)((uint8_t*)NULL+AUDIO_ES) ) + else if( es == es_cat + AUDIO_ES ) { /*p_sys->i_default_video_id = -1;*/ } - else if( es == (es_out_id_t*)((uint8_t*)NULL+VIDEO_ES) ) + else if( es == es_cat + VIDEO_ES ) { /*p_sys->i_default_audio_id = -1;*/ } - else if( es == (es_out_id_t*)((uint8_t*)NULL+SPU_ES) ) + else if( es == es_cat + SPU_ES ) { p_sys->sub.i_demux_id = -1; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
