]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/corefoundation/cfstring.cpp
Fixes and XCode 2.3 update
[wxWidgets.git] / src / mac / corefoundation / cfstring.cpp
index ace47930f9556462770038d9fb6b7fefbc4d818b..078df1e308da30b4ccc9c1ffe0eaaa4dc91377b0 100644 (file)
@@ -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,10 +679,12 @@ 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 ) ;
+    wxASSERT_MSG( noChars != wxCONV_FAILED, _T("Unable to count the number of characters in this string!") );
     buf = new wxChar[ noChars + 1 ] ;
-    converter.MB2WC( buf , (const char*)unibuf , noChars ) ;
+    noChars = converter.MB2WC( buf , (const char*)unibuf , noChars + 1 ) ;
+    wxASSERT_MSG( noChars != wxCONV_FAILED, _T("Conversion of string failed!") );
     delete[] unibuf ;
 #endif
 #else