[FFmpeg-cvslog] lavu/imgutils: Use FFABS() instead of abs() for ptrdiff_t.

Carl Eugen Hoyos git at videolan.org
Sat Feb 2 00:19:51 EET 2019


ffmpeg | branch: master | Carl Eugen Hoyos <ceffmpeg at gmail.com> | Fri Feb  1 23:18:05 2019 +0100| [73d4efc596ad7d476dc303a88d251a903ed31136] | committer: Carl Eugen Hoyos

lavu/imgutils: Use FFABS() instead of abs() for ptrdiff_t.

Fixes a warning with clang:
libavutil/imgutils.c:314:16: warning: absolute value function 'abs'
given an argument of type 'ptrdiff_t' (aka 'long') but has
parameter of type 'int' which may cause truncation of value

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73d4efc596ad7d476dc303a88d251a903ed31136
---

 libavutil/imgutils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index afc73e2def..c733cb5cf5 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -311,8 +311,8 @@ static void image_copy_plane(uint8_t       *dst, ptrdiff_t dst_linesize,
 {
     if (!dst || !src)
         return;
-    av_assert0(abs(src_linesize) >= bytewidth);
-    av_assert0(abs(dst_linesize) >= bytewidth);
+    av_assert0(FFABS(src_linesize) >= bytewidth);
+    av_assert0(FFABS(dst_linesize) >= bytewidth);
     for (;height > 0; height--) {
         memcpy(dst, src, bytewidth);
         dst += dst_linesize;



More information about the ffmpeg-cvslog mailing list