[FFmpeg-devel] & vs. &&

Michael Niedermayer michaelni
Fri Oct 16 14:13:55 CEST 2009


On Tue, Oct 13, 2009 at 02:42:57PM +0200, Benoit Fouet wrote:
> On 2009-10-13 14:04, Reimar D?ffinger wrote:
> > On Tue, Oct 13, 2009 at 01:54:42PM +0200, Benoit Fouet wrote:
> >> So my guess is that url_open_dyn_buf_internal is buggy.
> >> I don't know what to do, but hope that helps knowledgeable people :)
> > 
> > My suggestion is to "fix" url_resetbuf to make it do what it already
> > does now, ignoring what it may be supposed to do.
> > The h->flags stuff IMO is only to check against programming errors but
> > obviously adds more errors that it avoids.
> > So I suggest to change the whole thing to
> > assert(flags == URL_WRONLY || flags == URL_RDONLY)
> 
> sample patch to do that, now 'make test' passes:
> 
> Index: libavformat/aviobuf.c
> ===================================================================
> --- libavformat/aviobuf.c       (revision 20220)
> +++ libavformat/aviobuf.c       (working copy)
> @@ -585,9 +585,7 @@ int url_setbufsize(ByteIOContext *s, int
> 
>  int url_resetbuf(ByteIOContext *s, int flags)
>  {
> -    URLContext *h = s->opaque;
> -    if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags &
> URL_RDWR))
> -        return AVERROR(EINVAL);
> +    assert(flags == URL_WRONLY || flags == URL_RDONLY);

if url_resetbuf where static i wouldnt mind the assert ... btw why is it
not static ?

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091016/69bba324/attachment.pgp>



More information about the ffmpeg-devel mailing list