Merge branch 'gcc8-msw-warns'

Fix tons of warnings given by default by gcc 8, potentially fixing some
real problems in Win64 build in the process.

See https://github.com/wxWidgets/wxWidgets/pull/822
This commit is contained in:
Vadim Zeitlin
2018-06-10 23:41:05 +02:00
18 changed files with 141 additions and 112 deletions

View File

@@ -667,6 +667,17 @@ typedef short int WXTYPE;
# define wxGCC_WARNING_RESTORE(x) # define wxGCC_WARNING_RESTORE(x)
#endif #endif
/* Specific macros for -Wcast-function-type warning new in gcc 8. */
#if wxCHECK_GCC_VERSION(8, 0)
#define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE() \
wxGCC_WARNING_SUPPRESS(cast-function-type)
#define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE() \
wxGCC_WARNING_RESTORE(cast-function-type)
#else
#define wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
#define wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
#endif
/* /*
Macros to suppress and restore clang warning only when it is valid. Macros to suppress and restore clang warning only when it is valid.
@@ -2845,11 +2856,18 @@ typedef wxW64 long WXLPARAM;
typedef wxW64 long WXLRESULT; typedef wxW64 long WXLRESULT;
#endif #endif
/*
This is defined for compatibility only, it's not really the same thing as
FARPROC.
*/
#if defined(__GNUWIN32__) #if defined(__GNUWIN32__)
typedef int (*WXFARPROC)(); typedef int (*WXFARPROC)();
#else #else
typedef int (__stdcall *WXFARPROC)(); typedef int (__stdcall *WXFARPROC)();
#endif #endif
typedef WXLRESULT (wxSTDCALL *WXWNDPROC)(WXHWND, WXUINT, WXWPARAM, WXLPARAM);
#endif /* __WIN32__ */ #endif /* __WIN32__ */

View File

