[1/3] mov: Change MOVTrack.entry to unsigned

Message ID 1478194356-12211-1-git-send-email-diego@biurrun.de
State New
Headers show

Commit Message

Diego Biurrun Nov. 3, 2016, 5:32 p.m.
libavformat/movenc.c:3170:12: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
---
 libavformat/movenc.c | 2 +-
 libavformat/movenc.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Anton Khirnov Nov. 3, 2016, 7:41 p.m. | #1
Quoting Diego Biurrun (2016-11-03 18:32:34)
> libavformat/movenc.c:3170:12: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]

This is not sufficient explanation for the commit.

Just the fact that some compiler warns about some piece of code does not
necessarily mean that anything is wrong. And just the fact that the
patch makes the warning go away does not mean it is the right thing to
do.
Diego Biurrun Nov. 3, 2016, 7:47 p.m. | #2
On Thu, Nov 03, 2016 at 08:41:10PM +0100, Anton Khirnov wrote:
> Quoting Diego Biurrun (2016-11-03 18:32:34)
> > libavformat/movenc.c:3170:12: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
> 
> This is not sufficient explanation for the commit.
> 
> Just the fact that some compiler warns about some piece of code does not
> necessarily mean that anything is wrong. And just the fact that the
> patch makes the warning go away does not mean it is the right thing to
> do.

Certainly. I forgot to add the [RFC] marker to this one as I originally
intended to.

Diego

Patch

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f99617a..bcd405f 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -573,7 +573,7 @@  static int mov_get_lpcm_flags(enum AVCodecID codec_id)
     }
 }
 
-static int get_cluster_duration(MOVTrack *track, int cluster_idx)
+static int get_cluster_duration(MOVTrack *track, unsigned cluster_idx)
 {
     int64_t next_dts;
 
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index f4ed188..93350a8 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -78,7 +78,7 @@  typedef struct MOVFragmentInfo {
 
 typedef struct MOVTrack {
     int         mode;
-    int         entry;
+    unsigned    entry;
     unsigned    timescale;
     uint64_t    time;
     int64_t     track_duration;