git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24718
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// tried using wxMacCFStringHolder in the code below, but it seems
// the CFStrings were being released before the save dialog was called,
// causing a crash - open dialog works fine with or without wxMacCFStringHolder
// tried using wxMacCFStringHolder in the code below, but it seems
// the CFStrings were being released before the save dialog was called,
// causing a crash - open dialog works fine with or without wxMacCFStringHolder
- CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
- m_message.wc_str(),
- kCFStringEncodingUnicode);
+ CFStringRef titleRef = ::CFStringCreateWithCharacters( kCFAllocatorDefault,
+ (const unsigned short*)m_message.wc_str(),
+ m_message.Len() );
#else
CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
m_message.c_str(),
#else
CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
m_message.c_str(),
#endif
dialogCreateOptions.windowTitle = titleRef;
#if wxUSE_UNICODE
#endif
dialogCreateOptions.windowTitle = titleRef;
#if wxUSE_UNICODE
- CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
- m_fileName.wc_str(),
- kCFStringEncodingUnicode);
+ CFStringRef defaultFileNameRef = ::CFStringCreateWithCharacters( kCFAllocatorDefault,
+ (const unsigned short*)m_fileName.wc_str(),
+ m_fileName.Len() );
#else
CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
m_fileName.c_str(),
#else
CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
m_fileName.c_str(),
DescType actualType;
Size actualSize;
FSRef theFSRef;
DescType actualType;
Size actualSize;
FSRef theFSRef;
- char thePath[FILENAME_MAX];
-
long count;
::AECountItems(&navReply.selection , &count);
for (long i = 1; i <= count; ++i)
long count;
::AECountItems(&navReply.selection , &count);
for (long i = 1; i <= count; ++i)
if (m_dialogStyle & wxSAVE)
{
if (m_dialogStyle & wxSAVE)
{
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
if (parentURLRef)
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
if (parentURLRef)
+ Size len = CFStringGetLength( cfStringUnescaped ) ;
+ wxChar* buf = thePath.GetWriteBuf( len ) ;
+ //buf[0] = '\0';
- ::CFStringGetCString(cfStringUnescaped,
- thePath,
- FILENAME_MAX,
- kCFStringEncodingUnicode);
+ CFStringGetCharacters(cfStringUnescaped , CFRangeMake( 0 , len ) , (UniChar*) buf ) ;
- ::CFStringGetCString(cfStringUnescaped,
- thePath,
- FILENAME_MAX,
- CFStringGetSystemEncoding());
+ CFStringGetCString( cfStringUnescaped , buf , len+1 , CFStringGetSystemEncoding() ) ;
+ buf[len] = 0 ;
+ wxMacConvertNewlines10To13( buf ) ;
+ thePath.UngetWriteBuf() ;
::CFRelease(cfStringUnescaped);
}
}
}
}
::CFRelease(cfStringUnescaped);
}
}
}
}
{
::NavDisposeReply(&navReply);
return wxID_CANCEL;
{
::NavDisposeReply(&navReply);
return wxID_CANCEL;
- err = ::FSRefMakePath(&theFSRef,
- (UInt8 *)thePath, sizeof(thePath));
+ const short maxpath = 1024 ;
+ ::FSRefMakePath( &theFSRef , (UInt8*) thePath.GetWriteBuf(maxpath+1),maxpath) ;
+ thePath.UngetWriteBuf() ;
if (err != noErr)
break;
}
if (err != noErr)
break;
}
// tried using wxMacCFStringHolder in the code below, but it seems
// the CFStrings were being released before the save dialog was called,
// causing a crash - open dialog works fine with or without wxMacCFStringHolder
// tried using wxMacCFStringHolder in the code below, but it seems
// the CFStrings were being released before the save dialog was called,
// causing a crash - open dialog works fine with or without wxMacCFStringHolder
- CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
- m_message.wc_str(),
- kCFStringEncodingUnicode);
+ CFStringRef titleRef = ::CFStringCreateWithCharacters( kCFAllocatorDefault,
+ (const unsigned short*)m_message.wc_str(),
+ m_message.Len() );
#else
CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
m_message.c_str(),
#else
CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
m_message.c_str(),
#endif
dialogCreateOptions.windowTitle = titleRef;
#if wxUSE_UNICODE
#endif
dialogCreateOptions.windowTitle = titleRef;
#if wxUSE_UNICODE
- CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
- m_fileName.wc_str(),
- kCFStringEncodingUnicode);
+ CFStringRef defaultFileNameRef = ::CFStringCreateWithCharacters( kCFAllocatorDefault,
+ (const unsigned short*)m_fileName.wc_str(),
+ m_fileName.Len() );
#else
CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
m_fileName.c_str(),
#else
CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
m_fileName.c_str(),
DescType actualType;
Size actualSize;
FSRef theFSRef;
DescType actualType;
Size actualSize;
FSRef theFSRef;
- char thePath[FILENAME_MAX];
-
long count;
::AECountItems(&navReply.selection , &count);
for (long i = 1; i <= count; ++i)
long count;
::AECountItems(&navReply.selection , &count);
for (long i = 1; i <= count; ++i)
if (m_dialogStyle & wxSAVE)
{
if (m_dialogStyle & wxSAVE)
{
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
if (parentURLRef)
CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef);
if (parentURLRef)
+ Size len = CFStringGetLength( cfStringUnescaped ) ;
+ wxChar* buf = thePath.GetWriteBuf( len ) ;
+ //buf[0] = '\0';
- ::CFStringGetCString(cfStringUnescaped,
- thePath,
- FILENAME_MAX,
- kCFStringEncodingUnicode);
+ CFStringGetCharacters(cfStringUnescaped , CFRangeMake( 0 , len ) , (UniChar*) buf ) ;
- ::CFStringGetCString(cfStringUnescaped,
- thePath,
- FILENAME_MAX,
- CFStringGetSystemEncoding());
+ CFStringGetCString( cfStringUnescaped , buf , len+1 , CFStringGetSystemEncoding() ) ;
+ buf[len] = 0 ;
+ wxMacConvertNewlines10To13( buf ) ;
+ thePath.UngetWriteBuf() ;
::CFRelease(cfStringUnescaped);
}
}
}
}
::CFRelease(cfStringUnescaped);
}
}
}
}
{
::NavDisposeReply(&navReply);
return wxID_CANCEL;
{
::NavDisposeReply(&navReply);
return wxID_CANCEL;
- err = ::FSRefMakePath(&theFSRef,
- (UInt8 *)thePath, sizeof(thePath));
+ const short maxpath = 1024 ;
+ ::FSRefMakePath( &theFSRef , (UInt8*) thePath.GetWriteBuf(maxpath+1),maxpath) ;
+ thePath.UngetWriteBuf() ;
if (err != noErr)
break;
}
if (err != noErr)
break;
}