diff options
author | Jordi Vilalta Prat | 2008-01-27 19:47:41 +0000 |
---|---|---|
committer | Jordi Vilalta Prat | 2008-01-27 19:47:41 +0000 |
commit | 66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985 (patch) | |
tree | e27aadabecd8dd910884280e6559ff9c94c3d73c /backends/fs | |
parent | 278857698dc7b1623096fe1ad12511dc4c886c7e (diff) | |
download | scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.gz scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.tar.bz2 scummvm-rg350-66e9d4f5e8f35b28f8abd9ce53a0da4da3ce8985.zip |
Removed trailing spaces.
svn-id: r30664
Diffstat (limited to 'backends/fs')
25 files changed, 363 insertions, 363 deletions
diff --git a/backends/fs/abstract-fs-factory.cpp b/backends/fs/abstract-fs-factory.cpp index 6126d82737..8cf936f5bc 100644 --- a/backends/fs/abstract-fs-factory.cpp +++ b/backends/fs/abstract-fs-factory.cpp @@ -27,7 +27,7 @@ /* * All the following includes choose, at compile time, which specific backend will be used * during the execution of the ScummVM. - * + * * It has to be done this way because not all the necessary libraries will be available in * all build environments. Additionally, this results in smaller binaries. */ @@ -57,8 +57,8 @@ /** * Creates concrete FilesystemFactory objects depending on the current architecture. - * - * @return AbstractFilesystemFactory* The specific factory for the current architecture. + * + * @return AbstractFilesystemFactory* The specific factory for the current architecture. */ AbstractFilesystemFactory *AbstractFilesystemFactory::makeFSFactory() { #if defined(__amigaos4__) diff --git a/backends/fs/abstract-fs.h b/backends/fs/abstract-fs.h index 611948691e..f593023d24 100644 --- a/backends/fs/abstract-fs.h +++ b/backends/fs/abstract-fs.h @@ -46,7 +46,7 @@ protected: friend class FilesystemNode; typedef Common::String String; typedef FilesystemNode::ListMode ListMode; - + /** * Returns the child node with the given name. If no child with this name * exists, returns 0. When called on a non-directory node, it should @@ -55,13 +55,13 @@ protected: * Example: * Calling getChild() for a node with path "/foo/bar" using name="file.txt", * would produce a new node with "/foo/bar/file.txt" as path. - * + * * @note This function will append a separator char (\ or /) to the end of the * path if needed. - * + * * @note Handling calls on non-dir nodes gracefully makes it possible to * switch to a lazy type detection scheme in the future. - * + * * @param name String containing the name of the child to create a new node. */ virtual AbstractFilesystemNode *getChild(const String &name) const = 0; @@ -77,7 +77,7 @@ public: * Destructor. */ virtual ~AbstractFilesystemNode() {} - + /* * Indicates whether the object referred by this path exists in the filesystem or not. */ @@ -86,65 +86,65 @@ public: /** * Return a list of child nodes of this directory node. If called on a node * that does not represent a directory, false is returned. - * + * * @param list List to put the contents of the directory in. * @param mode Mode to use while listing the directory. * @param hidden Whether to include hidden files or not in the results. - * + * * @return true if succesful, false otherwise (e.g. when the directory does not exist). */ virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const = 0; /** * Returns a human readable path string. - * + * * @note By default, this method returns the value of getName(). */ virtual String getDisplayName() const { return getName(); } - + /** * Returns the last component of the path pointed by this FilesystemNode. - * + * * Examples (POSIX): * /foo/bar.txt would return /bar.txt * /foo/bar/ would return /bar/ - * + * * @note This method is very architecture dependent, please check the concrete implementation for more information. */ virtual String getName() const = 0; - + /** * Returns the 'path' of the current node, usable in fopen(). */ virtual String getPath() const = 0; - + /** * Indicates whether this path refers to a directory or not. */ virtual bool isDirectory() const = 0; - + /** * Indicates whether the object referred by this path can be read from or not. - * - * If the path refers to a directory, readability implies being able to read + * + * If the path refers to a directory, readability implies being able to read * and list the directory entries. - * - * If the path refers to a file, readability implies being able to read the + * + * If the path refers to a file, readability implies being able to read the * contents of the file. - * + * * @return bool true if the object can be read, false otherwise. */ virtual bool isReadable() const = 0; - + /** * Indicates whether the object referred by this path can be written to or not. - * + * * If the path refers to a directory, writability implies being able to modify * the directory entry (i.e. rename the directory, remove it or write files inside of it). - * + * * If the path refers to a file, writability implies being able to write data * to the file. - * + * * @return bool true if the object can be written to, false otherwise. */ virtual bool isWritable() const = 0; diff --git a/backends/fs/amigaos4/amigaos4-fs-factory.h b/backends/fs/amigaos4/amigaos4-fs-factory.h index 01a976bdd7..262b3ed233 100644 --- a/backends/fs/amigaos4/amigaos4-fs-factory.h +++ b/backends/fs/amigaos4/amigaos4-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates AmigaOSFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> { +class AmigaOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<AmigaOSFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: AmigaOSFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/amigaos4/amigaos4-fs.cpp b/backends/fs/amigaos4/amigaos4-fs.cpp index d4bf58c7e3..16a95cc779 100644 --- a/backends/fs/amigaos4/amigaos4-fs.cpp +++ b/backends/fs/amigaos4/amigaos4-fs.cpp @@ -46,7 +46,7 @@ const uint32 kExAllBufferSize = 40960; // TODO: is this okay for sure? /** * Implementation of the ScummVM file system API. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class AmigaOSFilesystemNode : public AbstractFilesystemNode { @@ -56,11 +56,11 @@ protected: String _sPath; bool _bIsDirectory; bool _bIsValid; - + /** * Obtain the FileInfoBlock protection value for this FilesystemNode, * as defined in the <proto/dos.h> header. - * + * * @return -1 if there were errors, 0 or a positive integer otherwise. */ virtual int getFibProtection() const; @@ -70,14 +70,14 @@ public: * Creates a AmigaOSFilesystemNode with the root node as path. */ AmigaOSFilesystemNode(); - + /** * Creates a AmigaOSFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ AmigaOSFilesystemNode(const String &p); - + /** * FIXME: document this constructor. */ @@ -85,11 +85,11 @@ public: /** * Copy constructor. - * + * * @note Needed because it duplicates the file lock */ AmigaOSFilesystemNode(const AmigaOSFilesystemNode &node); - + /** * Destructor. */ @@ -102,11 +102,11 @@ public: virtual bool isDirectory() const { return _bIsDirectory; }; virtual bool isReadable() const; virtual bool isWritable() const; - + virtual AbstractFilesystemNode *getChild(const String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; - + /** * Creates a list with all the volumes present in the root node. */ @@ -115,18 +115,18 @@ public: /** * Returns the last component of a given path. - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { int offset = str.size(); - + if (offset <= 0) { debug(6, "Bad offset"); return 0; } - + const char *p = str.c_str(); while (offset > 0 && (p[offset-1] == '/' || p[offset-1] == ':')) @@ -189,7 +189,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(const String &p) { else { //_bIsDirectory = false; _bIsValid = true; - } + } } IDOS->UnLock(pLock); @@ -220,7 +220,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayNam delete [] n; return; } - + bufSize *= 2; delete [] n; } @@ -248,7 +248,7 @@ AmigaOSFilesystemNode::AmigaOSFilesystemNode(BPTR pLock, const char *pDisplayNam else { //_bIsDirectory = false; _bIsValid = true; - } + } } IDOS->FreeDosObject(DOS_FIB, fib); @@ -277,23 +277,23 @@ bool AmigaOSFilesystemNode::exists() const { ENTER(); if(_sPath.empty()) return false; - + bool nodeExists = false; - + struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL); if (!fib) { debug(6, "FileInfoBlock is NULL"); LEAVE(); return false; } - + BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK); if (pLock) { if (IDOS->Examine(pLock, fib) != DOSFALSE) nodeExists = true; IDOS->UnLock(pLock); } - + IDOS->FreeDosObject(DOS_FIB, fib); LEAVE(); return nodeExists; @@ -402,13 +402,13 @@ bool AmigaOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b } LEAVE(); - + return true; } int AmigaOSFilesystemNode::getFibProtection() const { ENTER(); - + int fibProt = -1; struct FileInfoBlock *fib = (struct FileInfoBlock *)IDOS->AllocDosObject(DOS_FIB, NULL); if (!fib) { @@ -416,7 +416,7 @@ int AmigaOSFilesystemNode::getFibProtection() const { LEAVE(); return fibProt; } - + BPTR pLock = IDOS->Lock((STRPTR)_sPath.c_str(), SHARED_LOCK); if (pLock) { if (IDOS->Examine(pLock, fib) != DOSFALSE) { @@ -424,7 +424,7 @@ int AmigaOSFilesystemNode::getFibProtection() const { } IDOS->UnLock(pLock); } - + IDOS->FreeDosObject(DOS_FIB, fib); LEAVE(); return fibProt; @@ -456,39 +456,39 @@ AbstractFilesystemNode *AmigaOSFilesystemNode::getParent() const { node = new AmigaOSFilesystemNode(); LEAVE(); - + return node; } bool AmigaOSFilesystemNode::isReadable() const { bool readable = false; int fibProt = getFibProtection(); - + if (fibProt >= 0) { /* The fib_Protection flag is low-active or inverted, thus the negation. - * + * * For more information, consult the compiler/include/dos/dos.h * file from the AROS source (http://aros.sourceforge.net/). */ readable = !(fibProt & FIBF_READ); } - + return readable; } bool AmigaOSFilesystemNode::isWritable() const { bool writable = false; int fibProt = getFibProtection(); - + if (fibProt >= 0) { /* The fib_Protection flag is low-active or inverted, thus the negation. - * + * * For more information, consult the compiler/include/dos/dos.h * file from the AROS source (http://aros.sourceforge.net/). */ writable = !(fibProt & FIBF_WRITE); } - + return writable; } @@ -513,7 +513,7 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const { dosList->dol_Name && dosList->dol_Task) { //const char *volName = (const char *)BADDR(dosList->dol_Name)+1; - + // Copy name to buffer IDOS->CopyStringBSTRToC(dosList->dol_Name, buffer, MAXPATHLEN); @@ -533,7 +533,7 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const { // Find device name IDOS->DevNameFromLock(volumeLock, devName, MAXPATHLEN, DN_DEVICEONLY); - + sprintf(buffer, "%s (%s)", volName, devName); delete [] devName; @@ -562,7 +562,7 @@ AbstractFSList AmigaOSFilesystemNode::listVolumes() const { IDOS->UnLockDosList(kLockFlags); LEAVE(); - + return myList; } diff --git a/backends/fs/dc/dc-fs.cpp b/backends/fs/dc/dc-fs.cpp index 32170eef27..307f6f8852 100644 --- a/backends/fs/dc/dc-fs.cpp +++ b/backends/fs/dc/dc-fs.cpp @@ -32,7 +32,7 @@ /** * Implementation of the ScummVM file system API based on Ronin. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class RoninCDFilesystemNode : public AbstractFilesystemNode { @@ -47,10 +47,10 @@ public: * Creates a RoninCDFilesystemNode with the root node as path. */ RoninCDFilesystemNode(); - + /** * Creates a RoninCDFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. * @param verify true if the isValid and isDirectory flags should be verified during the construction. */ @@ -71,18 +71,18 @@ public: /** * Returns the last component of a given path. - * + * * Examples: * /foo/bar.txt would return /bar.txt * /foo/bar/ would return /bar/ - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { if(str.empty()) return ""; - + const char *start = str.c_str(); const char *cur = start + str.size() - 2; @@ -129,7 +129,7 @@ AbstractFilesystemNode *RoninCDFilesystemNode::getChild(const String &n) const { // FIXME: Pretty lame implementation! We do no error checking to speak // of, do not check if this is a special node, etc. assert(_isDirectory); - + String newPath(_path); if (_path.lastChar() != '/') newPath += '/'; @@ -140,9 +140,9 @@ AbstractFilesystemNode *RoninCDFilesystemNode::getChild(const String &n) const { bool RoninCDFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { assert(_isDirectory); - + //TODO: honor the hidden flag - + DIR *dirp = opendir(_path.c_str()); struct dirent *dp; @@ -172,11 +172,11 @@ bool RoninCDFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b if (entry._isDirectory) entry._path += "/"; - + myList.push_back(new RoninCDFilesystemNode(entry)); } closedir(dirp); - + return true; } diff --git a/backends/fs/dc/ronincd-fs-factory.h b/backends/fs/dc/ronincd-fs-factory.h index d827cc51e3..e49c2c04fa 100644 --- a/backends/fs/dc/ronincd-fs-factory.h +++ b/backends/fs/dc/ronincd-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates RoninCDFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<RoninCDFilesystemFactory> { +class RoninCDFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<RoninCDFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: RoninCDFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/ds/ds-fs-factory.h b/backends/fs/ds/ds-fs-factory.h index a6a7bf6532..292a2baa69 100644 --- a/backends/fs/ds/ds-fs-factory.h +++ b/backends/fs/ds/ds-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates DSFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<DSFilesystemFactory> { +class DSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<DSFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: DSFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/ds/ds-fs.cpp b/backends/fs/ds/ds-fs.cpp index bd8cc59008..6a1279e1e1 100644 --- a/backends/fs/ds/ds-fs.cpp +++ b/backends/fs/ds/ds-fs.cpp @@ -8,7 +8,7 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -49,7 +49,7 @@ DSFileSystemNode::DSFileSystemNode() { _archive = (GBFS_FILE *) find_first_gbfs_file(scummdata); if (!_archive) consolePrintf("No GBFS archive found!\n"); }*/ - + if (!_zipFile) { _zipFile = new ZipFile(); } @@ -57,19 +57,19 @@ DSFileSystemNode::DSFileSystemNode() { DSFileSystemNode::DSFileSystemNode(const String& path) { // consolePrintf("--%s ",path.c_str()); - + char disp[128]; char* pathStr = (char *) path.c_str(); - + int lastSlash = 3; for (int r = 0; r < (int) strlen(pathStr) - 1; r++) { if (path[r] == '\\') { lastSlash = r; } } - + strcpy(disp, pathStr + lastSlash + 1); - + _displayName = String(disp); _path = path; // _isValid = true; @@ -78,13 +78,13 @@ DSFileSystemNode::DSFileSystemNode(const String& path) { if (!strncmp(pathStr, "ds:/", 4)) { pathStr += 4; } - + if (*pathStr == '\0') { _isValid = true; _isDirectory = true; return; } - + _zipFile->setAllFilesVisible(true); if (_zipFile->findFile(pathStr)) { _isValid = true; @@ -94,13 +94,13 @@ DSFileSystemNode::DSFileSystemNode(const String& path) { _isDirectory = false; } _zipFile->setAllFilesVisible(false); - + // consolePrintf("%s - Found: %d, Dir: %d\n", pathStr, _isValid, _isDirectory); } DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) { // consolePrintf("--%s ",path.c_str()); - + char disp[128]; char* pathStr = (char *) path.c_str(); int lastSlash = 3; @@ -109,14 +109,14 @@ DSFileSystemNode::DSFileSystemNode(const String& path, bool isDir) { lastSlash = r; } } - + strcpy(disp, pathStr + lastSlash + 1); - + _displayName = String(disp); _path = path; _isValid = true; _isDirectory = isDir; - + // consolePrintf("Found: %d, Dir: %d\n", _isValid, _isDirectory); } @@ -130,7 +130,7 @@ AbstractFilesystemNode *DSFileSystemNode::getChild(const Common::String& n) cons } else { return new DSFileSystemNode(_path + "\\" + n); } - + return NULL; } @@ -150,7 +150,7 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool _zipFile->changeDirectory(&temp[4]); } else { _zipFile->changeToRoot(); - + /* // This is the root dir, so add the RAM folder DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/ram"); dsfsn->_isDirectory = true; @@ -160,21 +160,21 @@ bool DSFileSystemNode::getChildren(AbstractFSList &dirList, ListMode mode, bool } else { _zipFile->changeDirectory(temp); } - + if (_zipFile->restartFile()) { do { - char n[128]; + char n[128]; _zipFile->getFileName(n); - + // consolePrintf("file: %s\n", n); - if ( (_zipFile->isDirectory() && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)) ) - || (!_zipFile->isDirectory() && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll)) ) ) + if ( (_zipFile->isDirectory() && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll)) ) + || (!_zipFile->isDirectory() && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll)) ) ) { DSFileSystemNode* dsfsn = new DSFileSystemNode("ds:/" + String(n), _zipFile->isDirectory()); dsfsn->_isDirectory = _zipFile->isDirectory(); dirList.push_back((dsfsn)); } - + } while (_zipFile->skipFile()); } @@ -185,10 +185,10 @@ AbstractFilesystemNode* DSFileSystemNode::getParent() const { // consolePrintf("parent\n"); DSFileSystemNode *p; - if (_path != "ds:/") { + if (_path != "ds:/") { char *path = (char *) _path.c_str(); int lastSlash = 4; - + for (int r = 4; r < (int) strlen((char *) path); r++) { if (path[r] == '\\') { lastSlash = r; @@ -218,7 +218,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode() { GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) { // consolePrintf("'%s'",path.c_str()); - + char disp[128]; char* pathStr = (char *) path.c_str(); int lastSlash = 3; @@ -227,12 +227,12 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) { lastSlash = r; } } - + strcpy(disp, pathStr + lastSlash + 1); char check[128]; int success; - + memset(check, 0, 128); if (strlen(pathStr) > 3) { strcpy(check, pathStr + 3); @@ -244,7 +244,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) { success = FT_DIR; } // consolePrintf("Path: %s (%d)\n", check, success); - + _displayName = String(disp); _path = path; _isValid = success == FT_FILE; @@ -253,7 +253,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path) { GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) { // consolePrintf("'%s'",path.c_str()); - + char disp[128]; char* pathStr = (char *) path.c_str(); int lastSlash = 3; @@ -262,7 +262,7 @@ GBAMPFileSystemNode::GBAMPFileSystemNode(const String& path, bool isDirectory) { lastSlash = r; } } - + strcpy(disp, pathStr + lastSlash + 1); _displayName = String(disp); @@ -282,7 +282,7 @@ AbstractFilesystemNode *GBAMPFileSystemNode::getChild(const Common::String& n) c } else { return new DSFileSystemNode(_path + "\\" + n); } - + return NULL; } @@ -292,12 +292,12 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo //TODO: honor the hidden flag enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 }; - + char temp[128], fname[256], *path, *pathTemp; strcpy(temp, _path.c_str()); - + path = temp + 3; - + pathTemp = path; while (*pathTemp) { if (*pathTemp == '\\') { @@ -308,37 +308,37 @@ bool GBAMPFileSystemNode::getChildren(AbstractFSList& dirList, ListMode mode, bo consolePrintf("This dir: %s\n", path); FAT_chdir(path); - + int entryType = FAT_FindFirstFileLFN(fname); - + while (entryType != TYPE_NO_MORE) { - + if ( ((entryType == TYPE_DIR) && ((mode == FilesystemNode::kListDirectoriesOnly) || (mode == FilesystemNode::kListAll))) || ((entryType == TYPE_FILE) && ((mode == FilesystemNode::kListFilesOnly) || (mode == FilesystemNode::kListAll))) ) { GBAMPFileSystemNode* dsfsn; consolePrintf("Fname: %s\n", fname); - + if (strcmp(fname, ".") && strcmp(fname, "..")) { - + if (!strcmp(path, "/")) { dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String(fname), entryType == TYPE_DIR); } else { dsfsn = new GBAMPFileSystemNode("mp:" + String(path) + String("/") + String(fname), entryType == TYPE_DIR); } - + // dsfsn->_isDirectory = entryType == DIR; dirList.push_back((dsfsn)); } } else { // consolePrintf("Skipping %s\n", fname); } - + entryType = FAT_FindNextFileLFN(fname); } - + // consolePrintf("No more"); - + FAT_chdir("/"); return true; @@ -348,10 +348,10 @@ AbstractFilesystemNode* GBAMPFileSystemNode::getParent() const { // consolePrintf("parent\n"); GBAMPFileSystemNode *p; - if (_path != "mp:/") { + if (_path != "mp:/") { char *path = (char *) _path.c_str(); int lastSlash = 4; - + for (int r = 4; r < (int) strlen((char *) path); r++) { if (path[r] == '/') { lastSlash = r; @@ -381,14 +381,14 @@ FILE* std_fopen(const char* name, const char* mode) { inited = true; currentDir[0] = '\0'; } - + char* realName = (char *) name; - + // Remove file system prefix if ((name[0] == 'd') && (name[1] == 's') && (name[2] == ':') && (name[3] == '/')) { realName += 4; } - + if ((name[0] == 'm') && (name[1] == 'p') && (name[2] == ':') && (name[3] == '/')) { realName += 4; } @@ -398,15 +398,15 @@ FILE* std_fopen(const char* name, const char* mode) { if (DS::isGBAMPAvailable()) { FAT_chdir("/"); - + char* p = realName; while (*p) { if (*p == '\\') *p = '/'; p++; } - + FAT_FILE* result = FAT_fopen(realName, mode); - + if (result == 0) { // consolePrintf("Error code %d\n", result); //consolePrintf("Opening file %s\n", realName); @@ -414,16 +414,16 @@ FILE* std_fopen(const char* name, const char* mode) { // consolePrintf("Opened file %d\n", result); } // MT_memoryReport(); - + return (FILE *) result; } - + // Fail to open file for writing. It's in ROM! - + // Allocate a file handle int r = 0; while (handle[r].used) r++; - + if (strchr(mode, 'w')) { // consolePrintf("Writing %s\n", realName); handle[r].sramFile = (DSSaveFile *) DSSaveFileManager::instance()->openSavefile(realName, true); @@ -439,22 +439,22 @@ FILE* std_fopen(const char* name, const char* mode) { handle[r].size = handle[r].sramFile->getSize(); // consolePrintf("Found it"); return &handle[r]; - } + } // consolePrintf("Not in SRAM!"); char* data; - + ZipFile* zip = DSFileSystemNode::getZip(); if (!zip) { // consolePrintf("No zip yet!"); return NULL; } - + // Grab the data if it exists - + zip->setAllFilesVisible(true); - + if (currentDir[0] != 0) { char nameWithPath[128]; sprintf(nameWithPath, "%s\%s", currentDir, realName); @@ -462,16 +462,16 @@ FILE* std_fopen(const char* name, const char* mode) { } // consolePrintf("fopen(%s, %s)\n", realName, name); - + if (zip->findFile(realName)) { data = zip->getFile(); zip->setAllFilesVisible(false); - + // Allocate a file handle int r = 0; while (handle[r].used) r++; - - + + handle[r].used = true; handle[r].pos = 0; handle[r].data = data; @@ -512,26 +512,26 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { return bytes / size; } return numItems; - + /* int item = 0; u8* data = (u8 *) ptr; while ((item < numItems) && (!FAT_feof((FAT_FILE *) handle))) { - + int bytes = 0; while ((bytes < size) && (!FAT_feof((FAT_FILE *) handle))) { *data++ = FAT_fgetc((FAT_FILE *) handle); bytes++; } - + item++; - + } - + return item; */ int items = 0; - + //for (int r = 0; r < numItems; r++) { if (!std_feof(handle)) { /* for (int t = 0; t < size; t++) { @@ -540,7 +540,7 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { }*/ int left = size * numItems; int bytesRead = -1; - + while ((left > 0) && (!FAT_feof((FAT_FILE *) handle))) { int amount = left > 8192? 8192: left; // do { @@ -548,9 +548,9 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { /* if (bytesRead == 0) { consolePrintf("Pos:%d items:%d num:%d amount:%d read:%d\n", ftell(handle), items, numItems, amount, bytesRead); left++; - + int pos = ftell(handle); - + fseek(handle, 0, SEEK_SET); int c = getc(handle); fseek(handle, pos - 1024, SEEK_SET); @@ -562,21 +562,21 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { } while (bytesRead == 0); */ left -= bytesRead; - ptr = ((char *) (ptr)) + bytesRead; + ptr = ((char *) (ptr)) + bytesRead; } - + items = numItems - (left / size); // FAT_fread((void *) ptr, size, 1, ((int) (handle)) - 1); -// ptr = ((char *) (ptr)) + size; +// ptr = ((char *) (ptr)) + size; } // } - + // consolePrintf("...done %d \n", items) return items; } - + if (handle->sramFile) { int bytes = 0; int result = 1; @@ -586,9 +586,9 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { bytes += result; //consolePrintf("'%d',", ((char *) (ptr))[0]); } - + handle->pos += bytes; - + return bytes / size; } @@ -607,7 +607,7 @@ size_t std_fread(const void* ptr, size_t size, size_t numItems, FILE* handle) { size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) { if ((handle == stdin)) return 0; - + if ((handle == stderr) || (handle == stdout)) { // consolePrintf((char *) ptr); return size; @@ -618,18 +618,18 @@ size_t std_fwrite(const void* ptr, size_t size, size_t numItems, FILE* handle) { if (DS::isGBAMPAvailable()) { FAT_fwrite(((char *) (ptr)), size, numItems, (FAT_FILE *) handle); return numItems; - + int length = size * numItems; int pos = 0; - + while (pos < length) { int amount = length > 512? 512: length; - + FAT_fwrite(((char *) (ptr)) + pos, 1, amount, (FAT_FILE *) handle); length -= amount; - pos += amount; - } - + pos += amount; + } + return numItems; } @@ -651,7 +651,7 @@ bool std_feof(FILE* handle) { if (DS::isGBAMPAvailable()) { return FAT_feof((FAT_FILE *) handle); } - + if (handle->sramFile) { return handle->sramFile->eos(); } @@ -667,19 +667,19 @@ void std_fflush(FILE* handle) { char* std_fgets(char* str, int size, FILE* file) { // consolePrintf("fgets file=%d ", file); - + if (DS::isGBAMPAvailable()) { char* s = str; while ((*s++ = std_getc(file)) >= 32) { // consolePrintf("%d ", *s); } *s = 0; - + // consolePrintf("Read:%s\n", str); - + return str; } - + if (file->sramFile) { file->pos--; int p = -1; @@ -694,7 +694,7 @@ char* std_fgets(char* str, int size, FILE* file) { // consolePrintf("Read:%s\n", str); return str; } - + return NULL; } @@ -727,7 +727,7 @@ int std_fseek(FILE* handle, long int offset, int whence) { handle->pos = offset; break; } - + return 0; } @@ -740,7 +740,7 @@ int std_getc(FILE* handle) { if (DS::isGBAMPAvailable()) { char c; FAT_fread(&c, 1, 1, (FAT_FILE *) handle); - + return c; } @@ -763,15 +763,15 @@ void std_cwd(char* dir) { if ((strlen(dir) >= 4) && (dir[0] == 'm') && (dir[1] == 'p') && (dir[2] == ':') && (dir[3] == '/')) { realName += 4; } - + // consolePrintf("Real cwd:%d\n", realName); - + char* p = realName; while (*p) { if (*p == '\\') *p = '/'; p++; } - + // consolePrintf("Real cwd:%d\n", realName); FAT_chdir(realName); } else { @@ -784,13 +784,13 @@ void std_cwd(char* dir) { if (*p == '\\') *p = '/'; p++; } - + strcpy(currentDir, realName); if (*(currentDir + strlen(currentDir) - 1) == '/') { *(currentDir + strlen(currentDir) - 1) = '\0'; } // consolePrintf("CWD: %s\n", currentDir); - } + } } int std_ferror(FILE* handle) { @@ -801,11 +801,11 @@ int std_ferror(FILE* handle) { /** * Returns the last component of a given path. - * + * * Examples: * /foo/bar.txt would return /bar.txt * /foo/bar/ would return /bar/ - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ diff --git a/backends/fs/ds/ds-fs.h b/backends/fs/ds/ds-fs.h index 0b5037d1a7..6b3452b53b 100644 --- a/backends/fs/ds/ds-fs.h +++ b/backends/fs/ds/ds-fs.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ - + #ifndef _DS_FS_H #define _DS_FS_H @@ -36,7 +36,7 @@ namespace DS { /** * Implementation of the ScummVM file system API. * This class is used when a Flash cart is in use. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class DSFileSystemNode : public AbstractFilesystemNode { @@ -50,33 +50,33 @@ protected: bool _isDirectory; bool _isValid; int _refCountVal; - + public: /** * Creates a DSFilesystemNode with the root node as path. */ DSFileSystemNode(); - + /** * Creates a DSFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ DSFileSystemNode(const String &path); - + /** * Creates a DSFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. * @param path true if path is a directory, false otherwise. */ DSFileSystemNode(const String& path, bool isDir); - + /** * Copy constructor. */ DSFileSystemNode(const DSFileSystemNode *node); - + virtual bool exists() const { return true; } //FIXME: this is just a stub virtual String getDisplayName() const { return _displayName; } virtual String getName() const { return _displayName; } @@ -84,7 +84,7 @@ public: virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return true; } //FIXME: this is just a stub virtual bool isWritable() const { return true; } //FIXME: this is just a stub - + /** * Returns a copy of this node. */ @@ -92,7 +92,7 @@ public: virtual AbstractFilesystemNode *getChild(const Common::String& name) const; virtual bool getChildren(AbstractFSList &list, ListMode mode = FilesystemNode::kListDirectoriesOnly, bool hidden = false) const; virtual AbstractFilesystemNode *getParent() const; - + /** * Returns the zip file this node points to. * TODO: check this documentation. @@ -103,7 +103,7 @@ public: /** * Implementation of the ScummVM file system API. * This class is used when the GBAMP (GBA Movie Player) is used with a CompactFlash card. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class GBAMPFileSystemNode : public AbstractFilesystemNode { @@ -115,41 +115,41 @@ protected: bool _isDirectory; bool _isValid; int _refCountVal; - + public: /** * Creates a GBAMPFilesystemNode with the root node as path. */ GBAMPFileSystemNode(); - + /** * Creates a GBAMPFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ GBAMPFileSystemNode(const String &path); - + /** * Creates a DSFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. * @param path true if path is a directory, false otherwise. */ GBAMPFileSystemNode(const String &path, bool isDirectory); - + /** * Copy constructor. */ GBAMPFileSystemNode(const GBAMPFileSystemNode *node); - virtual bool exists() const { return _isValid || _isDirectory; } + virtual bool exists() const { return _isValid || _isDirectory; } virtual String getDisplayName() const { return _displayName; } virtual String getName() const { return _displayName; } virtual String getPath() const { return _path; } virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return true; } //FIXME: this is just a stub virtual bool isWritable() const { return true; } //FIXME: this is just a stub - + /** * Returns a copy of this node. */ @@ -164,7 +164,7 @@ struct fileHandle { bool used; char* data; int size; - + DSSaveFile* sramFile; }; @@ -177,7 +177,7 @@ struct fileHandle { #define stdin ((DS::fileHandle*) -3) #define FILE DS::fileHandle - + // Please do not remove any of these prototypes that appear not to be required. FILE* std_fopen(const char* name, const char* mode); void std_fclose(FILE* handle); diff --git a/backends/fs/gp32/gp32-fs-factory.h b/backends/fs/gp32/gp32-fs-factory.h index 0810695152..90c6bd9500 100644 --- a/backends/fs/gp32/gp32-fs-factory.h +++ b/backends/fs/gp32/gp32-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates GP32FilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<GP32FilesystemFactory> { +class GP32FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<GP32FilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: GP32FilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/gp32/gp32-fs.cpp b/backends/fs/gp32/gp32-fs.cpp index 1df07a0d37..56705b90fc 100644 --- a/backends/fs/gp32/gp32-fs.cpp +++ b/backends/fs/gp32/gp32-fs.cpp @@ -29,7 +29,7 @@ /** * Implementation of the ScummVM file system API. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class GP32FilesystemNode : public AbstractFilesystemNode { @@ -44,10 +44,10 @@ public: * Creates a GP32FilesystemNode with the root node as path. */ GP32FilesystemNode(); - + /** * Creates a GP32FilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ GP32FilesystemNode(const String &path); @@ -72,18 +72,18 @@ const char gpRootPath[] = "gp:\\"; /** * Returns the last component of a given path. - * + * * Examples: * gp:\foo\bar.txt would return "\bar.txt" * gp:\foo\bar\ would return "\bar\" - * + * * @param str Path to obtain the last component from. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { if(str.empty()) return ""; - + const char *start = str.c_str(); const char *cur = start + str.size() - 2; @@ -96,7 +96,7 @@ const char *lastPathComponent(const Common::String &str) { /** * FIXME: document this function. - * + * * @param path * @param convPath */ @@ -165,7 +165,7 @@ GP32FilesystemNode::GP32FilesystemNode(const String &path) { _path = convPath; pos = convPath; - + while (*pos) if (*pos++ == '\\') dsplName = pos; @@ -186,7 +186,7 @@ AbstractFilesystemNode *GP32FilesystemNode::getChild(const String &n) const { // FIXME: Pretty lame implementation! We do no error checking to speak // of, do not check if this is a special node, etc. assert(_isDirectory); - + String newPath(_path); if (_path.lastChar() != '\\') newPath += '\\'; @@ -213,11 +213,11 @@ bool GP32FilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool int startIdx = 0; // current file String listDir(_path); //listDir += "/"; - + while (GpDirEnumList(listDir.c_str(), startIdx++, 1, &dirEntry, &read) == SM_OK) { da if (dirEntry.name[0] == '.') continue; - + entry._displayName = dirEntry.name; entry._path = _path; entry._path += dirEntry.name; diff --git a/backends/fs/morphos/abox-fs-factory.h b/backends/fs/morphos/abox-fs-factory.h index 19ef2b097f..1adbd1475a 100644 --- a/backends/fs/morphos/abox-fs-factory.h +++ b/backends/fs/morphos/abox-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates ABoxFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<ABoxFilesystemFactory> { +class ABoxFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<ABoxFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: ABoxFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/morphos/abox-fs.cpp b/backends/fs/morphos/abox-fs.cpp index 7b8bb4e451..bccd77a40f 100644 --- a/backends/fs/morphos/abox-fs.cpp +++ b/backends/fs/morphos/abox-fs.cpp @@ -35,7 +35,7 @@ /** * Implementation of the ScummVM file system API based on the MorphOS A-Box API. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class ABoxFilesystemNode : public AbstractFilesystemNode { @@ -51,19 +51,19 @@ public: * Creates a ABoxFilesystemNode with the root node as path. */ ABoxFilesystemNode(); - + /** * Creates a ABoxFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ ABoxFilesystemNode(const String &p); - + /** * FIXME: document this constructor. */ ABoxFilesystemNode(BPTR lock, CONST_STRPTR display_name = NULL); - + /** * Copy constructor. */ @@ -81,11 +81,11 @@ public: virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return true; } //FIXME: this is just a stub virtual bool isWritable() const { return true; } //FIXME: this is just a stub - + virtual AbstractFilesystemNode *getChild(const String &name) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; - + /** * Return the list of child nodes for the root node. */ @@ -94,14 +94,14 @@ public: /** * Returns the last component of a given path. - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { if (str.empty()) return ""; - + const char *str = _path.c_str(); while (offset > 0 && (str[offset-1] == '/' || str[offset-1] == ':') ) offset--; @@ -109,7 +109,7 @@ const char *lastPathComponent(const Common::String &str) { len++; offset--; } - + return str + offset; } @@ -162,7 +162,7 @@ ABoxFilesystemNode::ABoxFilesystemNode(const String &p) { _isValid = true; } } - + UnLock(pLock); } @@ -217,7 +217,7 @@ ABoxFilesystemNode::ABoxFilesystemNode(BPTR lock, CONST_STRPTR display_name) _isValid = true; } } - + FreeDosObject(DOS_FIB, fib); } @@ -262,7 +262,7 @@ AbstractFilesystemNode *ABoxFilesystemNode::getChild(const String &name) const { bool ABoxFilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const { //TODO: honor the hidden flag - + if (!_isValid) { debug(6, "listDir() called on invalid node"); diff --git a/backends/fs/palmos/palmos-fs-factory.h b/backends/fs/palmos/palmos-fs-factory.h index 575ad8fbfc..9d873eeb12 100644 --- a/backends/fs/palmos/palmos-fs-factory.h +++ b/backends/fs/palmos/palmos-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates PalmOSFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> { +class PalmOSFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PalmOSFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: PalmOSFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/palmos/palmos-fs.cpp b/backends/fs/palmos/palmos-fs.cpp index 5ad3302d79..335aa7e8dd 100644 --- a/backends/fs/palmos/palmos-fs.cpp +++ b/backends/fs/palmos/palmos-fs.cpp @@ -31,7 +31,7 @@ /** * Implementation of the ScummVM file system API based on PalmOS VFS API. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class PalmOSFilesystemNode : public AbstractFilesystemNode { @@ -41,16 +41,16 @@ protected: bool _isDirectory; bool _isValid; bool _isPseudoRoot; - + public: /** * Creates a PalmOSFilesystemNode with the root node as path. */ PalmOSFilesystemNode(); - + /** * Creates a POSIXFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ PalmOSFilesystemNode(const String &p); @@ -70,8 +70,8 @@ public: private: /** * Adds a single WindowsFilesystemNode to a given list. - * This method is used by getChildren() to populate the directory entries list. - * + * This method is used by getChildren() to populate the directory entries list. + * * @param list List to put the file entry node in. * @param mode Mode to use while adding the file entry to the list. * @param base String with the directory being listed. @@ -82,18 +82,18 @@ private: /** * Returns the last component of a given path. - * + * * Examples: * /foo/bar.txt would return /bar.txt * /foo/bar/ would return /bar/ - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { if(str.empty()) return ""; - + const char *start = str.c_str(); const char *cur = start + str.size() - 2; @@ -122,7 +122,7 @@ void PalmOSFilesystemNode::addFile(AbstractFSList &list, ListMode mode, const ch if (entry._isDirectory) entry._path += "/"; - entry._isValid = true; + entry._isValid = true; entry._isPseudoRoot = false; list.push_back(new PalmOSFilesystemNode(entry)); @@ -161,7 +161,7 @@ PalmOSFilesystemNode::PalmOSFilesystemNode(const String &p) { AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const { assert(_isDirectory); - + String newPath(_path); if (_path.lastChar() != '/') newPath += '/'; @@ -172,7 +172,7 @@ AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const { Err error = VFSFileOpen(gVars->VFS.volRefNum, newPath.c_str(), vfsModeRead, &handle); if (error) return 0; - + error = VFSFileGetAttributes(handle, &attr); VFSFileClose(handle); @@ -184,7 +184,7 @@ AbstractFilesystemNode *PalmOSFilesystemNode::getChild(const String &n) const { bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { //TODO: honor the hidden flag - + Err error; Char nameP[256]; FileInfoType desc; @@ -197,7 +197,7 @@ bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo if (error) return false; - + while (dirIterator != expIteratorStop) { error = VFSDirEntryEnumerate(handle, &dirIterator, &desc); if (!error) { @@ -212,11 +212,11 @@ bool PalmOSFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bo AbstractFilesystemNode *PalmOSFilesystemNode::getParent() const { PalmOSFilesystemNode *p = 0; - + if (!_isPseudoRoot) { const char *start = _path.c_str(); const char *end = lastPathComponent(_path); - + p = new PalmOSFilesystemNode(); p->_path = String(start, end - start); p->_isValid = true; @@ -224,7 +224,7 @@ AbstractFilesystemNode *PalmOSFilesystemNode::getParent() const { p->_displayName = lastPathComponent(p->_path); p->_isPseudoRoot =(p->_path == "/"); } - + return p; } diff --git a/backends/fs/posix/posix-fs-factory.h b/backends/fs/posix/posix-fs-factory.h index a714175548..cf1204c0a3 100644 --- a/backends/fs/posix/posix-fs-factory.h +++ b/backends/fs/posix/posix-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates POSIXFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ class POSIXFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<POSIXFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: POSIXFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp index 15acdbbf06..8ed6d9be6a 100644 --- a/backends/fs/posix/posix-fs.cpp +++ b/backends/fs/posix/posix-fs.cpp @@ -37,7 +37,7 @@ /** * Implementation of the ScummVM file system API based on POSIX. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class POSIXFilesystemNode : public AbstractFilesystemNode { @@ -52,15 +52,15 @@ public: * Creates a POSIXFilesystemNode with the root node as path. */ POSIXFilesystemNode(); - + /** * Creates a POSIXFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. * @param verify true if the isValid and isDirectory flags should be verified during the construction. */ POSIXFilesystemNode(const String &path, bool verify); - + virtual bool exists() const { return access(_path.c_str(), F_OK) == 0; } virtual String getDisplayName() const { return _displayName; } virtual String getName() const { return _displayName; } @@ -68,11 +68,11 @@ public: virtual bool isDirectory() const { return _isDirectory; } virtual bool isReadable() const { return access(_path.c_str(), R_OK) == 0; } virtual bool isWritable() const { return access(_path.c_str(), W_OK) == 0; } - + virtual AbstractFilesystemNode *getChild(const String &n) const; virtual bool getChildren(AbstractFSList &list, ListMode mode, bool hidden) const; virtual AbstractFilesystemNode *getParent() const; - + private: /** * Tests and sets the _isValid and _isDirectory flags, using the stat() function. @@ -82,18 +82,18 @@ private: /** * Returns the last component of a given path. - * + * * Examples: * /foo/bar.txt would return /bar.txt * /foo/bar/ would return /bar/ - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { if(str.empty()) return ""; - + const char *start = str.c_str(); const char *cur = start + str.size() - 2; @@ -106,7 +106,7 @@ const char *lastPathComponent(const Common::String &str) { void POSIXFilesystemNode::setFlags() { struct stat st; - + _isValid = (0 == stat(_path.c_str(), &st)); _isDirectory = _isValid ? S_ISDIR(st.st_mode) : false; } @@ -146,18 +146,18 @@ AbstractFilesystemNode *POSIXFilesystemNode::getChild(const String &n) const { // FIXME: Pretty lame implementation! We do no error checking to speak // of, do not check if this is a special node, etc. assert(_isDirectory); - + String newPath(_path); if (_path.lastChar() != '/') newPath += '/'; newPath += n; - + return new POSIXFilesystemNode(newPath, true); } bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool hidden) const { assert(_isDirectory); - + DIR *dirp = opendir(_path.c_str()); struct dirent *dp; @@ -186,7 +186,7 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo /* TODO: d_type is not part of POSIX, so it might not be supported * on some of our targets. For those systems where it isn't supported, * add this #elif case, which tries to use stat() instead. - * + * * The d_type method is used to avoid costly recurrent stat() calls in big * directories. */ @@ -221,11 +221,11 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo if (entry._isDirectory) entry._path += "/"; - + myList.push_back(new POSIXFilesystemNode(entry)); } closedir(dirp); - + return true; } diff --git a/backends/fs/ps2/ps2-fs-factory.h b/backends/fs/ps2/ps2-fs-factory.h index 9798b2b497..a7a52fdca3 100644 --- a/backends/fs/ps2/ps2-fs-factory.h +++ b/backends/fs/ps2/ps2-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates PS2FilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> { +class Ps2FilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<Ps2FilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: Ps2FilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/ps2/ps2-fs.cpp b/backends/fs/ps2/ps2-fs.cpp index f371af6e57..b972887f94 100644 --- a/backends/fs/ps2/ps2-fs.cpp +++ b/backends/fs/ps2/ps2-fs.cpp @@ -34,7 +34,7 @@ extern OSystem_PS2 *g_systemPs2; /** * Implementation of the ScummVM file system API based on the Ps2SDK. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class Ps2FilesystemNode : public AbstractFilesystemNode { @@ -49,14 +49,14 @@ public: * Creates a PS2FilesystemNode with the root node as path. */ Ps2FilesystemNode(); - + /** * Creates a PS2FilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ Ps2FilesystemNode(const String &path); - + /** * Copy constructor. */ @@ -78,7 +78,7 @@ public: /** * Returns the last component of a given path. - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ @@ -138,10 +138,10 @@ AbstractFilesystemNode *Ps2FilesystemNode::getChild(const String &n) const { char listDir[256]; sprintf(listDir, "%s/", _path.c_str()); int fd = fio.dopen(listDir); - + if (fd >= 0) { iox_dirent_t dirent; - + while (fio.dread(fd, &dirent) > 0) { if (strcmp(n.c_str(), dirent.name) == 0) { Ps2FilesystemNode *dirEntry = new Ps2FilesystemNode(); @@ -161,13 +161,13 @@ AbstractFilesystemNode *Ps2FilesystemNode::getChild(const String &n) const { } fio.dclose(fd); } - + return NULL; } bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hidden) const { //TODO: honor the hidden flag - + if (!_isDirectory) return false; @@ -194,14 +194,14 @@ bool Ps2FilesystemNode::getChildren(AbstractFSList &list, ListMode mode, bool hi } else { char listDir[256]; int fd; - + if (_path.lastChar() == '/') fd = fio.dopen(_path.c_str()); else { sprintf(listDir, "%s/", _path.c_str()); fd = fio.dopen(listDir); } - + if (fd >= 0) { iox_dirent_t dirent; Ps2FilesystemNode dirEntry; diff --git a/backends/fs/psp/psp-fs-factory.h b/backends/fs/psp/psp-fs-factory.h index 83a59dcc6a..143b2ce684 100644 --- a/backends/fs/psp/psp-fs-factory.h +++ b/backends/fs/psp/psp-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates PSPFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PSPFilesystemFactory> { +class PSPFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<PSPFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: PSPFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp index 2f7ec803fe..7e850e3a52 100644 --- a/backends/fs/psp/psp-fs.cpp +++ b/backends/fs/psp/psp-fs.cpp @@ -34,7 +34,7 @@ /** * Implementation of the ScummVM file system API based on PSPSDK API. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class PSPFilesystemNode : public AbstractFilesystemNode { @@ -43,16 +43,16 @@ protected: String _path; bool _isDirectory; bool _isValid; - + public: /** * Creates a PSPFilesystemNode with the root node as path. */ PSPFilesystemNode(); - + /** * Creates a PSPFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. * @param verify true if the isValid and isDirectory flags should be verified during the construction. */ @@ -73,18 +73,18 @@ public: /** * Returns the last component of a given path. - * + * * Examples: * /foo/bar.txt would return /bar.txt * /foo/bar/ would return /bar/ - * + * * @param str String containing the path. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { if(str.empty()) return ""; - + const char *start = str.c_str(); const char *cur = start + str.size() - 2; @@ -104,24 +104,24 @@ PSPFilesystemNode::PSPFilesystemNode() { PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) { assert(p.size() > 0); - + _path = p; _displayName = lastPathComponent(_path); _isValid = true; _isDirectory = true; if (verify) { - struct stat st; + struct stat st; _isValid = (0 == stat(_path.c_str(), &st)); _isDirectory = S_ISDIR(st.st_mode); - } + } } AbstractFilesystemNode *PSPFilesystemNode::getChild(const String &n) const { // FIXME: Pretty lame implementation! We do no error checking to speak // of, do not check if this is a special node, etc. assert(_isDirectory); - + String newPath(_path); if (_path.lastChar() != '/') newPath += '/'; @@ -137,30 +137,30 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool int dfd = sceIoDopen(_path.c_str()); if (dfd > 0) { - SceIoDirent dir; + SceIoDirent dir; memset(&dir, 0, sizeof(dir)); - + while (sceIoDread(dfd, &dir) > 0) { // Skip 'invisible files - if (dir.d_name[0] == '.') + if (dir.d_name[0] == '.') continue; - + PSPFilesystemNode entry; - + entry._isValid = true; entry._displayName = dir.d_name; entry._path = _path; entry._path += dir.d_name; entry._isDirectory = dir.d_stat.st_attr & FIO_SO_IFDIR; - + if (entry._isDirectory) entry._path += "/"; - + // Honor the chosen mode if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) || (mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) continue; - + myList.push_back(new PSPFilesystemNode(entry)); } @@ -174,10 +174,10 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool AbstractFilesystemNode *PSPFilesystemNode::getParent() const { if (_path == ROOT_PATH) return 0; - + const char *start = _path.c_str(); const char *end = lastPathComponent(_path); - + return new PSPFilesystemNode(String(start, end - start), false); } diff --git a/backends/fs/symbian/symbian-fs-factory.h b/backends/fs/symbian/symbian-fs-factory.h index b30ca89f99..4b663fd6b9 100644 --- a/backends/fs/symbian/symbian-fs-factory.h +++ b/backends/fs/symbian/symbian-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates SymbianFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<SymbianFilesystemFactory> { +class SymbianFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<SymbianFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: SymbianFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/symbian/symbian-fs.cpp b/backends/fs/symbian/symbian-fs.cpp index 90d7bb48d4..d4c4513d90 100644 --- a/backends/fs/symbian/symbian-fs.cpp +++ b/backends/fs/symbian/symbian-fs.cpp @@ -22,7 +22,7 @@ * $Id$ */ -#if defined (__SYMBIAN32__) +#if defined (__SYMBIAN32__) #include "backends/fs/abstract-fs.h" #include <dirent.h> @@ -32,7 +32,7 @@ /** * Implementation of the ScummVM file system API based on POSIX. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemNode. */ class SymbianFilesystemNode : public AbstractFilesystemNode { @@ -46,19 +46,19 @@ protected: public: /** * Creates a SymbianFilesystemNode with the root node as path. - * + * * @param aIsRoot true if the node will be a pseudo root, false otherwise. */ SymbianFilesystemNode(bool aIsRoot); - + /** * Creates a SymbianFilesystemNode for a given path. - * + * * @param path String with the path the new node should point to. */ SymbianFilesystemNode(const String &path); - - virtual bool exists() const { + + virtual bool exists() const { TFileName fname; TPtrC8 ptr((const unsigned char*)_path.c_str(),_path.size()); fname.Copy(ptr); @@ -79,18 +79,18 @@ public: /** * Returns the last component of a given path. - * + * * Examples: * c:\foo\bar.txt would return "\bar.txt" * c:\foo\bar\ would return "\bar\" - * + * * @param str Path to obtain the last component from. * @return Pointer to the first char of the last component inside str. */ const char *lastPathComponent(const Common::String &str) { if(str.empty()) return ""; - + const char *start = str.c_str(); const char *cur = start + str.size() - 2; @@ -103,14 +103,14 @@ const char *lastPathComponent(const Common::String &str) { /** * Fixes the path by changing all slashes to backslashes. - * + * * @param path String with the path to be fixed. */ static void fixFilePath(Common::String& path) { TInt len = path.size(); - + for (TInt index = 0; index < len; index++) { - if (path[index] == '/') { + if (path[index] == '/') { path[index] = '\\'; } } @@ -132,7 +132,7 @@ SymbianFilesystemNode::SymbianFilesystemNode(const String &path) { _isPseudoRoot = false; _path = path; - + fixFilePath(_path); _displayName = lastPathComponent(_path); @@ -184,27 +184,27 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b TVolumeInfo volumeInfo; TBuf8<30> driveLabel8; TBuf8<30> driveString8; - + for (driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++) { TInt err = fs.Volume(volumeInfo, driveNumber); if (err != KErrNone) - continue; + continue; if (fs.DriveToChar(driveNumber,driveLetter) != KErrNone) continue; driveLetterValue = driveLetter; - if (volumeInfo.iName.Length() > 0) { + if (volumeInfo.iName.Length() > 0) { driveLabel8.Copy(volumeInfo.iName); // 16 to 8bit des // enabling this line alone gives KERN-EXEC 3 with non-optimized GCC? WHY? grrr driveString8.Format(_L8("Drive %c: (%S)"), driveLetterValue, &driveLabel8); } else { driveString8.Format(_L8("Drive %c:"), driveLetterValue); } - + char path[10]; sprintf(path,"%c:\\", driveNumber+'A'); - - SymbianFilesystemNode entry(false); + + SymbianFilesystemNode entry(false); entry._displayName = (char*)driveString8.PtrZ(); // drive_name entry._isDirectory = true; entry._isValid = true; @@ -226,17 +226,17 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b nameBuf.Copy(fileentry.iName); SymbianFilesystemNode entry(false); entry._isPseudoRoot = false; - + entry._displayName =(char*)nameBuf.PtrZ(); entry._path = _path; entry._path +=(char*)nameBuf.PtrZ(); entry._isDirectory = fileentry.IsDir(); - + // Honor the chosen mode if ((mode == FilesystemNode::kListFilesOnly && entry._isDirectory) || (mode == FilesystemNode::kListDirectoriesOnly && !entry._isDirectory)) continue; - + if (entry._isDirectory) entry._path += "\\"; myList.push_back(new SymbianFilesystemNode(entry)); @@ -244,7 +244,7 @@ bool SymbianFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, b CleanupStack::PopAndDestroy(dirPtr); } } - + return true; } @@ -267,7 +267,7 @@ AbstractFilesystemNode *SymbianFilesystemNode::getParent() const { { p = new SymbianFilesystemNode(true); } - + return p; } diff --git a/backends/fs/windows/windows-fs-factory.h b/backends/fs/windows/windows-fs-factory.h index eb8ade1a8e..5989cbb17d 100644 --- a/backends/fs/windows/windows-fs-factory.h +++ b/backends/fs/windows/windows-fs-factory.h @@ -30,20 +30,20 @@ /** * Creates WindowsFilesystemNode objects. - * + * * Parts of this class are documented in the base interface class, AbstractFilesystemFactory. */ -class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> { +class WindowsFilesystemFactory : public AbstractFilesystemFactory, public Common::Singleton<WindowsFilesystemFactory> { public: typedef Common::String String; - + virtual AbstractFilesystemNode *makeRootFileNode() const; virtual AbstractFilesystemNode *makeCurrentDirectoryFileNode() const; virtual AbstractFilesystemNode *makeFileNodePath(const String &path) const; - + protected: WindowsFilesystemFactory() {}; - + private: friend class Common::Singleton<SingletonBaseType>; }; diff --git a/backends/fs/windows/windows-fs.cpp b/backends/fs/windows/windows-fs.cpp index 7777996345..a766132e94 100644 --- a/backends/fs/windows/windows-fs.cpp +++ b/backends/fs/windows/windows-fs.cpp @@ -141,7 +141,7 @@ private: const char *lastPathComponent(const Common::String &str) { if(str.empty()) return ""; - + const char *start = str.c_str(); const char *cur = start + str.size() - 2; |