Revert "Fix passing Unicode strings via wxIPC when using DDE"
This reverts commit c657fd3d61
because
changing the format of DDE advise requests/replies is not a good idea:
other applications (those using previous versions of wxWidgets or even
not using wxWidgets at all) may rely on getting data in real CF_TEXT
format rather than in one of text formats preceded by the extra byte
containing the actual format and the previous commit would have silently
broken this.
Another fix for #17900 will be implemented instead.
This commit is contained in:
@@ -124,10 +124,6 @@ All (GUI):
|
|||||||
- Allow changing tooltip text for button allowing to enter a new string
|
- Allow changing tooltip text for button allowing to enter a new string
|
||||||
in wxPGArrayEditorDialog.
|
in wxPGArrayEditorDialog.
|
||||||
|
|
||||||
wxMSW:
|
|
||||||
|
|
||||||
- Fix passing Unicode strings via wxIPC when using DDE.
|
|
||||||
|
|
||||||
|
|
||||||
3.1.2: (released 2018-12-10)
|
3.1.2: (released 2018-12-10)
|
||||||
----------------------------
|
----------------------------
|
||||||
|
@@ -70,6 +70,7 @@ public:
|
|||||||
WXHCONV m_hConv;
|
WXHCONV m_hConv;
|
||||||
const void* m_sendingData;
|
const void* m_sendingData;
|
||||||
int m_dataSize;
|
int m_dataSize;
|
||||||
|
wxIPCFormat m_dataType;
|
||||||
|
|
||||||
wxDECLARE_NO_COPY_CLASS(wxDDEConnection);
|
wxDECLARE_NO_COPY_CLASS(wxDDEConnection);
|
||||||
wxDECLARE_DYNAMIC_CLASS(wxDDEConnection);
|
wxDECLARE_DYNAMIC_CLASS(wxDDEConnection);
|
||||||
|
@@ -268,11 +268,7 @@ void MyServer::Advise()
|
|||||||
{
|
{
|
||||||
const wxDateTime now = wxDateTime::Now();
|
const wxDateTime now = wxDateTime::Now();
|
||||||
|
|
||||||
m_connection->Advise
|
m_connection->Advise(m_connection->m_advise, now.Format());
|
||||||
(
|
|
||||||
m_connection->m_advise,
|
|
||||||
wxString::FromUTF8("\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82")
|
|
||||||
);
|
|
||||||
|
|
||||||
const wxString s = now.FormatTime() + " " + now.FormatDate();
|
const wxString s = now.FormatTime() + " " + now.FormatDate();
|
||||||
m_connection->Advise(m_connection->m_advise, s.mb_str(), wxNO_LEN);
|
m_connection->Advise(m_connection->m_advise, s.mb_str(), wxNO_LEN);
|
||||||
|
@@ -748,20 +748,12 @@ bool wxDDEConnection::DoAdvise(const wxString& item,
|
|||||||
size_t size,
|
size_t size,
|
||||||
wxIPCFormat format)
|
wxIPCFormat format)
|
||||||
{
|
{
|
||||||
// Unfortunately we currently always use the same CF_TEXT in StartAdvise()
|
|
||||||
// but allow calling Advise() with different formats. This doesn't map well
|
|
||||||
// to the DDE API, so the price to pay for it is that we need to send the
|
|
||||||
// actual format used as part of the data, even if this means making
|
|
||||||
// another copy of it.
|
|
||||||
wxCharBuffer buf;
|
|
||||||
buf.extend(size + 1);
|
|
||||||
*buf.data() = format;
|
|
||||||
memcpy(buf.data() + 1, data, size);
|
|
||||||
|
|
||||||
HSZ item_atom = DDEGetAtom(item);
|
HSZ item_atom = DDEGetAtom(item);
|
||||||
HSZ topic_atom = DDEGetAtom(m_topicName);
|
HSZ topic_atom = DDEGetAtom(m_topicName);
|
||||||
m_sendingData = buf.data();
|
m_sendingData = data; // mrf: potential for scope problems here?
|
||||||
m_dataSize = size + 1;
|
m_dataSize = size;
|
||||||
|
// wxIPC_PRIVATE does not succeed, so use text instead
|
||||||
|
m_dataType = format == wxIPC_PRIVATE ? wxIPC_TEXT : format;
|
||||||
|
|
||||||
bool ok = DdePostAdvise(DDEIdInst, topic_atom, item_atom) != 0;
|
bool ok = DdePostAdvise(DDEIdInst, topic_atom, item_atom) != 0;
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
@@ -994,12 +986,11 @@ _DDECallback(UINT wType,
|
|||||||
connection->m_dataSize,
|
connection->m_dataSize,
|
||||||
0,
|
0,
|
||||||
hsz2,
|
hsz2,
|
||||||
wFmt,
|
connection->m_dataType,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
connection->m_sendingData = NULL;
|
connection->m_sendingData = NULL;
|
||||||
connection->m_dataSize = 0;
|
|
||||||
|
|
||||||
return (DDERETURN)data;
|
return (DDERETURN)data;
|
||||||
}
|
}
|
||||||
@@ -1017,21 +1008,18 @@ _DDECallback(UINT wType,
|
|||||||
|
|
||||||
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
||||||
|
|
||||||
BYTE* const data = static_cast<BYTE*>(connection->GetBufferAtLeast(len));
|
void *data = connection->GetBufferAtLeast(len);
|
||||||
wxASSERT_MSG(data != NULL,
|
wxASSERT_MSG(data != NULL,
|
||||||
wxT("Buffer too small in _DDECallback (XTYP_ADVDATA)") );
|
wxT("Buffer too small in _DDECallback (XTYP_ADVDATA)") );
|
||||||
|
|
||||||
DdeGetData(hData, data, len, 0);
|
DdeGetData(hData, (LPBYTE)data, len, 0);
|
||||||
|
|
||||||
DdeFreeDataHandle(hData);
|
DdeFreeDataHandle(hData);
|
||||||
|
|
||||||
// Our code in DoAdvise() prepends the actual format of the
|
|
||||||
// data as the first byte, extract it back now.
|
|
||||||
if ( connection->OnAdvise(connection->m_topicName,
|
if ( connection->OnAdvise(connection->m_topicName,
|
||||||
item_name,
|
item_name,
|
||||||
data + 1,
|
data,
|
||||||
(int)len - 1,
|
(int)len,
|
||||||
(wxIPCFormat)*data) )
|
(wxIPCFormat) wFmt) )
|
||||||
{
|
{
|
||||||
return (DDERETURN)(DWORD)DDE_FACK;
|
return (DDERETURN)(DWORD)DDE_FACK;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user