[Scummvm-cvs-logs] CVS: scummvm/gob dataio.cpp,1.6,1.7 dataio.h,1.4,1.5

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Tue May 3 01:37:41 CEST 2005


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

Modified Files:
	dataio.cpp dataio.h 
Log Message:
Use File::size() instead of stat() to find the size of a file.


Index: dataio.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/dataio.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- dataio.cpp	9 Apr 2005 19:32:28 -0000	1.6
+++ dataio.cpp	3 May 2005 08:37:03 -0000	1.7
@@ -320,17 +320,20 @@
 int32 data_getDataSize(const char *name) {
 	char buf[128];
 	int32 chunkSz;
-	struct stat statBuf;
+	File file;
 
 	strcpy(buf, name);
 	chunkSz = data_getChunkSize(buf);
 	if (chunkSz >= 0)
 		return chunkSz;
 
-	if (stat(buf, &statBuf) == -1)
-		error("data_getDataSize: Can't find data (%s)", name);
+	if (!file.open(buf))
+		error("data_getDataSize: Can't find data(%s)", name);
 
-	return statBuf.st_size;
+	chunkSz = file.size();
+	file.close();
+
+	return chunkSz;
 }
 
 char *data_getData(const char *path) {
@@ -359,7 +362,6 @@
 	data_readData(handle, ptr, size);
 	data_closeData(handle);
 	return data;
-
 }
 
 char *data_getSmallData(const char *path) {

Index: dataio.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gob/dataio.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dataio.h	9 Apr 2005 19:19:53 -0000	1.4
+++ dataio.h	3 May 2005 08:37:04 -0000	1.5
@@ -23,7 +23,6 @@
 #define GOB_DATAIO_H
 
 #include "common/file.h"
-#include <sys/stat.h>
 
 namespace Gob {
 





More information about the Scummvm-git-logs mailing list