]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/oleutils.cpp
removed hardcoded size of 66 bytes of PRINTDLG struct for mingw32, this breaks printi...
[wxWidgets.git] / src / msw / ole / oleutils.cpp
index c596c2bc1cf6ac4dbee8d48c21524a27d1d46253..59f387426c88a9f981723a2f2d61246220d0b669 100644 (file)
@@ -80,19 +80,21 @@ WXDLLEXPORT wxString wxConvertStringFromOle(BSTR bStr)
     if ( !bStr )
         return wxString();
 
     if ( !bStr )
         return wxString();
 
+    const int len = SysStringLen(bStr);
+
 #if wxUSE_UNICODE
 #if wxUSE_UNICODE
-    wxString str(bStr);
+    wxString str(bStr, len);
 #else
     wxString str;
 #else
     wxString str;
-    const int len = SysStringLen(bStr) + 1;
     if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
     if ( !::WideCharToMultiByte(CP_ACP, 0 /* no flags */,
-                                bStr, len,
-                                wxStringBuffer(str, len), len,
+                                bStr, len /* not necessary NUL-terminated */,
+                                wxStringBuffer(str, len + 1), len + 1,
                                 NULL, NULL /* no default char */) )
     {
         str.clear();
     }
 #endif
                                 NULL, NULL /* no default char */) )
     {
         str.clear();
     }
 #endif
+
     return str;
 }
 
     return str;
 }