[Scummvm-cvs-logs] CVS: scummvm/sky control.cpp,1.98.2.1,1.98.2.2
Robert Göffringmann
lavosspawn at users.sourceforge.net
Tue Oct 25 23:09:27 CEST 2005
Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24067/sky
Modified Files:
Tag: branch-0-8-0
control.cpp
Log Message:
copied from CVS head:
call OutSaveFile::flush() to check for errors
Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.cpp,v
retrieving revision 1.98.2.1
retrieving revision 1.98.2.2
diff -u -d -r1.98.2.1 -r1.98.2.2
--- control.cpp 18 Oct 2005 02:11:26 -0000 1.98.2.1
+++ control.cpp 26 Oct 2005 06:08:37 -0000 1.98.2.2
@@ -1098,10 +1098,16 @@
Common::OutSaveFile *outf;
outf = _saveFileMan->openForSaving("SKY-VM.SAV");
- if (outf != NULL) {
+ bool ioFailed = true;
+ if (outf) {
outf->write(tmpBuf, tmpPos - tmpBuf);
+ outf->flush();
+ if (!outf->ioFailed())
+ ioFailed = false;
delete outf;
}
+ if (ioFailed)
+ displayMessage(NULL, "Unable to store Savegame names to file SKY-VM.SAV in directory %s", _saveFileMan->getSavePath());
free(tmpBuf);
}
@@ -1121,7 +1127,10 @@
uint8 *saveData = (uint8 *)malloc(0x20000);
uint32 fSize = prepareSaveData(saveData);
- if (outf->write(saveData, fSize) != fSize)
+ outf->write(saveData, fSize);
+ outf->flush();
+
+ if (outf->ioFailed())
displayMessage(0, "Unable to write autosave file '%s' in directory '%s'. Disk full?", fName, _saveFileMan->getSavePath());
delete outf;
@@ -1134,21 +1143,20 @@
Common::OutSaveFile *outf;
outf = _saveFileMan->openForSaving(fName);
- if (outf == NULL) {
+ if (outf == NULL)
return NO_DISK_SPACE;
- }
uint8 *saveData = (uint8 *)malloc(0x20000);
uint32 fSize = prepareSaveData(saveData);
- if (outf->write(saveData, fSize) != fSize) {
- free(saveData);
- delete outf;
- return NO_DISK_SPACE;
- }
- delete outf;
+ uint32 writeRes = outf->write(saveData, fSize);
+ outf->flush();
+ if (outf->ioFailed())
+ writeRes = 0;
free(saveData);
- return GAME_SAVED;
+ delete outf;
+
+ return (writeRes == fSize) ? GAME_SAVED : NO_DISK_SPACE;
}
#define STOSD(ptr, val) { *(uint32 *)(ptr) = TO_LE_32(val); (ptr) += 4; }
More information about the Scummvm-git-logs
mailing list