add default value for the encoding parameter of wxMacCFStringHolder() instead of passing wxLocale::GetSystemEncoding() which doesn't work when wxUSE_INTL == 0 to it in many places (replaces 2nd part of patch 1501724)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40283 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-07-24 18:01:39 +00:00
parent b9eb3d9de6
commit a8d69700fc
4 changed files with 57 additions and 57 deletions

View File

@@ -44,7 +44,8 @@ public:
{ {
} }
wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding ) wxMacCFStringHolder(const wxString &str,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT)
: m_cfs(NULL) , m_release(false) : m_cfs(NULL) , m_release(false)
{ {
Assign( str , encoding ) ; Assign( str , encoding ) ;
@@ -75,7 +76,8 @@ public:
m_cfs = NULL ; m_cfs = NULL ;
} }
void Assign( const wxString &str , wxFontEncoding encoding ) ; void Assign(const wxString &str,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
operator CFStringRef () const { return m_cfs; } operator CFStringRef () const { return m_cfs; }
wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ; wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;

View File

@@ -884,13 +884,13 @@ wxString wxMacFSRefToPath( const FSRef *fsRef , CFStringRef additionalPathCompon
CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString); CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, cfString);
CFRelease( cfString ); CFRelease( cfString );
CFStringNormalize(cfMutableString,kCFStringNormalizationFormC); CFStringNormalize(cfMutableString,kCFStringNormalizationFormC);
return wxMacCFStringHolder(cfMutableString).AsString(wxLocale::GetSystemEncoding()); return wxMacCFStringHolder(cfMutableString).AsString();
} }
OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef ) OSStatus wxMacPathToFSRef( const wxString&path , FSRef *fsRef )
{ {
OSStatus err = noErr ; OSStatus err = noErr ;
CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, wxMacCFStringHolder(path ,wxLocale::GetSystemEncoding() ) ) ; CFMutableStringRef cfMutableString = CFStringCreateMutableCopy(NULL, 0, wxMacCFStringHolder(path));
CFStringNormalize(cfMutableString,kCFStringNormalizationFormD); CFStringNormalize(cfMutableString,kCFStringNormalizationFormD);
CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kDefaultPathStyle, false); CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfMutableString , kDefaultPathStyle, false);
CFRelease( cfMutableString ); CFRelease( cfMutableString );

View File

@@ -105,9 +105,10 @@ wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding)
#if wxUSE_GUI #if wxUSE_GUI
encoding = wxFont::GetDefaultEncoding() ; encoding = wxFont::GetDefaultEncoding() ;
#else #else
encoding = wxLocale::GetSystemEncoding() ; encoding = wxFONTENCODING_SYSTEM; // to be set below
#endif #endif
} }
if ( encoding == wxFONTENCODING_SYSTEM ) if ( encoding == wxFONTENCODING_SYSTEM )
{ {
enc = CFStringGetSystemEncoding(); enc = CFStringGetSystemEncoding();

View File

@@ -51,7 +51,7 @@
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// //
// wxMacExecute // wxMacExecute
// //
// argv is the command line split up, with the application path first // argv is the command line split up, with the application path first
// flags are the flags from wxExecute // flags are the flags from wxExecute
@@ -63,8 +63,8 @@ long wxMacExecute(wxChar **argv,
wxProcess *process) wxProcess *process)
{ {
// Semi-macros used for return value of wxMacExecute // Semi-macros used for return value of wxMacExecute
const long errorCode = ((flags & wxEXEC_SYNC) ? -1 : 0); const long errorCode = ((flags & wxEXEC_SYNC) ? -1 : 0);
const long successCode = ((flags & wxEXEC_SYNC) ? 0 : -1); // fake PID const long successCode = ((flags & wxEXEC_SYNC) ? 0 : -1); // fake PID
// Obtains the number of arguments for determining the size of // Obtains the number of arguments for determining the size of
// the CFArray used to hold them // the CFArray used to hold them
@@ -90,8 +90,7 @@ long wxMacExecute(wxChar **argv,
CFURLRef cfurlApp = CFURLRef cfurlApp =
CFURLCreateWithFileSystemPath( CFURLCreateWithFileSystemPath(
kCFAllocatorDefault, kCFAllocatorDefault,
wxMacCFStringHolder(path, wxMacCFStringHolder(path),
wxLocale::GetSystemEncoding()),
kDefaultPathStyle, kDefaultPathStyle,
true); //false == not a directory true); //false == not a directory
@@ -151,16 +150,15 @@ long wxMacExecute(wxChar **argv,
continue; continue;
CFURLRef cfurlCurrentFile; // CFURL to hold file path CFURLRef cfurlCurrentFile; // CFURL to hold file path
wxFileName argfn(*argv); // Filename for path wxFileName argfn(*argv); // Filename for path
if(argfn.DirExists()) if(argfn.DirExists())
{ {
// First, try creating as a directory // First, try creating as a directory
cfurlCurrentFile = CFURLCreateWithFileSystemPath( cfurlCurrentFile = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault, kCFAllocatorDefault,
wxMacCFStringHolder(*argv, wxMacCFStringHolder(*argv),
wxLocale::GetSystemEncoding()),
kDefaultPathStyle, kDefaultPathStyle,
true); //true == directory true); //true == directory
} }
@@ -170,8 +168,7 @@ long wxMacExecute(wxChar **argv,
// as a regular file // as a regular file
cfurlCurrentFile = CFURLCreateWithFileSystemPath( cfurlCurrentFile = CFURLCreateWithFileSystemPath(
kCFAllocatorDefault, kCFAllocatorDefault,
wxMacCFStringHolder(*argv, wxMacCFStringHolder(*argv),
wxLocale::GetSystemEncoding()),
kDefaultPathStyle, kDefaultPathStyle,
false); //false == regular file false); //false == regular file
} }
@@ -181,9 +178,9 @@ long wxMacExecute(wxChar **argv,
// an entry in the local filesystem, // an entry in the local filesystem,
// so try creating it through CFURLCreateWithString // so try creating it through CFURLCreateWithString
cfurlCurrentFile = CFURLCreateWithString( cfurlCurrentFile = CFURLCreateWithString(
kCFAllocatorDefault, kCFAllocatorDefault,
wxMacCFStringHolder(*argv, wxLocale::GetSystemEncoding()), wxMacCFStringHolder(*argv),
NULL); NULL);
} }
// Continue in the loop if the CFURL could not be created // Continue in the loop if the CFURL could not be created