diff options
author | Matthew Hoops | 2011-02-04 15:27:56 +0000 |
---|---|---|
committer | Matthew Hoops | 2011-02-04 15:27:56 +0000 |
commit | 2be57434a1f7381c19be06bd2af4d4bf64df360f (patch) | |
tree | 44dbd2f96b6e8de0acd3f3c9b857bef411802fc7 /common | |
parent | 80bfecb6256d60d47e99db7b63f6c8e3878f8e7d (diff) | |
download | scummvm-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')
-rw-r--r-- | common/macresman.cpp | 13 | ||||
-rw-r--r-- | common/macresman.h | 6 |
2 files changed, 13 insertions, 6 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)); } diff --git a/common/macresman.h b/common/macresman.h index 4b0aea18f6..1cbebbcf4b 100644 --- a/common/macresman.h +++ b/common/macresman.h @@ -134,10 +134,10 @@ public: String getResName(uint32 typeID, uint16 resID) const; /** - * Get the size of the resource fork - * @return The size of the resource fork + * Get the size of the data portion of the resource fork + * @return The size of the data portion of the resource fork */ - uint32 getResForkSize() const; + uint32 getResForkDataSize() const; /** * Calculate the MD5 checksum of the resource fork |