[vlc-commits] stream: warn on stream_Read() and stream_Peek() unused result

Rémi Denis-Courmont git at videolan.org
Mon Aug 31 22:03:27 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Aug 31 22:08:26 2015 +0300| [b85d67cb7f559b8dccf471a6f875c1df63a8bb43] | committer: Rémi Denis-Courmont

stream: warn on stream_Read() and stream_Peek() unused result

Both functions can always fail. Even if the stream size is known,
and larger than the requested bytes, reading can fail due to lower
level errors. stream_Peek() can also fail to allocate memory.

Not checking the return value is a bug.

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

 include/vlc_stream.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/vlc_stream.h b/include/vlc_stream.h
index 30fde50..285c679 100644
--- a/include/vlc_stream.h
+++ b/include/vlc_stream.h
@@ -109,8 +109,8 @@ enum stream_query_e
     STREAM_GET_PRIVATE_BLOCK, /**< arg1= block_t **b, arg2=bool *eof */
 };
 
-VLC_API ssize_t stream_Read(stream_t *, void *, size_t);
-VLC_API ssize_t stream_Peek(stream_t *, const uint8_t **, size_t);
+VLC_API ssize_t stream_Read(stream_t *, void *, size_t) VLC_USED;
+VLC_API ssize_t stream_Peek(stream_t *, const uint8_t **, size_t) VLC_USED;
 VLC_API int stream_vaControl( stream_t *s, int i_query, va_list args );
 VLC_API void stream_Delete( stream_t *s );
 VLC_API int stream_Control( stream_t *s, int i_query, ... );



More information about the vlc-commits mailing list