After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754756 - directsoundsrc: Compiler warning with 64bit Windows MinGW, cast from pointer to integer of different size
directsoundsrc: Compiler warning with 64bit Windows MinGW, cast from pointer ...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Windows
: Normal minor
: 1.5.91
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-09-09 05:02 UTC by Kouhei Sutou
Modified: 2015-09-09 14:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix this problem (1.38 KB, patch)
2015-09-09 05:02 UTC, Kouhei Sutou
committed Details | Review

Description Kouhei Sutou 2015-09-09 05:02:08 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.
Comment 1 Sebastian Dröge (slomo) 2015-09-09 07:07:13 UTC
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.
Comment 2 Kouhei Sutou 2015-09-09 13:52:48 UTC
(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 3 Sebastian Dröge (slomo) 2015-09-09 13:57:20 UTC
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 :)
Comment 4 Sebastian Dröge (slomo) 2015-09-09 13:58:27 UTC
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
Comment 5 Kouhei Sutou 2015-09-09 14:05:36 UTC
Thanks!