GNOME Bugzilla – Bug 754756
directsoundsrc: Compiler warning with 64bit Windows MinGW, cast from pointer to integer of different size
Last modified: 2015-09-09 14:05:36 UTC
Created attachment 310946 [details] [review] Fix this problem We get the following error by building with 64bit Windows target MinGW: ---- ggstdirectsoundsrc.c: In function 'gst_directsound_src_mixer_find': gstdirectsoundsrc.c:733:30: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] mmres = mixerGetDevCaps ((UINT) dsoundsrc->mixer, ^ cc1: all warnings being treated as errors ---- It shows that HMIXER to UINT cast is warned. We can use portable GPOINTER_TO_UINT() macro for this propose.
Not sure if this is entirely correct, MSDN says explicitly to cast to UINT. Is UINT and guint guaranteed to be the same? https://msdn.microsoft.com/de-de/library/windows/desktop/dd757300%28v=vs.85%29.aspx > This function also accepts a mixer device handle returned by the mixerOpen > function as the uMxId parameter. The application should cast the HMIXER handle > to a UINT.
(In reply to Sebastian Dröge (slomo) from comment #1) > Not sure if this is entirely correct, MSDN says explicitly to cast to UINT. > Is UINT and guint guaranteed to be the same? UINT is unsigned int: https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx#UINT > This type is declared in WinDef.h as follows: > > typedef unsigned int UINT; guint is also unsigned int: https://developer.gnome.org/glib/stable/glib-Basic-Types.html#guint > typedef unsigned int guint;
Comment on attachment 310946 [details] [review] Fix this problem I guess it's fine then, thanks for checking the definitions of UINT and the others. Weird Windows API :)
commit 21bfa428d1f6cd84aa5b2da0eef047d3130babe2 Author: Kouhei Sutou <kou@clear-code.com> Date: Wed Sep 9 13:58:05 2015 +0900 directsoundsrc: fix build error for 64bit Windows build by MinGW Casting to UINT from HMIXER generates the following warning with 64bit Windows target MinGW: gstdirectsoundsrc.c: In function 'gst_directsound_src_mixer_find': gstdirectsoundsrc.c:733:30: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] mmres = mixerGetDevCaps ((UINT) dsoundsrc->mixer, ^ cc1: all warnings being treated as errors We can use portable GPOINTER_TO_UINT() macro for this propose. https://bugzilla.gnome.org/show_bug.cgi?id=754756
Thanks!