Permalink
Browse files

PSP: Fix invalid return type of PspIoStream

The underlying API returns a SceUID, which is not valid to be
casted to a pointer.
  • Loading branch information...
csnover authored and sev- committed Oct 28, 2017
1 parent c494123 commit 452e979101da7586042bbe07691b99773e398f1e
Showing with 5 additions and 5 deletions.
  1. +4 −4 backends/fs/psp/psp-stream.cpp
  2. +1 −1 backends/fs/psp/psp-stream.h
@@ -82,7 +82,7 @@ PspIoStream::~PspIoStream() {
/* Function to open the file pointed to by the path.
*
*/
void *PspIoStream::open() {
SceUID PspIoStream::open() {
DEBUG_ENTER_FUNC();

if (PowerMan.beginCriticalSection()) {
@@ -91,9 +91,9 @@ void *PspIoStream::open() {
}

_handle = sceIoOpen(_path.c_str(), _writeMode ? PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC : PSP_O_RDONLY, 0777);
if (!_handle) {
if (_handle <= 0) {
_error = true;
_handle = NULL;
_handle = 0;
}

// Get the file size. This way is much faster than going to the end of the file and back
@@ -107,7 +107,7 @@ void *PspIoStream::open() {

PowerMan.endCriticalSection();

return (void *)_handle;
return _handle;
}

bool PspIoStream::err() const {
@@ -69,7 +69,7 @@ class PspIoStream : public Common::SeekableReadStream, public Common::WriteStrea
PspIoStream(const Common::String &path, bool writeMode);
virtual ~PspIoStream();

void * open(); // open the file pointed to by the file path
SceUID open(); // open the file pointed to by the file path

bool err() const;
void clearErr();

0 comments on commit 452e979

Please sign in to comment.