[vlc-commits] mkv: fix return values of ebml callbacks

Thomas Guillem git at videolan.org
Thu Feb 11 09:46:35 CET 2016


vlc/vlc-2.2 | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Feb 10 19:54:46 2016 +0100| [77fa2d35092813baaf3992bcb719a794aab16fce] | committer: Thomas Guillem

mkv: fix return values of ebml callbacks

stream_Read can return -1 in case of error while ebml read callback returns an
unsigned.

(cherry picked from commit 565dd315b8855cd364d4757806d96a0014e5c879)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/demux/mkv/stream_io_callback.cpp |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/demux/mkv/stream_io_callback.cpp b/modules/demux/mkv/stream_io_callback.cpp
index 555cc9b..4f2306b 100644
--- a/modules/demux/mkv/stream_io_callback.cpp
+++ b/modules/demux/mkv/stream_io_callback.cpp
@@ -41,7 +41,8 @@ uint32 vlc_stream_io_callback::read( void *p_buffer, size_t i_size )
     if( i_size <= 0 || mb_eof )
         return 0;
 
-    return stream_Read( s, p_buffer, i_size );
+    int i_ret = stream_Read( s, p_buffer, i_size );
+    return i_ret < 0 ? 0 : i_ret;
 }
 
 void vlc_stream_io_callback::setFilePointer(int64_t i_offset, seek_mode mode )
@@ -100,7 +101,7 @@ uint64 vlc_stream_io_callback::toRead( void )
 
     i_size = stream_Size( s );
 
-    if( i_size == 0 )
+    if( i_size <= 0 )
         return UINT64_MAX;
 
     return (uint64) i_size - stream_Tell( s );



More information about the vlc-commits mailing list