[FFmpeg-devel] [PATCHv2] avformat/movenc: suppress -Wstrict-overflow warnings

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sun Sep 27 01:18:43 CEST 2015


This patch results in identical behavior of movenc, and suppresses -Wstrict-overflow
warnings observed in GCC 5.2:
http://fate.ffmpeg.org/log.cgi?time=20150926231053&log=compile&slot=x86_64-archlinux-gcc-threads-misc,
"warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]"
I have manually checked that all usages are safe, and overflow possibility does
not exist with this expression rewrite.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavformat/movenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index af03d1e..6e4a1a6 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -854,7 +854,7 @@ static int get_cluster_duration(MOVTrack *track, int cluster_idx)
 {
     int64_t next_dts;
 
-    if (cluster_idx >= track->entry)
+    if (cluster_idx - track->entry >= 0)
         return 0;
 
     if (cluster_idx + 1 == track->entry)
-- 
2.5.3



More information about the ffmpeg-devel mailing list