[Scummvm-cvs-logs] SF.net SVN: scummvm:[34710] scummvm/trunk/engines/agi
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Tue Sep 30 18:38:50 CEST 2008
Revision: 34710
http://scummvm.svn.sourceforge.net/scummvm/?rev=34710&view=rev
Author: fingolfin
Date: 2008-09-30 16:38:46 +0000 (Tue, 30 Sep 2008)
Log Message:
-----------
AGI: Got rid of yet another unwarranted use of FSNode::getPath
Modified Paths:
--------------
scummvm/trunk/engines/agi/detection.cpp
scummvm/trunk/engines/agi/wagparser.cpp
scummvm/trunk/engines/agi/wagparser.h
Modified: scummvm/trunk/engines/agi/detection.cpp
===================================================================
--- scummvm/trunk/engines/agi/detection.cpp 2008-09-30 16:34:38 UTC (rev 34709)
+++ scummvm/trunk/engines/agi/detection.cpp 2008-09-30 16:38:46 UTC (rev 34710)
@@ -2207,7 +2207,7 @@
bool matchedUsingWag = false;
int wagFileCount = 0;
WagFileParser wagFileParser;
- Common::String wagFilePath;
+ Common::FilesystemNode wagFileNode;
Common::String description;
Common::FSList fslistCurrentDir; // Only used if fslist == NULL
@@ -2246,7 +2246,7 @@
if (filename.hasSuffix(".wag")) {
// Save latest found *.wag file's path (Can be used to open the file, the name can't)
- wagFilePath = file->getPath();
+ wagFileNode = *file;
wagFileCount++; // Count found *.wag files
}
}
@@ -2298,7 +2298,7 @@
// WinAGI produces *.wag file with interpreter version, game name and other parameters.
// If there's exactly one *.wag file and it parses successfully then we'll use its information.
- if (wagFileCount == 1 && wagFileParser.parse(wagFilePath.c_str())) {
+ if (wagFileCount == 1 && wagFileParser.parse(wagFileNode)) {
matchedUsingWag = true;
const WagProperty *wagAgiVer = wagFileParser.getProperty(WagProperty::PC_INTVERSION);
Modified: scummvm/trunk/engines/agi/wagparser.cpp
===================================================================
--- scummvm/trunk/engines/agi/wagparser.cpp 2008-09-30 16:34:38 UTC (rev 34709)
+++ scummvm/trunk/engines/agi/wagparser.cpp 2008-09-30 16:38:46 UTC (rev 34710)
@@ -173,14 +173,14 @@
}
}
-bool WagFileParser::parse(const char *filename) {
+bool WagFileParser::parse(const Common::FilesystemNode &node) {
Common::File file;
WagProperty property; // Temporary property used for reading
Common::MemoryReadStream *stream = NULL; // The file is to be read fully into memory and handled using this
_parsedOk = false; // We haven't parsed the file yet
- if (file.open(filename)) { // Open the file
+ if (file.open(node)) { // Open the file
stream = file.readStream(file.size()); // Read the file into memory
if (stream != NULL && stream->size() == file.size()) { // Check that the whole file was read into memory
if (checkWagVersion(*stream)) { // Check that WinAGI version string is valid
@@ -202,15 +202,15 @@
_parsedOk = endOfProperties(*stream) && property.readOk();
if (!_parsedOk) // Error parsing stream
- warning("Error parsing WAG file (%s). WAG file ignored", filename);
+ warning("Error parsing WAG file (%s). WAG file ignored", node.getPath().c_str());
} else // Invalid WinAGI version string or it couldn't be read
- warning("Invalid WAG file (%s) version or error reading it. WAG file ignored", filename);
+ warning("Invalid WAG file (%s) version or error reading it. WAG file ignored", node.getPath().c_str());
} else // Couldn't fully read file into memory
- warning("Error reading WAG file (%s) into memory. WAG file ignored", filename);
+ warning("Error reading WAG file (%s) into memory. WAG file ignored", node.getPath().c_str());
} else // Couldn't open file
- warning("Couldn't open WAG file (%s). WAG file ignored", filename);
+ warning("Couldn't open WAG file (%s). WAG file ignored", node.getPath().c_str());
- if (stream != NULL) delete stream; // If file was read into memory, deallocate that buffer
+ delete stream;
return _parsedOk;
}
Modified: scummvm/trunk/engines/agi/wagparser.h
===================================================================
--- scummvm/trunk/engines/agi/wagparser.h 2008-09-30 16:34:38 UTC (rev 34709)
+++ scummvm/trunk/engines/agi/wagparser.h 2008-09-30 16:38:46 UTC (rev 34710)
@@ -223,7 +223,7 @@
* @param filename Name of the file to be parsed.
* @return True if parsed successfully, false otherwise.
*/
- bool parse(const char *filename);
+ bool parse(const Common::FilesystemNode &node);
/**
* Get list of the loaded properties.
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