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

Frederic YHUEL fyhuel at viotech.net
Wed Dec 28 11:41:37 CET 2011


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 :-)

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'll try and write a wiki page for stream_filter modules if you agree.

Best Regards,

-- 
Frédéric



More information about the vlc-devel mailing list