fix wxTextDataObject::GetDataHere and SetData functions (under wxMSW) so that they work with strings with embedded NULLs and can cope with non-NULL terminated arrays.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
98b04f2112
commit
f453d7eada
@ -422,14 +422,16 @@ size_t wxTextDataObject::GetDataSize() const
|
||||
|
||||
bool wxTextDataObject::GetDataHere(void *buf) const
|
||||
{
|
||||
wxStrcpy( (wxChar*)buf, GetText().c_str() );
|
||||
// NOTE: use wxTmemcpy() instead of wxStrncpy() to allow
|
||||
// retrieval of strings with embedded NULLs
|
||||
wxTmemcpy( (wxChar*)buf, GetText().c_str(), GetTextLength() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxTextDataObject::SetData(size_t WXUNUSED(len), const void *buf)
|
||||
bool wxTextDataObject::SetData(size_t len, const void *buf)
|
||||
{
|
||||
SetText( wxString((const wxChar*)buf) );
|
||||
SetText( wxString((const wxChar*)buf, len/sizeof(wxChar)) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user