X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/60431236a330a9f3f1d071719e818812820b4d0c..0d1c8f39baaaeb7a7f757091209eab471ef5dbc4:/src/common/filesys.cpp?ds=inline diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index ed72a22b7a..65cc39f1c0 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: filesys.cpp +// Name: src/common/filesys.cpp // Purpose: wxFileSystem class - interface for opening files // Author: Vaclav Slavik // Copyright: (c) 1999 Vaclav Slavik @@ -7,25 +7,25 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "filesys.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif #if wxUSE_FILESYSTEM +#include "wx/filesys.h" + +#ifndef WX_PRECOMP + #include "wx/log.h" +#endif + #include "wx/wfstream.h" #include "wx/module.h" -#include "wx/filesys.h" #include "wx/mimetype.h" #include "wx/filename.h" -#include "wx/log.h" //-------------------------------------------------------------------------------- @@ -40,7 +40,7 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) wxString ext, mime; wxString loc = GetRightLocation(location); wxChar c; - int l = loc.Length(), l2; + int l = loc.length(), l2; l2 = l; for (int i = l-1; i >= 0; i--) @@ -64,28 +64,28 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) static const wxFileTypeInfo fallbacks[] = { wxFileTypeInfo(_T("image/jpeg"), - _T(""), - _T(""), + wxEmptyString, + wxEmptyString, _T("JPEG image (from fallback)"), _T("jpg"), _T("jpeg"), _T("JPG"), _T("JPEG"), NULL), wxFileTypeInfo(_T("image/gif"), - _T(""), - _T(""), + wxEmptyString, + wxEmptyString, _T("GIF image (from fallback)"), _T("gif"), _T("GIF"), NULL), wxFileTypeInfo(_T("image/png"), - _T(""), - _T(""), + wxEmptyString, + wxEmptyString, _T("PNG image (from fallback)"), _T("png"), _T("PNG"), NULL), wxFileTypeInfo(_T("image/bmp"), - _T(""), - _T(""), + wxEmptyString, + wxEmptyString, _T("windows bitmap image (from fallback)"), _T("bmp"), _T("BMP"), NULL), wxFileTypeInfo(_T("text/html"), - _T(""), - _T(""), + wxEmptyString, + wxEmptyString, _T("HTML document (from fallback)"), _T("htm"), _T("html"), _T("HTM"), _T("HTML"), NULL), // must terminate the table with this! @@ -124,7 +124,7 @@ wxString wxFileSystemHandler::GetMimeTypeFromExt(const wxString& location) wxString wxFileSystemHandler::GetProtocol(const wxString& location) const { wxString s = wxEmptyString; - int i, l = location.Length(); + int i, l = location.length(); bool fnd = false; for (i = l-1; (i >= 0) && ((location[i] != wxT('#')) || (!fnd)); i--) { @@ -141,7 +141,7 @@ wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const int i; bool fnd = false; - for (i = location.Length()-1; i >= 0; i--) { + for (i = location.length()-1; i >= 0; i--) { if ((location[i] == wxT(':')) && (i != 1 /*win: C:\path*/)) fnd = true; else if (fnd && (location[i] == wxT('#'))) return location.Left(i); } @@ -150,7 +150,7 @@ wxString wxFileSystemHandler::GetLeftLocation(const wxString& location) const wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const { - int i, l = location.Length(); + int i, l = location.length(); int l2 = l + 1; for (i = l-1; @@ -167,7 +167,7 @@ wxString wxFileSystemHandler::GetRightLocation(const wxString& location) const wxString wxFileSystemHandler::GetAnchor(const wxString& location) const { wxChar c; - int l = location.Length(); + int l = location.length(); for (int i = l-1; i >= 0; i--) { c = location[i]; @@ -260,7 +260,7 @@ static wxString MakeCorrectPath(const wxString& path) wxString r; int i, j, cnt; - cnt = p.Length(); + cnt = p.length(); for (i = 0; i < cnt; i++) if (p.GetChar(i) == wxT('\\')) p.GetWritableChar(i) = wxT('/'); // Want to be windows-safe @@ -279,7 +279,7 @@ static wxString MakeCorrectPath(const wxString& path) r << p.GetChar(i); if (p.GetChar(i) == wxT('/') && p.GetChar(i-1) == wxT('.') && p.GetChar(i-2) == wxT('.')) { - for (j = r.Length() - 2; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {} + for (j = r.length() - 2; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {} if (j >= 0 && r.GetChar(j) != wxT(':')) { for (j = j - 1; j >= 0 && r.GetChar(j) != wxT('/') && r.GetChar(j) != wxT(':'); j--) {} @@ -302,13 +302,13 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir) if (is_dir) { - if (m_Path.Length() > 0 && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':')) + if (m_Path.length() > 0 && m_Path.Last() != wxT('/') && m_Path.Last() != wxT(':')) m_Path << wxT('/'); } else { - for (i = m_Path.Length()-1; i >= 0; i--) + for (i = m_Path.length()-1; i >= 0; i--) { if (m_Path[(unsigned int) i] == wxT('/')) { @@ -330,7 +330,7 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir) } if (pathpos == -1) { - for (i = 0; i < (int) m_Path.Length(); i++) + for (i = 0; i < (int) m_Path.length(); i++) { if (m_Path[(unsigned int) i] == wxT(':')) { @@ -338,7 +338,7 @@ void wxFileSystem::ChangePathTo(const wxString& location, bool is_dir) break; } } - if (i == (int) m_Path.Length()) + if (i == (int) m_Path.length()) m_Path = wxEmptyString; } else @@ -358,7 +358,7 @@ wxFSFile* wxFileSystem::OpenFile(const wxString& location) wxFSFile *s = NULL; wxList::compatibility_iterator node; - ln = loc.Length(); + ln = loc.length(); meta = 0; for (i = 0; i < ln; i++) { @@ -415,7 +415,7 @@ wxString wxFileSystem::FindFirst(const wxString& spec, int flags) m_FindFileHandler = NULL; - for (int i = spec2.Length()-1; i >= 0; i--) + for (int i = spec2.length()-1; i >= 0; i--) if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // Want to be windows-safe node = m_Handlers.GetFirst(); @@ -495,7 +495,7 @@ wxFileName wxFileSystem::URLToFileName(const wxString& url) } else if ( (url.Find(wxT("file://")) == 0) && (path.Find(wxT('/')) != wxNOT_FOUND) && - (path.Length() > 1) && (path[1u] != wxT(':')) ) + (path.length() > 1) && (path[1u] != wxT(':')) ) { path = wxT("//") + path; } @@ -559,6 +559,3 @@ IMPLEMENT_DYNAMIC_CLASS(wxFileSystemModule, wxModule) #endif // wxUSE_FILESYSTEM - - -