]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/core/strconv_cf.cpp
fix memory leak in SetColFormat() if the column already had an attribute (closes...
[wxWidgets.git] / src / osx / core / strconv_cf.cpp
index 0c2abfbcc825116420396b2c296f8ca0f78500d5..78f6429c2c7114350114f79d064f5b549b266d79 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/corefoundation/strconv.cpp
+// Name:        src/osx/corefoundation/strconv.cpp
 // Purpose:     Unicode conversion classes
 // Author:      David Elliott
 // Modified by:
@@ -85,7 +85,8 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding)
                                                 false //no BOM/external representation
                                                 ));
 
-        wxCHECK(theString != NULL, wxCONV_FAILED);
+        if ( theString == NULL )
+            return wxCONV_FAILED;
 
         /* NOTE: The string content includes the NULL element if the source string did
          * That means we have to do nothing special because the destination will have
@@ -114,8 +115,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding)
                     dstSize * sizeof(wchar_t),
                     &usedBufLen);
 
-            // charsConverted is > 0 iff conversion succeeded
-            if(charsConverted <= 0)
+            if(charsConverted < CFStringGetLength(theString))
                 return wxCONV_FAILED;
 
             /* usedBufLen is the number of bytes written, so we divide by
@@ -216,8 +216,7 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_cf(wxFontEncoding encoding)
                 &usedBufLen
             );
 
-        // charsConverted is > 0 iff conversion succeeded
-        if(charsConverted <= 0)
+        if(charsConverted < CFStringGetLength(theString) )
             return wxCONV_FAILED;
 
         return usedBufLen;