[Scummvm-cvs-logs] CVS: scummvm/simon res.cpp,1.2,1.3 simon.cpp,1.13,1.14

Max Horn fingolfin at users.sourceforge.net
Mon Oct 21 05:35:05 CEST 2002


Update of /cvsroot/scummvm/scummvm/simon
In directory usw-pr-cvs1:/tmp/cvs-serv17075/simon

Modified Files:
	res.cpp simon.cpp 
Log Message:
use File::size() method were it makes sense; one small change to simon.cpp based on comment on bug #595813

Index: res.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/res.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- res.cpp	16 Sep 2002 08:22:30 -0000	1.2
+++ res.cpp	21 Oct 2002 12:34:54 -0000	1.3
@@ -123,13 +123,11 @@
 	if (in->isOpen() == false)
 		return false;
 
-	in->seek(0, SEEK_END);
-	file_size = in->pos();
+	file_size = in->size();
 
 	_tbl_list = (byte *)malloc(file_size);
 	if (_tbl_list == NULL)
 		error("Out of memory for strip table list");
-	in->seek(0, SEEK_SET);
 	in->read(_tbl_list, file_size);
 	in->close();
 
@@ -143,12 +141,10 @@
 	if (in->isOpen() == false)
 		return false;
 
-	in->seek(0, SEEK_END);
-	file_size = in->pos();
+	file_size = in->size();
 	_stripped_txt_mem = (byte *)malloc(file_size);
 	if (_stripped_txt_mem == NULL)
 		error("Out of memory for strip text list");
-	in->seek(0, SEEK_SET);
 	in->read(_stripped_txt_mem, file_size);
 	in->close();
 

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- simon.cpp	20 Oct 2002 18:12:11 -0000	1.13
+++ simon.cpp	21 Oct 2002 12:34:54 -0000	1.14
@@ -869,9 +869,7 @@
 	if (fo.isOpen() == false)
 		error("loadTextFile: Cannot open '%s'", filename);
 
-	fo.seek(0, SEEK_END);
-	size = fo.pos();
-	fo.seek(0, SEEK_SET);
+	size = fo.size();
 
 	if (fo.read(dst, size) != size)
 		error("loadTextFile: fread failed");
@@ -1421,15 +1419,12 @@
 	if (in.isOpen() == false)
 		error("Cannot open icon.dat");
 
-	in.seek(0, SEEK_END);
-	size = in.pos();
+	size = in.size();
 
 	_icon_file_ptr = (byte *)malloc(size);
 	if (_icon_file_ptr == NULL)
 		error("Out of icon memory");
 
-	in.seek(0, SEEK_SET);
-
 	in.read(_icon_file_ptr, size);
 	in.close();
 }
@@ -3276,10 +3271,7 @@
 			return;
 		}
 
-		in.seek(0, SEEK_END);
-		size = in.pos();
-
-		in.seek(0, SEEK_SET);
+		size = in.size();
 
 		/* stop all sounds */
 		_mixer->stopAll();
@@ -4036,9 +4028,7 @@
 			return;
 		}
 
-		in.seek(0, SEEK_END);
-		size = in.pos();
-		in.seek(0, SEEK_SET);
+		size = in.size();
 
 		if (in.read(_vga_buffer_pointers[11].vgaFile2, size) != size)
 			error("read_vga_from_datfile_1: read failed");
@@ -4066,9 +4056,7 @@
 		if (in.isOpen() == false)
 			error("read_vga_from_datfile_2: cannot open %s", buf);
 
-		in.seek(0, SEEK_END);
-		size = in.pos();
-		in.seek(0, SEEK_SET);
+		size = in.size();
 
 		dst = setup_vga_destination(size);
 
@@ -4880,10 +4868,7 @@
 
 	/* FIXME: not properly implemented */
 	if (_game & GAME_WIN) {
-		int32 offset = _game_offsets_ptr[gss->MUSIC_INDEX_BASE + music];
-		if (_game & GAME_SIMON2)
-			offset--;
-		_game_file->seek(offset, SEEK_SET);
+		_game_file->seek(_game_offsets_ptr[gss->MUSIC_INDEX_BASE + music], SEEK_SET);
 		File *f = _game_file;
 		midi.read_all_songs(f);
 	} else {





More information about the Scummvm-git-logs mailing list