X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5283098e1316b4a811fbccaabbda71f676e86c93..1da51aafba47af813ed5165855c819f490086f85:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 706a7d01cc..fe708cb0a4 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -75,7 +75,7 @@ #include #include "wx/os2/private.h" #endif -#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) && !defined(__WXWINE__) +#if defined(__WINDOWS__) && !defined(__WXMICROWIN__) #if !defined( __GNUWIN32__ ) && !defined( __MWERKS__ ) && !defined(__SALFORDC__) #include #include @@ -260,9 +260,9 @@ void wxPathList::EnsureFileAccessible (const wxString& path) bool wxPathList::Member (const wxString& path) { - for (wxNode * node = First (); node != NULL; node = node->Next ()) + for (wxStringList::Node *node = GetFirst(); node; node = node->GetNext()) { - wxString path2((wxChar *) node->Data ()); + wxString path2( node->GetData() ); if ( #if defined(__WINDOWS__) || defined(__VMS__) || defined (__WXMAC__) // Case INDEPENDENT @@ -288,9 +288,9 @@ wxString wxPathList::FindValidPath (const wxString& file) wxChar *filename = (wxChar*) NULL; /* shut up buggy egcs warning */ filename = wxIsAbsolutePath (buf) ? wxFileNameFromPath (buf) : (wxChar *)buf; - for (wxNode * node = First (); node; node = node->Next ()) + for (wxStringList::Node *node = GetFirst(); node; node = node->GetNext()) { - wxChar *path = (wxChar *) node->Data (); + wxChar *path = node->GetData(); wxStrcpy (wxFileFunctionsBuffer, path); wxChar ch = wxFileFunctionsBuffer[wxStrlen(wxFileFunctionsBuffer)-1]; if (ch != wxT('\\') && ch != wxT('/')) @@ -305,7 +305,7 @@ wxString wxPathList::FindValidPath (const wxString& file) } } // for() - return wxString(wxT("")); // Not found + return wxEmptyString; // Not found } wxString wxPathList::FindAbsoluteValidPath (const wxString& file) @@ -865,8 +865,8 @@ wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) int j; OSErr theErr; OSStatus theStatus; - Boolean isDirectory = false; - Str255 theParentPath = "\p"; + Boolean isDirectory = FALSE; + Str255 theParentPath = "\p"; FSSpec theParentSpec; FSRef theParentRef; char theFileName[FILENAME_MAX]; @@ -944,7 +944,7 @@ static char sMacFileNameConversion[ 1000 ] ; #endif void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) { - OSStatus err = noErr ; + OSStatus err = noErr ; #ifdef __DARWIN__ FSRef theRef; @@ -953,9 +953,9 @@ void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) // convert the FSRef to an FSSpec err = FSGetCatalogInfo(&theRef, kFSCatInfoNone, NULL, NULL, spec, NULL); #else - if ( strchr( path , ':' ) == NULL ) + if ( strchr( path , ':' ) == NULL ) { - // try whether it is a volume / or a mounted volume + // try whether it is a volume / or a mounted volume strncpy( sMacFileNameConversion , path , 1000 ) ; sMacFileNameConversion[998] = 0 ; strcat( sMacFileNameConversion , ":" ) ; @@ -963,7 +963,7 @@ void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) } else { - err = FSpLocationFromFullPath( strlen(path) , path , spec ) ; + err = FSpLocationFromFullPath( strlen(path) , path , spec ) ; } #endif } @@ -1175,7 +1175,7 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite) // create file2 with the same permissions than file1 and open it for // writing - + wxFile fileOut; if ( !fileOut.Create(file2, overwrite, fbuf.st_mode & 0777) ) return FALSE; @@ -1262,8 +1262,12 @@ bool wxMkdir(const wxString& dir, int perm) // assume mkdir() has 2 args on non Windows-OS/2 platforms and on Windows too // for the GNU compiler -#if (!(defined(__WXMSW__) || defined(__WXPM__) || defined(__DOS__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WXWINE__) || defined(__WINE__) || defined(__WXMICROWIN__) +#if (!(defined(__WXMSW__) || defined(__WXPM__) || defined(__DOS__))) || (defined(__GNUWIN32__) && !defined(__MINGW32__)) || defined(__WINE__) || defined(__WXMICROWIN__) + #ifndef MSVCRT if ( mkdir(wxFNCONV(dirname), perm) != 0 ) + #else + if ( mkdir(wxFNCONV(dirname)) != 0 ) + #endif #elif defined(__WXPM__) if (::DosCreateDir((PSZ)dirname, NULL) != 0) // enhance for EAB's?? #elif defined(__DOS__) @@ -1444,7 +1448,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) bool needsANSI = TRUE; #if !defined(HAVE_WGETCWD) || wxUSE_UNICODE_MSLU - // This is not legal code as the compiler + // This is not legal code as the compiler // is allowed destroy the wxCharBuffer. // wxCharBuffer c_buffer(sz); // char *cbuf = (char*)(const char*)c_buffer; @@ -1555,7 +1559,7 @@ wxString wxGetCwd() wxGetWorkingDirectory(buffer, _MAXPATHLEN); wxString str( buffer ); delete [] buffer; - + return str; } @@ -1616,7 +1620,7 @@ bool wxEndsWithPathSeparator(const wxChar *pszFileName) return len && wxIsPathSeparator(pszFileName[len - 1]); } -// find a file in a list of directories, returns false if not found +// find a file in a list of directories, returns FALSE if not found bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile) { // we assume that it's not empty @@ -1655,7 +1659,7 @@ bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFi delete [] szPath; - return pc != NULL; // if true => we breaked from the loop + return pc != NULL; // if TRUE => we breaked from the loop } void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName, @@ -1673,7 +1677,7 @@ time_t WXDLLEXPORT wxFileModificationTime(const wxString& filename) { wxStructStat buf; wxStat( filename, &buf); - + return buf.st_mtime; } @@ -1686,9 +1690,9 @@ bool wxIsWild( const wxString& pattern ) { wxString tmp = pattern; wxChar *pat = WXSTRINGCAST(tmp); - while (*pat) + while (*pat) { - switch (*pat++) + switch (*pat++) { case wxT('?'): case wxT('*'): case wxT('['): case wxT('{'): return TRUE; @@ -1713,7 +1717,7 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) /* Match if both are empty. */ return pat.empty(); } - + const wxChar *m = pat.c_str(), *n = text.c_str(), *ma = NULL, @@ -1727,7 +1731,7 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) if (dot_special && (*n == wxT('.'))) { - /* Never match so that hidden Unix files + /* Never match so that hidden Unix files * are never found. */ return FALSE; }