X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c072b9ec8a5a9f65743ecbd16b0b0bb9dbc8b46b..c9ed413ab4f5673ffff00198dc6ce1397398bda4:/src/osx/carbon/textctrl.cpp diff --git a/src/osx/carbon/textctrl.cpp b/src/osx/carbon/textctrl.cpp index 17ba7c86d1..267680fca8 100644 --- a/src/osx/carbon/textctrl.cpp +++ b/src/osx/carbon/textctrl.cpp @@ -739,10 +739,6 @@ wxString wxMacMLTEControl::GetStringValue() const { wxChar *ptr = NULL ; -#if SIZEOF_WCHAR_T == 2 - ptr = new wxChar[actualSize + 1] ; - wxStrncpy( ptr , (wxChar*)(*theText) , actualSize ) ; -#else SetHandleSize( theText, (actualSize + 1) * sizeof(UniChar) ) ; HLock( theText ) ; (((UniChar*)*theText)[actualSize]) = 0 ; @@ -755,7 +751,6 @@ wxString wxMacMLTEControl::GetStringValue() const wxASSERT_MSG( noChars != wxCONV_FAILED, wxT("Conversion of string failed!") ); ptr[noChars] = 0 ; HUnlock( theText ) ; -#endif ptr[actualSize] = 0 ; result = wxString( ptr ) ; @@ -764,7 +759,7 @@ wxString wxMacMLTEControl::GetStringValue() const DisposeHandle( theText ) ; } -#else +#else // !wxUSE_UNICODE Handle theText ; err = TXNGetDataEncoded( m_txn , kTXNStartOffset, kTXNEndOffset, &theText, kTXNTextData ); @@ -785,7 +780,7 @@ wxString wxMacMLTEControl::GetStringValue() const DisposeHandle( theText ) ; } -#endif +#endif // wxUSE_UNICODE/!wxUSE_UNICODE } #if '\n' == 10 @@ -1381,10 +1376,6 @@ void wxMacMLTEControl::ShowPosition( long pos ) void wxMacMLTEControl::SetTXNData( const wxString& st, TXNOffset start, TXNOffset end ) { #if wxUSE_UNICODE -#if SIZEOF_WCHAR_T == 2 - size_t len = st.length() ; - TXNSetData( m_txn, kTXNUnicodeTextData, (void*)st.wc_str(), len * 2, start, end ); -#else wxMBConvUTF16 converter ; ByteCount byteBufferLen = converter.WC2MB( NULL, st.wc_str(), 0 ) ; wxASSERT_MSG( byteBufferLen != wxCONV_FAILED, @@ -1393,11 +1384,10 @@ void wxMacMLTEControl::SetTXNData( const wxString& st, TXNOffset start, TXNOffse converter.WC2MB( (char*)unibuf, st.wc_str(), byteBufferLen + 2 ) ; TXNSetData( m_txn, kTXNUnicodeTextData, (void*)unibuf, byteBufferLen, start, end ) ; free( unibuf ) ; -#endif -#else +#else // !wxUSE_UNICODE wxCharBuffer text = st.mb_str( wxConvLocal ) ; TXNSetData( m_txn, kTXNTextData, (void*)text.data(), strlen( text ), start, end ) ; -#endif +#endif // wxUSE_UNICODE/!wxUSE_UNICODE } wxString wxMacMLTEControl::GetLineText(long lineNo) const