Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2007-08-27 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:54 +0300
commit051769bbc577aeede90558b6ab5c9be187940ca0 (patch)
treee6330cb80f2d4a526d8aa27812528e053b0cda90 /CPP/7zip/Compress
parent33ccab7e728a996800e166d849fe1e92a17e1afe (diff)
4.53 beta
Diffstat (limited to 'CPP/7zip/Compress')
-rwxr-xr-xCPP/7zip/Compress/Branch/x86_2.cpp16
-rwxr-xr-xCPP/7zip/Compress/Copy/CopyCoder.cpp2
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar1Decoder.cpp12
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar2Decoder.cpp1
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar3Decoder.cpp5
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar3Decoder.h7
6 files changed, 26 insertions, 17 deletions
diff --git a/CPP/7zip/Compress/Branch/x86_2.cpp b/CPP/7zip/Compress/Branch/x86_2.cpp
index 61f0c55a..51176c98 100755
--- a/CPP/7zip/Compress/Branch/x86_2.cpp
+++ b/CPP/7zip/Compress/Branch/x86_2.cpp
@@ -238,6 +238,13 @@ HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
if (progress != NULL)
{
+ /*
+ const UInt64 compressedSize =
+ _mainStream.GetProcessedSize() +
+ _callStream.GetProcessedSize() +
+ _jumpStream.GetProcessedSize() +
+ _rangeEncoder.GetProcessedSize();
+ */
RINOK(progress->SetRatioInfo(&nowPos64, NULL));
}
@@ -312,7 +319,14 @@ HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams,
{
if (processedBytes >= (1 << 20) && progress != NULL)
{
- UInt64 nowPos64 = _outStream.GetProcessedSize();
+ /*
+ const UInt64 compressedSize =
+ _mainInStream.GetProcessedSize() +
+ _callStream.GetProcessedSize() +
+ _jumpStream.GetProcessedSize() +
+ _rangeDecoder.GetProcessedSize();
+ */
+ const UInt64 nowPos64 = _outStream.GetProcessedSize();
RINOK(progress->SetRatioInfo(NULL, &nowPos64));
processedBytes = 0;
}
diff --git a/CPP/7zip/Compress/Copy/CopyCoder.cpp b/CPP/7zip/Compress/Copy/CopyCoder.cpp
index b9af74db..8e18db2b 100755
--- a/CPP/7zip/Compress/Copy/CopyCoder.cpp
+++ b/CPP/7zip/Compress/Copy/CopyCoder.cpp
@@ -40,7 +40,7 @@ STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
if (size > *outSize - TotalSize)
size = (UInt32)(*outSize - TotalSize);
RINOK(inStream->Read(_buffer, size, &realProcessedSize));
- if(realProcessedSize == 0)
+ if (realProcessedSize == 0)
break;
RINOK(WriteStream(outStream, _buffer, realProcessedSize, NULL));
TotalSize += realProcessedSize;
diff --git a/CPP/7zip/Compress/Rar/Rar1Decoder.cpp b/CPP/7zip/Compress/Rar/Rar1Decoder.cpp
index f19b14f4..0998a3f2 100755
--- a/CPP/7zip/Compress/Rar/Rar1Decoder.cpp
+++ b/CPP/7zip/Compress/Rar/Rar1Decoder.cpp
@@ -463,14 +463,10 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress)
{
- try
- {
- HRESULT res = CodeReal(inStream, outStream, inSize, outSize, progress);
- m_OutWindowStream.Flush();
- return res;
- }
- catch(const CLZOutWindowException &e) { m_OutWindowStream.Flush(); return e.ErrorCode; }
- catch(...) { m_OutWindowStream.Flush(); return S_FALSE; }
+ try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
+ catch(const CInBufferException &e) { return e.ErrorCode; }
+ catch(const CLZOutWindowException &e) { return e.ErrorCode; }
+ catch(...) { return S_FALSE; }
}
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size)
diff --git a/CPP/7zip/Compress/Rar/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar/Rar2Decoder.cpp
index 152c388b..057a1a60 100755
--- a/CPP/7zip/Compress/Rar/Rar2Decoder.cpp
+++ b/CPP/7zip/Compress/Rar/Rar2Decoder.cpp
@@ -385,6 +385,7 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
+ catch(const CInBufferException &e) { return e.ErrorCode; }
catch(const CLZOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
index 7f71d1d8..e629f4df 100755
--- a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
+++ b/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
@@ -52,8 +52,8 @@ CDecoder::CDecoder():
CDecoder::~CDecoder()
{
InitFilters();
- if (_vmData)
- ::MidFree(_vmData);
+ ::MidFree(_vmData);
+ ::MidFree(_window);
}
HRESULT CDecoder::WriteDataToStream(const Byte *data, UInt32 size)
@@ -821,6 +821,7 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
_unpackSize = *outSize;
return CodeReal(progress);
}
+ catch(const CInBufferException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
// CNewException is possible here. But probably CNewException is caused
// by error in data stream.
diff --git a/CPP/7zip/Compress/Rar/Rar3Decoder.h b/CPP/7zip/Compress/Rar/Rar3Decoder.h
index 178bf5db..6eefb28f 100755
--- a/CPP/7zip/Compress/Rar/Rar3Decoder.h
+++ b/CPP/7zip/Compress/Rar/Rar3Decoder.h
@@ -35,13 +35,12 @@ const UInt32 kLevelTableSize = 20;
const UInt32 kTablesSizesSum = kMainTableSize + kDistTableSize + kAlignTableSize + kLenTableSize;
-template<class TInByte>
-class CBitDecoder2
+class CBitDecoder
{
UInt32 m_Value;
public:
UInt32 m_BitPos;
- TInByte m_Stream;
+ CInBuffer m_Stream;
bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
void ReleaseStream() { m_Stream.ReleaseStream();}
@@ -98,8 +97,6 @@ public:
}
};
-typedef CBitDecoder2<CInBuffer> CBitDecoder;
-
const int kNumTopBits = 24;
const UInt32 kTopValue = (1 << kNumTopBits);
const UInt32 kBot = (1 << 15);