@@ -44,6 +44,11 @@ typedef int (wxCMPFUNC_CONV *CMPFUNC)(const void* pItem1, const void* pItem2);
// Array class providing legacy dynamic arrays API on top of wxVector<> // Array class providing legacy dynamic arrays API on top of wxVector<>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// For some reasons lost in the depths of time, sort functions with different
// signatures are used to sort normal arrays and to keep sorted arrays sorted.
// These two functors can be used as predicates with std::sort() adapting the
// sort function to it, whichever signature it uses.
template<class T> template<class T>
class wxArray_SortFunction class wxArray_SortFunction
{ {
@@ -52,7 +57,7 @@ public:
wxArray_SortFunction(CMPFUNC f) : m_f(f) { } wxArray_SortFunction(CMPFUNC f) : m_f(f) { }
bool operator()(const T& i1, const T& i2) bool operator()(const T& i1, const T& i2)
{ return m_f((T*)&i1, (T*)&i2) < 0; } { return m_f(const_cast<T*>(&i1), const_cast<T*>(&i2)) < 0; }
private: private:
CMPFUNC m_f; CMPFUNC m_f;
}; };
@@ -74,9 +79,9 @@ template <typename T>
class wxBaseArray : public wxVector<T> class wxBaseArray : public wxVector<T>
{ {
typedef wxSortedArray_SortFunction<T> Predicate; typedef wxSortedArray_SortFunction<T> Predicate;
typedef int (wxCMPFUNC_CONV *SCMPFUNC)(T, T);
public: public:
typedef typename Predicate::CMPFUNC SCMPFUNC;
typedef typename wxArray_SortFunction<T>::CMPFUNC CMPFUNC; typedef typename wxArray_SortFunction<T>::CMPFUNC CMPFUNC;
typedef wxVector<T> base_vec; typedef wxVector<T> base_vec;
@@ -151,17 +156,17 @@ public:
return wxNOT_FOUND; return wxNOT_FOUND;
} }
int Index(T lItem, CMPFUNC fnCompare) const int Index(T lItem, SCMPFUNC fnCompare) const
{ {
Predicate p((SCMPFUNC)fnCompare); Predicate p(fnCompare);
const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p); const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p);
return i != this->end() && !p(lItem, *i) ? (int)(i - this->begin()) return i != this->end() && !p(lItem, *i) ? (int)(i - this->begin())
: wxNOT_FOUND; : wxNOT_FOUND;
} }
size_t IndexForInsert(T lItem, CMPFUNC fnCompare) const size_t IndexForInsert(T lItem, SCMPFUNC fnCompare) const
{ {
Predicate p((SCMPFUNC)fnCompare); Predicate p(fnCompare);
const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p); const_iterator i = std::lower_bound(this->begin(), this->end(), lItem, p);
return i - this->begin(); return i - this->begin();
} }
@@ -171,7 +176,7 @@ public:
this->insert(this->end(), nInsert, lItem); this->insert(this->end(), nInsert, lItem);
} }
size_t Add(T lItem, CMPFUNC fnCompare) size_t Add(T lItem, SCMPFUNC fnCompare)
{ {
size_t n = IndexForInsert(lItem, fnCompare); size_t n = IndexForInsert(lItem, fnCompare);
Insert(lItem, n); Insert(lItem, n);
@@ -200,6 +205,12 @@ public:
wxArray_SortFunction<T> p(fCmp); wxArray_SortFunction<T> p(fCmp);
std::sort(this->begin(), this->end(), p); std::sort(this->begin(), this->end(), p);
} }
void Sort(SCMPFUNC fCmp)
{
Predicate p(fCmp);
std::sort(this->begin(), this->end(), p);
}
}; };
// ============================================================================ // ============================================================================
@@ -223,8 +234,6 @@ public:
template <typename T, typename Cmp> template <typename T, typename Cmp>
class wxBaseSortedArray : public wxBaseArray<T> class wxBaseSortedArray : public wxBaseArray<T>
{ {
typedef typename wxBaseArray<T>::CMPFUNC CMPFUNC;
public: public:
explicit wxBaseSortedArray(Cmp fn) : m_fnCompare(fn) { } explicit wxBaseSortedArray(Cmp fn) : m_fnCompare(fn) { }
@@ -237,7 +246,7 @@ public:
size_t IndexForInsert(T item) const size_t IndexForInsert(T item) const
{ {
return this->wxBaseArray<T>::IndexForInsert(item, (CMPFUNC)m_fnCompare); return this->wxBaseArray<T>::IndexForInsert(item, m_fnCompare);
} }
void AddAt(T item, size_t index) void AddAt(T item, size_t index)
@@ -247,7 +256,7 @@ public:
size_t Add(T item) size_t Add(T item)
{ {
return this->wxBaseArray<T>::Add(item, (CMPFUNC)m_fnCompare); return this->wxBaseArray<T>::Add(item, m_fnCompare);
} }
void push_back(T item) void push_back(T item)

View File

@@ -81,9 +81,9 @@ typedef int wxEventType;
#define wxEVT_ANY ((wxEventType)-1) #define wxEVT_ANY ((wxEventType)-1)
// this is used to make the event table entry type safe, so that for an event // This macro exists for compatibility only (even though it was never public,
// handler only a function with proper parameter list can be given. See also // it still appears in some code using wxWidgets), see public
// the wxEVENT_HANDLER_CAST-macro. // wxEVENT_HANDLER_CAST instead.
#define wxStaticCastEvent(type, val) static_cast<type>(val) #define wxStaticCastEvent(type, val) static_cast<type>(val)
#define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \ #define wxDECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
@@ -122,10 +122,30 @@ extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
#define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \ #define wxDECLARE_EXPORTED_EVENT_ALIAS( expdecl, name, type ) \
extern const expdecl wxEventTypeTag< type > name extern const expdecl wxEventTypeTag< type > name
// Try to cast the given event handler to the correct handler type: // The type-erased method signature used for event handling.
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
template <typename T>
inline wxEventFunction wxEventFunctionCast(void (wxEvtHandler::*func)(T&))
{
// There is no going around the cast here: we do rely calling the event
// handler method, which takes a reference to an object of a class derived
// from wxEvent, as if it took wxEvent itself. On all platforms supported
// by wxWidgets, this cast is harmless, but it's not a valid cast in C++
// and gcc 8 started giving warnings about this (with -Wextra), so suppress
// them locally to avoid generating hundreds of them when compiling any
// code using event table macros.
wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
return reinterpret_cast<wxEventFunction>(func);
wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
}
// Try to cast the given event handler to the correct handler type:
#define wxEVENT_HANDLER_CAST( functype, func ) \ #define wxEVENT_HANDLER_CAST( functype, func ) \
( wxObjectEventFunction )( wxEventFunction )wxStaticCastEvent( functype, &func ) wxEventFunctionCast(static_cast<functype>(&func))
// The tag is a type associated to the event type (which is an integer itself, // The tag is a type associated to the event type (which is an integer itself,
@@ -150,9 +170,6 @@ private:
wxEventType m_type; wxEventType m_type;
}; };
// These are needed for the functor definitions
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
// We had some trouble with using wxEventFunction // We had some trouble with using wxEventFunction
// in the past so we had introduced wxObjectEventFunction which // in the past so we had introduced wxObjectEventFunction which
// used to be a typedef for a member of wxObject and not wxEvtHandler to work // used to be a typedef for a member of wxObject and not wxEvtHandler to work
@@ -295,8 +312,8 @@ struct HandlerImpl<T, A, true>
static wxEvtHandler *ConvertToEvtHandler(T *p) static wxEvtHandler *ConvertToEvtHandler(T *p)
{ return p; } { return p; }
static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&)) static wxEventFunction ConvertToEvtMethod(void (T::*f)(A&))
{ return static_cast<wxEventFunction>( { return wxEventFunctionCast(
reinterpret_cast<void (T::*)(wxEvent&)>(f)); } static_cast<void (wxEvtHandler::*)(A&)>(f)); }
}; };
// specialization for handlers not deriving from wxEvtHandler // specialization for handlers not deriving from wxEvtHandler

