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 61bc909189) 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
This commit is contained in:
Victor Toso 2019-01-17 15:38:40 +01:00 committed by Tim-Philipp Müller
parent c7fe0ed637
commit 1012e3d89c

View file

@ -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);