From d5c45cc949db1ed5ae59c424242d7f5231094b88 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 23 May 2003 18:30:26 +0000 Subject: [PATCH] speed up for string conversion git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/app.cpp | 34 ++++++++++++++++++++++++++++------ src/mac/carbon/app.cpp | 34 ++++++++++++++++++++++++++++------ 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/src/mac/app.cpp b/src/mac/app.cpp index beadc2d5c4..c4c8be74f4 100644 --- a/src/mac/app.cpp +++ b/src/mac/app.cpp @@ -274,10 +274,21 @@ void wxMacConvertFromPC( const char *from , char *to , int len ) { for( int i = 0 ; i < len ; ++ i ) { - c = strchr( StringANSI , *from ) ; - if ( c != NULL ) + if ( *from & 0x80 ) { - *to = StringMac[ c - StringANSI] ; + c = strchr( StringANSI , *from ) ; + if ( c != NULL ) + { + *to = StringMac[ c - StringANSI] ; + } + } + else if ( *from == 0x0a ) + { + *to = 0x0d ; + } + else + { + *to = *from ; } ++to ; ++from ; @@ -287,10 +298,21 @@ void wxMacConvertFromPC( const char *from , char *to , int len ) { for( int i = 0 ; i < len ; ++ i ) { - c = strchr( StringANSI , *from ) ; - if ( c != NULL ) + if ( *from & 0x80 ) { - *to = StringMac[ c - StringANSI] ; + c = strchr( StringANSI , *from ) ; + if ( c != NULL ) + { + *to = StringMac[ c - StringANSI] ; + } + else + { + *to = *from ; + } + } + else if ( *from == 0x0a ) + { + *to = 0x0d ; } else { diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index beadc2d5c4..c4c8be74f4 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -274,10 +274,21 @@ void wxMacConvertFromPC( const char *from , char *to , int len ) { for( int i = 0 ; i < len ; ++ i ) { - c = strchr( StringANSI , *from ) ; - if ( c != NULL ) + if ( *from & 0x80 ) { - *to = StringMac[ c - StringANSI] ; + c = strchr( StringANSI , *from ) ; + if ( c != NULL ) + { + *to = StringMac[ c - StringANSI] ; + } + } + else if ( *from == 0x0a ) + { + *to = 0x0d ; + } + else + { + *to = *from ; } ++to ; ++from ; @@ -287,10 +298,21 @@ void wxMacConvertFromPC( const char *from , char *to , int len ) { for( int i = 0 ; i < len ; ++ i ) { - c = strchr( StringANSI , *from ) ; - if ( c != NULL ) + if ( *from & 0x80 ) { - *to = StringMac[ c - StringANSI] ; + c = strchr( StringANSI , *from ) ; + if ( c != NULL ) + { + *to = StringMac[ c - StringANSI] ; + } + else + { + *to = *from ; + } + } + else if ( *from == 0x0a ) + { + *to = 0x0d ; } else {