View File

@@ -81,7 +81,7 @@ class WXDLLIMPEXP_BASE _wxHashTableBase2
{ {
public: public:
typedef void (*NodeDtor)(_wxHashTable_NodeBase*); typedef void (*NodeDtor)(_wxHashTable_NodeBase*);
typedef unsigned long (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*); typedef size_t (*BucketFromNode)(_wxHashTableBase2*,_wxHashTable_NodeBase*);
typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*); typedef _wxHashTable_NodeBase* (*ProcessNode)(_wxHashTable_NodeBase*);
protected: protected:
static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node); static _wxHashTable_NodeBase* DummyProcessNode(_wxHashTable_NodeBase* node);

View File

@@ -936,7 +936,10 @@ extern WXDLLIMPEXP_CORE int wxGetWindowId(WXHWND hWnd);
// check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are // check if hWnd's WNDPROC is wndProc. Return true if yes, false if they are
// different // different
extern WXDLLIMPEXP_CORE bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc); //
// wndProc parameter is unused and only kept for compatibility
extern WXDLLIMPEXP_CORE
bool wxCheckWindowWndProc(WXHWND hWnd, WXWNDPROC wndProc = NULL);
// Does this window style specify any border? // Does this window style specify any border?
inline bool wxStyleHasBorder(long style) inline bool wxStyleHasBorder(long style)
@@ -1055,54 +1058,28 @@ inline void wxFillRect(HWND hwnd, HDC hdc, HBRUSH hbr)
// 32/64 bit helpers // 32/64 bit helpers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifdef __WIN64__
inline void *wxGetWindowProc(HWND hwnd)
{
return (void *)::GetWindowLongPtr(hwnd, GWLP_WNDPROC);
}
inline void *wxGetWindowUserData(HWND hwnd)
{
return (void *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
}
inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func)
{
return (WNDPROC)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func);
}
inline void *wxSetWindowUserData(HWND hwnd, void *data)
{
return (void *)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
}
#else // __WIN32__
// note that the casts to LONG_PTR here are required even on 32-bit machines // note that the casts to LONG_PTR here are required even on 32-bit machines
// for the 64-bit warning mode of later versions of MSVC (C4311/4312) // for the 64-bit warning mode of later versions of MSVC (C4311/4312)
inline WNDPROC wxGetWindowProc(HWND hwnd) inline WNDPROC wxGetWindowProc(HWND hwnd)
{ {
return (WNDPROC)(LONG_PTR)::GetWindowLong(hwnd, GWL_WNDPROC); return (WNDPROC)(LONG_PTR)::GetWindowLongPtr(hwnd, GWLP_WNDPROC);
} }
inline void *wxGetWindowUserData(HWND hwnd) inline void *wxGetWindowUserData(HWND hwnd)
{ {
return (void *)(LONG_PTR)::GetWindowLong(hwnd, GWL_USERDATA); return (void *)(LONG_PTR)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
} }
inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func) inline WNDPROC wxSetWindowProc(HWND hwnd, WNDPROC func)
{ {
return (WNDPROC)(LONG_PTR)::SetWindowLong(hwnd, GWL_WNDPROC, (LONG_PTR)func); return (WNDPROC)(LONG_PTR)::SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)func);
} }
inline void *wxSetWindowUserData(HWND hwnd, void *data) inline void *wxSetWindowUserData(HWND hwnd, void *data)
{ {
return (void *)(LONG_PTR)::SetWindowLong(hwnd, GWL_USERDATA, (LONG_PTR)data); return (void *)(LONG_PTR)::SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
} }
#endif // __WIN64__/__WIN32__
#endif // wxUSE_GUI && __WXMSW__ #endif // wxUSE_GUI && __WXMSW__
#endif // _WX_PRIVATE_H_ #endif // _WX_PRIVATE_H_

