[FFmpeg-devel] [PATCH] 3 trivial fixes to enforce order of operations

Michael Niedermayer michaelni
Fri Jul 4 02:03:16 CEST 2008


On Wed, Jul 02, 2008 at 01:55:42PM -0400, Shane wrote:
> Hi,
> 
> Three trivial patches to enforce the intended order of operations.
> 
>           !flags & y     vs.    !(flags & y)
> 
> (I'm not subscribed to the list)
> 
> Regards,
> 
> Shane

> Index: libavformat/aviobuf.c
> ===================================================================
> --- libavformat/aviobuf.c	(revision 17253)
> +++ libavformat/aviobuf.c	(working copy)
> @@ -559,7 +559,7 @@
>  int url_resetbuf(ByteIOContext *s, int flags)
>  {
>      URLContext *h = s->opaque;
> -    if ((flags & URL_RDWR) || (h && h->flags != flags && !h->flags & URL_RDWR))
> +    if ((flags & URL_RDWR) || (h && h->flags != flags && !(h->flags & URL_RDWR)))
>          return AVERROR(EINVAL);
>  
>      if (flags & URL_WRONLY) {

The code makes no sense
To reach the part after ||, flags & URL_RDWR must be 0 thus this would be
redundant


> Index: libavformat/movenc.c
> ===================================================================
> --- libavformat/movenc.c	(revision 17253)
> +++ libavformat/movenc.c	(working copy)
> @@ -1235,7 +1235,7 @@
>      if (s->title[0]   || s->author[0] || s->album[0] || s->year ||
>          s->comment[0] || s->genre[0]  || s->track ||
>         (mov->mode == MODE_MOV &&
> -      ((mov->tracks[0].enc && !mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT) || req))) {
> +      ((mov->tracks[0].enc && !(mov->tracks[0].enc->flags & CODEC_FLAG_BITEXACT)) || req))) {
>          offset_t pos = url_ftell(pb);
>  
>          put_be32(pb, 0); /* size */

looks ok


> Index: libavcodec/txd.c
> ===================================================================
> --- libavcodec/txd.c	(revision 17253)
> +++ libavcodec/txd.c	(working copy)
> @@ -104,7 +104,7 @@
>      } else if (depth == 16) {
>          switch (d3d_format) {
>          case 0:
> -            if (!flags&1) goto unsupported;
> +            if (!(flags&1)) goto unsupported;
>          case FF_S3TC_DXT1:
>              ff_decode_dxt1(cur, ptr, w, h, stride);
>              break;

Maintainer ivo ?

PS: the MIME type is text/plain not plain/text even if later sounds better

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

I wish the Xiph folks would stop pretending they've got something they
do not.  Somehow I fear this will remain a wish. -- M?ns Rullg?rd
-------------- 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/20080704/bc5f96e7/attachment.pgp>



More information about the ffmpeg-devel mailing list