X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6ce27aa2fdfc14e6cbe811661a95f98e9563b1e5..878711c01c1b9ad5b97d35f379a048b8ce1bfb49:/src/common/filename.cpp?ds=sidebyside diff --git a/src/common/filename.cpp b/src/common/filename.cpp index e99778308b..82efd1a6ae 100644 --- a/src/common/filename.cpp +++ b/src/common/filename.cpp @@ -6,7 +6,7 @@ // Created: 28.12.2000 // RCS-ID: $Id$ // Copyright: (c) 2000 Robert Roebling -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /* @@ -107,10 +107,17 @@ #endif #ifdef __MWERKS__ +#ifdef __MACH__ +#include +#include +#include +#include +#else #include #include #include #endif +#endif #ifdef __WATCOMC__ #include @@ -124,6 +131,10 @@ #endif #endif +#ifdef __EMX__ +#define MAX_PATH _MAX_PATH +#endif + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -146,7 +157,7 @@ public: m_hFile = ::CreateFile ( filename, // name - mode == Read ? GENERIC_READ // access mask + mode == Read ? GENERIC_READ // access mask : GENERIC_WRITE, 0, // no sharing NULL, // no secutity attr @@ -190,7 +201,7 @@ private: // private functions // ---------------------------------------------------------------------------- -#if defined(__WIN32__) && !defined(__WXMICROWIN__) +#if wxUSE_DATETIME && defined(__WIN32__) && !defined(__WXMICROWIN__) // convert between wxDateTime and FILETIME which is a 64-bit value representing // the number of 100-nanosecond intervals since January 1, 1601. @@ -237,7 +248,7 @@ static void ConvertWxToFileTime(FILETIME *ft, const wxDateTime& dt) } } -#endif // __WIN32__ +#endif // wxUSE_DATETIME && __WIN32__ // return a string with the volume par static wxString wxGetVolumeString(const wxString& volume, wxPathFormat format) @@ -415,7 +426,7 @@ void wxFileName::Assign(const wxString& fullpathOrig, _T("the path shouldn't contain file name nor extension") ); #else // !__WXDEBUG__ - SplitPath(fullname, NULL /* no path */, &name, &ext, format); + SplitPath(fullname, NULL /* no path */, &name, &ext, format); SplitPath(fullpath, &volume, &path, NULL, NULL, format); #endif // __WXDEBUG__/!__WXDEBUG__ @@ -434,6 +445,9 @@ void wxFileName::Clear() m_volume = m_name = m_ext = wxEmptyString; + + // we don't have any absolute path for now + m_relative = TRUE; } /* static */ @@ -454,7 +468,7 @@ wxFileName wxFileName::DirName(const wxString& dir) // existence tests // ---------------------------------------------------------------------------- -bool wxFileName::FileExists() +bool wxFileName::FileExists() const { return wxFileName::FileExists( GetFullPath() ); } @@ -464,7 +478,7 @@ bool wxFileName::FileExists( const wxString &file ) return ::wxFileExists( file ); } -bool wxFileName::DirExists() +bool wxFileName::DirExists() const { return wxFileName::DirExists( GetFullPath() ); } @@ -638,9 +652,11 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) // 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 *)path.mb_str()); + // we need to copy the path to the buffer in which mkstemp() can modify it + wxCharBuffer buf( wxConvFile.cWX2MB( path ) ); + + // cast is safe because the string length doesn't change + int fdTemp = mkstemp( (char*)(const char*) buf ); if ( fdTemp == -1 ) { // this might be not necessary as mkstemp() on most systems should have @@ -649,6 +665,8 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) } else // mkstemp() succeeded { + path = wxConvFile.cMB2WX( (const char*) buf ); + // avoid leaking the fd if ( fileTemp ) { @@ -665,10 +683,15 @@ wxFileName::CreateTempFileName(const wxString& prefix, wxFile *fileTemp) // same as above path += _T("XXXXXX"); - if ( !mktemp((char *)path.mb_str()) ) + wxCharBuffer buf = wxConvFile.cWX2MB( path ); + if ( !mktemp( (const char*) buf ) ) { path.clear(); } + else + { + path = wxConvFile.cMB2WX( (const char*) buf ); + } #else // !HAVE_MKTEMP (includes __DOS__) // generate the unique file name ourselves #ifndef __DOS__ @@ -751,16 +774,23 @@ bool wxFileName::Mkdir( const wxString& dir, int perm, int flags ) filename.AssignDir(dir); wxString currPath; - if ( filename.HasVolume()) - { + if ( filename.HasVolume()) + { currPath << wxGetVolumeString(filename.GetVolume(), wxPATH_NATIVE); - } + } wxArrayString dirs = filename.GetDirs(); size_t count = dirs.GetCount(); for ( size_t i = 0; i < count; i++ ) { - if ( i > 0 || filename.IsAbsolute() ) + if ( i > 0 || +#if defined(__WXMAC__) && !defined(__DARWIN__) + // relative pathnames are exactely the other way round under mac... + !filename.IsAbsolute() +#else + filename.IsAbsolute() +#endif + ) currPath += wxFILE_SEP_PATH; currPath += dirs[i]; @@ -912,6 +942,11 @@ bool wxFileName::Normalize(int flags, m_ext.MakeLower(); } + // we do have the path now + // + // NB: need to do this before (maybe) calling Assign() below + m_relative = FALSE; + #if defined(__WIN32__) if ( (flags & wxPATH_NORM_LONG) && (format == wxPATH_DOS) ) { @@ -919,9 +954,6 @@ bool wxFileName::Normalize(int flags, } #endif // Win32 - // we do have the path now - m_relative = FALSE; - return TRUE; } @@ -953,8 +985,8 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format) // get cwd only once - small time saving wxString cwd = wxGetCwd(); - Normalize(wxPATH_NORM_ALL, cwd, format); - fnBase.Normalize(wxPATH_NORM_ALL, cwd, format); + Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); + fnBase.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); bool withCase = IsCaseSensitive(format); @@ -991,7 +1023,7 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format) if ( m_dirs.IsEmpty() && IsDir() ) { m_dirs.Add(_T('.')); - } + } } m_relative = TRUE; @@ -1004,15 +1036,15 @@ bool wxFileName::MakeRelativeTo(const wxString& pathBase, wxPathFormat format) // filename kind tests // ---------------------------------------------------------------------------- -bool wxFileName::SameAs(const wxFileName &filepath, wxPathFormat format) +bool wxFileName::SameAs(const wxFileName& filepath, wxPathFormat format) const { wxFileName fn1 = *this, fn2 = filepath; // get cwd only once - small time saving wxString cwd = wxGetCwd(); - fn1.Normalize(wxPATH_NORM_ALL, cwd, format); - fn2.Normalize(wxPATH_NORM_ALL, cwd, format); + fn1.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); + fn2.Normalize(wxPATH_NORM_ALL & ~wxPATH_NORM_CASE, cwd, format); if ( fn1.GetFullPath() == fn2.GetFullPath() ) return TRUE; @@ -1144,113 +1176,40 @@ wxString wxFileName::GetPath( int flags, wxPathFormat format ) const } // the leading character - if ( format == wxPATH_MAC ) - { - if ( m_relative ) - fullpath += wxFILE_SEP_PATH_MAC; - } - else if ( format == wxPATH_DOS ) + switch ( format ) { - if (!m_relative) - fullpath += wxFILE_SEP_PATH_DOS; - } - else if ( format == wxPATH_UNIX ) - { - if (!m_relative) - fullpath += wxFILE_SEP_PATH_UNIX; - } + case wxPATH_MAC: + if ( m_relative ) + fullpath += wxFILE_SEP_PATH_MAC; + break; - // then concatenate all the path components using the path separator - size_t dirCount = m_dirs.GetCount(); - if ( dirCount ) - { - if ( format == wxPATH_VMS ) - { - fullpath += wxT('['); - } + case wxPATH_DOS: + if (!m_relative) + fullpath += wxFILE_SEP_PATH_DOS; + break; - for ( size_t i = 0; i < dirCount; i++ ) - { - // TODO: What to do with ".." under VMS + default: + wxFAIL_MSG( _T("unknown path format") ); + // fall through - switch (format) + case wxPATH_UNIX: + if ( !m_relative ) { - case wxPATH_MAC: - { - if (m_dirs[i] == wxT(".")) - break; - if (m_dirs[i] != wxT("..")) // convert back from ".." to nothing - fullpath += m_dirs[i]; - fullpath += wxT(':'); - break; - } - case wxPATH_DOS: - { - fullpath += m_dirs[i]; - fullpath += wxT('\\'); - break; - } - case wxPATH_UNIX: - { - fullpath += m_dirs[i]; - fullpath += wxT('/'); - break; - } - case wxPATH_VMS: + // normally the absolute file names starts with a slash with + // one exception: file names like "~/foo.bar" don't have it + if ( m_dirs.IsEmpty() || m_dirs[0u] != _T('~') ) { - if (m_dirs[i] != wxT("..")) // convert back from ".." to nothing - fullpath += m_dirs[i]; - if (i == dirCount-1) - fullpath += wxT(']'); - else - fullpath += wxT('.'); - break; - } - default: - { - wxFAIL_MSG( wxT("error") ); + fullpath += wxFILE_SEP_PATH_UNIX; } } - } - } - - if ( (flags & wxPATH_GET_SEPARATOR) && !fullpath.empty() ) - { - fullpath += GetPathSeparator(format); - } - - return fullpath; -} - -wxString wxFileName::GetFullPath( wxPathFormat format ) const -{ - format = GetFormat(format); - - // first put the volume - wxString fullpath = wxGetVolumeString(m_volume, format); + break; - // the leading character - if ( format == wxPATH_MAC ) - { - if ( m_relative ) - fullpath += wxFILE_SEP_PATH_MAC; - } - else if ( format == wxPATH_DOS ) - { - if ( !m_relative ) - fullpath += wxFILE_SEP_PATH_DOS; - } - else if ( format == wxPATH_UNIX ) - { - if ( !m_relative ) - { - // normally the absolute file names starts with a slash with one - // exception: file names like "~/foo.bar" don't have it - if ( m_dirs.IsEmpty() || m_dirs[0u] != _T('~') ) - { - fullpath += wxFILE_SEP_PATH_UNIX; - } - } + case wxPATH_VMS: + // no leading character here but use this place to unset + // wxPATH_GET_SEPARATOR flag: under VMS it doesn't make sense as, + // if I understand correctly, there should never be a dot before + // the closing bracket + flags &= ~wxPATH_GET_SEPARATOR; } // then concatenate all the path components using the path separator @@ -1262,53 +1221,61 @@ wxString wxFileName::GetFullPath( wxPathFormat format ) const fullpath += wxT('['); } - for ( size_t i = 0; i < dirCount; i++ ) { - // TODO: What to do with ".." under VMS - switch (format) { case wxPATH_MAC: - { - if (m_dirs[i] == wxT(".")) - break; - if (m_dirs[i] != wxT("..")) // convert back from ".." to nothing + if ( m_dirs[i] == wxT(".") ) + { + // skip appending ':', this shouldn't be done in this + // case as "::" is interpreted as ".." under Unix + continue; + } + + // convert back from ".." to nothing + if ( m_dirs[i] != wxT("..") ) fullpath += m_dirs[i]; - fullpath += wxT(':'); break; - } + + default: + wxFAIL_MSG( wxT("unexpected path format") ); + // still fall through + case wxPATH_DOS: - { - fullpath += m_dirs[i]; - fullpath += wxT('\\'); - break; - } case wxPATH_UNIX: - { fullpath += m_dirs[i]; - fullpath += wxT('/'); break; - } + case wxPATH_VMS: - { - if (m_dirs[i] != wxT("..")) // convert back from ".." to nothing + // TODO: What to do with ".." under VMS + + // convert back from ".." to nothing + if ( m_dirs[i] != wxT("..") ) fullpath += m_dirs[i]; - if (i == dirCount-1) - fullpath += wxT(']'); - else - fullpath += wxT('.'); break; - } - default: - { - wxFAIL_MSG( wxT("error") ); - } } + + if ( (flags & wxPATH_GET_SEPARATOR) || (i != dirCount - 1) ) + fullpath += GetPathSeparator(format); + } + + if ( format == wxPATH_VMS ) + { + fullpath += wxT(']'); } } - // finally add the file name and extension + return fullpath; +} + +wxString wxFileName::GetFullPath( wxPathFormat format ) const +{ + // we already have a function to get the path + wxString fullpath = GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR, + format); + + // now just add the file name and extension to it fullpath += GetFullName(); return fullpath; @@ -1351,12 +1318,15 @@ wxString wxFileName::GetLongPath() const bool success = FALSE; #if wxUSE_DYNAMIC_LOADER - typedef DWORD (*GET_LONG_PATH_NAME)(const wxChar *, wxChar *, DWORD); + typedef DWORD (WINAPI *GET_LONG_PATH_NAME)(const wxChar *, wxChar *, DWORD); static bool s_triedToLoad = FALSE; if ( !s_triedToLoad ) { + // suppress the errors about missing GetLongPathName[AW] + wxLogNull noLog; + s_triedToLoad = TRUE; wxDynamicLibrary dllKernel(_T("kernel32")); if ( dllKernel.IsLoaded() ) @@ -1394,6 +1364,7 @@ wxString wxFileName::GetLongPath() const } } } + if (success) return pathOut; #endif // wxUSE_DYNAMIC_LOADER @@ -1405,7 +1376,13 @@ wxString wxFileName::GetLongPath() const WIN32_FIND_DATA findFileData; HANDLE hFind; - pathOut = wxEmptyString; + + if ( HasVolume() ) + pathOut = GetVolume() + + GetVolumeSeparator(wxPATH_DOS) + + GetPathSeparator(wxPATH_DOS); + else + pathOut = wxEmptyString; wxArrayString dirs = GetDirs(); dirs.Add(GetFullName()); @@ -1423,7 +1400,8 @@ wxString wxFileName::GetLongPath() const if ( tmpPath.empty() ) continue; - if ( tmpPath.Last() == wxT(':') ) + // can't see this being necessary? MF + if ( tmpPath.Last() == GetVolumeSeparator(wxPATH_DOS) ) { // Can't pass a drive and root dir to FindFirstFile, // so continue to next dir @@ -1435,8 +1413,12 @@ wxString wxFileName::GetLongPath() const hFind = ::FindFirstFile(tmpPath, &findFileData); if (hFind == INVALID_HANDLE_VALUE) { - // Error: return immediately with the original path - return path; + // Error: most likely reason is that path doesn't exist, so + // append any unprocessed parts and return + for ( i += 1; i < count; i++ ) + tmpPath += wxFILE_SEP_PATH + dirs[i]; + + return tmpPath; } pathOut += findFileData.cFileName; @@ -1644,11 +1626,42 @@ void wxFileName::SplitPath(const wxString& fullpath, // time functions // ---------------------------------------------------------------------------- +#if wxUSE_DATETIME + bool wxFileName::SetTimes(const wxDateTime *dtAccess, const wxDateTime *dtMod, const wxDateTime *dtCreate) { -#if defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__)) +#if defined(__WIN32__) + if ( IsDir() ) + { + // VZ: please let me know how to do this if you can + wxFAIL_MSG( _T("SetTimes() not implemented for the directories") ); + } + else // file + { + wxFileHandle fh(GetFullPath(), wxFileHandle::Write); + if ( fh.IsOk() ) + { + FILETIME ftAccess, ftCreate, ftWrite; + + if ( dtCreate ) + ConvertWxToFileTime(&ftCreate, *dtCreate); + if ( dtAccess ) + ConvertWxToFileTime(&ftAccess, *dtAccess); + if ( dtMod ) + ConvertWxToFileTime(&ftWrite, *dtMod); + + if ( ::SetFileTime(fh, + dtCreate ? &ftCreate : NULL, + dtAccess ? &ftAccess : NULL, + dtMod ? &ftWrite : NULL) ) + { + return TRUE; + } + } + } +#elif defined(__UNIX_LIKE__) || (defined(__DOS__) && defined(__WATCOMC__)) if ( !dtAccess && !dtMod ) { // can't modify the creation time anyhow, don't try @@ -1660,31 +1673,10 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess, utimbuf utm; utm.actime = dtAccess ? dtAccess->GetTicks() : dtMod->GetTicks(); utm.modtime = dtMod ? dtMod->GetTicks() : dtAccess->GetTicks(); - if ( utime(GetFullPath(), &utm) == 0 ) + if ( utime(GetFullPath().fn_str(), &utm) == 0 ) { return TRUE; } -#elif defined(__WIN32__) - wxFileHandle fh(GetFullPath(), wxFileHandle::Write); - if ( fh.IsOk() ) - { - FILETIME ftAccess, ftCreate, ftWrite; - - if ( dtCreate ) - ConvertWxToFileTime(&ftCreate, *dtCreate); - if ( dtAccess ) - ConvertWxToFileTime(&ftAccess, *dtAccess); - if ( dtMod ) - ConvertWxToFileTime(&ftWrite, *dtMod); - - if ( ::SetFileTime(fh, - dtCreate ? &ftCreate : NULL, - dtAccess ? &ftAccess : NULL, - dtMod ? &ftWrite : NULL) ) - { - return TRUE; - } - } #else // other platform #endif // platforms @@ -1698,7 +1690,7 @@ bool wxFileName::Touch() { #if defined(__UNIX_LIKE__) // under Unix touching file is simple: just pass NULL to utime() - if ( utime(GetFullPath(), NULL) == 0 ) + if ( utime(GetFullPath().fn_str(), NULL) == 0 ) { return TRUE; } @@ -1717,9 +1709,54 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess, wxDateTime *dtMod, wxDateTime *dtCreate) const { -#if defined(__UNIX_LIKE__) || defined(__WXMAC__) || (defined(__DOS__) && defined(__WATCOMC__)) +#if defined(__WIN32__) + // we must use different methods for the files and directories under + // Windows as CreateFile(GENERIC_READ) doesn't work for the directories and + // CreateFile(FILE_FLAG_BACKUP_SEMANTICS) works -- but only under NT and + // not 9x + bool ok; + FILETIME ftAccess, ftCreate, ftWrite; + if ( IsDir() ) + { + // implemented in msw/dir.cpp + extern bool wxGetDirectoryTimes(const wxString& dirname, + FILETIME *, FILETIME *, FILETIME *); + + // we should pass the path without the trailing separator to + // wxGetDirectoryTimes() + ok = wxGetDirectoryTimes(GetPath(wxPATH_GET_VOLUME), + &ftAccess, &ftCreate, &ftWrite); + } + else // file + { + wxFileHandle fh(GetFullPath(), wxFileHandle::Read); + if ( fh.IsOk() ) + { + ok = ::GetFileTime(fh, + dtCreate ? &ftCreate : NULL, + dtAccess ? &ftAccess : NULL, + dtMod ? &ftWrite : NULL) != 0; + } + else + { + ok = FALSE; + } + } + + if ( ok ) + { + if ( dtCreate ) + ConvertFileTimeToWx(dtCreate, ftCreate); + if ( dtAccess ) + ConvertFileTimeToWx(dtAccess, ftAccess); + if ( dtMod ) + ConvertFileTimeToWx(dtMod, ftWrite); + + return TRUE; + } +#elif defined(__UNIX_LIKE__) || defined(__WXMAC__) || (defined(__DOS__) && defined(__WATCOMC__)) wxStructStat stBuf; - if ( wxStat(GetFullPath(), &stBuf) == 0 ) + if ( wxStat( GetFullPath().c_str(), &stBuf) == 0 ) { if ( dtAccess ) dtAccess->Set(stBuf.st_atime); @@ -1730,27 +1767,6 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess, return TRUE; } -#elif defined(__WIN32__) - wxFileHandle fh(GetFullPath(), wxFileHandle::Read); - if ( fh.IsOk() ) - { - FILETIME ftAccess, ftCreate, ftWrite; - - if ( ::GetFileTime(fh, - dtMod ? &ftCreate : NULL, - dtAccess ? &ftAccess : NULL, - dtCreate ? &ftWrite : NULL) ) - { - if ( dtMod ) - ConvertFileTimeToWx(dtMod, ftCreate); - if ( dtAccess ) - ConvertFileTimeToWx(dtAccess, ftAccess); - if ( dtCreate ) - ConvertFileTimeToWx(dtCreate, ftWrite); - - return TRUE; - } - } #else // other platform #endif // platforms @@ -1760,44 +1776,69 @@ bool wxFileName::GetTimes(wxDateTime *dtAccess, return FALSE; } +#endif // wxUSE_DATETIME + #ifdef __WXMAC__ const short kMacExtensionMaxLength = 16 ; -typedef struct +class MacDefaultExtensionRecord { - char m_ext[kMacExtensionMaxLength] ; +public : + MacDefaultExtensionRecord() + { + m_ext[0] = 0 ; + m_type = m_creator = NULL ; + } + MacDefaultExtensionRecord( const MacDefaultExtensionRecord& from ) + { + wxStrcpy( m_ext , from.m_ext ) ; + m_type = from.m_type ; + m_creator = from.m_creator ; + } + MacDefaultExtensionRecord( const wxChar * extension , OSType type , OSType creator ) + { + wxStrncpy( m_ext , extension , kMacExtensionMaxLength ) ; + m_ext[kMacExtensionMaxLength] = 0 ; + m_type = type ; + m_creator = creator ; + } + wxChar m_ext[kMacExtensionMaxLength] ; OSType m_type ; OSType m_creator ; -} MacDefaultExtensionRecord ; +} ; #include "wx/dynarray.h" WX_DECLARE_OBJARRAY(MacDefaultExtensionRecord, MacDefaultExtensionArray) ; + +bool gMacDefaultExtensionsInited = false ; + #include "wx/arrimpl.cpp" -WX_DEFINE_OBJARRAY(MacDefaultExtensionArray) ; + +WX_DEFINE_EXPORTED_OBJARRAY(MacDefaultExtensionArray) ; MacDefaultExtensionArray gMacDefaultExtensions ; -bool gMacDefaultExtensionsInited = false ; static void MacEnsureDefaultExtensionsLoaded() { if ( !gMacDefaultExtensionsInited ) { + // load the default extensions - MacDefaultExtensionRecord defaults[] = + MacDefaultExtensionRecord defaults[1] = { - { "txt" , 'TEXT' , 'ttxt' } , - + MacDefaultExtensionRecord( wxT("txt") , 'TEXT' , 'ttxt' ) , + } ; // we could load the pc exchange prefs here too - - for ( int i = 0 ; i < WXSIZEOF( defaults ) ; ++i ) + + for ( size_t i = 0 ; i < WXSIZEOF( defaults ) ; ++i ) { gMacDefaultExtensions.Add( defaults[i] ) ; - } + } gMacDefaultExtensionsInited = true ; } } -bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) +bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) { FInfo fndrInfo ; FSSpec spec ; @@ -1811,7 +1852,7 @@ bool wxFileName::MacSetTypeAndCreator( wxUint32 type , wxUint32 creator ) return true ; } -bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) +bool wxFileName::MacGetTypeAndCreator( wxUint32 *type , wxUint32 *creator ) { FInfo fndrInfo ; FSSpec spec ; @@ -1835,7 +1876,7 @@ bool wxFileName::MacSetDefaultTypeAndCreator() return false; } -bool wxFileName::MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) +bool wxFileName::MacFindDefaultTypeAndCreator( const wxString& ext , wxUint32 *type , wxUint32 *creator ) { MacEnsureDefaultExtensionsLoaded() ; wxString extl = ext.Lower() ; @@ -1857,7 +1898,7 @@ void wxFileName::MacRegisterDefaultTypeAndCreator( const wxString& ext , wxUint3 MacDefaultExtensionRecord rec ; rec.m_type = type ; rec.m_creator = creator ; - strncpy( rec.m_ext , ext.Lower().c_str() , kMacExtensionMaxLength ) ; + wxStrncpy( rec.m_ext , ext.Lower().c_str() , kMacExtensionMaxLength ) ; gMacDefaultExtensions.Add( rec ) ; } #endif