[Scummvm-cvs-logs] SF.net SVN: scummvm:[52387] scummvm/trunk/backends/fs/psp/psp-stream.cpp

Bluddy at users.sourceforge.net Bluddy at users.sourceforge.net
Wed Aug 25 15:26:30 CEST 2010


Revision: 52387
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52387&view=rev
Author:   Bluddy
Date:     2010-08-25 13:26:30 +0000 (Wed, 25 Aug 2010)

Log Message:
-----------
PSP: fixed flag to open()

I was missing a flag (PSP_O_TRUNC) causing the config file to be opened on top of the old file, causing file corruption.

Modified Paths:
--------------
    scummvm/trunk/backends/fs/psp/psp-stream.cpp

Modified: scummvm/trunk/backends/fs/psp/psp-stream.cpp
===================================================================
--- scummvm/trunk/backends/fs/psp/psp-stream.cpp	2010-08-25 12:03:43 UTC (rev 52386)
+++ scummvm/trunk/backends/fs/psp/psp-stream.cpp	2010-08-25 13:26:30 UTC (rev 52387)
@@ -93,7 +93,7 @@
 		PSP_DEBUG_PRINT_FUNC("suspended\n");
 	}
 
-	_handle = sceIoOpen(_path.c_str(), _writeMode ? PSP_O_RDWR | PSP_O_CREAT : PSP_O_RDONLY, 0777);
+	_handle = sceIoOpen(_path.c_str(), _writeMode ? PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC : PSP_O_RDONLY, 0777);
 	if (!_handle) {
 		_error = true;
 		_handle = NULL;
@@ -228,8 +228,7 @@
 
 uint32 PspIoStream::write(const void *ptr, uint32 len) {
 	DEBUG_ENTER_FUNC();
-	PSP_DEBUG_PRINT_FUNC("filename[%s], len[0x%x], ptr[%p], _pos[%x], _physPos[%x] buf[%x %x %x %x..%x %x]\n", _path.c_str(), len, ptr, _pos, _physicalPos, ((byte *)ptr)[0], ((byte *)ptr)[1], ((byte *)ptr)[2], ((byte *)ptr)[3], ((byte *)ptr)[len - 2],
-	((byte *)ptr)[len - 1]);
+	PSP_DEBUG_PRINT_FUNC("filename[%s], len[0x%x], ptr[%p], _pos[%x], _physPos[%x]\n", _path.c_str(), len, ptr, _pos, _physicalPos);
 
 	if (!len || _error)		// we actually get some calls with len == 0!
 		return 0;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list