diff options
author | Einar Johan Trøan Sømåen | 2012-07-26 04:12:58 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-07-26 04:12:58 +0200 |
commit | 38507fa9895620639d8733dbb4e085dfb2282a33 (patch) | |
tree | 2b246fa93ce4ec173ac3db77e8cbacc562c6bb20 /engines/wintermute/base/file | |
parent | 1ad859a468415cc7fd93adaa84beba02aae29ad8 (diff) | |
download | scummvm-rg350-38507fa9895620639d8733dbb4e085dfb2282a33.tar.gz scummvm-rg350-38507fa9895620639d8733dbb4e085dfb2282a33.tar.bz2 scummvm-rg350-38507fa9895620639d8733dbb4e085dfb2282a33.zip |
WINTERMUTE: AStyle-formatting.
Diffstat (limited to 'engines/wintermute/base/file')
-rw-r--r-- | engines/wintermute/base/file/base_disk_file.cpp | 8 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_disk_file.h | 2 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_file_entry.cpp | 10 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_package.cpp | 40 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_package.h | 6 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_resources.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/base/file/base_resources.h | 2 | ||||
-rw-r--r-- | engines/wintermute/base/file/dcpackage.h | 4 |
8 files changed, 37 insertions, 37 deletions
diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp index 1598101036..bb8504d2f4 100644 --- a/engines/wintermute/base/file/base_disk_file.cpp +++ b/engines/wintermute/base/file/base_disk_file.cpp @@ -46,7 +46,7 @@ void correctSlashes(char *fileName) { }
// Parse a relative path in the game-folder, and if it exists, return a FSNode to it.
-static Common::FSNode getNodeForRelativePath(const Common::String& filename) {
+static Common::FSNode getNodeForRelativePath(const Common::String &filename) {
// The filename can be an explicit path, thus we need to chop it up, expecting the path the game
// specifies to follow the Windows-convention of folder\subfolder\file (absolute paths should not happen)
@@ -88,11 +88,11 @@ static Common::FSNode getNodeForRelativePath(const Common::String& filename) { return Common::FSNode();
}
-bool diskFileExists(const Common::String& filename) {
+bool diskFileExists(const Common::String &filename) {
// Try directly from SearchMan first
Common::ArchiveMemberList files;
SearchMan.listMatchingMembers(files, filename);
-
+
for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); it++) {
if ((*it)->getName() == filename) {
return true;
@@ -112,7 +112,7 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { // Try directly from SearchMan first
Common::ArchiveMemberList files;
SearchMan.listMatchingMembers(files, filename);
-
+
for (Common::ArchiveMemberList::iterator it = files.begin(); it != files.end(); it++) {
if ((*it)->getName() == filename) {
file = (*it)->createReadStream();
diff --git a/engines/wintermute/base/file/base_disk_file.h b/engines/wintermute/base/file/base_disk_file.h index 0653b2e854..99a9e8b9a3 100644 --- a/engines/wintermute/base/file/base_disk_file.h +++ b/engines/wintermute/base/file/base_disk_file.h @@ -34,7 +34,7 @@ namespace WinterMute {
Common::SeekableReadStream *openDiskFile(const Common::String &filename);
-bool diskFileExists(const Common::String& filename);
+bool diskFileExists(const Common::String &filename);
} // end of namespace WinterMute
diff --git a/engines/wintermute/base/file/base_file_entry.cpp b/engines/wintermute/base/file/base_file_entry.cpp index 5032650704..8282079c86 100644 --- a/engines/wintermute/base/file/base_file_entry.cpp +++ b/engines/wintermute/base/file/base_file_entry.cpp @@ -62,11 +62,11 @@ public: Common::SeekableReadStream *BaseFileEntry::createReadStream() const {
Common::SeekableReadStream *file = _package->getFilePointer();
if (!file) return NULL;
-
+
// TODO: Cleanup
bool compressed = (_compressedLength != 0);
/* _size = fileEntry->_length; */
-
+
if (compressed) {
// TODO: Really, most of this logic might be doable directly in the fileEntry?
// But for now, this should get us rolling atleast.
@@ -77,14 +77,14 @@ Common::SeekableReadStream *BaseFileEntry::createReadStream() const { if (file->size() == 0) {
file = new CBPkgFile(file, _length);
}
-
+
file->seek(0);
-
+
return file;
}
//////////////////////////////////////////////////////////////////////////
-BaseFileEntry::BaseFileEntry(){
+BaseFileEntry::BaseFileEntry() {
_package = NULL;
_length = _compressedLength = _offset = _flags = 0;
_filename = "";
diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index 90bb027042..f2d2378c6a 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -51,33 +51,33 @@ Common::SeekableReadStream *BasePackage::getFilePointer() { static bool findPackageSignature(Common::SeekableReadStream *f, uint32 *offset) {
byte buf[32768];
-
+
byte signature[8];
((uint32 *)signature)[0] = PACKAGE_MAGIC_1;
((uint32 *)signature)[1] = PACKAGE_MAGIC_2;
-
+
uint32 fileSize = (uint32)f->size();
uint32 startPos = 1024 * 1024;
uint32 bytesRead = startPos;
-
+
while (bytesRead < fileSize - 16) {
uint32 toRead = MIN((unsigned int)32768, fileSize - bytesRead);
f->seek((int32)startPos, SEEK_SET);
uint32 actuallyRead = f->read(buf, toRead);
if (actuallyRead != toRead) return false;
-
+
for (uint32 i = 0; i < toRead - 8; i++)
if (!memcmp(buf + i, signature, 8)) {
*offset = startPos + i;
return true;
}
-
+
bytesRead = bytesRead + toRead - 16;
startPos = startPos + toRead - 16;
-
+
}
return false;
-
+
}
PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool searchSignature) {
@@ -98,7 +98,7 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool boundToExe = true;
}
}
-
+
TPackageHeader hdr;
hdr.readFromStream(stream);
if (hdr._magic1 != PACKAGE_MAGIC_1 || hdr._magic2 != PACKAGE_MAGIC_2 || hdr._packageVersion > PACKAGE_VERSION) {
@@ -106,7 +106,7 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool delete stream;
return;
}
-
+
if (hdr._packageVersion != PACKAGE_VERSION) {
debugC(kWinterMuteDebugFileAccess | kWinterMuteDebugLog, " Warning: package file '%s' is outdated.", filename.c_str());
}
@@ -125,7 +125,7 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool pkg->_fsnode = file;
pkg->_boundToExe = boundToExe;
-
+
// read package info
byte nameLength = stream->readByte();
char *pkgName = new char[nameLength];
@@ -141,15 +141,15 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool // read file entries
uint32 numFiles = stream->readUint32LE();
-
+
for (uint32 j = 0; j < numFiles; j++) {
char *name;
uint32 offset, length, compLength, flags, timeDate1, timeDate2;
-
+
nameLength = stream->readByte();
name = new char[nameLength];
stream->read(name, nameLength);
-
+
// v2 - xor name
if (hdr._packageVersion == PACKAGE_VERSION) {
for (int k = 0; k < nameLength; k++) {
@@ -157,18 +157,18 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool }
}
debugC(kWinterMuteDebugFileAccess, "Package contains %s", name);
-
+
Common::String upcName = name;
upcName.toUppercase();
delete[] name;
name = NULL;
-
+
offset = stream->readUint32LE();
offset += absoluteOffset;
length = stream->readUint32LE();
compLength = stream->readUint32LE();
flags = stream->readUint32LE();
-
+
if (hdr._packageVersion == PACKAGE_VERSION) {
timeDate1 = stream->readUint32LE();
timeDate2 = stream->readUint32LE();
@@ -181,12 +181,12 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool fileEntry->_length = length;
fileEntry->_compressedLength = compLength;
fileEntry->_flags = flags;
-
+
_files[upcName] = Common::ArchiveMemberPtr(fileEntry);
} else {
// current package has higher priority than the registered
// TODO: This cast might be a bit ugly.
- BaseFileEntry *filePtr = (BaseFileEntry*) &*(_filesIter->_value);
+ BaseFileEntry *filePtr = (BaseFileEntry *) &*(_filesIter->_value);
if (pkg->_priority > filePtr->_package->_priority) {
filePtr->_package = pkg;
filePtr->_offset = offset;
@@ -198,12 +198,12 @@ PackageSet::PackageSet(Common::FSNode file, const Common::String &filename, bool }
}
debugC(kWinterMuteDebugFileAccess, " Registered %d files in %d package(s)", _files.size(), _packages.size());
-
+
delete stream;
}
PackageSet::~PackageSet() {
- for (Common::Array<BasePackage*>::iterator it = _packages.begin(); it != _packages.end(); it++) {
+ for (Common::Array<BasePackage *>::iterator it = _packages.begin(); it != _packages.end(); it++) {
delete *it;
}
_packages.clear();
diff --git a/engines/wintermute/base/file/base_package.h b/engines/wintermute/base/file/base_package.h index b9a7bc5934..a562229f65 100644 --- a/engines/wintermute/base/file/base_package.h +++ b/engines/wintermute/base/file/base_package.h @@ -48,7 +48,7 @@ public: class PackageSet : public Common::Archive {
public:
virtual ~PackageSet();
-
+
PackageSet(Common::FSNode package, const Common::String &filename = "", bool searchSignature = false);
/**
* Check if a member with the given name is present in the Archive.
@@ -64,12 +64,12 @@ public: * @return the number of names added to list
*/
virtual int listMembers(Common::ArchiveMemberList &list) const;
-
+
/**
* Returns a ArchiveMember representation of the given file.
*/
virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
-
+
/**
* Create a stream bound to a member with the specified name in the
* archive. If no member with this name exists, 0 is returned.
diff --git a/engines/wintermute/base/file/base_resources.cpp b/engines/wintermute/base/file/base_resources.cpp index 73c06271d7..aac5436071 100644 --- a/engines/wintermute/base/file/base_resources.cpp +++ b/engines/wintermute/base/file/base_resources.cpp @@ -2816,7 +2816,7 @@ Common::SeekableReadStream *BaseResources::getFile(const Common::String &filenam return NULL;
}
-bool BaseResources::hasFile(const Common::String& filename) {
+bool BaseResources::hasFile(const Common::String &filename) {
if (scumm_stricmp(filename.c_str(), "invalid.bmp") == 0) {
return true;
} else if (scumm_stricmp(filename.c_str(), "invalid_debug.bmp") == 0) {
diff --git a/engines/wintermute/base/file/base_resources.h b/engines/wintermute/base/file/base_resources.h index 2959f9882f..2ccab6996f 100644 --- a/engines/wintermute/base/file/base_resources.h +++ b/engines/wintermute/base/file/base_resources.h @@ -37,7 +37,7 @@ namespace WinterMute { class BaseResources {
public:
static Common::SeekableReadStream *getFile(const Common::String &filename);
- static bool hasFile(const Common::String& filename);
+ static bool hasFile(const Common::String &filename);
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/base/file/dcpackage.h b/engines/wintermute/base/file/dcpackage.h index 5e47edba56..4a51683260 100644 --- a/engines/wintermute/base/file/dcpackage.h +++ b/engines/wintermute/base/file/dcpackage.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|