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 584678 - Miscast of a pointer in gstglwindow_win32.c
Miscast of a pointer in gstglwindow_win32.c
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-gl
git master
Other Windows
: Normal normal
: 0.10.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-06-03 01:21 UTC by LRN
Modified: 2009-08-10 23:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description LRN 2009-06-03 01:21:08 UTC
GCC 4.4.0 complains:
gstglwindow_win32.c: In function 'gst_gl_window_set_external_window_id':
gstglwindow_win32.c:207: error: cast from pointer to integer of different size

The offending line is:
SetWindowLongPtr ((HWND) id, GWL_WNDPROC, (DWORD) (guint64) sub_class_proc);

Prototype for SetWindowLongPtr is:
WINUSERAPI LONG_PTR WINAPI SetWindowLongPtrW(HWND,int,LONG_PTR); (on x64)
or
WINUSERAPI LONG WINAPI SetWindowLongW(HWND,int,LONG); (on x86)

In MinGW LONG_PTR is defined as
typedef __int64 LONG_PTR, *PLONG_PTR; (on x64)
or as
typedef  long LONG_PTR, *PLONG_PTR; (on x86)

and LONG is defined as
typedef long LONG;

So, on x86 systems the SetWindowLongPtr accepts LONG, LONG_PTR being equivalent to LONG, while on x64 systems it accepts LONG_PTR itself. Both DWORD and guint64 are out of place.

In case you're wondering, MSDN says that
typedef __int3264 LONG_PTR; 
which is the same thing.

How to fix:
replace "(DWORD) (guint64)" with "(LONG_PTR)"
Comment 1 Julien Isorce 2009-06-03 22:36:44 UTC
commit 3d6ff87b54547e91a244a020b44fc55d4245635a
Author: LRN <lrn1986@gmail.com>
Date:   Thu Jun 4 00:27:44 2009 +0200

    fix miscast of a pointer in SetWindowLongPtr

    GCC 4.4.0 complains error: cast from pointer to integer of different size
    Fixes #584678.