[Scummvm-cvs-logs] SF.net SVN: scummvm:[34694] scummvm/trunk/engines/scumm/he
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Sep 30 11:09:41 CEST 2008
Revision: 34694
http://scummvm.svn.sourceforge.net/scummvm/?rev=34694&view=rev
Author: fingolfin
Date: 2008-09-30 09:09:39 +0000 (Tue, 30 Sep 2008)
Log Message:
-----------
SCUMM HE: Use FilesystemNode::openForReading() instead of 'new Common::File' (didn't cover all instances, though)
Modified Paths:
--------------
scummvm/trunk/engines/scumm/he/resource_he.cpp
scummvm/trunk/engines/scumm/he/resource_he.h
scummvm/trunk/engines/scumm/he/script_v60he.cpp
Modified: scummvm/trunk/engines/scumm/he/resource_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.cpp 2008-09-30 09:08:17 UTC (rev 34693)
+++ scummvm/trunk/engines/scumm/he/resource_he.cpp 2008-09-30 09:09:39 UTC (rev 34694)
@@ -159,15 +159,16 @@
/* initiate stuff */
fi.memory = NULL;
- fi.file = new Common::File;
+ fi.file = NULL;
if (_fileName.empty()) { // We are running for the first time
_fileName = _vm->generateFilename(-3);
}
/* get file size */
- fi.file->open(_fileName);
- if (!fi.file->isOpen()) {
+ Common::FilesystemNode node(_fileName);
+ fi.file = node.openForReading();
+ if (!fi.file) {
error("Cannot open file %s", _fileName.c_str());
}
@@ -199,12 +200,8 @@
/* free stuff and close file */
cleanup:
- if (fi.file != NULL) {
- fi.file->close();
- delete fi.file;
- }
- if (fi.memory != NULL)
- free(fi.memory);
+ delete fi.file;
+ free(fi.memory);
return ressize;
}
Modified: scummvm/trunk/engines/scumm/he/resource_he.h
===================================================================
--- scummvm/trunk/engines/scumm/he/resource_he.h 2008-09-30 09:08:17 UTC (rev 34693)
+++ scummvm/trunk/engines/scumm/he/resource_he.h 2008-09-30 09:09:39 UTC (rev 34694)
@@ -168,7 +168,7 @@
#include "common/pack-start.h" // START STRUCT PACKING
struct WinLibrary {
- Common::File *file;
+ Common::SeekableReadStream *file;
byte *memory;
byte *first_resource;
int total_size;
Modified: scummvm/trunk/engines/scumm/he/script_v60he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/script_v60he.cpp 2008-09-30 09:08:17 UTC (rev 34693)
+++ scummvm/trunk/engines/scumm/he/script_v60he.cpp 2008-09-30 09:09:39 UTC (rev 34694)
@@ -1010,12 +1010,8 @@
// TODO / FIXME: Consider using listSavefiles to avoid unneccessary openForLoading calls
_hInFileTable[slot] = _saveFileMan->openForLoading(filename);
if (_hInFileTable[slot] == 0) {
- Common::File *f = new Common::File();
- f->open(filename);
- if (!f->isOpen())
- delete f;
- else
- _hInFileTable[slot] = f;
+ Common::FilesystemNode node(filename);
+ _hInFileTable[slot] = node.openForReading();
}
break;
case 2:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list