From 1012e3d89cfb50a88c7679a58de1adf4529c761c Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Thu, 17 Jan 2019 15:38:40 +0100 Subject: [PATCH] tests: use GPOINTER_TO_INT to avoid warnings with mingw New casts to avoid the the warnings mentioned below. While at it, move some existing casts (introduced at 61bc9091894062b9) to use GPOINTER_TO_INT too. [458/673] Compiling C object 'tests/check/7d01337@@libs_video@exe/libs_video.c.obj'. ../tests/check/libs/video.c: In function 'fourcc_get_size': ../tests/check/libs/video.c:160:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] return (unsigned long) p->endptr; ^ In file included from ../tests/check/libs/video.c:32: ../tests/check/libs/video.c: In function 'test_video_formats': ../tests/check/libs/video.c:563:39: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] fail_unless_equals_int (size, (unsigned long) paintinfo.endptr); ^ And more. https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/94 --- tests/check/libs/video.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index 81828a6adc..2fdb54c96f 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -157,7 +157,7 @@ fourcc_get_size (struct fourcc_list_struct *fourcc, int w, int h) fourcc->paint_setup (p, NULL); - return (unsigned long) p->endptr; + return GPOINTER_TO_INT (p->endptr); } static void @@ -555,19 +555,19 @@ GST_START_TEST (test_video_formats) off1 = GST_VIDEO_INFO_COMP_OFFSET (&vinfo, 1); off2 = GST_VIDEO_INFO_COMP_OFFSET (&vinfo, 2); - GST_INFO ("size %d <> %d", size, (int) ((guintptr) paintinfo.endptr)); - GST_INFO ("off0 %d <> %d", off0, (int) ((guintptr) paintinfo.yp)); - GST_INFO ("off1 %d <> %d", off1, (int) ((guintptr) paintinfo.up)); - GST_INFO ("off2 %d <> %d", off2, (int) ((guintptr) paintinfo.vp)); + GST_INFO ("size %d <> %d", size, GPOINTER_TO_INT (paintinfo.endptr)); + GST_INFO ("off0 %d <> %d", off0, GPOINTER_TO_INT (paintinfo.yp)); + GST_INFO ("off1 %d <> %d", off1, GPOINTER_TO_INT (paintinfo.up)); + GST_INFO ("off2 %d <> %d", off2, GPOINTER_TO_INT (paintinfo.vp)); - fail_unless_equals_int (size, (unsigned long) paintinfo.endptr); - fail_unless_equals_int (off0, (unsigned long) paintinfo.yp); - fail_unless_equals_int (off1, (unsigned long) paintinfo.up); - fail_unless_equals_int (off2, (unsigned long) paintinfo.vp); + fail_unless_equals_int (size, GPOINTER_TO_INT (paintinfo.endptr)); + fail_unless_equals_int (off0, GPOINTER_TO_INT (paintinfo.yp)); + fail_unless_equals_int (off1, GPOINTER_TO_INT (paintinfo.up)); + fail_unless_equals_int (off2, GPOINTER_TO_INT (paintinfo.vp)); /* should be 0 if there's no alpha component */ off3 = GST_VIDEO_INFO_COMP_OFFSET (&vinfo, 3); - fail_unless_equals_int (off3, (unsigned long) paintinfo.ap); + fail_unless_equals_int (off3, GPOINTER_TO_INT (paintinfo.ap)); cs0 = GST_VIDEO_INFO_COMP_WIDTH (&vinfo, 0) * GST_VIDEO_INFO_COMP_HEIGHT (&vinfo, 0);