]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/oleutils.cpp
don't use wxVector<wxDataFormat> from wx/clipbrd.h as wxDataFormat definition is...
[wxWidgets.git] / src / msw / ole / oleutils.cpp
index e23617df25e3cbabc0fc69aeb74839e4ef6e2054..94f134a097af38981513e4182471ff32c946d50f 100644 (file)
@@ -86,12 +86,13 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr)
     wxString str(bStr, len);
 #else
     wxString str;
-    if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
-                                bStr, len + 1 /* include last NUL */,
-                                wxStringBuffer(str, len), len,
-                                NULL, NULL /* no default char */) )
+    if (len)
     {
-        str.clear();
+        wxStringBufferLength buf(str, len); // asserts if len == 0
+        buf.SetLength(WideCharToMultiByte(CP_ACP, 0 /* no flags */,
+                                  bStr, len /* not necessarily NUL-terminated */,
+                                  buf, len,
+                                  NULL, NULL /* no default char */));
     }
 #endif