View File

@@ -100,7 +100,7 @@ public:
// for internal use only // for internal use only
// get the subclassed window proc of the buddy text // get the subclassed window proc of the buddy text
WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } WXWNDPROC GetBuddyWndProc() const { return m_wndProcBuddy; }
// return the spinctrl object whose buddy is the given window or NULL // return the spinctrl object whose buddy is the given window or NULL
static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy); static wxSpinCtrl *GetSpinForTextCtrl(WXHWND hwndBuddy);
@@ -145,7 +145,7 @@ protected:
// the data for the "buddy" text ctrl // the data for the "buddy" text ctrl
WXHWND m_hwndBuddy; WXHWND m_hwndBuddy;
WXFARPROC m_wndProcBuddy; WXWNDPROC m_wndProcBuddy;
// Block text update event after SetValue() // Block text update event after SetValue()
bool m_blockEvent; bool m_blockEvent;

View File

@@ -206,8 +206,8 @@ public:
void SubclassWin(WXHWND hWnd); void SubclassWin(WXHWND hWnd);
void UnsubclassWin(); void UnsubclassWin();
WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; } WXWNDPROC MSWGetOldWndProc() const { return m_oldWndProc; }
void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; } void MSWSetOldWndProc(WXWNDPROC proc) { m_oldWndProc = proc; }
// return true if the window is of a standard (i.e. not wxWidgets') class // return true if the window is of a standard (i.e. not wxWidgets') class
// //
@@ -597,7 +597,7 @@ protected:
WXHWND m_hWnd; WXHWND m_hWnd;
// the old window proc (we subclass all windows) // the old window proc (we subclass all windows)
WXFARPROC m_oldWndProc; WXWNDPROC m_oldWndProc;
// additional (MSW specific) flags // additional (MSW specific) flags
bool m_mouseInWindow:1; bool m_mouseInWindow:1;

View File

@@ -79,11 +79,6 @@ bool wxVListBox::Create(wxWindow *parent,
long style, long style,
const wxString& name) const wxString& name)
{ {
#ifdef __WXMSW__
if ( (style & wxBORDER_MASK) == wxDEFAULT )
style |= wxBORDER_THEME;
#endif
style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE; style |= wxWANTS_CHARS | wxFULL_REPAINT_ON_RESIZE;
if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) ) if ( !wxVScrolledWindow::Create(parent, id, pos, size, style, name) )
return false; return false;

View File

