[FFmpeg-devel] [PATCH] avcodec/xface: suppress -Wstrict-overflow warnings

Ganesh Ajjanagadde gajjanagadde at gmail.com
Fri Sep 18 23:31:26 CEST 2015


This patch results in identical behavior of xface, and suppresses -Wstrict-overflow
warnings observed in GCC 5.2.
I have manually checked that this usage is safe, and overflow possibility does
not exist with this expression rewrite.

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

diff --git a/libavcodec/xface.c b/libavcodec/xface.c
index 8c0cbfd..78b6def 100644
--- a/libavcodec/xface.c
+++ b/libavcodec/xface.c
@@ -315,7 +315,7 @@ 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 - i >= 0) && m == j)
                         continue;
                     if (l > 0 && l <= XFACE_WIDTH && m > 0)
                         k = 2*k + src[l + m * XFACE_WIDTH];
-- 
2.5.2



More information about the ffmpeg-devel mailing list