[vlc-commits] demux: wav: use vlc_stream_GetSize()

Thomas Guillem git at videolan.org
Mon Mar 16 13:31:36 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 13 16:04:55 2020 +0100| [7adb4c9b055a17cedd9a84f7127302cfc4795022] | committer: Thomas Guillem

demux: wav: use vlc_stream_GetSize()

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

 modules/demux/wav.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index be7d0f3266..ddd3a04a2a 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -612,21 +612,21 @@ static int Open( vlc_object_t * p_this )
         {
             case wav_chunk_id_data:
             {
-                int64_t i_stream_size = stream_Size( p_demux->s );
+                uint64_t i_stream_size;
+                if( vlc_stream_GetSize( p_demux->s, &i_stream_size ) != VLC_SUCCESS )
+                    goto error;
                 p_sys->i_data_pos = vlc_stream_Tell( p_demux->s );
 
-                if( !b_is_rf64 && i_stream_size > 0
-                 && (uint64_t) i_stream_size >= i_size + p_sys->i_data_pos )
+                if( !b_is_rf64 && i_stream_size >= i_size + p_sys->i_data_pos )
                     p_sys->i_data_size = i_size;
 
                 if( likely( b_is_rf64
-                 || p_sys->i_data_pos + i_size == (uint64_t) i_stream_size ) )
+                 || p_sys->i_data_pos + i_size == i_stream_size ) )
                 {
                     /* Bypass the final ChunkGetNext() to avoid a read+seek
                      * since this chunk is the last one */
                     eof = true;
-                }
-                /* Unlikely case where there is a chunk after 'data' */
+                }   /* Unlikely case where there is a chunk after 'data' */
                 else if( ChunkSkip( p_demux, i_size ) != VLC_SUCCESS )
                     goto error;
                 break;



More information about the vlc-commits mailing list