[vlc-commits] chroma copy: fix signedness warning

Rémi Denis-Courmont git at videolan.org
Sun Mar 3 10:25:14 CET 2019


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Mar  3 10:56:57 2019 +0200| [2412d317ed9a9a02c6325a705c95215447617788] | committer: Rémi Denis-Courmont

chroma copy: fix signedness warning

Unfortunately, plane_t.i_pitch is (still) signed.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2412d317ed9a9a02c6325a705c95215447617788
---

 modules/video_chroma/copy.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/video_chroma/copy.c b/modules/video_chroma/copy.c
index e9250b948e..5e2606d2ba 100644
--- a/modules/video_chroma/copy.c
+++ b/modules/video_chroma/copy.c
@@ -831,7 +831,9 @@ void Copy420_P_to_SP(picture_t *dst, const uint8_t *src[static 3],
               src[0], src_pitch[0], height, 0);
 
     const unsigned copy_lines = (height+1) / 2;
-    const unsigned copy_pitch = __MIN(src_pitch[1], dst->p[1].i_pitch / 2);
+    unsigned copy_pitch = src_pitch[1];
+    if (copy_pitch > (size_t)dst->p[1].i_pitch / 2)
+        copy_pitch = dst->p[1].i_pitch / 2;
 
     const int i_extra_pitch_uv = dst->p[1].i_pitch - 2 * copy_pitch;
     const int i_extra_pitch_u  = src_pitch[U_PLANE] - copy_pitch;



More information about the vlc-commits mailing list