[Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.63,1.64
Robert Göffringmann
lavosspawn at users.sourceforge.net
Tue Oct 25 23:32:14 CEST 2005
Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26991/sword1
Modified Files:
control.cpp
Log Message:
added call to OutSaveFile::flush() and some more I/O error checks
Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- control.cpp 26 Oct 2005 06:16:14 -0000 1.63
+++ control.cpp 26 Oct 2005 06:30:28 -0000 1.64
@@ -750,7 +750,7 @@
if (!outf) {
// Display an error message, and do nothing
- displayMessage(0, "Unable to write to path '%s'", _saveFileMan->getSavePath());
+ displayMessage(0, "Can't create SAVEGAME.INF in directory '%s'", _saveFileMan->getSavePath());
return;
}
@@ -765,6 +765,9 @@
else
outf->writeByte(255);
}
+ outf->flush();
+ if (outf->ioFailed())
+ displayMessage(0, "Can't write to SAVEGAME.INF in directory '%s'. Device full?", _saveFileMan->getSavePath());
delete outf;
}
@@ -934,7 +937,7 @@
Common::OutSaveFile *outf;
outf = _saveFileMan->openForSaving(fName);
if (!outf) {
- // Display an error message, and do nothing
+ // Display an error message and do nothing
displayMessage(0, "Unable to create file '%s' in directory '%s'", fName, _saveFileMan->getSavePath());
return;
}
@@ -957,6 +960,9 @@
uint32 *playerRaw = (uint32*)cpt;
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++)
outf->writeUint32LE(playerRaw[cnt2]);
+ outf->flush();
+ if (outf->ioFailed())
+ displayMessage(0, "Couldn't write to file '%s' in directory '%s'. Device full?", fName, _saveFileMan->getSavePath());
delete outf;
}
@@ -991,6 +997,13 @@
for (uint32 cnt2 = 0; cnt2 < playerSize; cnt2++)
playerBuf[cnt2] = inf->readUint32LE();
+ if (inf->ioFailed()) {
+ displayMessage(0, "Can't read from file '%s' in directory '%s'", fName, _saveFileMan->getSavePath());
+ delete inf;
+ free(_restoreBuf);
+ _restoreBuf = NULL;
+ return false;
+ }
delete inf;
return true;
}
More information about the Scummvm-git-logs
mailing list