aboutsummaryrefslogtreecommitdiff
path: root/CPP/7zip/Compress/ZlibEncoder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Compress/ZlibEncoder.cpp')
-rw-r--r--CPP/7zip/Compress/ZlibEncoder.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/CPP/7zip/Compress/ZlibEncoder.cpp b/CPP/7zip/Compress/ZlibEncoder.cpp
index 09235c3..3670d30 100644
--- a/CPP/7zip/Compress/ZlibEncoder.cpp
+++ b/CPP/7zip/Compress/ZlibEncoder.cpp
@@ -14,12 +14,12 @@ namespace NZlib {
14 14
15UInt32 Adler32_Update(UInt32 adler, const Byte *buf, size_t size); 15UInt32 Adler32_Update(UInt32 adler, const Byte *buf, size_t size);
16 16
17STDMETHODIMP CInStreamWithAdler::Read(void *data, UInt32 size, UInt32 *processedSize) 17Z7_COM7F_IMF(CInStreamWithAdler::Read(void *data, UInt32 size, UInt32 *processedSize))
18{ 18{
19 HRESULT result = _stream->Read(data, size, &size); 19 const HRESULT result = _stream->Read(data, size, &size);
20 _adler = Adler32_Update(_adler, (const Byte *)data, size); 20 _adler = Adler32_Update(_adler, (const Byte *)data, size);
21 _size += size; 21 _size += size;
22 if (processedSize != NULL) 22 if (processedSize)
23 *processedSize = size; 23 *processedSize = size;
24 return result; 24 return result;
25} 25}
@@ -30,8 +30,8 @@ void CEncoder::Create()
30 DeflateEncoder = DeflateEncoderSpec = new NDeflate::NEncoder::CCOMCoder; 30 DeflateEncoder = DeflateEncoderSpec = new NDeflate::NEncoder::CCOMCoder;
31} 31}
32 32
33STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream, 33Z7_COM7F_IMF(CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
34 const UInt64 *inSize, const UInt64 * /* outSize */, ICompressProgressInfo *progress) 34 const UInt64 *inSize, const UInt64 * /* outSize */, ICompressProgressInfo *progress))
35{ 35{
36 DEFLATE_TRY_BEGIN 36 DEFLATE_TRY_BEGIN
37 if (!AdlerStream) 37 if (!AdlerStream)
@@ -40,19 +40,19 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream
40 40
41 { 41 {
42 Byte buf[2] = { 0x78, 0xDA }; 42 Byte buf[2] = { 0x78, 0xDA };
43 RINOK(WriteStream(outStream, buf, 2)); 43 RINOK(WriteStream(outStream, buf, 2))
44 } 44 }
45 45
46 AdlerSpec->SetStream(inStream); 46 AdlerSpec->SetStream(inStream);
47 AdlerSpec->Init(); 47 AdlerSpec->Init();
48 HRESULT res = DeflateEncoder->Code(AdlerStream, outStream, inSize, NULL, progress); 48 const HRESULT res = DeflateEncoder->Code(AdlerStream, outStream, inSize, NULL, progress);
49 AdlerSpec->ReleaseStream(); 49 AdlerSpec->ReleaseStream();
50 50
51 RINOK(res); 51 RINOK(res)
52 52
53 { 53 {
54 UInt32 a = AdlerSpec->GetAdler(); 54 const UInt32 a = AdlerSpec->GetAdler();
55 Byte buf[4] = { (Byte)(a >> 24), (Byte)(a >> 16), (Byte)(a >> 8), (Byte)(a) }; 55 const Byte buf[4] = { (Byte)(a >> 24), (Byte)(a >> 16), (Byte)(a >> 8), (Byte)(a) };
56 return WriteStream(outStream, buf, 4); 56 return WriteStream(outStream, buf, 4);
57 } 57 }
58 DEFLATE_TRY_END 58 DEFLATE_TRY_END