Create the buffer holding the result of conversion instead of converting
twice, once to only get the length of the result and the second time to get
the data.
Closes #13877.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70392
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
const wxString& textdata,
const wxString& mimetype)
{
- AddFileWithMimeType
- (
- filename,
- static_cast<const char *>(textdata.To8BitData()),
- wxStrlen(static_cast<const char *>(textdata.To8BitData())),
- mimetype
- );
+ const wxCharBuffer buf(textdata.To8BitData());
+
+ AddFileWithMimeType(filename, buf.data(), buf.length(), mimetype);
}