X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/25758297101c1b4be1164357efc60e69b1d1127a..3e2656801d825761f55ea9b0b766802c6cd32f1d:/src/common/dobjcmn.cpp diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index 3f145db321..0957f4b47f 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -5,7 +5,7 @@ // Modified by: // Created: 19.10.99 // RCS-ID: $Id$ -// Copyright: (c) wxWindows Team +// Copyright: (c) wxWidgets Team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -290,8 +290,7 @@ size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const { // host native is UTF16 wxMBConvUTF16BE converter ; - wxCharBuffer buffer = converter.cWX2MB( GetText().c_str() ); - return strlen( (const char*) buffer ) + 1; + return converter.WC2MB( NULL , GetText().c_str() , 0 ) + 2; // add space for trailing unichar 0 } else // == wxDF_TEXT { @@ -306,8 +305,9 @@ bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const { // host native is UTF16 wxMBConvUTF16BE converter ; + size_t len = converter.WC2MB( NULL , GetText().c_str() , 0 ) ; wxCharBuffer buffer = converter.cWX2MB( GetText().c_str() ); - strcpy( (char*) buf, (const char*) buffer ); + memcpy( (char*) buf, (const char*) buffer , len + 2); // trailing unichar 0 } else {