conversion corrections

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-02-11 15:13:53 +00:00
parent 439ddeba9d
commit 79a73b4f86
4 changed files with 90 additions and 460 deletions

View File

@@ -662,16 +662,16 @@ END_EVENT_TABLE()
static void SetTXNData( TXNObject txn , const wxString& st , TXNOffset start , TXNOffset end )
{
#if wxUSE_UNICODE
size_t len = st.Len() ;
#if SIZEOF_WCHAR_T == 2
size_t len = st.Len() ;
TXNSetData( txn , kTXNUnicodeTextData, (void*)st.wc_str(), len * 2,
start, end);
#else
ByteCount byteBufferLen = len * sizeof( UniChar ) ;
UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
wxMBConvUTF16BE converter ;
ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ;
TXNSetData( txn , kTXNUnicodeTextData, (void*)unibuf, len * 2,
TXNSetData( txn , kTXNUnicodeTextData, (void*)unibuf, byteBufferLen ,
start, end);
free( unibuf ) ;
#endif
@@ -861,7 +861,7 @@ wxString wxTextCtrl::GetValue() const
#else
wxMBConvUTF16BE converter ;
HLock( theText ) ;
converter.MB2WC( ptr , (const char*)*theText , actualSize*sizeof(wxChar) ) ;
converter.MB2WC( ptr , (const char*)*theText , actualSize ) ;
HUnlock( theText ) ;
#endif
ptr[actualSize] = 0 ;