[vlc-devel] [PATCH] stream: remove VLC_USED for vlc_stream_Seek

Rémi Denis-Courmont remi at remlab.net
Wed Mar 6 17:39:08 CET 2019

Le keskiviikkona 6. maaliskuuta 2019, 18.24.38 EET Thomas Guillem a écrit :
> On Wed, Mar 6, 2019, at 16:23, Rémi Denis-Courmont wrote:
> > Le keskiviikkona 6. maaliskuuta 2019, 16.33.55 EET Thomas Guillem a écrit 
> > > Because most stream/access implementations will just set an offset on
> > > seek
> > > and return the actual I/O error on the next read.
> > 
> > This is obviously wrong. RTFM.
> This is not obvious when you create and use a vlc_stream_Memory. The seek
> can not fail in that case.

So should we remove the used flags from (vlc_obj_)malloc() because it is 
guaranteed to return NULL? Come on...

If you know statically that you have a memory stream, then why bother with 
vlc_stream_Memory() instead of accessing the memory directly? And if you 
don't, then you have to handle the error. You could make the same argument for 
fseek() with open_memstream().

This _is_ obviously wrong. Contrary to the claim in the patch description, the 
two most common streams (file and HTTP) don't work as described - they will 
read from the old offset after seek fails. And a quick grep shows that the 
warnings comes from generic demuxers. Really this patch removes a warning 
within fixing the bugs.


More information about the vlc-devel mailing list