Closed Bug 606846 Opened 14 years ago Closed 14 years ago

nsPluginNativeWindowWin.cpp compilation broken on mingw

Categories

(Core Graveyard :: Plug-ins, defect)

x86_64
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jacek, Assigned: jacek)

References

Details

Attachments

(1 file)

Attached patch fix v1.0Splinter Review
I get following errors:

In file included from /home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp:55:0:
../../../../dist/include/nsWindowsDllInterceptor.h: In member function 'bool WindowsDllInterceptor::AddHook(const char*, void*, void**)':
../../../../dist/include/nsWindowsDllInterceptor.h:119:57: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object
/home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp: In function 'void HookSetWindowLongPtr()':
/home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp:508:67: error: no matching function for call to 'WindowsDllInterceptor::AddHook(const char [15], LONG (&)(HWND__*, int, LONG), void**)'
../../../../dist/include/nsWindowsDllInterceptor.h:112:8: note: candidate is: bool WindowsDllInterceptor::AddHook(const char*, void*, void**) <near match>
/home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp:510:67: error: no matching function for call to 'WindowsDllInterceptor::AddHook(const char [15], LONG (&)(HWND__*, int, LONG), void**)'
../../../../dist/include/nsWindowsDllInterceptor.h:112:8: note: candidate is: bool WindowsDllInterceptor::AddHook(const char*, void*, void**) <near match>
/home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp: In constructor 'nsPluginNativeWindowWin::nsPluginNativeWindowWin()':
/home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp:531:17: warning: converting to non-pointer type 'LONG_PTR' from NULL
/home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp: In member function 'nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()':
/home/jacek/mozilla-build/mozilla-central/modules/plugin/base/src/nsPluginNativeWindowWin.cpp:770:19: warning: converting to non-pointer type 'LONG_PTR' from NULL

GCC is stricter than MSVC for function pointer casts and it doesn't implicitly casts function pointers to void. The fix is as simple as adding an explicit cast.

While I was at this, I've fixed warnings about assigning NULL to integer type.
Attachment #485612 - Attachment is patch: true
Attachment #485612 - Flags: review?(jmathies)
Assignee: nobody → jacek
Blocks: 596094
Comment on attachment 485612 [details] [diff] [review]
fix v1.0

nit, static_cast<void*>() vs the c style (void*).
Attachment #485612 - Flags: review?(jmathies) → review+
(In reply to comment #1)
> Comment on attachment 485612 [details] [diff] [review]
> fix v1.0
> 
> nit, static_cast<void*>() vs the c style (void*).

Thanks for the review. I should write it in my first comment that static_cast won't work here. GCC doesn't consider such cast as safe:

nsPluginNativeWindowWin.cpp:507:83: error: invalid static_cast from type 'LONG(HWND__*, int, LONG)' to type 'void*'
Attachment #485612 - Flags: approval2.0?
Attachment #485612 - Flags: approval2.0? → approval2.0+
http://hg.mozilla.org/mozilla-central/rev/09bb38fc6594
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: