// scratch space for mkstemp()
path += _T("XXXXXX");
- // can use the cast here because the length doesn't change and the string
- // is not shared
- int fdTemp = mkstemp((char*)(const char *)path.mb_str());
+ // we need to copy the path to the buffer in which mkstemp() can modify it
+ wxCharBuffer buf(path.fn_str());
+
+ // cast is safe because the string length doesn't change
+ int fdTemp = mkstemp( (char *)buf.data() );
if ( fdTemp == -1 )
{
// this might be not necessary as mkstemp() on most systems should have
}
else // mkstemp() succeeded
{
+ path = wxConvFile.cMB2WX(buf);
+
// avoid leaking the fd
if ( fileTemp )
{
// same as above
path += _T("XXXXXX");
- if ( !mktemp((char *)path.mb_str()) )
+ wxCharBuffer buf(path.fn_str());
+ if ( !mktemp( buf ) )
{
path.clear();
}
+ else
+ {
+ path = wxConvFile.cMB2WX(buf);
+ }
#else // !HAVE_MKTEMP (includes __DOS__)
// generate the unique file name ourselves
#ifndef __DOS__
{
if ( !gMacDefaultExtensionsInited )
{
-
+
// load the default extensions
MacDefaultExtensionRecord defaults[1] =
{