vlc | branch: master | Sven Petai <had...@bsd.ee> | Sat Nov 6 12:25:01 2010 +0200| [ec1566fe68ee6b2e027b379671c75dae21c1bb52] | committer: Rémi Denis-Courmont
Make returning fatal error from the Read() more obvious. No functional change. Signed-off-by: Rémi Denis-Courmont <r...@remlab.net> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ec1566fe68ee6b2e027b379671c75dae21c1bb52 --- modules/access/http.c | 30 ++++++++++-------------------- 1 files changed, 10 insertions(+), 20 deletions(-) diff --git a/modules/access/http.c b/modules/access/http.c index 5519af9..b1890d1 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -760,10 +760,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) int i_read; if( p_sys->fd == -1 ) - { - p_access->info.b_eof = true; - return 0; - } + goto fatal; if( p_sys->b_has_size ) { @@ -780,10 +777,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) if( p_sys->b_chunked ) { if( p_sys->i_chunk < 0 ) - { - p_access->info.b_eof = true; - return 0; - } + goto fatal; if( p_sys->i_chunk <= 0 ) { @@ -801,8 +795,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) if( p_sys->i_chunk <= 0 ) /* eof */ { p_sys->i_chunk = -1; - p_access->info.b_eof = true; - return 0; + goto fatal; } } @@ -811,10 +804,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) } if( i_len == 0 ) - { - p_access->info.b_eof = true; - return 0; - } + goto fatal; if( p_sys->i_icy_meta > 0 && p_access->info.i_pos-p_sys->i_icy_offset > 0 ) { @@ -824,10 +814,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) if( i_next == p_sys->i_icy_meta ) { if( ReadICYMeta( p_access ) ) - { - p_access->info.b_eof = true; - return 0; - } + goto fatal; } if( i_len > i_next ) i_len = i_next; @@ -883,10 +870,9 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) if( i_read <= 0 ) { - p_access->info.b_eof = true; if( i_read < 0 ) p_sys->b_error = true; - return 0; + goto fatal; } } @@ -900,6 +886,10 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) } return i_read; + +fatal: + p_access->info.b_eof = true; + return 0; } static int ReadICYMeta( access_t *p_access ) _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org http://mailman.videolan.org/listinfo/vlc-commits