Use correct DDE callback signature in Win64 build

Don't use the deprecated since Win16 (!) and doing nothing
MakeProcInstance() and fix the signature of DDECallback() which was
actually wrong in Win64 build but the problem was hidden due to the
casts done inside and outside MakeProcInstance() before.

Remove this macro and fix the signature to actually conform to the real
callback one.

This also fixes another gcc8 -Wcast-function-type warning.
This commit is contained in:
Vadim Zeitlin
2018-05-27 23:25:15 +02:00
parent 0cda7c2f13
commit 004af0b963

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)
{ {