aboutsummaryrefslogtreecommitdiff
path: root/common/macresman.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-02-04 15:27:56 +0000
committerMatthew Hoops2011-02-04 15:27:56 +0000
commit2be57434a1f7381c19be06bd2af4d4bf64df360f (patch)
tree44dbd2f96b6e8de0acd3f3c9b857bef411802fc7 /common/macresman.cpp
parent80bfecb6256d60d47e99db7b63f6c8e3878f8e7d (diff)
downloadscummvm-rg350-2be57434a1f7381c19be06bd2af4d4bf64df360f.tar.gz
scummvm-rg350-2be57434a1f7381c19be06bd2af4d4bf64df360f.tar.bz2
scummvm-rg350-2be57434a1f7381c19be06bd2af4d4bf64df360f.zip
COMMON: Only take the md5 of the resource fork data section
Since various apps can modify the type/creator of the files, we can't rely on the header of the resource fork to take the md5. I've therefore also recalculated all of the detector entries (all 5 of them) that use the Mac resource fork code. svn-id: r55764
Diffstat (limited to 'common/macresman.cpp')
-rw-r--r--common/macresman.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/common/macresman.cpp b/common/macresman.cpp
index fc4e0a55f5..9a50549a9d 100644
--- a/common/macresman.cpp
+++ b/common/macresman.cpp
@@ -83,18 +83,25 @@ bool MacResManager::hasResFork() const {
return !_baseFileName.empty() && _mode != kResForkNone;
}
-uint32 MacResManager::getResForkSize() const {
+uint32 MacResManager::getResForkDataSize() const {
if (!hasResFork())
return 0;
- return _resForkSize;
+ _stream->seek(_resForkOffset + 4);
+ return _stream->readUint32BE();
}
String MacResManager::computeResForkMD5AsString(uint32 length) const {
if (!hasResFork())
return String();
- SeekableSubReadStream resForkStream(_stream, _resForkOffset, _resForkOffset + _resForkSize);
+ _stream->seek(_resForkOffset);
+ uint32 dataOffset = _stream->readUint32BE() + _resForkOffset;
+ /* uint32 mapOffset = */ _stream->readUint32BE();
+ uint32 dataLength = _stream->readUint32BE();
+
+
+ SeekableSubReadStream resForkStream(_stream, dataOffset, dataOffset + dataLength);
return computeStreamMD5AsString(resForkStream, MIN<uint32>(length, _resForkSize));
}