X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8aa701edbb1e27eacb22f169cfa3585c6e093063..3ef37e7f4ec5f0688a4fb47e530ca2d30a6bb3ed:/src/mac/utils.cpp?ds=sidebyside diff --git a/src/mac/utils.cpp b/src/mac/utils.cpp index cd800e3ea4..0a0735d4a7 100644 --- a/src/mac/utils.cpp +++ b/src/mac/utils.cpp @@ -803,19 +803,29 @@ void wxMacConvertNewlines10To13( char * data ) void wxMacConvertNewlines13To10( wxString * data ) { - if ( data->Length() == 0 ) + size_t len = data->Length() ; + + if ( len == 0 || wxStrchr(data->c_str(),0x0d)==NULL) return ; - wxMacConvertNewlines13To10( data->GetWriteBuf( data->Length() ) ) ; - data->UngetWriteBuf() ; + wxString temp(*data) ; + wxStringBuffer buf(*data,len ) ; + memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ; + + wxMacConvertNewlines13To10( buf ) ; } void wxMacConvertNewlines10To13( wxString * data ) { - if ( data->Length() == 0 ) + size_t len = data->Length() ; + + if ( data->Length() == 0 || wxStrchr(data->c_str(),0x0a)==NULL) return ; - wxMacConvertNewlines10To13( data->GetWriteBuf( data->Length() ) ) ; - data->UngetWriteBuf() ; + + wxString temp(*data) ; + wxStringBuffer buf(*data,len ) ; + memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ; + wxMacConvertNewlines10To13( buf ) ; }