[Scummvm-cvs-logs] CVS: scummvm/simon saveload.cpp,1.6,1.7

Max Horn fingolfin at users.sourceforge.net
Wed Apr 13 11:39:03 CEST 2005


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12854/simon

Modified Files:
	saveload.cpp 
Log Message:
Get rid of errno; add some (optional) error checking facilities to SaveFile classes (they are ugly, and to simple, but better than nothing)

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/saveload.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- saveload.cpp	10 Apr 2005 15:13:38 -0000	1.6
+++ saveload.cpp	13 Apr 2005 18:36:54 -0000	1.7
@@ -21,13 +21,6 @@
 
 #include "stdafx.h"
 
-#ifndef _WIN32_WCE
-// FIXME TODO FIXME: Using errno is not really portable!
-// We should get rid of this, possibly by adding (clear)ioFailed methods
-// to the SaveFile class.
-#include <errno.h>
-#endif
-
 #include "gui/about.h"
 #include "gui/message.h"
 
@@ -413,11 +406,6 @@
 
 	_lock_word |= 0x100;
 
-#ifndef _WIN32_WCE
-	errno = 0;
-#endif
-
-
 	f = _saveFileMan->openForSaving(gen_savename(slot));
 	if (f == NULL) {
 		_lock_word &= ~0x100;
@@ -514,11 +502,6 @@
 
 	_lock_word |= 0x100;
 
-#ifndef _WIN32_WCE
-	errno = 0;
-#endif
-
-
 	f = _saveFileMan->openForLoading(gen_savename(slot));
 	if (f == NULL) {
 		_lock_word &= ~0x100;
@@ -606,6 +589,10 @@
 	// Write the bits in array 1 & 2
 	for (i = 0; i != 32; i++)
 		_bit_array[i] = f->readUint16BE();
+	
+	if (f->readingFailed()) {
+		error("load failed");
+	}
 
 	delete f;
 
@@ -613,11 +600,6 @@
 
 	_lock_word &= ~0x100;
 
-#ifndef _WIN32_WCE
-	if (errno != 0)
-		error("load failed");
-#endif
-
 	return true;
 }
 





More information about the Scummvm-git-logs mailing list