correcting non-unicode char conversion
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20399 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -598,8 +598,8 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
|
|
||||||
TECObjectRef s_TECNativeCToUnicode = NULL ;
|
TECObjectRef s_TECNativeCToUnicode = NULL ;
|
||||||
TECObjectRef s_TECUnicodeToNativeC = NULL ;
|
TECObjectRef s_TECUnicodeToNativeC = NULL ;
|
||||||
TECObjectRef s_TECPCToNativeC = NULL ;
|
TECObjectRef s_TECPlatformToNativeC = NULL ;
|
||||||
TECObjectRef s_TECNativeCToPC = NULL ;
|
TECObjectRef s_TECNativeCToPlatform = NULL ;
|
||||||
void wxMacSetupConverters()
|
void wxMacSetupConverters()
|
||||||
{
|
{
|
||||||
// if we assume errors are happening here we need low level debugging since the high level assert will use the encoders that
|
// if we assume errors are happening here we need low level debugging since the high level assert will use the encoders that
|
||||||
@@ -613,14 +613,14 @@ void wxMacSetupConverters()
|
|||||||
status = TECCreateConverter(&s_TECUnicodeToNativeC,
|
status = TECCreateConverter(&s_TECUnicodeToNativeC,
|
||||||
kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
||||||
|
|
||||||
if ( !wxApp::s_macDefaultEncodingIsPC )
|
if ( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
status = TECCreateConverter(&s_TECPCToNativeC,
|
status = TECCreateConverter(&s_TECPlatformToNativeC,
|
||||||
kTextEncodingWindowsLatin1, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
kTextEncodingMacRoman, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
||||||
|
|
||||||
|
|
||||||
status = TECCreateConverter(&s_TECNativeCToPC,
|
status = TECCreateConverter(&s_TECNativeCToPlatform,
|
||||||
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingWindowsLatin1 );
|
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingMacRoman );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,9 +631,9 @@ void wxMacCleanupConverters()
|
|||||||
|
|
||||||
status = TECDisposeConverter(s_TECUnicodeToNativeC);
|
status = TECDisposeConverter(s_TECUnicodeToNativeC);
|
||||||
|
|
||||||
status = TECDisposeConverter(s_TECPCToNativeC);
|
status = TECDisposeConverter(s_TECPlatformToNativeC);
|
||||||
|
|
||||||
status = TECDisposeConverter(s_TECNativeCToPC);
|
status = TECDisposeConverter(s_TECNativeCToPlatform);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWCharBuffer wxMacStringToWString( const wxString &from )
|
wxWCharBuffer wxMacStringToWString( const wxString &from )
|
||||||
@@ -666,7 +666,7 @@ wxString wxMacMakeStringFromCString( const char * from , int len )
|
|||||||
status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from , byteInLen, &byteInLen,
|
status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from , byteInLen, &byteInLen,
|
||||||
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
||||||
#else
|
#else
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
if ( !wxApp::s_macDefaultEncodingIsPC )
|
||||||
memcpy( buf , from , len ) ;
|
memcpy( buf , from , len ) ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -675,7 +675,7 @@ wxString wxMacMakeStringFromCString( const char * from , int len )
|
|||||||
ByteCount byteInLen = len ;
|
ByteCount byteInLen = len ;
|
||||||
ByteCount byteBufferLen = byteInLen ;
|
ByteCount byteBufferLen = byteInLen ;
|
||||||
|
|
||||||
status = TECConvertText(s_TECNativeCToPC, (ConstTextPtr)from , byteInLen, &byteInLen,
|
status = TECConvertText(s_TECPlatformToNativeC, (ConstTextPtr)from , byteInLen, &byteInLen,
|
||||||
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -701,7 +701,7 @@ wxCharBuffer wxMacStringToCString( const wxString &from )
|
|||||||
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
||||||
return result ;
|
return result ;
|
||||||
#else
|
#else
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
if ( !wxApp::s_macDefaultEncodingIsPC )
|
||||||
return wxCharBuffer( from.c_str() ) ;
|
return wxCharBuffer( from.c_str() ) ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -711,7 +711,7 @@ wxCharBuffer wxMacStringToCString( const wxString &from )
|
|||||||
ByteCount byteInLen = from.Length() ;
|
ByteCount byteInLen = from.Length() ;
|
||||||
ByteCount byteBufferLen = byteInLen ;
|
ByteCount byteBufferLen = byteInLen ;
|
||||||
|
|
||||||
status = TECConvertText(s_TECPCToNativeC, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
|
status = TECConvertText(s_TECNativeCToPlatform, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
|
||||||
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
@@ -598,8 +598,8 @@ void wxMacConvertToPC( const char *from , char *to , int len )
|
|||||||
|
|
||||||
TECObjectRef s_TECNativeCToUnicode = NULL ;
|
TECObjectRef s_TECNativeCToUnicode = NULL ;
|
||||||
TECObjectRef s_TECUnicodeToNativeC = NULL ;
|
TECObjectRef s_TECUnicodeToNativeC = NULL ;
|
||||||
TECObjectRef s_TECPCToNativeC = NULL ;
|
TECObjectRef s_TECPlatformToNativeC = NULL ;
|
||||||
TECObjectRef s_TECNativeCToPC = NULL ;
|
TECObjectRef s_TECNativeCToPlatform = NULL ;
|
||||||
void wxMacSetupConverters()
|
void wxMacSetupConverters()
|
||||||
{
|
{
|
||||||
// if we assume errors are happening here we need low level debugging since the high level assert will use the encoders that
|
// if we assume errors are happening here we need low level debugging since the high level assert will use the encoders that
|
||||||
@@ -613,14 +613,14 @@ void wxMacSetupConverters()
|
|||||||
status = TECCreateConverter(&s_TECUnicodeToNativeC,
|
status = TECCreateConverter(&s_TECUnicodeToNativeC,
|
||||||
kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
||||||
|
|
||||||
if ( !wxApp::s_macDefaultEncodingIsPC )
|
if ( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
status = TECCreateConverter(&s_TECPCToNativeC,
|
status = TECCreateConverter(&s_TECPlatformToNativeC,
|
||||||
kTextEncodingWindowsLatin1, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
kTextEncodingMacRoman, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
|
||||||
|
|
||||||
|
|
||||||
status = TECCreateConverter(&s_TECNativeCToPC,
|
status = TECCreateConverter(&s_TECNativeCToPlatform,
|
||||||
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingWindowsLatin1 );
|
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingMacRoman );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,9 +631,9 @@ void wxMacCleanupConverters()
|
|||||||
|
|
||||||
status = TECDisposeConverter(s_TECUnicodeToNativeC);
|
status = TECDisposeConverter(s_TECUnicodeToNativeC);
|
||||||
|
|
||||||
status = TECDisposeConverter(s_TECPCToNativeC);
|
status = TECDisposeConverter(s_TECPlatformToNativeC);
|
||||||
|
|
||||||
status = TECDisposeConverter(s_TECNativeCToPC);
|
status = TECDisposeConverter(s_TECNativeCToPlatform);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxWCharBuffer wxMacStringToWString( const wxString &from )
|
wxWCharBuffer wxMacStringToWString( const wxString &from )
|
||||||
@@ -666,7 +666,7 @@ wxString wxMacMakeStringFromCString( const char * from , int len )
|
|||||||
status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from , byteInLen, &byteInLen,
|
status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from , byteInLen, &byteInLen,
|
||||||
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
||||||
#else
|
#else
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
if ( !wxApp::s_macDefaultEncodingIsPC )
|
||||||
memcpy( buf , from , len ) ;
|
memcpy( buf , from , len ) ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -675,7 +675,7 @@ wxString wxMacMakeStringFromCString( const char * from , int len )
|
|||||||
ByteCount byteInLen = len ;
|
ByteCount byteInLen = len ;
|
||||||
ByteCount byteBufferLen = byteInLen ;
|
ByteCount byteBufferLen = byteInLen ;
|
||||||
|
|
||||||
status = TECConvertText(s_TECNativeCToPC, (ConstTextPtr)from , byteInLen, &byteInLen,
|
status = TECConvertText(s_TECPlatformToNativeC, (ConstTextPtr)from , byteInLen, &byteInLen,
|
||||||
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
(TextPtr)buf, byteBufferLen, &byteOutLen);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -701,7 +701,7 @@ wxCharBuffer wxMacStringToCString( const wxString &from )
|
|||||||
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
||||||
return result ;
|
return result ;
|
||||||
#else
|
#else
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
if ( !wxApp::s_macDefaultEncodingIsPC )
|
||||||
return wxCharBuffer( from.c_str() ) ;
|
return wxCharBuffer( from.c_str() ) ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -711,7 +711,7 @@ wxCharBuffer wxMacStringToCString( const wxString &from )
|
|||||||
ByteCount byteInLen = from.Length() ;
|
ByteCount byteInLen = from.Length() ;
|
||||||
ByteCount byteBufferLen = byteInLen ;
|
ByteCount byteBufferLen = byteInLen ;
|
||||||
|
|
||||||
status = TECConvertText(s_TECPCToNativeC, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
|
status = TECConvertText(s_TECNativeCToPlatform, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
|
||||||
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
(TextPtr)result.data(), byteBufferLen, &byteOutLen);
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user