cleaning up problems after string changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45449 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -47,56 +47,19 @@ void wxMacConvertNewlines10To13( char * data )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const wxString sCR((wxChar)13);
|
||||||
|
const wxString sLF((wxChar)10);
|
||||||
|
|
||||||
void wxMacConvertNewlines13To10( wxString * data )
|
void wxMacConvertNewlines13To10( wxString * data )
|
||||||
{
|
{
|
||||||
size_t len = data->Length() ;
|
data->Replace( sCR,sLF);
|
||||||
|
|
||||||
if ( len == 0 || wxStrchr(data->c_str(),0x0d)==NULL)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
wxString temp(*data) ;
|
|
||||||
wxStringBuffer buf(*data,len ) ;
|
|
||||||
memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ;
|
|
||||||
|
|
||||||
wxMacConvertNewlines13To10( buf ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacConvertNewlines10To13( wxString * data )
|
void wxMacConvertNewlines10To13( wxString * data )
|
||||||
{
|
{
|
||||||
size_t len = data->Length() ;
|
data->Replace( sLF,sCR);
|
||||||
|
|
||||||
if ( data->Length() == 0 || wxStrchr(data->c_str(),0x0a)==NULL)
|
|
||||||
return ;
|
|
||||||
|
|
||||||
wxString temp(*data) ;
|
|
||||||
wxStringBuffer buf(*data,len ) ;
|
|
||||||
memcpy( buf , temp.c_str() , (len+1)*sizeof(wxChar) ) ;
|
|
||||||
wxMacConvertNewlines10To13( buf ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
|
||||||
void wxMacConvertNewlines13To10( wxChar * data )
|
|
||||||
{
|
|
||||||
wxChar * buf = data ;
|
|
||||||
while( (buf=wxStrchr(buf,0x0d)) != NULL )
|
|
||||||
{
|
|
||||||
*buf = 0x0a ;
|
|
||||||
buf++ ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMacConvertNewlines10To13( wxChar * data )
|
|
||||||
{
|
|
||||||
wxChar * buf = data ;
|
|
||||||
while( (buf=wxStrchr(buf,0x0a)) != NULL )
|
|
||||||
{
|
|
||||||
*buf = 0x0d ;
|
|
||||||
buf++ ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding)
|
wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding)
|
||||||
{
|
{
|
||||||
TextEncodingBase enc = 0 ;
|
TextEncodingBase enc = 0 ;
|
||||||
@@ -703,9 +666,9 @@ wxString wxMacCFStringHolder::AsString(wxFontEncoding encoding)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf[noChars] = 0 ;
|
buf[noChars] = 0 ;
|
||||||
wxMacConvertNewlines10To13( buf ) ;
|
|
||||||
wxString result(buf) ;
|
wxString result(buf) ;
|
||||||
delete[] buf ;
|
delete[] buf ;
|
||||||
|
wxMacConvertNewlines10To13( &result);
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user