From d9d488cf1b5bd28722ae3020606e9674108dd417 Mon Sep 17 00:00:00 2001
From: Stefan Csomor <csomor@advancedconcepts.ch>
Date: Wed, 8 Jun 2005 23:34:05 +0000
Subject: [PATCH] UniChar being platform endian

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/common/dobjcmn.cpp              | 6 +++---
 src/common/strconv.cpp              | 6 +++---
 src/mac/carbon/dc.cpp               | 2 +-
 src/mac/carbon/dccg.cpp             | 6 +++---
 src/mac/carbon/textctrl.cpp         | 4 ++--
 src/mac/carbon/toplevel.cpp         | 2 +-
 src/mac/corefoundation/cfstring.cpp | 4 ++--
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp
index ac306c2d90..a37ffa50e6 100644
--- a/src/common/dobjcmn.cpp
+++ b/src/common/dobjcmn.cpp
@@ -281,7 +281,7 @@ size_t wxTextDataObject::GetDataSize(const wxDataFormat& format) const
     if (format == wxDF_UNICODETEXT)
     {
         // host native is UTF16
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         return converter.WC2MB( NULL , GetText().c_str() , 0 ) + 2; // add space for trailing unichar 0
     }
     else  // == wxDF_TEXT
@@ -296,7 +296,7 @@ bool wxTextDataObject::GetDataHere(const wxDataFormat& format, void *buf) const
     if (format == wxDF_UNICODETEXT)
     {
         // host native is UTF16
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         size_t len = converter.WC2MB( NULL , GetText().c_str() , 0 ) ;
         wxCharBuffer buffer = converter.cWX2MB( GetText().c_str() );
         memcpy( (char*) buf, (const char*) buffer , len + 2); // trailing unichar 0
@@ -316,7 +316,7 @@ bool wxTextDataObject::SetData(const wxDataFormat& format,
     if (format == wxDF_UNICODETEXT)
     {
         // host native is UTF16
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         SetText( converter.cMB2WX( (const char*) buf ) );
     }
     else
diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp
index 45af589a8b..aea1e1a18a 100644
--- a/src/common/strconv.cpp
+++ b/src/common/strconv.cpp
@@ -2116,7 +2116,7 @@ public:
         UniChar* szUniBuffer = (UniChar*) szUnConv;
 
 #if SIZEOF_WCHAR_T == 4
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         nBufSize = converter.WC2MB( NULL , szUnConv , 0 );
         szUniBuffer = new UniChar[ (nBufSize / sizeof(UniChar)) + 1] ;
         converter.WC2MB( (char*) szUniBuffer , szUnConv, nBufSize + sizeof(UniChar)) ;
@@ -2252,7 +2252,7 @@ public:
         // we have to terminate here, because n might be larger for the trailing zero, and if UniChar
         // is not properly terminated we get random characters at the end
         ubuf[byteOutLen / sizeof( UniChar ) ] = 0 ;
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         res = converter.MB2WC( (buf ? buf : tbuf) , (const char*)ubuf , n ) ;
         free( ubuf ) ;
 #else
@@ -2285,7 +2285,7 @@ public:
         ByteCount byteBufferLen = n ;
         UniChar* ubuf = NULL ;
 #if SIZEOF_WCHAR_T == 4
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         size_t unicharlen = converter.WC2MB( NULL , psz , 0 ) ;
         byteInLen = unicharlen ;
         ubuf = (UniChar*) malloc( byteInLen + 2 ) ;
diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp
index e3439b8aec..31ace9896a 100644
--- a/src/mac/carbon/dc.cpp
+++ b/src/mac/carbon/dc.cpp
@@ -1315,7 +1315,7 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     UniCharCount chars = str.Length() ;
     UniChar* ubuf = NULL ;
 #if SIZEOF_WCHAR_T == 4
-    wxMBConvUTF16BE converter ;
+    wxMBConvUTF16 converter ;
 #if wxUSE_UNICODE
     size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
     ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
diff --git a/src/mac/carbon/dccg.cpp b/src/mac/carbon/dccg.cpp
index 7253d6d835..c5ed4a9bae 100755
--- a/src/mac/carbon/dccg.cpp
+++ b/src/mac/carbon/dccg.cpp
@@ -1294,7 +1294,7 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     UniCharCount chars = str.Length() ;
     UniChar* ubuf = NULL ;
 #if SIZEOF_WCHAR_T == 4
-	wxMBConvUTF16BE converter ;
+	wxMBConvUTF16 converter ;
 #if wxUSE_UNICODE
 	size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
 	ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
@@ -1454,7 +1454,7 @@ void  wxDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *heigh
     UniCharCount chars = str.Length() ;
     UniChar* ubuf = NULL ;
 #if SIZEOF_WCHAR_T == 4
-	wxMBConvUTF16BE converter ;
+	wxMBConvUTF16 converter ;
 #if wxUSE_UNICODE
 	size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
 	ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
@@ -1526,7 +1526,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
     UniCharCount chars = text.Length() ;
     UniChar* ubuf = NULL ;
 #if SIZEOF_WCHAR_T == 4
-    wxMBConvUTF16BE converter ;
+    wxMBConvUTF16 converter ;
 #if wxUSE_UNICODE
     size_t unicharlen = converter.WC2MB( NULL , text.wc_str() , 0 ) ;
     ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp
index e41e0e2c8e..6980cdc9f3 100644
--- a/src/mac/carbon/textctrl.cpp
+++ b/src/mac/carbon/textctrl.cpp
@@ -1424,7 +1424,7 @@ wxString wxMacMLTEControl::GetStringValue() const
                 SetHandleSize( theText , ( actualSize + 1 ) * sizeof( UniChar ) ) ;
                 HLock( theText ) ;
                 (((UniChar*)*theText)[actualSize]) = 0 ;
-                wxMBConvUTF16BE converter ;
+                wxMBConvUTF16 converter ;
                 size_t noChars = converter.MB2WC( NULL , (const char*)*theText , 0 ) ;
                 ptr = new wxChar[noChars + 1] ;
 
@@ -1896,7 +1896,7 @@ void wxMacMLTEControl::SetTXNData( const wxString& st , TXNOffset start , TXNOff
     TXNSetData( m_txn , kTXNUnicodeTextData,  (void*)st.wc_str(), len * 2,
       start, end);
 #else
-    wxMBConvUTF16BE converter ;
+    wxMBConvUTF16 converter ;
     ByteCount byteBufferLen = converter.WC2MB( NULL , st.wc_str() , 0 ) ;
     UniChar *unibuf = (UniChar*) malloc(byteBufferLen) ;
     converter.WC2MB( (char*) unibuf , st.wc_str() , byteBufferLen ) ;
diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp
index 5a047b14de..f1308198d4 100644
--- a/src/mac/carbon/toplevel.cpp
+++ b/src/mac/carbon/toplevel.cpp
@@ -188,7 +188,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
 #if SIZEOF_WCHAR_T == 2
         uniChar = charBuf[0] ;
 #else
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         converter.MB2WC( &uniChar , (const char*)charBuf , 1 ) ;
 #endif
         if ( dataSize > 4 )
diff --git a/src/mac/corefoundation/cfstring.cpp b/src/mac/corefoundation/cfstring.cpp
index ace47930f9..11b0f6d4ff 100644
--- a/src/mac/corefoundation/cfstring.cpp
+++ b/src/mac/corefoundation/cfstring.cpp
@@ -648,7 +648,7 @@ void wxMacCFStringHolder::Assign( const wxString &st , wxFontEncoding encoding )
         m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault,
             (UniChar*)str.wc_str() , str.Len() );
 #else
-        wxMBConvUTF16BE converter ;
+        wxMBConvUTF16 converter ;
         size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
         UniChar *unibuf = new UniChar[ unicharlen / sizeof(UniChar) + 1 ] ;
         converter.WC2MB( (char*)unibuf , str.wc_str() , unicharlen ) ;
@@ -679,7 +679,7 @@ wxString wxMacCFStringHolder::AsString(wxFontEncoding encoding)
     UniChar* unibuf = new UniChar[ cflen + 1 ] ;
     CFStringGetCharacters( m_cfs , CFRangeMake( 0 , cflen ) , (UniChar*) unibuf ) ;
     unibuf[cflen] = 0 ;
-    wxMBConvUTF16BE converter ;
+    wxMBConvUTF16 converter ;
     noChars = converter.MB2WC( NULL , (const char*)unibuf , 0 ) ;
     buf = new wxChar[ noChars + 1 ] ;
     converter.MB2WC( buf , (const char*)unibuf , noChars ) ;
-- 
2.47.2