This commit is contained in:
Igor Pavlov
2023-12-22 17:17:05 +00:00
committed by Kornel
parent ec44a8a070
commit a36c48cece
954 changed files with 42199 additions and 25482 deletions
+10 -10
View File
@@ -14,12 +14,12 @@ namespace NZlib {
UInt32 Adler32_Update(UInt32 adler, const Byte *buf, size_t size);
STDMETHODIMP CInStreamWithAdler::Read(void *data, UInt32 size, UInt32 *processedSize)
Z7_COM7F_IMF(CInStreamWithAdler::Read(void *data, UInt32 size, UInt32 *processedSize))
{
HRESULT result = _stream->Read(data, size, &size);
const HRESULT result = _stream->Read(data, size, &size);
_adler = Adler32_Update(_adler, (const Byte *)data, size);
_size += size;
if (processedSize != NULL)
if (processedSize)
*processedSize = size;
return result;
}
@@ -30,8 +30,8 @@ void CEncoder::Create()
DeflateEncoder = DeflateEncoderSpec = new NDeflate::NEncoder::CCOMCoder;
}
STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
Z7_COM7F_IMF(CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 * /* outSize */, ICompressProgressInfo *progress))
{
DEFLATE_TRY_BEGIN
if (!AdlerStream)
@@ -40,19 +40,19 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream
{
Byte buf[2] = { 0x78, 0xDA };
RINOK(WriteStream(outStream, buf, 2));
RINOK(WriteStream(outStream, buf, 2))
}
AdlerSpec->SetStream(inStream);
AdlerSpec->Init();
HRESULT res = DeflateEncoder->Code(AdlerStream, outStream, inSize, NULL, progress);
const HRESULT res = DeflateEncoder->Code(AdlerStream, outStream, inSize, NULL, progress);
AdlerSpec->ReleaseStream();
RINOK(res);
RINOK(res)
{
UInt32 a = AdlerSpec->GetAdler();
Byte buf[4] = { (Byte)(a >> 24), (Byte)(a >> 16), (Byte)(a >> 8), (Byte)(a) };
const UInt32 a = AdlerSpec->GetAdler();
const Byte buf[4] = { (Byte)(a >> 24), (Byte)(a >> 16), (Byte)(a >> 8), (Byte)(a) };
return WriteStream(outStream, buf, 4);
}
DEFLATE_TRY_END