[FFmpeg-devel] [PATCH]lavc/xface: Reorder conditions to silence a gcc warning

Carl Eugen Hoyos cehoyos at ag.or.at
Sun Feb 26 12:07:55 EET 2017


Hi!

I believe attached patch does not change the logic of the conditions 
but silences a (9 times shown, long-time) gcc warning.

Please review, Carl Eugen
-------------- next part --------------
From 2a634f0b1f265f96111895de8603f9deda91d3df Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Sun, 26 Feb 2017 11:03:50 +0100
Subject: [PATCH] lavc/xface: Reorder conditions to silence a gcc warning.

libavcodec/xface.c:318:27: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Wstrict-overflow]
---
 libavcodec/xface.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/xface.c b/libavcodec/xface.c
index 8c0cbfd..184c174 100644
--- a/libavcodec/xface.c
+++ b/libavcodec/xface.c
@@ -315,9 +315,9 @@ void ff_xface_generate_face(uint8_t *dst, uint8_t * const src)
 
             for (l = i - 2; l <= i + 2; l++) {
                 for (m = j - 2; m <= j; m++) {
-                    if (l >= i && m == j)
+                    if (l <= 0 || l >= i && m == j)
                         continue;
-                    if (l > 0 && l <= XFACE_WIDTH && m > 0)
+                    if (l <= XFACE_WIDTH && m > 0)
                         k = 2*k + src[l + m * XFACE_WIDTH];
                 }
             }
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list