mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛Fix dicformat crc64 calculation for metadata and last user data blocks.
This commit is contained in:
@@ -3114,6 +3114,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
{
|
{
|
||||||
lzmaProperties = lzmaBlockStream.Properties;
|
lzmaProperties = lzmaBlockStream.Properties;
|
||||||
lzmaBlockStream.Close();
|
lzmaBlockStream.Close();
|
||||||
|
cmpCrc64Context.Update(lzmaProperties);
|
||||||
if(blockStream.Length > decompressedStream.Length)
|
if(blockStream.Length > decompressedStream.Length)
|
||||||
currentBlockHeader.compression = CompressionType.None;
|
currentBlockHeader.compression = CompressionType.None;
|
||||||
}
|
}
|
||||||
@@ -3148,7 +3149,8 @@ namespace DiscImageChef.DiscImages
|
|||||||
imageStream.Write(structureBytes, 0, structureBytes.Length);
|
imageStream.Write(structureBytes, 0, structureBytes.Length);
|
||||||
structureBytes = null;
|
structureBytes = null;
|
||||||
if(currentBlockHeader.compression == CompressionType.Lzma)
|
if(currentBlockHeader.compression == CompressionType.Lzma)
|
||||||
imageStream.Write(lzmaProperties, 0, lzmaProperties.Length);
|
imageStream.Write(lzmaProperties, 0, lzmaProperties.Length);
|
||||||
|
|
||||||
imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length);
|
imageStream.Write(blockStream.ToArray(), 0, (int)blockStream.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3195,8 +3197,12 @@ namespace DiscImageChef.DiscImages
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tagData = blockStream.ToArray();
|
tagData = blockStream.ToArray();
|
||||||
Crc64Context.Data(tagData, out tagCrc);
|
Crc64Context crc64Ctx = new Crc64Context();
|
||||||
|
crc64Ctx.Init();
|
||||||
|
crc64Ctx.Update(lzmaProperties);
|
||||||
|
crc64Ctx.Update(tagData);
|
||||||
|
tagCrc = crc64Ctx.Final();
|
||||||
tagBlock.cmpLength = (uint)tagData.Length + LZMA_PROPERTIES_LENGTH;
|
tagBlock.cmpLength = (uint)tagData.Length + LZMA_PROPERTIES_LENGTH;
|
||||||
tagBlock.cmpCrc64 = BitConverter.ToUInt64(tagCrc, 0);
|
tagBlock.cmpCrc64 = BitConverter.ToUInt64(tagCrc, 0);
|
||||||
tagBlock.compression = CompressionType.Lzma;
|
tagBlock.compression = CompressionType.Lzma;
|
||||||
|
|||||||
Reference in New Issue
Block a user