Fixed bug with truncation of Unicode data in wxConnection under MSW.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -262,6 +262,7 @@ wxMSW:
|
|||||||
- restored (and improved) possibility to use wx with MFC broken in 2.5.2
|
- restored (and improved) possibility to use wx with MFC broken in 2.5.2
|
||||||
- fixed wxTextCtrl::SetMaxLength for rich edit controls
|
- fixed wxTextCtrl::SetMaxLength for rich edit controls
|
||||||
- fixed flat style for toolbars under XP, Windows Classic style
|
- fixed flat style for toolbars under XP, Windows Classic style
|
||||||
|
- fixed truncation of transferred data in wxConnection under unicode build
|
||||||
|
|
||||||
wxUniv/X11:
|
wxUniv/X11:
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title)
|
|||||||
SetMenuBar(menu_bar);
|
SetMenuBar(menu_bar);
|
||||||
|
|
||||||
// Make a listbox
|
// Make a listbox
|
||||||
wxListBox *list = new wxListBox(this, SERVER_LISTBOX, wxPoint(5, 5));
|
wxListBox *list = new wxListBox(this, SERVER_LISTBOX);
|
||||||
list->Append(_T("Apple"));
|
list->Append(_T("Apple"));
|
||||||
list->Append(_T("Pear"));
|
list->Append(_T("Pear"));
|
||||||
list->Append(_T("Orange"));
|
list->Append(_T("Orange"));
|
||||||
@@ -200,7 +200,7 @@ MyConnection::MyConnection()
|
|||||||
: wxConnection()
|
: wxConnection()
|
||||||
{
|
{
|
||||||
dialog = new IPCDialogBox(wxTheApp->GetTopWindow(), _T("Connection"),
|
dialog = new IPCDialogBox(wxTheApp->GetTopWindow(), _T("Connection"),
|
||||||
wxPoint(100, 100), wxSize(500, 500), this);
|
wxDefaultPosition, wxDefaultSize, this);
|
||||||
dialog->Show(true);
|
dialog->Show(true);
|
||||||
the_connection = this;
|
the_connection = this;
|
||||||
}
|
}
|
||||||
|
@@ -49,24 +49,6 @@
|
|||||||
#include "wx/msw/gnuwin32/extra.h"
|
#include "wx/msw/gnuwin32/extra.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// some compilers headers don't define this one (mingw32)
|
|
||||||
#ifndef DMLERR_NO_ERROR
|
|
||||||
#define DMLERR_NO_ERROR (0)
|
|
||||||
|
|
||||||
// this one is also missing from some mingw32 headers, but there is no way
|
|
||||||
// to test for it (I know of) - the test for DMLERR_NO_ERROR works for me,
|
|
||||||
// but is surely not the right thing to do
|
|
||||||
extern "C"
|
|
||||||
HDDEDATA STDCALL DdeClientTransaction(LPBYTE pData,
|
|
||||||
DWORD cbData,
|
|
||||||
HCONV hConv,
|
|
||||||
HSZ hszItem,
|
|
||||||
UINT wFmt,
|
|
||||||
UINT wType,
|
|
||||||
DWORD dwTimeout,
|
|
||||||
LPDWORD pdwResult);
|
|
||||||
#endif // no DMLERR_NO_ERROR
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// macros and constants
|
// macros and constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -579,7 +561,8 @@ bool wxDDEConnection::Execute(const wxChar *data, int size, wxIPCFormat format)
|
|||||||
size = wxStrlen(data) + 1;
|
size = wxStrlen(data) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = DdeClientTransaction((LPBYTE)data, size,
|
bool ok = DdeClientTransaction((LPBYTE)data,
|
||||||
|
size * sizeof(wxChar),
|
||||||
GetHConv(),
|
GetHConv(),
|
||||||
NULL,
|
NULL,
|
||||||
format,
|
format,
|
||||||
@@ -616,7 +599,7 @@ wxChar *wxDDEConnection::Request(const wxString& item, int *size, wxIPCFormat fo
|
|||||||
|
|
||||||
DWORD len = DdeGetData(returned_data, NULL, 0, 0);
|
DWORD len = DdeGetData(returned_data, NULL, 0, 0);
|
||||||
|
|
||||||
wxChar *data = GetBufferAtLeast( len );
|
wxChar *data = GetBufferAtLeast( len/sizeof(wxChar) );
|
||||||
wxASSERT_MSG(data != NULL,
|
wxASSERT_MSG(data != NULL,
|
||||||
_T("Buffer too small in wxDDEConnection::Request") );
|
_T("Buffer too small in wxDDEConnection::Request") );
|
||||||
(void) DdeGetData(returned_data, (LPBYTE)data, len, 0);
|
(void) DdeGetData(returned_data, (LPBYTE)data, len, 0);
|
||||||
@@ -624,7 +607,7 @@ wxChar *wxDDEConnection::Request(const wxString& item, int *size, wxIPCFormat fo
|
|||||||
(void) DdeFreeDataHandle(returned_data);
|
(void) DdeFreeDataHandle(returned_data);
|
||||||
|
|
||||||
if (size)
|
if (size)
|
||||||
*size = (int)len;
|
*size = (int)len/sizeof(wxChar);
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -638,7 +621,8 @@ bool wxDDEConnection::Poke(const wxString& item, wxChar *data, int size, wxIPCFo
|
|||||||
}
|
}
|
||||||
|
|
||||||
HSZ item_atom = DDEGetAtom(item);
|
HSZ item_atom = DDEGetAtom(item);
|
||||||
bool ok = DdeClientTransaction((LPBYTE)data, size,
|
bool ok = DdeClientTransaction((LPBYTE)data,
|
||||||
|
size * sizeof(wxChar),
|
||||||
GetHConv(),
|
GetHConv(),
|
||||||
item_atom, format,
|
item_atom, format,
|
||||||
XTYP_POKE,
|
XTYP_POKE,
|
||||||
@@ -796,7 +780,7 @@ _DDECallback(WORD wType,
|
|||||||
{
|
{
|
||||||
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
||||||
|
|
||||||
wxChar *data = connection->GetBufferAtLeast( len );
|
wxChar *data = connection->GetBufferAtLeast( len/sizeof(wxChar) );
|
||||||
wxASSERT_MSG(data != NULL,
|
wxASSERT_MSG(data != NULL,
|
||||||
_T("Buffer too small in _DDECallback (XTYP_EXECUTE)") );
|
_T("Buffer too small in _DDECallback (XTYP_EXECUTE)") );
|
||||||
|
|
||||||
@@ -806,7 +790,7 @@ _DDECallback(WORD wType,
|
|||||||
|
|
||||||
if ( connection->OnExecute(connection->m_topicName,
|
if ( connection->OnExecute(connection->m_topicName,
|
||||||
data,
|
data,
|
||||||
(int)len,
|
(int)len/sizeof(wxChar),
|
||||||
(wxIPCFormat) wFmt) )
|
(wxIPCFormat) wFmt) )
|
||||||
{
|
{
|
||||||
return (DDERETURN)(DWORD)DDE_FACK;
|
return (DDERETURN)(DWORD)DDE_FACK;
|
||||||
@@ -836,7 +820,7 @@ _DDECallback(WORD wType,
|
|||||||
|
|
||||||
HDDEDATA handle = DdeCreateDataHandle(DDEIdInst,
|
HDDEDATA handle = DdeCreateDataHandle(DDEIdInst,
|
||||||
(LPBYTE)data,
|
(LPBYTE)data,
|
||||||
user_size,
|
user_size*sizeof(wxChar),
|
||||||
0,
|
0,
|
||||||
hsz2,
|
hsz2,
|
||||||
wFmt,
|
wFmt,
|
||||||
@@ -857,7 +841,7 @@ _DDECallback(WORD wType,
|
|||||||
|
|
||||||
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
||||||
|
|
||||||
wxChar *data = connection->GetBufferAtLeast( len );
|
wxChar *data = connection->GetBufferAtLeast( len/sizeof(wxChar) );
|
||||||
wxASSERT_MSG(data != NULL,
|
wxASSERT_MSG(data != NULL,
|
||||||
_T("Buffer too small in _DDECallback (XTYP_EXECUTE)") );
|
_T("Buffer too small in _DDECallback (XTYP_EXECUTE)") );
|
||||||
|
|
||||||
@@ -868,7 +852,7 @@ _DDECallback(WORD wType,
|
|||||||
connection->OnPoke(connection->m_topicName,
|
connection->OnPoke(connection->m_topicName,
|
||||||
item_name,
|
item_name,
|
||||||
data,
|
data,
|
||||||
(int)len,
|
(int)len/sizeof(wxChar),
|
||||||
(wxIPCFormat) wFmt);
|
(wxIPCFormat) wFmt);
|
||||||
|
|
||||||
return (DDERETURN)DDE_FACK;
|
return (DDERETURN)DDE_FACK;
|
||||||
@@ -919,7 +903,7 @@ _DDECallback(WORD wType,
|
|||||||
(
|
(
|
||||||
DDEIdInst,
|
DDEIdInst,
|
||||||
(LPBYTE)connection->m_sendingData,
|
(LPBYTE)connection->m_sendingData,
|
||||||
connection->m_dataSize,
|
connection->m_dataSize*sizeof(wxChar),
|
||||||
0,
|
0,
|
||||||
hsz2,
|
hsz2,
|
||||||
connection->m_dataType,
|
connection->m_dataType,
|
||||||
@@ -944,7 +928,7 @@ _DDECallback(WORD wType,
|
|||||||
|
|
||||||
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
DWORD len = DdeGetData(hData, NULL, 0, 0);
|
||||||
|
|
||||||
wxChar *data = connection->GetBufferAtLeast( len );
|
wxChar *data = connection->GetBufferAtLeast( len/sizeof(wxChar) );
|
||||||
wxASSERT_MSG(data != NULL,
|
wxASSERT_MSG(data != NULL,
|
||||||
_T("Buffer too small in _DDECallback (XTYP_ADVDATA)") );
|
_T("Buffer too small in _DDECallback (XTYP_ADVDATA)") );
|
||||||
|
|
||||||
@@ -954,7 +938,7 @@ _DDECallback(WORD wType,
|
|||||||
if ( connection->OnAdvise(connection->m_topicName,
|
if ( connection->OnAdvise(connection->m_topicName,
|
||||||
item_name,
|
item_name,
|
||||||
data,
|
data,
|
||||||
(int)len,
|
(int)len/sizeof(wxChar),
|
||||||
(wxIPCFormat) wFmt) )
|
(wxIPCFormat) wFmt) )
|
||||||
{
|
{
|
||||||
return (DDERETURN)(DWORD)DDE_FACK;
|
return (DDERETURN)(DWORD)DDE_FACK;
|
||||||
|
Reference in New Issue
Block a user