[FFmpeg-devel] [PATCH] Fix warning in url_resetbuf (in aviobuf.c)

Eli Friedman eli.friedman
Mon Jun 28 00:08:51 CEST 2010


2010/6/27 M?ns Rullg?rd <mans at mansr.com>:
> Eli Friedman <eli.friedman at gmail.com> writes:
>
>> Patch attached; note that there isn't any functionality change because
>> URL_RDWR is 2, which makes the entire RHS of the || collapse to 0.
>>
>> -Eli
>>
>> Index: libavformat/aviobuf.c
>> ===================================================================
>> --- libavformat/aviobuf.c ? ? (revision 23833)
>> +++ libavformat/aviobuf.c ? ? (working copy)
>> @@ -606,7 +606,7 @@
>> ?{
>> ?#if LIBAVFORMAT_VERSION_MAJOR < 53
>> ? ? ?URLContext *h = s->opaque;
>> - ? ?if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR))
>
> That last bit of that expression should obviously be !(h->flags & URL_RDWR),
>
>> + ? ?if (flags & URL_RDWR)
>> ? ? ? ? ?return AVERROR(EINVAL);
>
> so this change is probably not correct.

Actually, I think the check was never correct... see
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-October/077001.html
.

New version attached which also eliminates the unused variable (I
didn't spot it originally because there are other warnings in the
file).

-Eli
-------------- next part --------------
Index: libavformat/aviobuf.c
===================================================================
--- libavformat/aviobuf.c	(revision 23833)
+++ libavformat/aviobuf.c	(working copy)
@@ -605,8 +605,7 @@
 #endif
 {
 #if LIBAVFORMAT_VERSION_MAJOR < 53
-    URLContext *h = s->opaque;
-    if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR))
+    if (flags & URL_RDWR)
         return AVERROR(EINVAL);
 #else
     assert(flags == URL_WRONLY || flags == URL_RDONLY);



More information about the ffmpeg-devel mailing list