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
This commit is contained in:
Stefan Csomor
2003-05-23 18:30:26 +00:00
parent 4e78ec2f5a
commit d5c45cc949
2 changed files with 56 additions and 12 deletions

View File

@@ -273,12 +273,23 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
if ( from == to ) if ( from == to )
{ {
for( int i = 0 ; i < len ; ++ i ) for( int i = 0 ; i < len ; ++ i )
{
if ( *from & 0x80 )
{ {
c = strchr( StringANSI , *from ) ; c = strchr( StringANSI , *from ) ;
if ( c != NULL ) if ( c != NULL )
{ {
*to = StringMac[ c - StringANSI] ; *to = StringMac[ c - StringANSI] ;
} }
}
else if ( *from == 0x0a )
{
*to = 0x0d ;
}
else
{
*to = *from ;
}
++to ; ++to ;
++from ; ++from ;
} }
@@ -286,6 +297,8 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
else else
{ {
for( int i = 0 ; i < len ; ++ i ) for( int i = 0 ; i < len ; ++ i )
{
if ( *from & 0x80 )
{ {
c = strchr( StringANSI , *from ) ; c = strchr( StringANSI , *from ) ;
if ( c != NULL ) if ( c != NULL )
@@ -296,6 +309,15 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
{ {
*to = *from ; *to = *from ;
} }
}
else if ( *from == 0x0a )
{
*to = 0x0d ;
}
else
{
*to = *from ;
}
++to ; ++to ;
++from ; ++from ;
} }

View File

@@ -273,12 +273,23 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
if ( from == to ) if ( from == to )
{ {
for( int i = 0 ; i < len ; ++ i ) for( int i = 0 ; i < len ; ++ i )
{
if ( *from & 0x80 )
{ {
c = strchr( StringANSI , *from ) ; c = strchr( StringANSI , *from ) ;
if ( c != NULL ) if ( c != NULL )
{ {
*to = StringMac[ c - StringANSI] ; *to = StringMac[ c - StringANSI] ;
} }
}
else if ( *from == 0x0a )
{
*to = 0x0d ;
}
else
{
*to = *from ;
}
++to ; ++to ;
++from ; ++from ;
} }
@@ -286,6 +297,8 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
else else
{ {
for( int i = 0 ; i < len ; ++ i ) for( int i = 0 ; i < len ; ++ i )
{
if ( *from & 0x80 )
{ {
c = strchr( StringANSI , *from ) ; c = strchr( StringANSI , *from ) ;
if ( c != NULL ) if ( c != NULL )
@@ -296,6 +309,15 @@ void wxMacConvertFromPC( const char *from , char *to , int len )
{ {
*to = *from ; *to = *from ;
} }
}
else if ( *from == 0x0a )
{
*to = 0x0d ;
}
else
{
*to = *from ;
}
++to ; ++to ;
++from ; ++from ;
} }