@@ -66,14 +66,14 @@ static void DDEDeleteConnection(HCONV hConv);
static wxDDEServer *DDEFindServer(const wxString& s); static wxDDEServer *DDEFindServer(const wxString& s);
extern "C" HDDEDATA EXPENTRY extern "C" HDDEDATA EXPENTRY
_DDECallback(WORD wType, _DDECallback(UINT wType,
WORD wFmt, UINT wFmt,
HCONV hConv, HCONV hConv,
HSZ hsz1, HSZ hsz1,
HSZ hsz2, HSZ hsz2,
HDDEDATA hData, HDDEDATA hData,
DWORD lData1, ULONG_PTR lData1,
DWORD lData2); ULONG_PTR lData2);
// Add topic name to atom table before using in conversations // Add topic name to atom table before using in conversations
static HSZ DDEAddAtom(const wxString& string); static HSZ DDEAddAtom(const wxString& string);
@@ -149,9 +149,7 @@ extern void wxDDEInitialize()
if ( !DDEInitialized ) if ( !DDEInitialized )
{ {
// Should insert filter flags // Should insert filter flags
PFNCALLBACK callback = (PFNCALLBACK) UINT rc = DdeInitialize(&DDEIdInst, _DDECallback, APPCLASS_STANDARD, 0L);
MakeProcInstance((FARPROC)_DDECallback, wxGetInstance());
UINT rc = DdeInitialize(&DDEIdInst, callback, APPCLASS_STANDARD, 0L);
if ( rc != DMLERR_NO_ERROR ) if ( rc != DMLERR_NO_ERROR )
{ {
DDELogError(wxT("Failed to initialize DDE"), rc); DDELogError(wxT("Failed to initialize DDE"), rc);
@@ -773,14 +771,14 @@ bool wxDDEConnection::DoAdvise(const wxString& item,
#define DDERETURN HDDEDATA #define DDERETURN HDDEDATA
HDDEDATA EXPENTRY HDDEDATA EXPENTRY
_DDECallback(WORD wType, _DDECallback(UINT wType,
WORD wFmt, UINT wFmt,
HCONV hConv, HCONV hConv,
HSZ hsz1, HSZ hsz1,
HSZ hsz2, HSZ hsz2,
HDDEDATA hData, HDDEDATA hData,
DWORD WXUNUSED(lData1), ULONG_PTR WXUNUSED(lData1),
DWORD WXUNUSED(lData2)) ULONG_PTR WXUNUSED(lData2))
{ {
switch (wType) switch (wType)
{ {

View File

@@ -147,8 +147,24 @@ wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 #define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
#endif #endif
typedef HGLRC(WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) // This helper function only exists to suppress unavoidable gcc 8 warnings
(HDC hDC, HGLRC hShareContext, const int *attribList); // about incompatible function casts.
template <typename T>
inline T wxWGLProcCast(PROC proc)
{
wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
return reinterpret_cast<T>(proc);
wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
}
// this macro defines a variable of type "name_t" called "name" and initializes
// it with the pointer to WGL function "name" (which may be NULL)
//
// NB: type name_t must be defined by the code using the macro
#define wxDEFINE_WGL_FUNC(name) \
name##_t name = wxWGLProcCast<name##_t>(wglGetProcAddress(#name))
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// libraries // libraries
@@ -580,9 +596,11 @@ wxGLContext::wxGLContext(wxGLCanvas *win,
wxCHECK_RET( tempContext, "wglCreateContext failed!" ); wxCHECK_RET( tempContext, "wglCreateContext failed!" );
wglMakeCurrent(win->GetHDC(), tempContext); wglMakeCurrent(win->GetHDC(), tempContext);
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB
= (PFNWGLCREATECONTEXTATTRIBSARBPROC) typedef HGLRC(WINAPI * wglCreateContextAttribsARB_t)
wglGetProcAddress("wglCreateContextAttribsARB"); (HDC hDC, HGLRC hShareContext, const int *attribList);
wxDEFINE_WGL_FUNC(wglCreateContextAttribsARB);
wglMakeCurrent(win->GetHDC(), NULL); wglMakeCurrent(win->GetHDC(), NULL);
wglDeleteContext(tempContext); wglDeleteContext(tempContext);
@@ -810,11 +828,6 @@ bool wxGLCanvas::SwapBuffers()
} }
// this macro defines a variable of type "name_t" called "name" and initializes
// it with the pointer to WGL function "name" (which may be NULL)
#define wxDEFINE_WGL_FUNC(name) \
name##_t name = (name##_t)wglGetProcAddress(#name)
/* static */ /* static */
bool wxGLCanvasBase::IsExtensionSupported(const char *extension) bool wxGLCanvasBase::IsExtensionSupported(const char *extension)
{ {

View File

@@ -160,6 +160,11 @@ enum
mcWithFrame = 16 mcWithFrame = 16
}; };
typedef void (*PPRMProcType)(Movie theMovie, OSErr theErr, void* theRefCon);
typedef Boolean (*MCFilterProcType)(MovieController theController,
short action, void *params,
LONG_PTR refCon);
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// QT Library // QT Library
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -246,7 +251,7 @@ public:
wxDL_VOIDMETHOD_DEFINE(DisposeMovieController, (ComponentInstance ci), (ci)) wxDL_VOIDMETHOD_DEFINE(DisposeMovieController, (ComponentInstance ci), (ci))
wxDL_METHOD_DEFINE(int, MCSetVisible, (ComponentInstance m, int b), (m, b), 0) wxDL_METHOD_DEFINE(int, MCSetVisible, (ComponentInstance m, int b), (m, b), 0)
wxDL_VOIDMETHOD_DEFINE(PrePrerollMovie, (Movie m, long t, Fixed r, WXFARPROC p1, void* p2), (m,t,r,p1,p2) ) wxDL_VOIDMETHOD_DEFINE(PrePrerollMovie, (Movie m, long t, Fixed r, PPRMProcType p1, void* p2), (m,t,r,p1,p2) )
wxDL_VOIDMETHOD_DEFINE(PrerollMovie, (Movie m, long t, Fixed r), (m,t,r) ) wxDL_VOIDMETHOD_DEFINE(PrerollMovie, (Movie m, long t, Fixed r), (m,t,r) )
wxDL_METHOD_DEFINE(Fixed, GetMoviePreferredRate, (Movie m), (m), 0) wxDL_METHOD_DEFINE(Fixed, GetMoviePreferredRate, (Movie m), (m), 0)
wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0) wxDL_METHOD_DEFINE(long, GetMovieLoadState, (Movie m), (m), 0)
@@ -263,7 +268,7 @@ public:
wxDL_VOIDMETHOD_DEFINE(MCPositionController, wxDL_VOIDMETHOD_DEFINE(MCPositionController,
(ComponentInstance ci, Rect* r, void* junk, void* morejunk), (ci,r,junk,morejunk)) (ComponentInstance ci, Rect* r, void* junk, void* morejunk), (ci,r,junk,morejunk))
wxDL_VOIDMETHOD_DEFINE(MCSetActionFilterWithRefCon, wxDL_VOIDMETHOD_DEFINE(MCSetActionFilterWithRefCon,
(ComponentInstance ci, WXFARPROC cb, void* ref), (ci,cb,ref)) (ComponentInstance ci, MCFilterProcType cb, void* ref), (ci,cb,ref))
wxDL_VOIDMETHOD_DEFINE(MCGetControllerInfo, (MovieController mc, long* flags), (mc,flags)) wxDL_VOIDMETHOD_DEFINE(MCGetControllerInfo, (MovieController mc, long* flags), (mc,flags))
wxDL_VOIDMETHOD_DEFINE(BeginUpdate, (CGrafPtr port), (port)) wxDL_VOIDMETHOD_DEFINE(BeginUpdate, (CGrafPtr port), (port))
wxDL_VOIDMETHOD_DEFINE(UpdateMovie, (Movie m), (m)) wxDL_VOIDMETHOD_DEFINE(UpdateMovie, (Movie m), (m))
@@ -804,8 +809,8 @@ bool wxQTMediaBackend::Load(const wxURI& location)
// which we don't by default. // which we don't by default.
// //
m_lib.PrePrerollMovie(m_movie, timeNow, playRate, m_lib.PrePrerollMovie(m_movie, timeNow, playRate,
(WXFARPROC)wxQTMediaBackend::PPRMProc, wxQTMediaBackend::PPRMProc,
(void*)this); this);
return true; return true;
} }
@@ -1119,7 +1124,7 @@ bool wxQTMediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags)
mcWithFrame); mcWithFrame);
m_lib.MCDoAction(m_pMC, 32, (void*)true); // mcActionSetKeysEnabled m_lib.MCDoAction(m_pMC, 32, (void*)true); // mcActionSetKeysEnabled
m_lib.MCSetActionFilterWithRefCon(m_pMC, m_lib.MCSetActionFilterWithRefCon(m_pMC,
(WXFARPROC)wxQTMediaBackend::MCFilterProc, (void*)this); wxQTMediaBackend::MCFilterProc, this);
m_bestSize.y += 16; // movie controller height m_bestSize.y += 16; // movie controller height
// By default the movie controller uses its own colour palette // By default the movie controller uses its own colour palette

View File

@@ -36,7 +36,7 @@
// global functions // global functions
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
extern LONG APIENTRY extern INT_PTR APIENTRY
wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
// =========================================================================== // ===========================================================================

View File

@@ -81,10 +81,10 @@
#if USE_NOTEBOOK_ANTIFLICKER #if USE_NOTEBOOK_ANTIFLICKER
// the pointer to standard spin button wnd proc // the pointer to standard spin button wnd proc
static WXFARPROC gs_wndprocNotebookSpinBtn = (WXFARPROC)NULL; static WXWNDPROC gs_wndprocNotebookSpinBtn = NULL;
// the pointer to standard tab control wnd proc // the pointer to standard tab control wnd proc
static WXFARPROC gs_wndprocNotebook = (WXFARPROC)NULL; static WXWNDPROC gs_wndprocNotebook = NULL;
LRESULT APIENTRY LRESULT APIENTRY
wxNotebookWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); wxNotebookWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
@@ -202,8 +202,7 @@ bool wxNotebook::Create(wxWindow *parent,
if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) ) if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) )
{ {
gs_wndprocNotebook = gs_wndprocNotebook = wc.lpfnWndProc;
reinterpret_cast<WXFARPROC>(wc.lpfnWndProc);
wc.lpszClassName = wxT("_wx_SysTabCtl32"); wc.lpszClassName = wxT("_wx_SysTabCtl32");
wc.style &= ~(CS_HREDRAW | CS_VREDRAW); wc.style &= ~(CS_HREDRAW | CS_VREDRAW);
wc.hInstance = wxGetInstance(); wc.hInstance = wxGetInstance();
@@ -996,7 +995,7 @@ void wxNotebook::OnSize(wxSizeEvent& event)
{ {
// subclass the spin button to override WM_ERASEBKGND // subclass the spin button to override WM_ERASEBKGND
if ( !gs_wndprocNotebookSpinBtn ) if ( !gs_wndprocNotebookSpinBtn )
gs_wndprocNotebookSpinBtn = (WXFARPROC)wxGetWindowProc(child); gs_wndprocNotebookSpinBtn = wxGetWindowProc(child);
wxSetWindowProc(child, wxNotebookSpinBtnWndProc); wxSetWindowProc(child, wxNotebookSpinBtnWndProc);
m_hasSubclassedUpdown = true; m_hasSubclassedUpdown = true;

View File

@@ -113,7 +113,7 @@ namespace
{ {
// the pointer to standard radio button wnd proc // the pointer to standard radio button wnd proc
WXFARPROC s_wndprocRadioBtn = (WXFARPROC)NULL; WXWNDPROC s_wndprocRadioBtn = NULL;
// Hash allowing to find wxRadioBox containing the given radio button by its // Hash allowing to find wxRadioBox containing the given radio button by its
// HWND. This is used by (subclassed) radio button window proc to find the // HWND. This is used by (subclassed) radio button window proc to find the
@@ -298,7 +298,7 @@ void wxRadioBox::SubclassRadioButton(WXHWND hWndBtn)
HWND hwndBtn = (HWND)hWndBtn; HWND hwndBtn = (HWND)hWndBtn;
if ( !s_wndprocRadioBtn ) if ( !s_wndprocRadioBtn )
s_wndprocRadioBtn = (WXFARPROC)wxGetWindowProc(hwndBtn); s_wndprocRadioBtn = wxGetWindowProc(hwndBtn);
wxSetWindowProc(hwndBtn, wxRadioBtnWndProc); wxSetWindowProc(hwndBtn, wxRadioBtnWndProc);

View File

@@ -329,8 +329,7 @@ bool wxSpinCtrl::Create(wxWindow *parent,
// subclass the text ctrl to be able to intercept some events // subclass the text ctrl to be able to intercept some events
gs_spinForTextCtrl[GetBuddyHwnd()] = this; gs_spinForTextCtrl[GetBuddyHwnd()] = this;
m_wndProcBuddy = (WXFARPROC)wxSetWindowProc(GetBuddyHwnd(), m_wndProcBuddy = wxSetWindowProc(GetBuddyHwnd(), wxBuddyTextWndProc);
wxBuddyTextWndProc);
// associate the text window with the spin button // associate the text window with the spin button
(void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0); (void)::SendMessage(GetHwnd(), UDM_SETBUDDY, (WPARAM)m_hwndBuddy, 0);

View File

@@ -92,7 +92,7 @@ struct NotifyIconData : public NOTIFYICONDATA
{ {
NotifyIconData(WXHWND hwnd) NotifyIconData(WXHWND hwnd)
{ {
memset(this, 0, sizeof(NOTIFYICONDATA)); wxZeroMemory(*this);
// Since Vista there is a new member hBalloonIcon which will be used // Since Vista there is a new member hBalloonIcon which will be used
// if a user specified icon is specified in ShowBalloon(). For XP // if a user specified icon is specified in ShowBalloon(). For XP

View File

@@ -51,7 +51,7 @@
// NB: wxDlgProc must be defined here and not in dialog.cpp because the latter // NB: wxDlgProc must be defined here and not in dialog.cpp because the latter
// is not included by wxUniv build which does need wxDlgProc // is not included by wxUniv build which does need wxDlgProc
LONG APIENTRY INT_PTR APIENTRY
wxDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); wxDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1242,7 +1242,7 @@ void wxTopLevelWindowMSW::OnActivate(wxActivateEvent& event)
} }
// the DialogProc for all wxWidgets dialogs // the DialogProc for all wxWidgets dialogs
LONG APIENTRY INT_PTR APIENTRY
wxDlgProc(HWND WXUNUSED(hDlg), wxDlgProc(HWND WXUNUSED(hDlg),
UINT message, UINT message,
WPARAM WXUNUSED(wParam), WPARAM WXUNUSED(wParam),

View File

@@ -1248,11 +1248,11 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
wxAssociateWinWithHandle(hwnd, this); wxAssociateWinWithHandle(hwnd, this);
m_oldWndProc = (WXFARPROC)wxGetWindowProc((HWND)hWnd); m_oldWndProc = wxGetWindowProc((HWND)hWnd);
// we don't need to subclass the window of our own class (in the Windows // we don't need to subclass the window of our own class (in the Windows
// sense of the word) // sense of the word)
if ( !wxCheckWindowWndProc(hWnd, (WXFARPROC)wxWndProc) ) if ( !wxCheckWindowWndProc(hWnd) )
{ {
wxSetWindowProc(hwnd, wxWndProc); wxSetWindowProc(hwnd, wxWndProc);
@@ -1289,9 +1289,9 @@ void wxWindowMSW::UnsubclassWin()
if ( m_oldWndProc ) if ( m_oldWndProc )
{ {
if ( !wxCheckWindowWndProc((WXHWND)hwnd, m_oldWndProc) ) if ( !wxCheckWindowWndProc((WXHWND)hwnd) )
{ {
wxSetWindowProc(hwnd, (WNDPROC)m_oldWndProc); wxSetWindowProc(hwnd, m_oldWndProc);
} }
m_oldWndProc = NULL; m_oldWndProc = NULL;
@@ -1322,8 +1322,7 @@ void wxWindowMSW::DissociateHandle()
} }
bool wxCheckWindowWndProc(WXHWND hWnd, bool wxCheckWindowWndProc(WXHWND hWnd, WXWNDPROC WXUNUSED(wndProc))
WXFARPROC WXUNUSED(wndProc))
{ {
const wxString str(wxGetWindowClass(hWnd)); const wxString str(wxGetWindowClass(hWnd));
@@ -2408,7 +2407,7 @@ WXLRESULT wxWindowMSW::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM l
{ {
WXLRESULT rc; WXLRESULT rc;
if ( m_oldWndProc ) if ( m_oldWndProc )
rc = ::CallWindowProc(CASTWNDPROC m_oldWndProc, GetHwnd(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam); rc = ::CallWindowProc(m_oldWndProc, GetHwnd(), nMsg, wParam, lParam);
else else
rc = ::DefWindowProc(GetHwnd(), nMsg, wParam, lParam); rc = ::DefWindowProc(GetHwnd(), nMsg, wParam, lParam);
@@ -6867,8 +6866,8 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd)
// in active frames and dialogs, regardless of where the focus is. // in active frames and dialogs, regardless of where the focus is.
static HHOOK wxTheKeyboardHook = 0; static HHOOK wxTheKeyboardHook = 0;
int APIENTRY LRESULT APIENTRY
wxKeyboardHook(int nCode, WORD wParam, DWORD lParam) wxKeyboardHook(int nCode, WXWPARAM wParam, WXLPARAM lParam)
{ {
DWORD hiWord = HIWORD(lParam); DWORD hiWord = HIWORD(lParam);
if ( nCode != HC_NOREMOVE && ((hiWord & KF_UP) == 0) ) if ( nCode != HC_NOREMOVE && ((hiWord & KF_UP) == 0) )
@@ -6935,7 +6934,7 @@ void wxSetKeyboardHook(bool doIt)
wxTheKeyboardHook = ::SetWindowsHookEx wxTheKeyboardHook = ::SetWindowsHookEx
( (
WH_KEYBOARD, WH_KEYBOARD,
(HOOKPROC)wxKeyboardHook, wxKeyboardHook,
NULL, // must be NULL for process hook NULL, // must be NULL for process hook
::GetCurrentThreadId() ::GetCurrentThreadId()
); );