mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ArchiveTools] Fix TorrentZip write
Apparently, only a very specific version of Zlib stuff will work for TZIP. This implementation is copied from RomVault for full compatibility.
This commit is contained in:
@@ -27,11 +27,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Ionic.Zlib;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace Ionic.Zlib
|
||||
namespace SabreTools.Helper
|
||||
{
|
||||
internal class WorkItem
|
||||
{
|
||||
@@ -45,7 +44,7 @@ namespace Ionic.Zlib
|
||||
public ZlibCodec compressor;
|
||||
|
||||
public WorkItem(int size,
|
||||
Ionic.Zlib.CompressionLevel compressLevel,
|
||||
CompressionLevel compressLevel,
|
||||
CompressionStrategy strategy,
|
||||
int ix)
|
||||
{
|
||||
@@ -121,12 +120,12 @@ namespace Ionic.Zlib
|
||||
private int _lastWritten;
|
||||
private int _latestCompressed;
|
||||
private int _Crc32;
|
||||
private Ionic.Crc.CRC32 _runningCrc;
|
||||
private CRC32 _runningCrc;
|
||||
private object _latestLock = new object();
|
||||
private System.Collections.Generic.Queue<int> _toWrite;
|
||||
private System.Collections.Generic.Queue<int> _toFill;
|
||||
private Int64 _totalBytesProcessed;
|
||||
private Ionic.Zlib.CompressionLevel _compressLevel;
|
||||
private CompressionLevel _compressLevel;
|
||||
private volatile Exception _pendingException;
|
||||
private bool _handlingException;
|
||||
private object _eLock = new Object(); // protects _pendingException
|
||||
@@ -488,7 +487,7 @@ namespace Ionic.Zlib
|
||||
}
|
||||
|
||||
_newlyCompressedBlob = new AutoResetEvent(false);
|
||||
_runningCrc = new Ionic.Crc.CRC32();
|
||||
_runningCrc = new CRC32();
|
||||
_currentlyFilling = -1;
|
||||
_lastFilled = -1;
|
||||
_lastWritten = -1;
|
||||
@@ -856,7 +855,7 @@ namespace Ionic.Zlib
|
||||
|
||||
_firstWriteDone = false;
|
||||
_totalBytesProcessed = 0L;
|
||||
_runningCrc = new Ionic.Crc.CRC32();
|
||||
_runningCrc = new CRC32();
|
||||
_isClosed= false;
|
||||
_currentlyFilling = -1;
|
||||
_lastFilled = -1;
|
||||
@@ -1155,7 +1154,7 @@ namespace Ionic.Zlib
|
||||
try
|
||||
{
|
||||
int myItem = workitem.index;
|
||||
Ionic.Crc.CRC32 crc = new Ionic.Crc.CRC32();
|
||||
CRC32 crc = new CRC32();
|
||||
|
||||
// calc CRC on the buffer
|
||||
crc.SlurpBlock(workitem.buffer, 0, workitem.inputBytesAvailable);
|
||||
|
||||
Reference in New Issue
Block a user