[vlc-devel] commit: stream_Read() : makes the buffer mandatory ( Rafaël Carré )

git version control git at videolan.org
Fri Jun 6 11:38:38 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri Jun  6 11:38:47 2008 +0200| [0bcda15e362b5e00fd4b6f458206ac52035b217d]

stream_Read() : makes the buffer mandatory

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

 src/input/stream.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 0c60db9..b98b26d 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -804,13 +804,10 @@ static int AStreamReadBlock( stream_t *s, void *p_read, int i_read )
         int i_copy = __MIN( i_current, i_read - i_data);
 
         /* Copy data */
-        if( p_data )
-        {
-            memcpy( p_data,
+        memcpy( p_data,
                     &p_sys->block.p_current->p_buffer[p_sys->block.i_offset],
                     i_copy );
-            p_data += i_copy;
-        }
+        p_data += i_copy;
         i_data += i_copy;
 
         p_sys->block.i_offset += i_copy;
@@ -1148,11 +1145,8 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read )
 
         /* Copy data */
         /* msg_Dbg( s, "AStreamReadStream: copy %d", i_copy ); */
-        if( p_data )
-        {
-            memcpy( p_data, &tk->p_buffer[i_off], i_copy );
-            p_data += i_copy;
-        }
+        memcpy( p_data, &tk->p_buffer[i_off], i_copy );
+        p_data += i_copy;
         i_data += i_copy;
         p_sys->stream.i_offset += i_copy;
 
@@ -2074,6 +2068,8 @@ static int ASeek( stream_t *s, int64_t i_pos )
  */
 int stream_Read( stream_t *s, void *p_read, int i_read )
 {
+    assert( s );
+    assert( p_read );
     return s->pf_read( s, p_read, i_read );
 }
 




More information about the vlc-devel mailing list