COMMON: Add possibility to compute md5 for tail of resfork data

This commit is contained in:
Eugene Sandulenko 2021-10-16 14:12:09 +03:00
parent d4443ed494
commit 4eea8524f7
No known key found for this signature in database
GPG key ID: 014D387312D34F08
2 changed files with 6 additions and 2 deletions

View file

@ -102,7 +102,7 @@ uint32 MacResManager::getResForkDataSize() const {
return _stream->readUint32BE();
}
String MacResManager::computeResForkMD5AsString(uint32 length) const {
String MacResManager::computeResForkMD5AsString(uint32 length, bool tail) const {
if (!hasResFork())
return String();
@ -113,6 +113,9 @@ String MacResManager::computeResForkMD5AsString(uint32 length) const {
SeekableSubReadStream resForkStream(_stream, dataOffset, dataOffset + dataLength);
if (tail && dataLength > length)
resForkStream.seek(length, SEEK_END);
return computeStreamMD5AsString(resForkStream, MIN<uint32>(length, _resForkSize));
}

View file

@ -170,9 +170,10 @@ public:
/**
* Calculate the MD5 checksum of the resource fork
* @param length The maximum length to compute for
* @param tail Caluclate length from the tail
* @return The MD5 checksum of the resource fork
*/
String computeResForkMD5AsString(uint32 length = 0) const;
String computeResForkMD5AsString(uint32 length = 0, bool tail = false) const;
/**
* Get the base file name of the data/resource fork pair