aboutsummaryrefslogtreecommitdiff
path: root/backends/fs
diff options
context:
space:
mode:
Diffstat (limited to 'backends/fs')
-rw-r--r--backends/fs/psp/psp-fs.cpp34
-rw-r--r--backends/fs/psp/psp-stream.cpp27
-rw-r--r--backends/fs/psp/psp-stream.h2
3 files changed, 31 insertions, 32 deletions
diff --git a/backends/fs/psp/psp-fs.cpp b/backends/fs/psp/psp-fs.cpp
index 0d824846e3..64983f7144 100644
--- a/backends/fs/psp/psp-fs.cpp
+++ b/backends/fs/psp/psp-fs.cpp
@@ -100,10 +100,10 @@ PSPFilesystemNode::PSPFilesystemNode(const Common::String &p, bool verify) {
_isDirectory = true;
PSP_DEBUG_PRINT_FUNC("path [%s]\n", _path.c_str());
-
+
if (verify) {
struct stat st;
- if (PowerMan.beginCriticalSection()==PowerManager::Blocked)
+ if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
PSP_DEBUG_PRINT_FUNC("Suspended\n");
_isValid = (0 == stat(_path.c_str(), &st));
PowerMan.endCriticalSection();
@@ -120,7 +120,7 @@ bool PSPFilesystemNode::exists() const {
PSP_DEBUG_PRINT_FUNC("Suspended\n"); // Make sure to block in case of suspend
PSP_DEBUG_PRINT_FUNC("path [%s]\n", _path.c_str());
-
+
ret = access(_path.c_str(), F_OK);
PowerMan.endCriticalSection();
@@ -135,8 +135,8 @@ bool PSPFilesystemNode::isReadable() const {
if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
PSP_DEBUG_PRINT_FUNC("Suspended\n"); // Make sure to block in case of suspend
- PSP_DEBUG_PRINT_FUNC("path [%s]\n", _path.c_str());
-
+ PSP_DEBUG_PRINT_FUNC("path [%s]\n", _path.c_str());
+
ret = access(_path.c_str(), R_OK);
PowerMan.endCriticalSection();
@@ -152,7 +152,7 @@ bool PSPFilesystemNode::isWritable() const {
PSP_DEBUG_PRINT_FUNC("Suspended\n"); // Make sure to block in case of suspend
PSP_DEBUG_PRINT_FUNC("path [%s]\n", _path.c_str());
-
+
ret = access(_path.c_str(), W_OK);
PowerMan.endCriticalSection();
@@ -173,9 +173,9 @@ AbstractFSNode *PSPFilesystemNode::getChild(const Common::String &n) const {
newPath += n;
PSP_DEBUG_PRINT_FUNC("child [%s]\n", newPath.c_str());
-
+
AbstractFSNode *node = new PSPFilesystemNode(newPath, true);
-
+
DEBUG_EXIT_FUNC();
return node;
}
@@ -191,8 +191,8 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
PSP_DEBUG_PRINT_FUNC("Suspended\n"); // Make sure to block in case of suspend
- PSP_DEBUG_PRINT_FUNC("Current path[%s]\n", _path.c_str());
-
+ PSP_DEBUG_PRINT_FUNC("Current path[%s]\n", _path.c_str());
+
int dfd = sceIoDopen(_path.c_str());
if (dfd > 0) {
SceIoDirent dir;
@@ -215,12 +215,12 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
entry._path = newPath;
entry._isDirectory = dir.d_stat.st_attr & FIO_SO_IFDIR;
-
- PSP_DEBUG_PRINT_FUNC("Child[%s], %s\n", entry._path.c_str(), entry._isDirectory ? "dir" : "file");
-
+
+ PSP_DEBUG_PRINT_FUNC("Child[%s], %s\n", entry._path.c_str(), entry._isDirectory ? "dir" : "file");
+
// Honor the chosen mode
if ((mode == Common::FSNode::kListFilesOnly && entry._isDirectory) ||
- (mode == Common::FSNode::kListDirectoriesOnly && !entry._isDirectory))
+ (mode == Common::FSNode::kListDirectoriesOnly && !entry._isDirectory))
continue;
myList.push_back(new PSPFilesystemNode(entry));
@@ -233,7 +233,7 @@ bool PSPFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, bool
}
PowerMan.endCriticalSection();
-
+
DEBUG_EXIT_FUNC();
return ret;
}
@@ -243,8 +243,8 @@ AbstractFSNode *PSPFilesystemNode::getParent() const {
if (_path == ROOT_PATH)
return 0;
- PSP_DEBUG_PRINT_FUNC("current[%s]\n", _path.c_str());
-
+ PSP_DEBUG_PRINT_FUNC("current[%s]\n", _path.c_str());
+
const char *start = _path.c_str();
const char *end = lastPathComponent(_path, '/');
diff --git a/backends/fs/psp/psp-stream.cpp b/backends/fs/psp/psp-stream.cpp
index 5b955beee6..2b99554182 100644
--- a/backends/fs/psp/psp-stream.cpp
+++ b/backends/fs/psp/psp-stream.cpp
@@ -38,9 +38,9 @@
#include "backends/platform/psp/trace.h"
PSPIoStream::PSPIoStream(const Common::String &path, bool writeMode)
-: StdioStream((void *)1), _path(path), _writeMode(writeMode) {
+ : StdioStream((void *)1), _path(path), _writeMode(writeMode) {
DEBUG_ENTER_FUNC();
-
+
assert(!path.empty());
_handle = (void *)0; // Need to do this since base class asserts not 0.
@@ -54,23 +54,23 @@ PSPIoStream::PSPIoStream(const Common::String &path, bool writeMode)
_errorPos = 0;
_errorHandle = 0;
_suspendCount = 0;
-
+
DEBUG_EXIT_FUNC();
}
PSPIoStream::~PSPIoStream() {
DEBUG_ENTER_FUNC();
-
+
if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
PSP_DEBUG_PRINT_FUNC("Suspended\n");
PowerMan.unregisterSuspend(this); // Unregister with powermanager to be suspended
- // Must do this before fclose() or resume() will reopen.
+ // Must do this before fclose() or resume() will reopen.
fclose((FILE *)_handle); // We don't need a critical section(?). Worst case, the handle gets closed on its own
PowerMan.endCriticalSection();
-
+
DEBUG_EXIT_FUNC();
}
@@ -98,7 +98,7 @@ bool PSPIoStream::err() const {
DEBUG_ENTER_FUNC();
if (_ferror)
PSP_ERROR("mem_ferror[%d], source[%d], suspend error[%d], pos[%d], _errorPos[%d], _errorHandle[%p], suspendCount[%d]\n",
- _ferror, _errorSource, _errorSuspend, _pos, _errorPos, _errorHandle, _suspendCount);
+ _ferror, _errorSource, _errorSuspend, _pos, _errorPos, _errorHandle, _suspendCount);
DEBUG_EXIT_FUNC();
return _ferror;
@@ -142,7 +142,7 @@ int32 PSPIoStream::size() const {
bool PSPIoStream::seek(int32 offs, int whence) {
DEBUG_ENTER_FUNC();
-
+
// Check if we can access the file
if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
PSP_DEBUG_PRINT_FUNC("Suspended\n");
@@ -155,8 +155,7 @@ bool PSPIoStream::seek(int32 offs, int whence) {
clearerr((FILE *)_handle);
_feof = feof((FILE *)_handle);
_errorSource = 3;
- }
- else { // everything ok
+ } else { // everything ok
_feof = false; // Reset eof flag since we know it was ok
}
@@ -173,7 +172,7 @@ uint32 PSPIoStream::read(void *ptr, uint32 len) {
// Check if we can access the file
if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
PSP_DEBUG_PRINT_FUNC("Suspended\n");
-
+
PSP_DEBUG_PRINT_FUNC("filename[%s], len[%d]\n", _path.c_str(), len);
size_t ret = fread((byte *)ptr, 1, len, (FILE *)_handle);
@@ -203,8 +202,8 @@ uint32 PSPIoStream::write(const void *ptr, uint32 len) {
if (PowerMan.beginCriticalSection() == PowerManager::Blocked)
PSP_DEBUG_PRINT_FUNC("Suspended\n");
- PSP_DEBUG_PRINT_FUNC("filename[%s], len[%d]\n", _path.c_str(), len);
-
+ PSP_DEBUG_PRINT_FUNC("filename[%s], len[%d]\n", _path.c_str(), len);
+
size_t ret = fwrite(ptr, 1, len, (FILE *)_handle);
_pos += ret;
@@ -255,7 +254,7 @@ PSPIoStream *PSPIoStream::makeFromPath(const Common::String &path, bool writeMod
delete stream;
stream = 0;
}
-
+
DEBUG_EXIT_FUNC();
return stream;
}
diff --git a/backends/fs/psp/psp-stream.h b/backends/fs/psp/psp-stream.h
index 20836ddf32..9fcdd6d606 100644
--- a/backends/fs/psp/psp-stream.h
+++ b/backends/fs/psp/psp-stream.h
@@ -55,7 +55,7 @@ protected:
int _suspendCount;
public:
-
+
const char *getObjectName() const { return "PSPIoStream"; }
/**
* Given a path, invoke fopen on that path and wrap the result in a