[vlc-devel] [PATCH] stream_filter/decomp.c: fix Read function

Rémi Denis-Courmont remi at remlab.net
Wed Dec 28 14:39:29 CET 2011


   Hello,

On Wednesday 28 December 2011, Frederic YHUEL wrote:
> 2011/12/28 Frédéric Yhuel <fyhuel at viotech.net>:
> > ---
> >  modules/stream_filter/decomp.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/modules/stream_filter/decomp.c
> > b/modules/stream_filter/decomp.c index 7aef4f9..b86f846 100644
> > --- a/modules/stream_filter/decomp.c
> > +++ b/modules/stream_filter/decomp.c
> > @@ -186,7 +186,7 @@ static int Read (stream_t *stream, void *buf,
> > unsigned int buflen) p_sys->offset += length;
> > 
> >         if (buflen > 0)
> > -            length += Read (stream, ((char *)buf) + length, buflen -
> > length); +            length += Read (stream, ((char *)buf) + length,
> > buflen); return length;
> >     }
> >     assert ((buf != NULL) || (buflen == 0));
> > --
> > 1.7.5.4
> 
> PS: This patch is not tested, because I've no idea about how to test
> it... but it seems trivial enough :-)

I am not applying untested patches because (other) people have abused this far 
too much far too recently.

> Actually I was reading this code to try and understand what *exactly*
> the Peek function is supposed to do in a stream_filter module.
> 
> So now it's clear, but seriously, this is not trivial. For example,
> you could be mislead (as I did) by the Peek function of decomp.c if
> you don't read also the Read function of the same file.

I don't think anybody disagrees. Nobody has bothered to simplify the interface 
though. And it gets harder and harder as more plugins get added.

-- 
Rémi Denis-Courmont
http://www.remlab.info



More information about the vlc-devel mailing list