From 2be57434a1f7381c19be06bd2af4d4bf64df360f Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 4 Feb 2011 15:27:56 +0000 Subject: 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 --- common/macresman.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'common/macresman.cpp') 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(length, _resForkSize)); } -- cgit v1.2.3