[Scummvm-cvs-logs] CVS: scummvm/common file.cpp,1.20,1.21 file.h,1.10,1.11

Max Horn fingolfin at users.sourceforge.net
Mon Dec 23 18:03:04 CET 2002


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv11777

Modified Files:
	file.cpp file.h 
Log Message:
File object stores file name (useful for debugging)

Index: file.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/file.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- file.cpp	2 Nov 2002 10:51:32 -0000	1.20
+++ file.cpp	24 Dec 2002 02:02:53 -0000	1.21
@@ -86,9 +86,11 @@
 	_handle = NULL;
 	_ioFailed = false;
 	_encbyte = 0;
+	_name = 0;
 }
 
 File::~File() {
+	delete [] _name;
 	close();
 }
 
@@ -123,6 +125,10 @@
 	}
 
 	_encbyte = encbyte;
+	
+	int len = strlen(filename);
+	_name = new char[len+1];
+	memcpy(_name, filename, len+1);
 
 	return true;
 }

Index: file.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/file.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- file.h	10 Nov 2002 14:54:21 -0000	1.10
+++ file.h	24 Dec 2002 02:02:53 -0000	1.11
@@ -32,6 +32,7 @@
 	FILE * _handle;
 	bool _ioFailed;
 	byte _encbyte;
+	char *_name;	// For debugging
 
 	FILE *fopenNoCase(const char *filename, const char *directory, const char *mode);
 
@@ -51,6 +52,7 @@
 	bool eof();
 	uint32 pos();
 	uint32 size();
+	const char *name() const { return _name; }
 	void seek(int32 offs, int whence);
 	uint32 read(void *ptr, uint32 size);
 	byte readByte();





More information about the Scummvm-git-logs mailing list