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>2008-12-31 03:00:00 +0300
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:58 +0300
commit3a524e5ba2d7bb0c46e11502822f8093dd2ab0f4 (patch)
treeb33da9cac0a5fc22a16bdf4de106c8a9eefd1465 /CPP/7zip/Compress
parentc1f1243a70558e86e14b1ea09dc287737378894b (diff)
4.634.63
Diffstat (limited to 'CPP/7zip/Compress')
-rwxr-xr-xCPP/7zip/Compress/Arj/ArjDecoder2.h64
-rwxr-xr-xCPP/7zip/Compress/Arj/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/ArjDecoder1.cpp (renamed from CPP/7zip/Compress/Arj/ArjDecoder1.cpp)18
-rwxr-xr-xCPP/7zip/Compress/ArjDecoder1.h (renamed from CPP/7zip/Compress/Arj/ArjDecoder1.h)33
-rwxr-xr-xCPP/7zip/Compress/ArjDecoder2.cpp (renamed from CPP/7zip/Compress/Arj/ArjDecoder2.cpp)15
-rwxr-xr-xCPP/7zip/Compress/ArjDecoder2.h59
-rwxr-xr-xCPP/7zip/Compress/BZip2/BZip2CRC.cpp26
-rwxr-xr-xCPP/7zip/Compress/BZip2/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/BZip2Const.h (renamed from CPP/7zip/Compress/BZip2/BZip2Const.h)0
-rwxr-xr-xCPP/7zip/Compress/BZip2Crc.cpp26
-rwxr-xr-xCPP/7zip/Compress/BZip2Crc.h (renamed from CPP/7zip/Compress/BZip2/BZip2CRC.h)10
-rwxr-xr-xCPP/7zip/Compress/BZip2Decoder.cpp (renamed from CPP/7zip/Compress/BZip2/BZip2Decoder.cpp)44
-rwxr-xr-xCPP/7zip/Compress/BZip2Decoder.h (renamed from CPP/7zip/Compress/BZip2/BZip2Decoder.h)41
-rwxr-xr-xCPP/7zip/Compress/BZip2Encoder.cpp (renamed from CPP/7zip/Compress/BZip2/BZip2Encoder.cpp)56
-rwxr-xr-xCPP/7zip/Compress/BZip2Encoder.h (renamed from CPP/7zip/Compress/BZip2/BZip2Encoder.h)49
-rwxr-xr-xCPP/7zip/Compress/BZip2Register.cpp (renamed from CPP/7zip/Compress/BZip2/BZip2Register.cpp)5
-rwxr-xr-xCPP/7zip/Compress/Bcj2Coder.cpp (renamed from CPP/7zip/Compress/Branch/x86_2.cpp)7
-rwxr-xr-xCPP/7zip/Compress/Bcj2Coder.h (renamed from CPP/7zip/Compress/Branch/x86_2.h)14
-rwxr-xr-xCPP/7zip/Compress/Bcj2Register.cpp (renamed from CPP/7zip/Compress/Branch/BCJ2Register.cpp)7
-rwxr-xr-xCPP/7zip/Compress/BcjCoder.cpp (renamed from CPP/7zip/Compress/Branch/x86.cpp)5
-rwxr-xr-xCPP/7zip/Compress/BcjCoder.h (renamed from CPP/7zip/Compress/Branch/x86.h)11
-rwxr-xr-xCPP/7zip/Compress/BcjRegister.cpp (renamed from CPP/7zip/Compress/Branch/BCJRegister.cpp)7
-rwxr-xr-xCPP/7zip/Compress/BitlDecoder.cpp24
-rwxr-xr-xCPP/7zip/Compress/BitlDecoder.h125
-rwxr-xr-xCPP/7zip/Compress/BitlEncoder.h60
-rwxr-xr-xCPP/7zip/Compress/BitmDecoder.h66
-rwxr-xr-xCPP/7zip/Compress/BitmEncoder.h52
-rwxr-xr-xCPP/7zip/Compress/Branch/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/BranchCoder.cpp (renamed from CPP/7zip/Compress/Branch/BranchCoder.cpp)1
-rwxr-xr-xCPP/7zip/Compress/BranchCoder.h (renamed from CPP/7zip/Compress/Branch/BranchCoder.h)9
-rwxr-xr-xCPP/7zip/Compress/BranchMisc.cpp (renamed from CPP/7zip/Compress/Branch/BranchMisc.cpp)5
-rwxr-xr-xCPP/7zip/Compress/BranchMisc.h (renamed from CPP/7zip/Compress/Branch/BranchMisc.h)4
-rwxr-xr-xCPP/7zip/Compress/BranchRegister.cpp (renamed from CPP/7zip/Compress/Branch/BranchRegister.cpp)2
-rwxr-xr-xCPP/7zip/Compress/ByteSwap.cpp (renamed from CPP/7zip/Compress/ByteSwap/ByteSwap.cpp)0
-rwxr-xr-xCPP/7zip/Compress/ByteSwap.h30
-rwxr-xr-xCPP/7zip/Compress/ByteSwap/ByteSwap.h37
-rwxr-xr-xCPP/7zip/Compress/ByteSwap/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/ByteSwapRegister.cpp (renamed from CPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp)3
-rwxr-xr-xCPP/7zip/Compress/Copy/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/CopyCoder.cpp (renamed from CPP/7zip/Compress/Copy/CopyCoder.cpp)6
-rwxr-xr-xCPP/7zip/Compress/CopyCoder.h (renamed from CPP/7zip/Compress/Copy/CopyCoder.h)15
-rwxr-xr-xCPP/7zip/Compress/CopyRegister.cpp (renamed from CPP/7zip/Compress/Copy/CopyRegister.cpp)5
-rwxr-xr-xCPP/7zip/Compress/Deflate/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/Deflate64Register.cpp (renamed from CPP/7zip/Compress/Deflate/Deflate64Register.cpp)3
-rwxr-xr-xCPP/7zip/Compress/DeflateConst.h (renamed from CPP/7zip/Compress/Deflate/DeflateConst.h)0
-rwxr-xr-xCPP/7zip/Compress/DeflateDecoder.cpp (renamed from CPP/7zip/Compress/Deflate/DeflateDecoder.cpp)13
-rwxr-xr-xCPP/7zip/Compress/DeflateDecoder.h (renamed from CPP/7zip/Compress/Deflate/DeflateDecoder.h)27
-rwxr-xr-xCPP/7zip/Compress/DeflateEncoder.cpp (renamed from CPP/7zip/Compress/Deflate/DeflateEncoder.cpp)65
-rwxr-xr-xCPP/7zip/Compress/DeflateEncoder.h (renamed from CPP/7zip/Compress/Deflate/DeflateEncoder.h)50
-rwxr-xr-xCPP/7zip/Compress/DeflateNsisRegister.cpp (renamed from CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp)3
-rwxr-xr-xCPP/7zip/Compress/DeflateRegister.cpp (renamed from CPP/7zip/Compress/Deflate/DeflateRegister.cpp)4
-rwxr-xr-xCPP/7zip/Compress/HuffmanDecoder.h (renamed from CPP/7zip/Compress/Huffman/HuffmanDecoder.h)6
-rwxr-xr-xCPP/7zip/Compress/Implode/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/ImplodeDecoder.cpp (renamed from CPP/7zip/Compress/Implode/ImplodeDecoder.cpp)12
-rwxr-xr-xCPP/7zip/Compress/ImplodeDecoder.h (renamed from CPP/7zip/Compress/Implode/ImplodeDecoder.h)27
-rwxr-xr-xCPP/7zip/Compress/ImplodeHuffmanDecoder.cpp (renamed from CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp)0
-rwxr-xr-xCPP/7zip/Compress/ImplodeHuffmanDecoder.h (renamed from CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h)7
-rwxr-xr-xCPP/7zip/Compress/LZ/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMA.dsp403
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMA.dsw29
-rwxr-xr-xCPP/7zip/Compress/LZMA/StdAfx.cpp3
-rwxr-xr-xCPP/7zip/Compress/LZMA/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/LZMA/makefile61
-rwxr-xr-xCPP/7zip/Compress/LZMA/resource.rc3
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp12
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp8
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp15
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/makefile6
-rwxr-xr-xCPP/7zip/Compress/LZMA_Alone/makefile.gcc12
-rwxr-xr-xCPP/7zip/Compress/LzOutWindow.cpp (renamed from CPP/7zip/Compress/LZ/LZOutWindow.cpp)10
-rwxr-xr-xCPP/7zip/Compress/LzOutWindow.h (renamed from CPP/7zip/Compress/LZ/LZOutWindow.h)11
-rwxr-xr-xCPP/7zip/Compress/LzhDecoder.cpp (renamed from CPP/7zip/Compress/Lzh/LzhDecoder.cpp)2
-rwxr-xr-xCPP/7zip/Compress/LzhDecoder.h (renamed from CPP/7zip/Compress/Lzh/LzhDecoder.h)19
-rwxr-xr-xCPP/7zip/Compress/LzmaDecoder.cpp (renamed from CPP/7zip/Compress/LZMA/LZMADecoder.cpp)19
-rwxr-xr-xCPP/7zip/Compress/LzmaDecoder.h (renamed from CPP/7zip/Compress/LZMA/LZMADecoder.h)20
-rwxr-xr-xCPP/7zip/Compress/LzmaEncoder.cpp (renamed from CPP/7zip/Compress/LZMA/LZMAEncoder.cpp)40
-rwxr-xr-xCPP/7zip/Compress/LzmaEncoder.h (renamed from CPP/7zip/Compress/LZMA/LZMAEncoder.h)30
-rwxr-xr-xCPP/7zip/Compress/LzmaRegister.cpp (renamed from CPP/7zip/Compress/LZMA/LZMARegister.cpp)13
-rwxr-xr-xCPP/7zip/Compress/Lzx.h (renamed from CPP/7zip/Compress/Lzx/Lzx.h)0
-rwxr-xr-xCPP/7zip/Compress/Lzx/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/Lzx86Converter.cpp (renamed from CPP/7zip/Compress/Lzx/Lzx86Converter.cpp)2
-rwxr-xr-xCPP/7zip/Compress/Lzx86Converter.h (renamed from CPP/7zip/Compress/Lzx/Lzx86Converter.h)11
-rwxr-xr-xCPP/7zip/Compress/LzxDecoder.cpp (renamed from CPP/7zip/Compress/Lzx/LzxDecoder.cpp)22
-rwxr-xr-xCPP/7zip/Compress/LzxDecoder.h (renamed from CPP/7zip/Compress/Lzx/LzxDecoder.h)27
-rwxr-xr-xCPP/7zip/Compress/Mtf8.h (renamed from CPP/7zip/Compress/BWT/Mtf8.h)109
-rwxr-xr-xCPP/7zip/Compress/PPMD/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/PpmdContext.h (renamed from CPP/7zip/Compress/PPMD/PPMDContext.h)10
-rwxr-xr-xCPP/7zip/Compress/PpmdDecode.h (renamed from CPP/7zip/Compress/PPMD/PPMDDecode.h)6
-rwxr-xr-xCPP/7zip/Compress/PpmdDecoder.cpp (renamed from CPP/7zip/Compress/PPMD/PPMDDecoder.cpp)16
-rwxr-xr-xCPP/7zip/Compress/PpmdDecoder.h (renamed from CPP/7zip/Compress/PPMD/PPMDDecoder.h)29
-rwxr-xr-xCPP/7zip/Compress/PpmdEncode.h (renamed from CPP/7zip/Compress/PPMD/PPMDEncode.h)9
-rwxr-xr-xCPP/7zip/Compress/PpmdEncoder.cpp (renamed from CPP/7zip/Compress/PPMD/PPMDEncoder.cpp)38
-rwxr-xr-xCPP/7zip/Compress/PpmdEncoder.h (renamed from CPP/7zip/Compress/PPMD/PPMDEncoder.h)29
-rwxr-xr-xCPP/7zip/Compress/PpmdRegister.cpp (renamed from CPP/7zip/Compress/PPMD/PPMDRegister.cpp)13
-rwxr-xr-xCPP/7zip/Compress/PpmdSubAlloc.h (renamed from CPP/7zip/Compress/PPMD/PPMDSubAlloc.h)12
-rwxr-xr-xCPP/7zip/Compress/PpmdType.h (renamed from CPP/7zip/Compress/PPMD/PPMDType.h)5
-rwxr-xr-xCPP/7zip/Compress/Quantum/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/QuantumDecoder.cpp (renamed from CPP/7zip/Compress/Quantum/QuantumDecoder.cpp)16
-rwxr-xr-xCPP/7zip/Compress/QuantumDecoder.h (renamed from CPP/7zip/Compress/Quantum/QuantumDecoder.h)26
-rwxr-xr-xCPP/7zip/Compress/RangeCoder.h (renamed from CPP/7zip/Compress/RangeCoder/RangeCoder.h)10
-rwxr-xr-xCPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp36
-rwxr-xr-xCPP/7zip/Compress/RangeCoder/RangeCoderBitTree.h161
-rwxr-xr-xCPP/7zip/Compress/RangeCoder/RangeCoderOpt.h31
-rwxr-xr-xCPP/7zip/Compress/RangeCoder/StdAfx.h6
-rwxr-xr-xCPP/7zip/Compress/RangeCoderBit.h (renamed from CPP/7zip/Compress/RangeCoder/RangeCoderBit.h)6
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar29.dsp319
-rwxr-xr-xCPP/7zip/Compress/Rar/Rar29.dsw29
-rwxr-xr-xCPP/7zip/Compress/Rar/StdAfx.cpp3
-rwxr-xr-xCPP/7zip/Compress/Rar/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/Rar/makefile60
-rwxr-xr-xCPP/7zip/Compress/Rar/resource.rc3
-rwxr-xr-xCPP/7zip/Compress/Rar1Decoder.cpp (renamed from CPP/7zip/Compress/Rar/Rar1Decoder.cpp)12
-rwxr-xr-xCPP/7zip/Compress/Rar1Decoder.h (renamed from CPP/7zip/Compress/Rar/Rar1Decoder.h)35
-rwxr-xr-xCPP/7zip/Compress/Rar2Decoder.cpp (renamed from CPP/7zip/Compress/Rar/Rar2Decoder.cpp)12
-rwxr-xr-xCPP/7zip/Compress/Rar2Decoder.h (renamed from CPP/7zip/Compress/Rar/Rar2Decoder.h)31
-rwxr-xr-xCPP/7zip/Compress/Rar3Decoder.cpp (renamed from CPP/7zip/Compress/Rar/Rar3Decoder.cpp)8
-rwxr-xr-xCPP/7zip/Compress/Rar3Decoder.h (renamed from CPP/7zip/Compress/Rar/Rar3Decoder.h)28
-rwxr-xr-xCPP/7zip/Compress/Rar3Vm.cpp (renamed from CPP/7zip/Compress/Rar/Rar3Vm.cpp)8
-rwxr-xr-xCPP/7zip/Compress/Rar3Vm.h (renamed from CPP/7zip/Compress/Rar/Rar3Vm.h)10
-rwxr-xr-xCPP/7zip/Compress/RarCodecsRegister.cpp (renamed from CPP/7zip/Compress/Rar/RarCodecsRegister.cpp)2
-rwxr-xr-xCPP/7zip/Compress/Shrink/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/ShrinkDecoder.cpp (renamed from CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp)26
-rwxr-xr-xCPP/7zip/Compress/ShrinkDecoder.h (renamed from CPP/7zip/Compress/Shrink/ShrinkDecoder.h)17
-rwxr-xr-xCPP/7zip/Compress/Z/StdAfx.h8
-rwxr-xr-xCPP/7zip/Compress/Z/ZDecoder.h43
-rwxr-xr-xCPP/7zip/Compress/ZDecoder.cpp (renamed from CPP/7zip/Compress/Z/ZDecoder.cpp)20
-rwxr-xr-xCPP/7zip/Compress/ZDecoder.h42
-rwxr-xr-xCPP/7zip/Compress/ZlibDecoder.cpp (renamed from CPP/7zip/Compress/Deflate/ZlibDecoder.cpp)10
-rwxr-xr-xCPP/7zip/Compress/ZlibDecoder.h (renamed from CPP/7zip/Compress/Deflate/ZlibDecoder.h)5
129 files changed, 1143 insertions, 2204 deletions
diff --git a/CPP/7zip/Compress/Arj/ArjDecoder2.h b/CPP/7zip/Compress/Arj/ArjDecoder2.h
deleted file mode 100755
index 9d17ee91..00000000
--- a/CPP/7zip/Compress/Arj/ArjDecoder2.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Arj/Decoder2.h
-
-#ifndef __COMPRESS_ARJ_DECODER2_H
-#define __COMPRESS_ARJ_DECODER2_H
-
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/MSBFDecoder.h"
-#include "../../Common/InBuffer.h"
-#include "../LZ/LZOutWindow.h"
-
-/*
-// {23170F69-40C1-278B-0404-020000000000}
-DEFINE_GUID(CLSID_CCompressArj2Decoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00);
-*/
-
-namespace NCompress {
-namespace NArj {
-namespace NDecoder2 {
-
-class CCoder :
- public ICompressCoder,
- public CMyUnknownImp
-{
- CLZOutWindow m_OutWindowStream;
- NStream::NMSBF::CDecoder<CInBuffer> m_InBitStream;
-
- void ReleaseStreams()
- {
- m_OutWindowStream.ReleaseStream();
- m_InBitStream.ReleaseStream();
- }
-
- class CCoderReleaser
- {
- CCoder *m_Coder;
- public:
- bool NeedFlush;
- CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {}
- ~CCoderReleaser()
- {
- if (NeedFlush)
- m_Coder->m_OutWindowStream.Flush();
- m_Coder->ReleaseStreams();
- }
- };
- friend class CCoderReleaser;
-
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
-};
-
-}}}
-
-#endif
diff --git a/CPP/7zip/Compress/Arj/StdAfx.h b/CPP/7zip/Compress/Arj/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Arj/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Arj/ArjDecoder1.cpp b/CPP/7zip/Compress/ArjDecoder1.cpp
index 964b2aea..3e66feeb 100755
--- a/CPP/7zip/Compress/Arj/ArjDecoder1.cpp
+++ b/CPP/7zip/Compress/ArjDecoder1.cpp
@@ -1,18 +1,16 @@
-// Arj/Decoder.cpp
+// ArjDecoder1.cpp
#include "StdAfx.h"
#include "ArjDecoder1.h"
-#include "Windows/Defs.h"
-
namespace NCompress{
namespace NArj {
namespace NDecoder1 {
static const UInt32 kHistorySize = 26624;
-static const UInt32 kMatchMaxLen = 256;
static const UInt32 kMatchMinLen = 3;
+static const UInt32 kMatchMaxLen = 256;
// static const UInt32 kNC = 255 + kMatchMaxLen + 2 - kMatchMinLen;
@@ -237,9 +235,8 @@ UInt32 CCoder::decode_p()
}
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
{
if (outSize == NULL)
return E_INVALIDARG;
@@ -306,13 +303,12 @@ HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
return m_OutWindowStream.Flush();
}
-STDMETHODIMP CCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, 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(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Arj/ArjDecoder1.h b/CPP/7zip/Compress/ArjDecoder1.h
index cecc9573..17939daf 100755
--- a/CPP/7zip/Compress/Arj/ArjDecoder1.h
+++ b/CPP/7zip/Compress/ArjDecoder1.h
@@ -1,19 +1,16 @@
-// Arj/Decoder1.h
+// ArjDecoder1.h
#ifndef __COMPRESS_ARJ_DECODER1_H
#define __COMPRESS_ARJ_DECODER1_H
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/MSBFDecoder.h"
-#include "../../Common/InBuffer.h"
-#include "../LZ/LZOutWindow.h"
+#include "../../Common/MyCom.h"
-/*
-// {23170F69-40C1-278B-0404-010000000000}
-DEFINE_GUID(CLSID_CCompressArjDecoder,
-0x23170F69, 0x40C1, 0x278B, 0x04, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00);
-*/
+#include "../ICoder.h"
+
+#include "../Common/InBuffer.h"
+
+#include "BitmDecoder.h"
+#include "LzOutWindow.h"
namespace NCompress {
namespace NArj {
@@ -47,8 +44,8 @@ class CCoder :
public ICompressCoder,
public CMyUnknownImp
{
- CLZOutWindow m_OutWindowStream;
- NStream::NMSBF::CDecoder<CInBuffer> m_InBitStream;
+ CLzOutWindow m_OutWindowStream;
+ NBitm::CDecoder<CInBuffer> m_InBitStream;
UInt32 left[2 * NC - 1];
UInt32 right[2 * NC - 1];
@@ -86,15 +83,13 @@ class CCoder :
UInt32 decode_c();
UInt32 decode_p();
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
public:
MY_UNKNOWN_IMP
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
};
diff --git a/CPP/7zip/Compress/Arj/ArjDecoder2.cpp b/CPP/7zip/Compress/ArjDecoder2.cpp
index 5d7bf2ee..365993bc 100755
--- a/CPP/7zip/Compress/Arj/ArjDecoder2.cpp
+++ b/CPP/7zip/Compress/ArjDecoder2.cpp
@@ -1,4 +1,4 @@
-// Arj/Decoder2.cpp
+// ArjDecoder2.cpp
#include "StdAfx.h"
@@ -9,12 +9,10 @@ namespace NArj {
namespace NDecoder2 {
static const UInt32 kHistorySize = 26624;
-// static const UInt32 kMatchMaxLen = 256;
static const UInt32 kMatchMinLen = 3;
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
- ICompressProgressInfo * /* progress */)
+HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo * /* progress */)
{
if (outSize == NULL)
return E_INVALIDARG;
@@ -80,13 +78,12 @@ HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
return m_OutWindowStream.Flush();
}
-STDMETHODIMP CCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, 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(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/ArjDecoder2.h b/CPP/7zip/Compress/ArjDecoder2.h
new file mode 100755
index 00000000..cf00975d
--- /dev/null
+++ b/CPP/7zip/Compress/ArjDecoder2.h
@@ -0,0 +1,59 @@
+// ArjDecoder2.h
+
+#ifndef __COMPRESS_ARJ_DECODER2_H
+#define __COMPRESS_ARJ_DECODER2_H
+
+#include "../../Common/MyCom.h"
+
+#include "../ICoder.h"
+
+#include "../Common/InBuffer.h"
+
+#include "BitmDecoder.h"
+#include "LzOutWindow.h"
+
+namespace NCompress {
+namespace NArj {
+namespace NDecoder2 {
+
+class CCoder :
+ public ICompressCoder,
+ public CMyUnknownImp
+{
+ CLzOutWindow m_OutWindowStream;
+ NBitm::CDecoder<CInBuffer> m_InBitStream;
+
+ void ReleaseStreams()
+ {
+ m_OutWindowStream.ReleaseStream();
+ m_InBitStream.ReleaseStream();
+ }
+
+ class CCoderReleaser
+ {
+ CCoder *m_Coder;
+ public:
+ bool NeedFlush;
+ CCoderReleaser(CCoder *coder): m_Coder(coder), NeedFlush(true) {}
+ ~CCoderReleaser()
+ {
+ if (NeedFlush)
+ m_Coder->m_OutWindowStream.Flush();
+ m_Coder->ReleaseStreams();
+ }
+ };
+ friend class CCoderReleaser;
+
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+public:
+ MY_UNKNOWN_IMP
+
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+
+};
+
+}}}
+
+#endif
diff --git a/CPP/7zip/Compress/BZip2/BZip2CRC.cpp b/CPP/7zip/Compress/BZip2/BZip2CRC.cpp
deleted file mode 100755
index ba9ddb7e..00000000
--- a/CPP/7zip/Compress/BZip2/BZip2CRC.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-// BZip2CRC.cpp
-
-#include "StdAfx.h"
-
-#include "BZip2CRC.h"
-
-UInt32 CBZip2CRC::Table[256];
-
-static const UInt32 kBZip2CRCPoly = 0x04c11db7; /* AUTODIN II, Ethernet, & FDDI */
-
-void CBZip2CRC::InitTable()
-{
- for (UInt32 i = 0; i < 256; i++)
- {
- UInt32 r = (i << 24);
- for (int j = 8; j > 0; j--)
- r = (r & 0x80000000) ? ((r << 1) ^ kBZip2CRCPoly) : (r << 1);
- Table[i] = r;
- }
-}
-
-class CBZip2CRCTableInit
-{
-public:
- CBZip2CRCTableInit() { CBZip2CRC::InitTable(); }
-} g_BZip2CRCTableInit;
diff --git a/CPP/7zip/Compress/BZip2/StdAfx.h b/CPP/7zip/Compress/BZip2/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/BZip2/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/BZip2/BZip2Const.h b/CPP/7zip/Compress/BZip2Const.h
index 62427aa6..62427aa6 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Const.h
+++ b/CPP/7zip/Compress/BZip2Const.h
diff --git a/CPP/7zip/Compress/BZip2Crc.cpp b/CPP/7zip/Compress/BZip2Crc.cpp
new file mode 100755
index 00000000..4e4741f4
--- /dev/null
+++ b/CPP/7zip/Compress/BZip2Crc.cpp
@@ -0,0 +1,26 @@
+// BZip2Crc.cpp
+
+#include "StdAfx.h"
+
+#include "BZip2Crc.h"
+
+UInt32 CBZip2Crc::Table[256];
+
+static const UInt32 kBZip2CrcPoly = 0x04c11db7; /* AUTODIN II, Ethernet, & FDDI */
+
+void CBZip2Crc::InitTable()
+{
+ for (UInt32 i = 0; i < 256; i++)
+ {
+ UInt32 r = (i << 24);
+ for (int j = 8; j > 0; j--)
+ r = (r & 0x80000000) ? ((r << 1) ^ kBZip2CrcPoly) : (r << 1);
+ Table[i] = r;
+ }
+}
+
+class CBZip2CrcTableInit
+{
+public:
+ CBZip2CrcTableInit() { CBZip2Crc::InitTable(); }
+} g_BZip2CrcTableInit;
diff --git a/CPP/7zip/Compress/BZip2/BZip2CRC.h b/CPP/7zip/Compress/BZip2Crc.h
index 981fe837..876945b5 100755
--- a/CPP/7zip/Compress/BZip2/BZip2CRC.h
+++ b/CPP/7zip/Compress/BZip2Crc.h
@@ -1,28 +1,28 @@
-// BZip2CRC.h
+// BZip2Crc.h
#ifndef __BZIP2_CRC_H
#define __BZIP2_CRC_H
#include "Common/Types.h"
-class CBZip2CRC
+class CBZip2Crc
{
UInt32 _value;
static UInt32 Table[256];
public:
static void InitTable();
- CBZip2CRC(): _value(0xFFFFFFFF) {};
+ CBZip2Crc(): _value(0xFFFFFFFF) {};
void Init() { _value = 0xFFFFFFFF; }
void UpdateByte(Byte b) { _value = Table[(_value >> 24) ^ b] ^ (_value << 8); }
void UpdateByte(unsigned int b) { _value = Table[(_value >> 24) ^ b] ^ (_value << 8); }
UInt32 GetDigest() const { return _value ^ 0xFFFFFFFF; }
};
-class CBZip2CombinedCRC
+class CBZip2CombinedCrc
{
UInt32 _value;
public:
- CBZip2CombinedCRC(): _value(0){};
+ CBZip2CombinedCrc(): _value(0){};
void Init() { _value = 0; }
void Update(UInt32 v) { _value = ((_value << 1) | (_value >> 31)) ^ v; }
UInt32 GetDigest() const { return _value ; }
diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp b/CPP/7zip/Compress/BZip2Decoder.cpp
index 6ec40ffa..c44debf0 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Decoder.cpp
+++ b/CPP/7zip/Compress/BZip2Decoder.cpp
@@ -2,20 +2,22 @@
#include "StdAfx.h"
-#include "BZip2Decoder.h"
-
extern "C"
{
-#include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
-#include "../../../Common/Defs.h"
-#include "../BWT/Mtf8.h"
-#include "BZip2CRC.h"
+#include "../../Common/Defs.h"
+
+#include "BZip2Crc.h"
+#include "BZip2Decoder.h"
+#include "Mtf8.h"
namespace NCompress {
namespace NBZip2 {
+#define NO_INLINE MY_FAST_CALL
+
const UInt32 kNumThreadsMax = 4;
static const UInt32 kBufferSize = (1 << 17);
@@ -92,7 +94,7 @@ UInt32 CDecoder::ReadBits(int numBits) { return m_InStream.ReadBits(numBits); }
Byte CDecoder::ReadByte() {return (Byte)ReadBits(8); }
bool CDecoder::ReadBit() { return ReadBits(1) != 0; }
-UInt32 CDecoder::ReadCRC()
+UInt32 CDecoder::ReadCrc()
{
UInt32 crc = 0;
for (int i = 0; i < 4; i++)
@@ -103,17 +105,17 @@ UInt32 CDecoder::ReadCRC()
return crc;
}
-UInt32 NO_INLINE ReadBits(NStream::NMSBF::CDecoder<CInBuffer> *m_InStream, int num)
+UInt32 NO_INLINE ReadBits(NBitm::CDecoder<CInBuffer> *m_InStream, int num)
{
return m_InStream->ReadBits(num);
}
-UInt32 NO_INLINE ReadBit(NStream::NMSBF::CDecoder<CInBuffer> *m_InStream)
+UInt32 NO_INLINE ReadBit(NBitm::CDecoder<CInBuffer> *m_InStream)
{
return m_InStream->ReadBits(1);
}
-static HRESULT NO_INLINE ReadBlock(NStream::NMSBF::CDecoder<CInBuffer> *m_InStream,
+static HRESULT NO_INLINE ReadBlock(NBitm::CDecoder<CInBuffer> *m_InStream,
UInt32 *CharCounters, UInt32 blockSizeMax, Byte *m_Selectors, CHuffmanDecoder *m_HuffmanDecoders,
UInt32 *blockSizeRes, UInt32 *origPtrRes, bool *randRes)
{
@@ -280,7 +282,7 @@ void NO_INLINE DecodeBlock1(UInt32 *charCounters, UInt32 blockSize)
static UInt32 NO_INLINE DecodeBlock2(const UInt32 *tt, UInt32 blockSize, UInt32 OrigPtr, COutBuffer &m_OutStream)
{
- CBZip2CRC crc;
+ CBZip2Crc crc;
// it's for speed optimization: prefetch & prevByte_init;
UInt32 tPos = tt[tt[OrigPtr] >> 8];
@@ -371,7 +373,7 @@ static UInt32 NO_INLINE DecodeBlock2(const UInt32 *tt, UInt32 blockSize, UInt32
static UInt32 NO_INLINE DecodeBlock2Rand(const UInt32 *tt, UInt32 blockSize, UInt32 OrigPtr, COutBuffer &m_OutStream)
{
- CBZip2CRC crc;
+ CBZip2Crc crc;
UInt32 randIndex = 1;
UInt32 randToGo = kRandNums[0] - 2;
@@ -492,7 +494,7 @@ HRESULT CDecoder::ReadSignatures(bool &wasFinished, UInt32 &crc)
Byte s[6];
for (int i = 0; i < 6; i++)
s[i] = ReadByte();
- crc = ReadCRC();
+ crc = ReadCrc();
if (s[0] == kFinSig0)
{
if (s[1] != kFinSig1 ||
@@ -503,7 +505,7 @@ HRESULT CDecoder::ReadSignatures(bool &wasFinished, UInt32 &crc)
return S_FALSE;
wasFinished = true;
- return (crc == CombinedCRC.GetDigest()) ? S_OK : S_FALSE;
+ return (crc == CombinedCrc.GetDigest()) ? S_OK : S_FALSE;
}
if (s[0] != kBlockSig0 ||
s[1] != kBlockSig1 ||
@@ -512,7 +514,7 @@ HRESULT CDecoder::ReadSignatures(bool &wasFinished, UInt32 &crc)
s[4] != kBlockSig4 ||
s[5] != kBlockSig5)
return S_FALSE;
- CombinedCRC.Update(crc);
+ CombinedCrc.Update(crc);
return S_OK;
}
@@ -552,7 +554,7 @@ HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress)
isBZ = true;
UInt32 dicSize = (UInt32)(s[3] - kArSig3) * kBlockSizeStep;
- CombinedCRC.Init();
+ CombinedCrc.Init();
#ifdef COMPRESS_BZIP2_MT
if (MtMode)
{
@@ -608,9 +610,8 @@ HRESULT CDecoder::DecodeFile(bool &isBZ, ICompressProgressInfo *progress)
return S_OK;
}
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 * /* outSize */,
- ICompressProgressInfo *progress)
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
if (!m_InStream.Create(kBufferSize))
return E_OUTOFMEMORY;
@@ -630,9 +631,8 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
return isBZ ? S_OK: S_FALSE;
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const CInBufferException &e) { return e.ErrorCode; }
diff --git a/CPP/7zip/Compress/BZip2/BZip2Decoder.h b/CPP/7zip/Compress/BZip2Decoder.h
index f6058841..195b6b38 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Decoder.h
+++ b/CPP/7zip/Compress/BZip2Decoder.h
@@ -1,23 +1,24 @@
-// Compress/BZip2/Decoder.h
+// Compress/BZip2Decoder.h
#ifndef __COMPRESS_BZIP2_DECODER_H
#define __COMPRESS_BZIP2_DECODER_H
-#include "../../ICoder.h"
-#include "../../../Common/MyCom.h"
-#include "../../Common/MSBFDecoder.h"
-#include "../../Common/InBuffer.h"
-#include "../../Common/OutBuffer.h"
-#include "../Huffman/HuffmanDecoder.h"
-#include "BZip2Const.h"
-#include "BZip2CRC.h"
+#include "../../Common/MyCom.h"
#ifdef COMPRESS_BZIP2_MT
-#include "../../../Windows/Thread.h"
-#include "../../../Windows/Synchronization.h"
+#include "../../Windows/Synchronization.h"
+#include "../../Windows/Thread.h"
#endif
-#define NO_INLINE MY_FAST_CALL
+#include "../ICoder.h"
+
+#include "../Common/InBuffer.h"
+#include "../Common/OutBuffer.h"
+
+#include "BitmDecoder.h"
+#include "BZip2Const.h"
+#include "BZip2Crc.h"
+#include "HuffmanDecoder.h"
namespace NCompress {
namespace NBZip2 {
@@ -67,7 +68,7 @@ class CDecoder :
public:
COutBuffer m_OutStream;
Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
- NStream::NMSBF::CDecoder<CInBuffer> m_InStream;
+ NBitm::CDecoder<CInBuffer> m_InStream;
Byte m_Selectors[kNumSelectorsMax];
CHuffmanDecoder m_HuffmanDecoders[kNumTablesMax];
private:
@@ -77,12 +78,11 @@ private:
UInt32 ReadBits(int numBits);
Byte ReadByte();
bool ReadBit();
- UInt32 ReadCRC();
+ UInt32 ReadCrc();
HRESULT PrepareBlock(CState &state);
HRESULT DecodeFile(bool &isBZ, ICompressProgressInfo *progress);
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
class CDecoderFlusher
{
CDecoder *_decoder;
@@ -98,7 +98,7 @@ private:
};
public:
- CBZip2CombinedCRC CombinedCRC;
+ CBZip2CombinedCrc CombinedCrc;
#ifdef COMPRESS_BZIP2_MT
ICompressProgressInfo *Progress;
@@ -144,9 +144,8 @@ public:
#endif
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp b/CPP/7zip/Compress/BZip2Encoder.cpp
index 5ac9e50b..ef284a33 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Encoder.cpp
+++ b/CPP/7zip/Compress/BZip2Encoder.cpp
@@ -4,15 +4,14 @@
extern "C"
{
-#include "../../../../C/Alloc.h"
-#include "../../../../C/BwtSort.h"
-#include "../../../../C/HuffEnc.h"
+#include "../../../C/Alloc.h"
+#include "../../../C/BwtSort.h"
+#include "../../../C/HuffEnc.h"
}
+#include "BZip2Crc.h"
#include "BZip2Encoder.h"
-
-#include "../BWT/Mtf8.h"
-#include "BZip2CRC.h"
+#include "Mtf8.h"
namespace NCompress {
namespace NBZip2 {
@@ -239,7 +238,7 @@ void CThreadInfo::WriteBits2(UInt32 value, UInt32 numBits)
{ m_OutStreamCurrent->WriteBits(value, numBits); }
void CThreadInfo::WriteByte2(Byte b) { WriteBits2(b , 8); }
void CThreadInfo::WriteBit2(bool v) { WriteBits2((v ? 1 : 0), 1); }
-void CThreadInfo::WriteCRC2(UInt32 v)
+void CThreadInfo::WriteCrc2(UInt32 v)
{
for (int i = 0; i < 4; i++)
WriteByte2(((Byte)(v >> (24 - i * 8))));
@@ -249,7 +248,7 @@ void CEncoder::WriteBits(UInt32 value, UInt32 numBits)
{ m_OutStream.WriteBits(value, numBits); }
void CEncoder::WriteByte(Byte b) { WriteBits(b , 8); }
void CEncoder::WriteBit(bool v) { WriteBits((v ? 1 : 0), 1); }
-void CEncoder::WriteCRC(UInt32 v)
+void CEncoder::WriteCrc(UInt32 v)
{
for (int i = 0; i < 4; i++)
WriteByte(((Byte)(v >> (24 - i * 8))));
@@ -284,7 +283,7 @@ void CThreadInfo::EncodeBlock(const Byte *block, UInt32 blockSize)
if (inUse[i])
{
inUse16[i >> 4] = true;
- mtf.Buffer[numInUse++] = (Byte)i;
+ mtf.Buf[numInUse++] = (Byte)i;
}
for (i = 0; i < 16; i++)
WriteBit2(inUse16[i]);
@@ -583,7 +582,7 @@ UInt32 CThreadInfo::EncodeBlockWithHeaders(const Byte *block, UInt32 blockSize)
WriteByte2(kBlockSig4);
WriteByte2(kBlockSig5);
- CBZip2CRC crc;
+ CBZip2Crc crc;
int numReps = 0;
Byte prevByte = block[0];
UInt32 i = 0;
@@ -608,7 +607,7 @@ UInt32 CThreadInfo::EncodeBlockWithHeaders(const Byte *block, UInt32 blockSize)
}
while (++i < blockSize);
UInt32 crcRes = crc.GetDigest();
- WriteCRC2(crcRes);
+ WriteCrc2(crcRes);
EncodeBlock(block, blockSize);
return crcRes;
}
@@ -689,7 +688,7 @@ HRESULT CThreadInfo::EncodeBlock3(UInt32 blockSize)
Encoder->ThreadsInfo[m_BlockIndex].CanWriteEvent.Lock();
#endif
for (UInt32 i = 0; i < m_NumCrcs; i++)
- Encoder->CombinedCRC.Update(m_CRCs[i]);
+ Encoder->CombinedCrc.Update(m_CRCs[i]);
Encoder->WriteBytes(m_TempArray, outStreamTemp.GetPos(), outStreamTemp.GetCurByte());
HRESULT res = S_OK;
#ifdef COMPRESS_BZIP2_MT
@@ -720,9 +719,8 @@ void CEncoder::WriteBytes(const Byte *data, UInt32 sizeInBits, Byte lastByte)
}
-HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 * /* outSize */,
- ICompressProgressInfo *progress)
+HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
#ifdef COMPRESS_BZIP2_MT
Progress = progress;
@@ -764,7 +762,7 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
CFlusher flusher(this);
- CombinedCRC.Init();
+ CombinedCrc.Init();
#ifdef COMPRESS_BZIP2_MT
NextBlockIndex = 0;
StreamWasFinished = false;
@@ -824,13 +822,12 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
WriteByte(kFinSig4);
WriteByte(kFinSig5);
- WriteCRC(CombinedCRC.GetDigest());
+ WriteCrc(CombinedCrc.GetDigest());
return S_OK;
}
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const CInBufferException &e) { return e.ErrorCode; }
@@ -838,19 +835,18 @@ STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
catch(...) { return S_FALSE; }
}
-HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
+HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
{
- for(UInt32 i = 0; i < numProperties; i++)
+ for(UInt32 i = 0; i < numProps; i++)
{
- const PROPVARIANT &property = properties[i];
+ const PROPVARIANT &prop = props[i];
switch(propIDs[i])
{
case NCoderPropID::kNumPasses:
{
- if (property.vt != VT_UI4)
+ if (prop.vt != VT_UI4)
return E_INVALIDARG;
- UInt32 numPasses = property.ulVal;
+ UInt32 numPasses = prop.ulVal;
if (numPasses == 0)
numPasses = 1;
if (numPasses > kNumPassesMax)
@@ -861,9 +857,9 @@ HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs,
}
case NCoderPropID::kDictionarySize:
{
- if (property.vt != VT_UI4)
+ if (prop.vt != VT_UI4)
return E_INVALIDARG;
- UInt32 dictionary = property.ulVal / kBlockSizeStep;
+ UInt32 dictionary = prop.ulVal / kBlockSizeStep;
if (dictionary < kBlockSizeMultMin)
dictionary = kBlockSizeMultMin;
else if (dictionary > kBlockSizeMultMax)
@@ -874,9 +870,9 @@ HRESULT CEncoder::SetCoderProperties(const PROPID *propIDs,
case NCoderPropID::kNumThreads:
{
#ifdef COMPRESS_BZIP2_MT
- if (property.vt != VT_UI4)
+ if (prop.vt != VT_UI4)
return E_INVALIDARG;
- NumThreads = property.ulVal;
+ NumThreads = prop.ulVal;
if (NumThreads < 1)
NumThreads = 1;
#endif
diff --git a/CPP/7zip/Compress/BZip2/BZip2Encoder.h b/CPP/7zip/Compress/BZip2Encoder.h
index a7adc587..1dda0aa8 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Encoder.h
+++ b/CPP/7zip/Compress/BZip2Encoder.h
@@ -1,21 +1,25 @@
-// Compress/BZip2/Encoder.h
+// Compress/BZip2Encoder.h
#ifndef __COMPRESS_BZIP2_ENCODER_H
#define __COMPRESS_BZIP2_ENCODER_H
-#include "../../ICoder.h"
-#include "../../../Common/MyCom.h"
-#include "../../Common/MSBFEncoder.h"
-#include "../../Common/InBuffer.h"
-#include "../../Common/OutBuffer.h"
-#include "BZip2Const.h"
-#include "BZip2CRC.h"
+#include "../../Common/Defs.h"
+#include "../../Common/MyCom.h"
#ifdef COMPRESS_BZIP2_MT
-#include "../../../Windows/Thread.h"
-#include "../../../Windows/Synchronization.h"
+#include "../../Windows/Synchronization.h"
+#include "../../Windows/Thread.h"
#endif
+#include "../ICoder.h"
+
+#include "../Common/InBuffer.h"
+#include "../Common/OutBuffer.h"
+
+#include "BitmEncoder.h"
+#include "BZip2Const.h"
+#include "BZip2Crc.h"
+
namespace NCompress {
namespace NBZip2 {
@@ -38,13 +42,13 @@ public:
void Flush()
{
- if(m_BitPos < 8)
+ if (m_BitPos < 8)
WriteBits(0, m_BitPos);
}
void WriteBits(UInt32 value, int numBits)
{
- while(numBits > 0)
+ while (numBits > 0)
{
int numNewBits = MyMin(numBits, m_BitPos);
numBits -= numNewBits;
@@ -108,7 +112,7 @@ private:
void WriteBits2(UInt32 value, UInt32 numBits);
void WriteByte2(Byte b);
void WriteBit2(bool v);
- void WriteCRC2(UInt32 v);
+ void WriteCrc2(UInt32 v);
void EncodeBlock(const Byte *block, UInt32 blockSize);
UInt32 EncodeBlockWithHeaders(const Byte *block, UInt32 blockSize);
@@ -158,9 +162,9 @@ class CEncoder :
public:
CInBuffer m_InStream;
Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
- NStream::NMSBF::CEncoder<COutBuffer> m_OutStream;
+ CBitmEncoder<COutBuffer> m_OutStream;
UInt32 NumPasses;
- CBZip2CombinedCRC CombinedCRC;
+ CBZip2CombinedCrc CombinedCrc;
#ifdef COMPRESS_BZIP2_MT
CThreadInfo *ThreadsInfo;
@@ -186,7 +190,7 @@ public:
void WriteBits(UInt32 value, UInt32 numBits);
void WriteByte(Byte b);
void WriteBit(bool v);
- void WriteCRC(UInt32 v);
+ void WriteCrc(UInt32 v);
#ifdef COMPRESS_BZIP2_MT
HRESULT Create();
@@ -227,15 +231,12 @@ public:
MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
#endif
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+ STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
#ifdef COMPRESS_BZIP2_MT
STDMETHOD(SetNumberOfThreads)(UInt32 numThreads);
diff --git a/CPP/7zip/Compress/BZip2/BZip2Register.cpp b/CPP/7zip/Compress/BZip2Register.cpp
index 1f9cf18d..ef14204b 100755
--- a/CPP/7zip/Compress/BZip2/BZip2Register.cpp
+++ b/CPP/7zip/Compress/BZip2Register.cpp
@@ -1,10 +1,11 @@
-// Bzip2Register.cpp
+// BZip2Register.cpp
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "BZip2Decoder.h"
+
static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NBZip2::CDecoder); }
#if !defined(EXTRACT_ONLY) && !defined(BZIP2_EXTRACT_ONLY)
#include "BZip2Encoder.h"
diff --git a/CPP/7zip/Compress/Branch/x86_2.cpp b/CPP/7zip/Compress/Bcj2Coder.cpp
index 87203195..e1356abb 100755
--- a/CPP/7zip/Compress/Branch/x86_2.cpp
+++ b/CPP/7zip/Compress/Bcj2Coder.cpp
@@ -1,13 +1,14 @@
-// x86_2.cpp
+// Bcj2Coder.cpp
#include "StdAfx.h"
-#include "x86_2.h"
extern "C"
{
-#include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
+#include "Bcj2Coder.h"
+
namespace NCompress {
namespace NBcj2 {
diff --git a/CPP/7zip/Compress/Branch/x86_2.h b/CPP/7zip/Compress/Bcj2Coder.h
index 8c5d754b..b8b1e7a9 100755
--- a/CPP/7zip/Compress/Branch/x86_2.h
+++ b/CPP/7zip/Compress/Bcj2Coder.h
@@ -1,11 +1,13 @@
-// x86_2.h
+// Bcj2Coder.h
-#ifndef __BRANCH_X86_2_H
-#define __BRANCH_X86_2_H
+#ifndef __COMPRESS_BCJ2_CODER_H
+#define __COMPRESS_BCJ2_CODER_H
-#include "../../../Common/MyCom.h"
-#include "../RangeCoder/RangeCoderBit.h"
-#include "../../ICoder.h"
+#include "../../Common/MyCom.h"
+
+#include "../ICoder.h"
+
+#include "RangeCoderBit.h"
namespace NCompress {
namespace NBcj2 {
diff --git a/CPP/7zip/Compress/Branch/BCJ2Register.cpp b/CPP/7zip/Compress/Bcj2Register.cpp
index 88ebbac6..8eb1e736 100755
--- a/CPP/7zip/Compress/Branch/BCJ2Register.cpp
+++ b/CPP/7zip/Compress/Bcj2Register.cpp
@@ -1,10 +1,11 @@
-// BranchRegister.cpp
+// Bcj2Register.cpp
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
+
+#include "Bcj2Coder.h"
-#include "x86_2.h"
static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CDecoder()); }
#ifndef EXTRACT_ONLY
static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CEncoder()); }
diff --git a/CPP/7zip/Compress/Branch/x86.cpp b/CPP/7zip/Compress/BcjCoder.cpp
index 79d49657..0e34ef48 100755
--- a/CPP/7zip/Compress/Branch/x86.cpp
+++ b/CPP/7zip/Compress/BcjCoder.cpp
@@ -1,7 +1,8 @@
-// x86.cpp
+// BcjCoder.cpp
#include "StdAfx.h"
-#include "x86.h"
+
+#include "BcjCoder.h"
UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size)
{
diff --git a/CPP/7zip/Compress/Branch/x86.h b/CPP/7zip/Compress/BcjCoder.h
index 960791c4..612bb547 100755
--- a/CPP/7zip/Compress/Branch/x86.h
+++ b/CPP/7zip/Compress/BcjCoder.h
@@ -1,14 +1,15 @@
-// x86.h
+// BcjCoder.h
-#ifndef __X86_H
-#define __X86_H
+#ifndef __COMPRESS_BCJ_CODER_H
+#define __COMPRESS_BCJ_CODER_H
-#include "BranchCoder.h"
extern "C"
{
-#include "../../../../C/Bra.h"
+#include "../../../C/Bra.h"
}
+#include "BranchCoder.h"
+
struct CBranch86
{
UInt32 _prevMask;
diff --git a/CPP/7zip/Compress/Branch/BCJRegister.cpp b/CPP/7zip/Compress/BcjRegister.cpp
index a62d964d..648ad8e0 100755
--- a/CPP/7zip/Compress/Branch/BCJRegister.cpp
+++ b/CPP/7zip/Compress/BcjRegister.cpp
@@ -1,10 +1,11 @@
-// BranchRegister.cpp
+// BcjRegister.cpp
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
+
+#include "BcjCoder.h"
-#include "x86.h"
static void *CreateCodec() { return (void *)(ICompressFilter *)(new CBCJ_x86_Decoder()); }
#ifndef EXTRACT_ONLY
static void *CreateCodecOut() { return (void *)(ICompressFilter *)(new CBCJ_x86_Encoder()); }
diff --git a/CPP/7zip/Compress/BitlDecoder.cpp b/CPP/7zip/Compress/BitlDecoder.cpp
new file mode 100755
index 00000000..78665be8
--- /dev/null
+++ b/CPP/7zip/Compress/BitlDecoder.cpp
@@ -0,0 +1,24 @@
+// BitlDecoder.cpp
+
+#include "StdAfx.h"
+
+#include "BitlDecoder.h"
+
+namespace NBitl {
+
+Byte kInvertTable[256];
+
+struct CInverterTableInitializer
+{
+ CInverterTableInitializer()
+ {
+ for (int i = 0; i < 256; i++)
+ {
+ int x = ((i & 0x55) << 1) | ((i & 0xAA) >> 1);
+ x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2);
+ kInvertTable[i] = (Byte)(((x & 0x0F) << 4) | ((x & 0xF0) >> 4));
+ }
+ }
+} g_InverterTableInitializer;
+
+}
diff --git a/CPP/7zip/Compress/BitlDecoder.h b/CPP/7zip/Compress/BitlDecoder.h
new file mode 100755
index 00000000..0ccd7154
--- /dev/null
+++ b/CPP/7zip/Compress/BitlDecoder.h
@@ -0,0 +1,125 @@
+// BitlDecoder.h -- the Least Significant Bit of byte is First
+
+#ifndef __BITL_DECODER_H
+#define __BITL_DECODER_H
+
+#include "../IStream.h"
+
+namespace NBitl {
+
+const int kNumBigValueBits = 8 * 4;
+
+const int kNumValueBytes = 3;
+const int kNumValueBits = 8 * kNumValueBytes;
+
+const UInt32 kMask = (1 << kNumValueBits) - 1;
+
+extern Byte kInvertTable[256];
+
+template<class TInByte>
+class CBaseDecoder
+{
+protected:
+ int m_BitPos;
+ UInt32 m_Value;
+ TInByte m_Stream;
+public:
+ UInt32 NumExtraBytes;
+ bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
+ void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream); }
+ void ReleaseStream() { m_Stream.ReleaseStream(); }
+ void Init()
+ {
+ m_Stream.Init();
+ m_BitPos = kNumBigValueBits;
+ m_Value = 0;
+ NumExtraBytes = 0;
+ }
+ UInt64 GetProcessedSize() const
+ { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
+ UInt64 GetProcessedBitsSize() const
+ { return (m_Stream.GetProcessedSize() << 3) - (kNumBigValueBits - m_BitPos); }
+ int GetBitPosition() const { return (m_BitPos & 7); }
+
+ void Normalize()
+ {
+ for (;m_BitPos >= 8; m_BitPos -= 8)
+ {
+ Byte b = 0;
+ if (!m_Stream.ReadByte(b))
+ {
+ b = 0xFF; // check it
+ NumExtraBytes++;
+ }
+ m_Value = (b << (kNumBigValueBits - m_BitPos)) | m_Value;
+ }
+ }
+
+ UInt32 ReadBits(int numBits)
+ {
+ Normalize();
+ UInt32 res = m_Value & ((1 << numBits) - 1);
+ m_BitPos += numBits;
+ m_Value >>= numBits;
+ return res;
+ }
+
+ bool ExtraBitsWereRead() const
+ {
+ if (NumExtraBytes == 0)
+ return false;
+ return ((UInt32)(kNumBigValueBits - m_BitPos) < (NumExtraBytes << 3));
+ }
+};
+
+template<class TInByte>
+class CDecoder: public CBaseDecoder<TInByte>
+{
+ UInt32 m_NormalValue;
+
+public:
+ void Init()
+ {
+ CBaseDecoder<TInByte>::Init();
+ m_NormalValue = 0;
+ }
+
+ void Normalize()
+ {
+ for (; this->m_BitPos >= 8; this->m_BitPos -= 8)
+ {
+ Byte b = 0;
+ if (!this->m_Stream.ReadByte(b))
+ {
+ b = 0xFF; // check it
+ this->NumExtraBytes++;
+ }
+ m_NormalValue = (b << (kNumBigValueBits - this->m_BitPos)) | m_NormalValue;
+ this->m_Value = (this->m_Value << 8) | kInvertTable[b];
+ }
+ }
+
+ UInt32 GetValue(int numBits)
+ {
+ Normalize();
+ return ((this->m_Value >> (8 - this->m_BitPos)) & kMask) >> (kNumValueBits - numBits);
+ }
+
+ void MovePos(int numBits)
+ {
+ this->m_BitPos += numBits;
+ m_NormalValue >>= numBits;
+ }
+
+ UInt32 ReadBits(int numBits)
+ {
+ Normalize();
+ UInt32 res = m_NormalValue & ( (1 << numBits) - 1);
+ MovePos(numBits);
+ return res;
+ }
+};
+
+}
+
+#endif
diff --git a/CPP/7zip/Compress/BitlEncoder.h b/CPP/7zip/Compress/BitlEncoder.h
new file mode 100755
index 00000000..02f5a9c6
--- /dev/null
+++ b/CPP/7zip/Compress/BitlEncoder.h
@@ -0,0 +1,60 @@
+// BitlEncoder.h -- the Least Significant Bit of byte is First
+
+#ifndef __BITL_ENCODER_H
+#define __BITL_ENCODER_H
+
+#include "../Common/OutBuffer.h"
+
+class CBitlEncoder
+{
+ COutBuffer m_Stream;
+ int m_BitPos;
+ Byte m_CurByte;
+public:
+ bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
+ void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream); }
+ void ReleaseStream() { m_Stream.ReleaseStream(); }
+ void Init()
+ {
+ m_Stream.Init();
+ m_BitPos = 8;
+ m_CurByte = 0;
+ }
+ HRESULT Flush()
+ {
+ FlushByte();
+ return m_Stream.Flush();
+ }
+
+ void FlushByte()
+ {
+ if(m_BitPos < 8)
+ m_Stream.WriteByte(m_CurByte);
+ m_BitPos = 8;
+ m_CurByte = 0;
+ }
+
+ void WriteBits(UInt32 value, int numBits)
+ {
+ while(numBits > 0)
+ {
+ if (numBits < m_BitPos)
+ {
+ m_CurByte |= (value & ((1 << numBits) - 1)) << (8 - m_BitPos);
+ m_BitPos -= numBits;
+ return;
+ }
+ numBits -= m_BitPos;
+ m_Stream.WriteByte((Byte)(m_CurByte | (value << (8 - m_BitPos))));
+ value >>= m_BitPos;
+ m_BitPos = 8;
+ m_CurByte = 0;
+ }
+ }
+ UInt32 GetBitPosition() const { return (8 - m_BitPos); }
+ UInt64 GetProcessedSize() const {
+ return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; }
+ void WriteByte(Byte b) { m_Stream.WriteByte(b);}
+};
+
+#endif
diff --git a/CPP/7zip/Compress/BitmDecoder.h b/CPP/7zip/Compress/BitmDecoder.h
new file mode 100755
index 00000000..fbe4c949
--- /dev/null
+++ b/CPP/7zip/Compress/BitmDecoder.h
@@ -0,0 +1,66 @@
+// BitmDecoder.h -- the Most Significant Bit of byte is First
+
+#ifndef __BITM_DECODER_H
+#define __BITM_DECODER_H
+
+#include "../IStream.h"
+
+namespace NBitm {
+
+const int kNumBigValueBits = 8 * 4;
+const int kNumValueBytes = 3;
+const int kNumValueBits = 8 * kNumValueBytes;
+
+const UInt32 kMask = (1 << kNumValueBits) - 1;
+
+template<class TInByte>
+class CDecoder
+{
+ UInt32 m_BitPos;
+ UInt32 m_Value;
+public:
+ TInByte m_Stream;
+ bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
+ void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
+ void ReleaseStream() { m_Stream.ReleaseStream();}
+
+ void Init()
+ {
+ m_Stream.Init();
+ m_BitPos = kNumBigValueBits;
+ Normalize();
+ }
+
+ UInt64 GetProcessedSize() const
+ { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
+ UInt32 GetBitPosition() const { return (m_BitPos & 7); }
+
+ void Normalize()
+ {
+ for (;m_BitPos >= 8; m_BitPos -= 8)
+ m_Value = (m_Value << 8) | m_Stream.ReadByte();
+ }
+
+ UInt32 GetValue(UInt32 numBits) const
+ {
+ // return (m_Value << m_BitPos) >> (kNumBigValueBits - numBits);
+ return ((m_Value >> (8 - m_BitPos)) & kMask) >> (kNumValueBits - numBits);
+ }
+
+ void MovePos(UInt32 numBits)
+ {
+ m_BitPos += numBits;
+ Normalize();
+ }
+
+ UInt32 ReadBits(UInt32 numBits)
+ {
+ UInt32 res = GetValue(numBits);
+ MovePos(numBits);
+ return res;
+ }
+};
+
+}
+
+#endif
diff --git a/CPP/7zip/Compress/BitmEncoder.h b/CPP/7zip/Compress/BitmEncoder.h
new file mode 100755
index 00000000..25976ef6
--- /dev/null
+++ b/CPP/7zip/Compress/BitmEncoder.h
@@ -0,0 +1,52 @@
+// BitmEncoder.h -- the Most Significant Bit of byte is First
+
+#ifndef __BITM_ENCODER_H
+#define __BITM_ENCODER_H
+
+#include "../IStream.h"
+
+template<class TOutByte>
+class CBitmEncoder
+{
+ TOutByte m_Stream;
+ int m_BitPos;
+ Byte m_CurByte;
+public:
+ bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
+ void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream);}
+ void ReleaseStream() { m_Stream.ReleaseStream(); }
+ void Init()
+ {
+ m_Stream.Init();
+ m_BitPos = 8;
+ m_CurByte = 0;
+ }
+ HRESULT Flush()
+ {
+ if(m_BitPos < 8)
+ WriteBits(0, m_BitPos);
+ return m_Stream.Flush();
+ }
+
+ void WriteBits(UInt32 value, int numBits)
+ {
+ while(numBits > 0)
+ {
+ if (numBits < m_BitPos)
+ {
+ m_CurByte |= ((Byte)value << (m_BitPos -= numBits));
+ return;
+ }
+ numBits -= m_BitPos;
+ UInt32 newBits = (value >> numBits);
+ value -= (newBits << numBits);
+ m_Stream.WriteByte((Byte)(m_CurByte | newBits));
+ m_BitPos = 8;
+ m_CurByte = 0;
+ }
+ }
+ UInt64 GetProcessedSize() const {
+ return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) / 8; }
+};
+
+#endif
diff --git a/CPP/7zip/Compress/Branch/StdAfx.h b/CPP/7zip/Compress/Branch/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Branch/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Branch/BranchCoder.cpp b/CPP/7zip/Compress/BranchCoder.cpp
index 8d25f0d5..43170952 100755
--- a/CPP/7zip/Compress/Branch/BranchCoder.cpp
+++ b/CPP/7zip/Compress/BranchCoder.cpp
@@ -1,6 +1,7 @@
// BranchCoder.cpp
#include "StdAfx.h"
+
#include "BranchCoder.h"
STDMETHODIMP CBranchConverter::Init()
diff --git a/CPP/7zip/Compress/Branch/BranchCoder.h b/CPP/7zip/Compress/BranchCoder.h
index 8ea84761..0e3a5c4e 100755
--- a/CPP/7zip/Compress/Branch/BranchCoder.h
+++ b/CPP/7zip/Compress/BranchCoder.h
@@ -1,12 +1,11 @@
// BranchCoder.h
-#ifndef __BRANCH_CODER_H
-#define __BRANCH_CODER_H
+#ifndef __COMPRESS_BRANCH_CODER_H
+#define __COMPRESS_BRANCH_CODER_H
-#include "Common/MyCom.h"
-#include "Common/Types.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
+#include "../ICoder.h"
class CBranchConverter:
public ICompressFilter,
diff --git a/CPP/7zip/Compress/Branch/BranchMisc.cpp b/CPP/7zip/Compress/BranchMisc.cpp
index 956bafaf..5a19c44a 100755
--- a/CPP/7zip/Compress/Branch/BranchMisc.cpp
+++ b/CPP/7zip/Compress/BranchMisc.cpp
@@ -1,13 +1,14 @@
// BranchMisc.cpp
#include "StdAfx.h"
-#include "BranchMisc.h"
extern "C"
{
-#include "../../../../C/Bra.h"
+#include "../../../C/Bra.h"
}
+#include "BranchMisc.h"
+
UInt32 CBC_ARM_Encoder::SubFilter(Byte *data, UInt32 size)
{ return (UInt32)::ARM_Convert(data, size, _bufferPos, 1); }
diff --git a/CPP/7zip/Compress/Branch/BranchMisc.h b/CPP/7zip/Compress/BranchMisc.h
index 219eec1c..81198b21 100755
--- a/CPP/7zip/Compress/Branch/BranchMisc.h
+++ b/CPP/7zip/Compress/BranchMisc.h
@@ -1,7 +1,7 @@
// BranchMisc.h
-#ifndef __BRANCHMISC_H
-#define __BRANCHMISC_H
+#ifndef __COMPRESS_BRANCH_MISC_H
+#define __COMPRESS_BRANCH_MISC_H
#include "BranchCoder.h"
diff --git a/CPP/7zip/Compress/Branch/BranchRegister.cpp b/CPP/7zip/Compress/BranchRegister.cpp
index 69fbe5d3..380828c6 100755
--- a/CPP/7zip/Compress/Branch/BranchRegister.cpp
+++ b/CPP/7zip/Compress/BranchRegister.cpp
@@ -2,7 +2,7 @@
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "BranchMisc.h"
diff --git a/CPP/7zip/Compress/ByteSwap/ByteSwap.cpp b/CPP/7zip/Compress/ByteSwap.cpp
index 3f252f2c..3f252f2c 100755
--- a/CPP/7zip/Compress/ByteSwap/ByteSwap.cpp
+++ b/CPP/7zip/Compress/ByteSwap.cpp
diff --git a/CPP/7zip/Compress/ByteSwap.h b/CPP/7zip/Compress/ByteSwap.h
new file mode 100755
index 00000000..f13bec80
--- /dev/null
+++ b/CPP/7zip/Compress/ByteSwap.h
@@ -0,0 +1,30 @@
+// ByteSwap.h
+
+#ifndef __COMPRESS_BYTE_SWAP_H
+#define __COMPRESS_BYTE_SWAP_H
+
+#include "../../Common/MyCom.h"
+
+#include "../ICoder.h"
+
+class CByteSwap2:
+ public ICompressFilter,
+ public CMyUnknownImp
+{
+public:
+ MY_UNKNOWN_IMP
+ STDMETHOD(Init)();
+ STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
+};
+
+class CByteSwap4:
+ public ICompressFilter,
+ public CMyUnknownImp
+{
+public:
+ MY_UNKNOWN_IMP
+ STDMETHOD(Init)();
+ STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
+};
+
+#endif
diff --git a/CPP/7zip/Compress/ByteSwap/ByteSwap.h b/CPP/7zip/Compress/ByteSwap/ByteSwap.h
deleted file mode 100755
index 4d223d4c..00000000
--- a/CPP/7zip/Compress/ByteSwap/ByteSwap.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// ByteSwap.h
-
-#ifndef __BYTESWAP_H
-#define __BYTESWAP_H
-
-#include "../../ICoder.h"
-#include "Common/MyCom.h"
-
-// {23170F69-40C1-278B-0203-020000000000}
-DEFINE_GUID(CLSID_CCompressConvertByteSwap2,
-0x23170F69, 0x40C1, 0x278B, 0x02, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-// {23170F69-40C1-278B-0203-040000000000}
-DEFINE_GUID(CLSID_CCompressConvertByteSwap4,
-0x23170F69, 0x40C1, 0x278B, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00);
-
-class CByteSwap2:
- public ICompressFilter,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-class CByteSwap4:
- public ICompressFilter,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
- STDMETHOD(Init)();
- STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
-};
-
-#endif
diff --git a/CPP/7zip/Compress/ByteSwap/StdAfx.h b/CPP/7zip/Compress/ByteSwap/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/ByteSwap/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp b/CPP/7zip/Compress/ByteSwapRegister.cpp
index b1cf8fa6..e3405ca0 100755
--- a/CPP/7zip/Compress/ByteSwap/ByteSwapRegister.cpp
+++ b/CPP/7zip/Compress/ByteSwapRegister.cpp
@@ -2,9 +2,10 @@
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "ByteSwap.h"
+
static void *CreateCodec2() { return (void *)(ICompressFilter *)(new CByteSwap2); }
static void *CreateCodec4() { return (void *)(ICompressFilter *)(new CByteSwap4); }
diff --git a/CPP/7zip/Compress/Copy/StdAfx.h b/CPP/7zip/Compress/Copy/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Copy/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Copy/CopyCoder.cpp b/CPP/7zip/Compress/CopyCoder.cpp
index be4fee36..899ffa3a 100755
--- a/CPP/7zip/Compress/Copy/CopyCoder.cpp
+++ b/CPP/7zip/Compress/CopyCoder.cpp
@@ -4,11 +4,12 @@
extern "C"
{
-#include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
+#include "../Common/StreamUtils.h"
+
#include "CopyCoder.h"
-#include "../../Common/StreamUtils.h"
namespace NCompress {
@@ -59,4 +60,3 @@ STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value)
}
}
-
diff --git a/CPP/7zip/Compress/Copy/CopyCoder.h b/CPP/7zip/Compress/CopyCoder.h
index 7de13992..c5736781 100755
--- a/CPP/7zip/Compress/Copy/CopyCoder.h
+++ b/CPP/7zip/Compress/CopyCoder.h
@@ -1,10 +1,11 @@
// Compress/CopyCoder.h
-#ifndef __COMPRESS_COPYCODER_H
-#define __COMPRESS_COPYCODER_H
+#ifndef __COMPRESS_COPY_CODER_H
+#define __COMPRESS_COPY_CODER_H
-#include "../../ICoder.h"
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
+
+#include "../ICoder.h"
namespace NCompress {
@@ -21,10 +22,8 @@ public:
MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
};
diff --git a/CPP/7zip/Compress/Copy/CopyRegister.cpp b/CPP/7zip/Compress/CopyRegister.cpp
index 1e688b7c..efb9b9e9 100755
--- a/CPP/7zip/Compress/Copy/CopyRegister.cpp
+++ b/CPP/7zip/Compress/CopyRegister.cpp
@@ -1,10 +1,11 @@
-// LZMARegister.cpp
+// CopyRegister.cpp
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "CopyCoder.h"
+
static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::CCopyCoder); }
static CCodecInfo g_CodecInfo =
diff --git a/CPP/7zip/Compress/Deflate/StdAfx.h b/CPP/7zip/Compress/Deflate/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Deflate/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Deflate/Deflate64Register.cpp b/CPP/7zip/Compress/Deflate64Register.cpp
index 554e0153..509e675a 100755
--- a/CPP/7zip/Compress/Deflate/Deflate64Register.cpp
+++ b/CPP/7zip/Compress/Deflate64Register.cpp
@@ -2,9 +2,10 @@
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "DeflateDecoder.h"
+
static void *CreateCodecDeflate64() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder64); }
#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY)
#include "DeflateEncoder.h"
diff --git a/CPP/7zip/Compress/Deflate/DeflateConst.h b/CPP/7zip/Compress/DeflateConst.h
index 00e5ab8b..00e5ab8b 100755
--- a/CPP/7zip/Compress/Deflate/DeflateConst.h
+++ b/CPP/7zip/Compress/DeflateConst.h
diff --git a/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp b/CPP/7zip/Compress/DeflateDecoder.cpp
index b5382912..dae60c07 100755
--- a/CPP/7zip/Compress/Deflate/DeflateDecoder.cpp
+++ b/CPP/7zip/Compress/DeflateDecoder.cpp
@@ -231,10 +231,8 @@ HRESULT CCoder::CodeSpec(UInt32 curSize)
return S_OK;
}
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *, const UInt64 *outSize, ICompressProgressInfo *progress)
{
SetInStream(inStream);
m_OutWindowStream.SetStream(outStream);
@@ -286,14 +284,13 @@ HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
#define DEFLATE_TRY_BEGIN try {
#define DEFLATE_TRY_END } \
catch(const CInBufferException &e) { return e.ErrorCode; } \
- catch(const CLZOutWindowException &e) { return e.ErrorCode; } \
+ catch(const CLzOutWindowException &e) { return e.ErrorCode; } \
catch(...) { return S_FALSE; }
#endif
-HRESULT CCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
DEFLATE_TRY_BEGIN
return CodeReal(inStream, outStream, inSize, outSize, progress);
diff --git a/CPP/7zip/Compress/Deflate/DeflateDecoder.h b/CPP/7zip/Compress/DeflateDecoder.h
index add02ba6..796d90a4 100755
--- a/CPP/7zip/Compress/Deflate/DeflateDecoder.h
+++ b/CPP/7zip/Compress/DeflateDecoder.h
@@ -3,15 +3,16 @@
#ifndef __DEFLATE_DECODER_H
#define __DEFLATE_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/LSBFDecoder.h"
-#include "../../Common/InBuffer.h"
-#include "../LZ/LZOutWindow.h"
-#include "../Huffman/HuffmanDecoder.h"
+#include "../ICoder.h"
+#include "../Common/InBuffer.h"
+
+#include "BitlDecoder.h"
#include "DeflateConst.h"
+#include "HuffmanDecoder.h"
+#include "LzOutWindow.h"
namespace NCompress {
namespace NDeflate {
@@ -27,8 +28,8 @@ class CCoder:
#endif
public CMyUnknownImp
{
- CLZOutWindow m_OutWindowStream;
- NStream::NLSBF::CDecoder<CInBuffer> m_InBitStream;
+ CLzOutWindow m_OutWindowStream;
+ NBitl::CDecoder<CInBuffer> m_InBitStream;
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kFixedMainTableSize> m_MainDecoder;
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kFixedDistTableSize> m_DistDecoder;
NCompress::NHuffman::CDecoder<kNumHuffmanBits, kLevelTableSize> m_LevelDecoder;
@@ -82,9 +83,8 @@ public:
CCoder(bool deflate64Mode, bool deflateNSIS = false);
void SetKeepHistory(bool keepHistory) { _keepHistory = keepHistory; }
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
#ifndef NO_READ_FROM_CODER
MY_UNKNOWN_IMP4(
@@ -98,9 +98,8 @@ public:
ICompressGetInStreamProcessedSize)
#endif
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetInStream)(ISequentialInStream *inStream);
STDMETHOD(ReleaseInStream)();
diff --git a/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp b/CPP/7zip/Compress/DeflateEncoder.cpp
index 14c7cb00..b5c70969 100755
--- a/CPP/7zip/Compress/Deflate/DeflateEncoder.cpp
+++ b/CPP/7zip/Compress/DeflateEncoder.cpp
@@ -2,18 +2,16 @@
#include "StdAfx.h"
-#include <stdio.h>
-
-#include "DeflateEncoder.h"
-
-#include "Windows/Defs.h"
-#include "Common/ComTry.h"
extern "C"
{
-#include "../../../../C/Alloc.h"
-#include "../../../../C/HuffEnc.h"
+#include "../../../C/Alloc.h"
+#include "../../../C/HuffEnc.h"
}
+#include "Common/ComTry.h"
+
+#include "DeflateEncoder.h"
+
#if _MSC_VER >= 1300
#define NO_INLINE __declspec(noinline)
#else
@@ -163,13 +161,11 @@ HRESULT CCoder::Create()
COM_TRY_END
}
-// ICompressSetEncoderProperties2
-HRESULT CCoder::BaseSetEncoderProperties2(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
+HRESULT CCoder::BaseSetEncoderProperties2(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
{
- for(UInt32 i = 0; i < numProperties; i++)
+ for (UInt32 i = 0; i < numProps; i++)
{
- const PROPVARIANT &prop = properties[i];
+ const PROPVARIANT &prop = props[i];
switch(propIDs[i])
{
case NCoderPropID::kNumPasses:
@@ -220,14 +216,10 @@ HRESULT CCoder::BaseSetEncoderProperties2(const PROPID *propIDs,
void CCoder::Free()
{
- ::MidFree(m_OnePosMatchesMemory);
- m_OnePosMatchesMemory = 0;
- ::MyFree(m_DistanceMemory);
- m_DistanceMemory = 0;
- ::MyFree(m_Values);
- m_Values = 0;
- ::MyFree(m_Tables);
- m_Tables = 0;
+ ::MidFree(m_OnePosMatchesMemory); m_OnePosMatchesMemory = 0;
+ ::MyFree(m_DistanceMemory); m_DistanceMemory = 0;
+ ::MyFree(m_Values); m_Values = 0;
+ ::MyFree(m_Tables); m_Tables = 0;
}
CCoder::~CCoder()
@@ -922,9 +914,8 @@ SRes Read(void *object, void *data, size_t *size)
return (SRes)res;
}
-HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */ , const UInt64 * /* outSize */ ,
- ICompressProgressInfo *progress)
+HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */ , const UInt64 * /* outSize */ , ICompressProgressInfo *progress)
{
m_CheckStatic = (m_NumPasses != 1 || m_NumDivPasses != 1);
m_IsMultiPass = (m_CheckStatic || (m_NumPasses != 1 || m_NumDivPasses != 1));
@@ -971,32 +962,26 @@ HRESULT CCoder::CodeReal(ISequentialInStream *inStream,
return m_OutStream.Flush();
}
-HRESULT CCoder::BaseCode(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CCoder::BaseCode(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const COutBufferException &e) { return e.ErrorCode; }
catch(...) { return E_FAIL; }
}
-STDMETHODIMP CCOMCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CCOMCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{ return BaseCode(inStream, outStream, inSize, outSize, progress); }
-STDMETHODIMP CCOMCoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
- { return BaseSetEncoderProperties2(propIDs, properties, numProperties); }
+STDMETHODIMP CCOMCoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
+ { return BaseSetEncoderProperties2(propIDs, props, numProps); }
-STDMETHODIMP CCOMCoder64::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CCOMCoder64::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{ return BaseCode(inStream, outStream, inSize, outSize, progress); }
-STDMETHODIMP CCOMCoder64::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
- { return BaseSetEncoderProperties2(propIDs, properties, numProperties); }
+STDMETHODIMP CCOMCoder64::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
+ { return BaseSetEncoderProperties2(propIDs, props, numProps); }
}}}
-
diff --git a/CPP/7zip/Compress/Deflate/DeflateEncoder.h b/CPP/7zip/Compress/DeflateEncoder.h
index e16b074d..2790bcc7 100755
--- a/CPP/7zip/Compress/Deflate/DeflateEncoder.h
+++ b/CPP/7zip/Compress/DeflateEncoder.h
@@ -3,18 +3,18 @@
#ifndef __DEFLATE_ENCODER_H
#define __DEFLATE_ENCODER_H
+extern "C"
+{
+ #include "../../../C/LzFind.h"
+}
+
#include "Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/LSBFEncoder.h"
+#include "../ICoder.h"
+#include "BitlEncoder.h"
#include "DeflateConst.h"
-extern "C"
-{
- #include "../../../../C/LzFind.h"
-}
-
namespace NCompress {
namespace NDeflate {
namespace NEncoder {
@@ -58,7 +58,7 @@ typedef struct _CSeqInStream
class CCoder
{
CMatchFinder _lzInWindow;
- NStream::NLSBF::CEncoder m_OutStream;
+ CBitlEncoder m_OutStream;
CSeqInStream _seqInStream;
@@ -171,20 +171,15 @@ public:
CCoder(bool deflate64Mode = false);
~CCoder();
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- HRESULT BaseCode(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT BaseCode(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- // ICompressSetCoderProperties
- HRESULT BaseSetEncoderProperties2(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties);
+ HRESULT BaseSetEncoderProperties2(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
};
-///////////////////////////////////////////////////////////////
class CCOMCoder :
public ICompressCoder,
@@ -195,12 +190,9 @@ class CCOMCoder :
public:
MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
CCOMCoder(): CCoder(false) {};
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
- // ICompressSetCoderProperties
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+ STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
};
class CCOMCoder64 :
@@ -212,15 +204,11 @@ class CCOMCoder64 :
public:
MY_UNKNOWN_IMP1(ICompressSetCoderProperties)
CCOMCoder64(): CCoder(true) {};
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
- // ICompressSetCoderProperties
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+ STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
};
-
}}}
#endif
diff --git a/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp b/CPP/7zip/Compress/DeflateNsisRegister.cpp
index db181021..ffad96c2 100755
--- a/CPP/7zip/Compress/Deflate/DeflateNsisRegister.cpp
+++ b/CPP/7zip/Compress/DeflateNsisRegister.cpp
@@ -2,9 +2,10 @@
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "DeflateDecoder.h"
+
static void *CreateCodecDeflateNsis() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CNsisCOMCoder); }
static CCodecInfo g_CodecInfo =
diff --git a/CPP/7zip/Compress/Deflate/DeflateRegister.cpp b/CPP/7zip/Compress/DeflateRegister.cpp
index ab3789fd..45f55219 100755
--- a/CPP/7zip/Compress/Deflate/DeflateRegister.cpp
+++ b/CPP/7zip/Compress/DeflateRegister.cpp
@@ -2,10 +2,12 @@
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "DeflateDecoder.h"
+
static void *CreateCodecDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NDecoder::CCOMCoder); }
+
#if !defined(EXTRACT_ONLY) && !defined(DEFLATE_EXTRACT_ONLY)
#include "DeflateEncoder.h"
static void *CreateCodecOutDeflate() { return (void *)(ICompressCoder *)(new NCompress::NDeflate::NEncoder::CCOMCoder); }
diff --git a/CPP/7zip/Compress/Huffman/HuffmanDecoder.h b/CPP/7zip/Compress/HuffmanDecoder.h
index 76b35c3a..82a1e6f2 100755
--- a/CPP/7zip/Compress/Huffman/HuffmanDecoder.h
+++ b/CPP/7zip/Compress/HuffmanDecoder.h
@@ -1,9 +1,9 @@
// Compress/HuffmanDecoder.h
-#ifndef __COMPRESS_HUFFMANDECODER_H
-#define __COMPRESS_HUFFMANDECODER_H
+#ifndef __COMPRESS_HUFFMAN_DECODER_H
+#define __COMPRESS_HUFFMAN_DECODER_H
-#include "../../../Common/Types.h"
+#include "../../Common/Types.h"
namespace NCompress {
namespace NHuffman {
diff --git a/CPP/7zip/Compress/Implode/StdAfx.h b/CPP/7zip/Compress/Implode/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Implode/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Implode/ImplodeDecoder.cpp b/CPP/7zip/Compress/ImplodeDecoder.cpp
index a641f53e..f84a013c 100755
--- a/CPP/7zip/Compress/Implode/ImplodeDecoder.cpp
+++ b/CPP/7zip/Compress/ImplodeDecoder.cpp
@@ -121,9 +121,8 @@ public:
~CCoderReleaser() { m_Coder->ReleaseStreams(); }
};
-STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CCoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
{
if (!m_InBitStream.Create(1 << 20))
return E_OUTOFMEMORY;
@@ -193,12 +192,11 @@ STDMETHODIMP CCoder::CodeReal(ISequentialInStream *inStream,
return m_OutWindowStream.Flush();
}
-STDMETHODIMP CCoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CCoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CLZOutWindowException &e) { return e.ErrorCode; }
+ catch(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Implode/ImplodeDecoder.h b/CPP/7zip/Compress/ImplodeDecoder.h
index 9616edf9..7ea1553e 100755
--- a/CPP/7zip/Compress/Implode/ImplodeDecoder.h
+++ b/CPP/7zip/Compress/ImplodeDecoder.h
@@ -1,26 +1,26 @@
// ImplodeDecoder.h
-#ifndef __IMPLODE_DECODER_H
-#define __IMPLODE_DECODER_H
+#ifndef __COMPRESS_IMPLODE_DECODER_H
+#define __COMPRESS_IMPLODE_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../LZ/LZOutWindow.h"
+#include "../ICoder.h"
#include "ImplodeHuffmanDecoder.h"
+#include "LzOutWindow.h"
namespace NCompress {
namespace NImplode {
namespace NDecoder {
-class CCoder :
+class CCoder:
public ICompressCoder,
public ICompressSetDecoderProperties2,
public CMyUnknownImp
{
- CLZOutWindow m_OutWindowStream;
- NStream::NLSBF::CDecoder<CInBuffer> m_InBitStream;
+ CLzOutWindow m_OutWindowStream;
+ NBitl::CDecoder<CInBuffer> m_InBitStream;
NImplode::NHuffman::CDecoder m_LiteralDecoder;
NImplode::NHuffman::CDecoder m_LengthDecoder;
@@ -41,17 +41,14 @@ public:
MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
void ReleaseStreams();
- HRESULT (Flush)() { return m_OutWindowStream.Flush(); }
+ HRESULT Flush() { return m_OutWindowStream.Flush(); }
- STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- // ICompressSetDecoderProperties
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
};
diff --git a/CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp b/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp
index 64345e08..64345e08 100755
--- a/CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.cpp
+++ b/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp
diff --git a/CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h b/CPP/7zip/Compress/ImplodeHuffmanDecoder.h
index 541ca59d..6120a35a 100755
--- a/CPP/7zip/Compress/Implode/ImplodeHuffmanDecoder.h
+++ b/CPP/7zip/Compress/ImplodeHuffmanDecoder.h
@@ -3,8 +3,9 @@
#ifndef __IMPLODE_HUFFMAN_DECODER_H
#define __IMPLODE_HUFFMAN_DECODER_H
-#include "../../Common/LSBFDecoder.h"
-#include "../../Common/InBuffer.h"
+#include "../Common/InBuffer.h"
+
+#include "BitlDecoder.h"
namespace NCompress {
namespace NImplode {
@@ -12,7 +13,7 @@ namespace NHuffman {
const int kNumBitsInLongestCode = 16;
-typedef NStream::NLSBF::CDecoder<CInBuffer> CInBit;
+typedef NBitl::CDecoder<CInBuffer> CInBit;
class CDecoder
{
diff --git a/CPP/7zip/Compress/LZ/StdAfx.h b/CPP/7zip/Compress/LZ/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/LZ/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/LZMA/LZMA.dsp b/CPP/7zip/Compress/LZMA/LZMA.dsp
deleted file mode 100755
index d7e130fd..00000000
--- a/CPP/7zip/Compress/LZMA/LZMA.dsp
+++ /dev/null
@@ -1,403 +0,0 @@
-# Microsoft Developer Studio Project File - Name="LZMA" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=LZMA - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "LZMA.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "LZMA.mak" CFG="LZMA - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "LZMA - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "LZMA - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-zip\Codecs\LZMA.dll" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none /debug
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_7ZIP_LARGE_PAGES" /Yu"StdAfx.h" /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-zip\Codecs\LZMA.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "LZMA - Win32 Release"
-# Name "LZMA - Win32 Debug"
-# Begin Group "Spec"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\Codec.def
-# End Source File
-# Begin Source File
-
-SOURCE=..\CodecExports.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\DllExports.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"StdAfx.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "7-zip Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.h
-# End Source File
-# End Group
-# Begin Group "RangeCoder"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\RangeCoder\RangeCoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\RangeCoder\RangeCoderBit.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\RangeCoder\RangeCoderBit.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\RangeCoder\RangeCoderBitTree.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\RangeCoder\RangeCoderOpt.h
-# End Source File
-# End Group
-# Begin Group "Interface"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\ICoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\IStream.h
-# End Source File
-# End Group
-# Begin Group "LZ"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\LZ\LZOutWindow.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\LZOutWindow.h
-# End Source File
-# End Group
-# Begin Group "Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Common\ComTry.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Defs.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\Exception.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyCom.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyUnknown.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyWindows.h
-# End Source File
-# End Group
-# Begin Group "C"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.c
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\IStream.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFind.c
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFind.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFindMt.c
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzFindMt.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzHash.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaDec.c
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaDec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaEnc.c
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\LzmaEnc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Threads.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Types.h
-# End Source File
-# End Group
-# Begin Source File
-
-SOURCE=.\LZMA.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\LZMADecoder.cpp
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\LZMADecoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\LZMAEncoder.cpp
-
-!IF "$(CFG)" == "LZMA - Win32 Release"
-
-# ADD CPP /O2 /FAs
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\LZMAEncoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\LZMARegister.cpp
-# End Source File
-# End Target
-# End Project
diff --git a/CPP/7zip/Compress/LZMA/LZMA.dsw b/CPP/7zip/Compress/LZMA/LZMA.dsw
deleted file mode 100755
index f750e453..00000000
--- a/CPP/7zip/Compress/LZMA/LZMA.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "LZMA"=".\LZMA.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/CPP/7zip/Compress/LZMA/StdAfx.cpp b/CPP/7zip/Compress/LZMA/StdAfx.cpp
deleted file mode 100755
index d0feea85..00000000
--- a/CPP/7zip/Compress/LZMA/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/CPP/7zip/Compress/LZMA/StdAfx.h b/CPP/7zip/Compress/LZMA/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/LZMA/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/LZMA/makefile b/CPP/7zip/Compress/LZMA/makefile
deleted file mode 100755
index e3b795e6..00000000
--- a/CPP/7zip/Compress/LZMA/makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-PROG = LZMA.dll
-DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../ \
- -DCOMPRESS_MF_MT \
- -D_7ZIP_LARGE_PAGES \
-
-LIBS = $(LIBS) oleaut32.lib
-
-COMPRESS_OBJS = \
- $O\CodecExports.obj \
- $O\DllExports.obj \
-
-COMMON_OBJS = \
- $O\CRC.obj \
-
-LZMA_OPT_OBJS = \
- $O\LZMADecoder.obj \
- $O\LZMAEncoder.obj \
- $O\LZMARegister.obj \
-
-7ZIP_COMMON_OBJS = \
- $O\InBuffer.obj \
- $O\OutBuffer.obj \
- $O\StreamUtils.obj \
-
-C_OBJS = \
- $O\Alloc.obj \
- $O\LzFind.obj \
- $O\LzFindMt.obj \
- $O\LzmaDec.obj \
- $O\LzmaEnc.obj \
- $O\Threads.obj \
-
-!include "../../Crc2.mak"
-
-OBJS = \
- $O\StdAfx.obj \
- $(COMPRESS_OBJS) \
- $(COMMON_OBJS) \
- $(LZMA_OPT_OBJS) \
- $(7ZIP_COMMON_OBJS) \
- $(C_OBJS) \
- $(CRC_OBJS) \
- $O\RangeCoderBit.obj \
- $O\resource.res
-
-!include "../../../Build.mak"
-
-$(COMPRESS_OBJS): ../$(*B).cpp
- $(COMPL)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
- $(COMPL)
-$(LZMA_OPT_OBJS): $(*B).cpp
- $(COMPL_O2)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
- $(COMPL)
-$O\RangeCoderBit.obj: ../RangeCoder/$(*B).cpp
- $(COMPL)
-$(C_OBJS): ../../../../C/$(*B).c
- $(COMPL_O2)
-!include "../../Crc.mak"
diff --git a/CPP/7zip/Compress/LZMA/resource.rc b/CPP/7zip/Compress/LZMA/resource.rc
deleted file mode 100755
index 1b2b6abb..00000000
--- a/CPP/7zip/Compress/LZMA/resource.rc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "../../MyVersionInfo.rc"
-
-MY_VERSION_INFO_DLL("LZMA Codec", "LZMA")
diff --git a/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp b/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
index abfbb237..76fa7b84 100755
--- a/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
+++ b/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp
@@ -160,23 +160,19 @@ SOURCE=.\StdAfx.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=..\LZMA\LZMA.h
+SOURCE=..\LzmaDecoder.cpp
# End Source File
# Begin Source File
-SOURCE=..\LZMA\LZMADecoder.cpp
+SOURCE=..\LzmaDecoder.h
# End Source File
# Begin Source File
-SOURCE=..\LZMA\LZMADecoder.h
+SOURCE=..\LzmaEncoder.cpp
# End Source File
# Begin Source File
-SOURCE=..\LZMA\LZMAEncoder.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZMA\LZMAEncoder.h
+SOURCE=..\LzmaEncoder.h
# End Source File
# End Group
# End Group
diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
index d6ead3f4..4044c86d 100755
--- a/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
+++ b/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp
@@ -22,8 +22,8 @@
#include "../../Common/FileStreams.h"
#include "../../Common/StreamUtils.h"
-#include "../LZMA/LZMADecoder.h"
-#include "../LZMA/LZMAEncoder.h"
+#include "../LzmaDecoder.h"
+#include "../LzmaEncoder.h"
#include "LzmaBenchCon.h"
@@ -380,7 +380,7 @@ int main2(int n, const char *args[])
UInt64 fileSize;
if (encodeMode)
{
- NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder;
+ NCompress::NLzma::CEncoder *encoderSpec = new NCompress::NLzma::CEncoder;
CMyComPtr<ICompressCoder> encoder = encoderSpec;
if (!dictDefined)
@@ -482,7 +482,7 @@ int main2(int n, const char *args[])
}
else
{
- NCompress::NLZMA::CDecoder *decoderSpec = new NCompress::NLZMA::CDecoder;
+ NCompress::NLzma::CDecoder *decoderSpec = new NCompress::NLzma::CDecoder;
CMyComPtr<ICompressCoder> decoder = decoderSpec;
decoderSpec->FinishStream = true;
const UInt32 kPropertiesSize = 5;
diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
index 5d350d45..2ad9a577 100755
--- a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
+++ b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp
@@ -30,22 +30,23 @@
extern "C"
{
-#include "../../../../C/Alloc.h"
#include "../../../../C/7zCrc.h"
+#include "../../../../C/Alloc.h"
}
+
#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
#ifdef BENCH_MT
-#include "../../../Windows/Thread.h"
#include "../../../Windows/Synchronization.h"
+#include "../../../Windows/Thread.h"
#endif
#ifdef EXTERNAL_LZMA
#include "../../../Windows/PropVariant.h"
+#include "../../ICoder.h"
#else
-#include "../LZMA/LZMADecoder.h"
-#include "../LZMA/LZMAEncoder.h"
+#include "../LzmaDecoder.h"
+#include "../LzmaEncoder.h"
#endif
static const UInt32 kUncompressMinBlockSize = 1 << 26;
@@ -697,14 +698,14 @@ HRESULT LzmaBench(
#ifdef EXTERNAL_LZMA
RINOK(codecs->CreateCoder(name, true, encoder.encoder));
#else
- encoder.encoder = new NCompress::NLZMA::CEncoder;
+ encoder.encoder = new NCompress::NLzma::CEncoder;
#endif
for (UInt32 j = 0; j < numSubDecoderThreads; j++)
{
#ifdef EXTERNAL_LZMA
RINOK(codecs->CreateCoder(name, false, encoder.decoders[j]));
#else
- encoder.decoders[j] = new NCompress::NLZMA::CDecoder;
+ encoder.decoders[j] = new NCompress::NLzma::CDecoder;
#endif
}
}
diff --git a/CPP/7zip/Compress/LZMA_Alone/makefile b/CPP/7zip/Compress/LZMA_Alone/makefile
index 69196871..1c4baa0b 100755
--- a/CPP/7zip/Compress/LZMA_Alone/makefile
+++ b/CPP/7zip/Compress/LZMA_Alone/makefile
@@ -10,8 +10,8 @@ LZMA_OBJS = \
$O\LzmaBenchCon.obj \
LZMA_OPT_OBJS = \
- $O\LZMADecoder.obj \
- $O\LZMAEncoder.obj \
+ $O\LzmaDecoder.obj \
+ $O\LzmaEncoder.obj \
COMMON_OBJS = \
$O\CommandLineParser.obj \
@@ -61,7 +61,7 @@ OBJS = \
$(LZMA_OBJS): $(*B).cpp
$(COMPL)
-$(LZMA_OPT_OBJS): ../LZMA/$(*B).cpp
+$(LZMA_OPT_OBJS): ../$(*B).cpp
$(COMPL_O2)
$(COMMON_OBJS): ../../../Common/$(*B).cpp
$(COMPL)
diff --git a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
index 32ec28a3..8d534372 100755
--- a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
+++ b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc
@@ -22,8 +22,8 @@ OBJS = \
LzmaAlone.o \
LzmaBench.o \
LzmaBenchCon.o \
- LZMADecoder.o \
- LZMAEncoder.o \
+ LzmaDecoder.o \
+ LzmaEncoder.o \
InBuffer.o \
OutBuffer.o \
FileStreams.o \
@@ -60,11 +60,11 @@ LzmaBench.o: LzmaBench.cpp
LzmaBenchCon.o: LzmaBenchCon.cpp
$(CXX) $(CFLAGS) LzmaBenchCon.cpp
-LZMADecoder.o: ../LZMA/LZMADecoder.cpp
- $(CXX) $(CFLAGS) ../LZMA/LZMADecoder.cpp
+LzmaDecoder.o: ../LzmaDecoder.cpp
+ $(CXX) $(CFLAGS) ../LzmaDecoder.cpp
-LZMAEncoder.o: ../LZMA/LZMAEncoder.cpp
- $(CXX) $(CFLAGS) ../LZMA/LZMAEncoder.cpp
+LzmaEncoder.o: ../LzmaEncoder.cpp
+ $(CXX) $(CFLAGS) ../LzmaEncoder.cpp
InBuffer.o: ../../Common/InBuffer.cpp
$(CXX) $(CFLAGS) ../../Common/InBuffer.cpp
diff --git a/CPP/7zip/Compress/LZ/LZOutWindow.cpp b/CPP/7zip/Compress/LzOutWindow.cpp
index 9de2d06f..df46295b 100755
--- a/CPP/7zip/Compress/LZ/LZOutWindow.cpp
+++ b/CPP/7zip/Compress/LzOutWindow.cpp
@@ -1,16 +1,14 @@
-// LZOutWindow.cpp
+// LzOutWindow.cpp
#include "StdAfx.h"
-#include "LZOutWindow.h"
+#include "LzOutWindow.h"
-void CLZOutWindow::Init(bool solid)
+void CLzOutWindow::Init(bool solid)
{
- if(!solid)
+ if (!solid)
COutBuffer::Init();
#ifdef _NO_EXCEPTIONS
ErrorCode = S_OK;
#endif
}
-
-
diff --git a/CPP/7zip/Compress/LZ/LZOutWindow.h b/CPP/7zip/Compress/LzOutWindow.h
index 747d49d1..d8d13c22 100755
--- a/CPP/7zip/Compress/LZ/LZOutWindow.h
+++ b/CPP/7zip/Compress/LzOutWindow.h
@@ -1,16 +1,17 @@
-// LZOutWindow.h
+// LzOutWindow.h
#ifndef __LZ_OUT_WINDOW_H
#define __LZ_OUT_WINDOW_H
-#include "../../IStream.h"
-#include "../../Common/OutBuffer.h"
+#include "../IStream.h"
+
+#include "../Common/OutBuffer.h"
#ifndef _NO_EXCEPTIONS
-typedef COutBufferException CLZOutWindowException;
+typedef COutBufferException CLzOutWindowException;
#endif
-class CLZOutWindow: public COutBuffer
+class CLzOutWindow: public COutBuffer
{
public:
void Init(bool solid = false);
diff --git a/CPP/7zip/Compress/Lzh/LzhDecoder.cpp b/CPP/7zip/Compress/LzhDecoder.cpp
index ef1b718a..6f9b5065 100755
--- a/CPP/7zip/Compress/Lzh/LzhDecoder.cpp
+++ b/CPP/7zip/Compress/LzhDecoder.cpp
@@ -213,7 +213,7 @@ STDMETHODIMP CCoder::Code(ISequentialInStream *inStream,
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress);}
catch(const CInBufferException &e) { return e.ErrorCode; }
- catch(const CLZOutWindowException &e) { return e.ErrorCode; }
+ catch(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Lzh/LzhDecoder.h b/CPP/7zip/Compress/LzhDecoder.h
index c2f240e0..ed631e20 100755
--- a/CPP/7zip/Compress/Lzh/LzhDecoder.h
+++ b/CPP/7zip/Compress/LzhDecoder.h
@@ -3,12 +3,15 @@
#ifndef __COMPRESS_LZH_DECODER_H
#define __COMPRESS_LZH_DECODER_H
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/MSBFDecoder.h"
-#include "../../Common/InBuffer.h"
-#include "../Huffman/HuffmanDecoder.h"
-#include "../LZ/LZOutWindow.h"
+#include "../../Common/MyCom.h"
+
+#include "../ICoder.h"
+
+#include "../Common/InBuffer.h"
+
+#include "BitmDecoder.h"
+#include "HuffmanDecoder.h"
+#include "LzOutWindow.h"
namespace NCompress {
namespace NLzh {
@@ -44,8 +47,8 @@ class CCoder :
public ICompressCoder,
public CMyUnknownImp
{
- CLZOutWindow m_OutWindowStream;
- NStream::NMSBF::CDecoder<CInBuffer> m_InBitStream;
+ CLzOutWindow m_OutWindowStream;
+ NBitm::CDecoder<CInBuffer> m_InBitStream;
int m_NumDictBits;
diff --git a/CPP/7zip/Compress/LZMA/LZMADecoder.cpp b/CPP/7zip/Compress/LzmaDecoder.cpp
index ae5da5de..5bfffe90 100755
--- a/CPP/7zip/Compress/LZMA/LZMADecoder.cpp
+++ b/CPP/7zip/Compress/LzmaDecoder.cpp
@@ -1,16 +1,16 @@
-// LZMADecoder.cpp
+// LzmaDecoder.cpp
#include "StdAfx.h"
-#include "LZMADecoder.h"
-#include "../../../Common/Defs.h"
-#include "../../Common/StreamUtils.h"
-
extern "C"
{
- #include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
+#include "../Common/StreamUtils.h"
+
+#include "LzmaDecoder.h"
+
static HRESULT SResToHRESULT(SRes res)
{
switch(res)
@@ -26,7 +26,7 @@ static HRESULT SResToHRESULT(SRes res)
}
namespace NCompress {
-namespace NLZMA {
+namespace NLzma {
static const UInt32 kInBufSize = 1 << 20;
@@ -76,9 +76,8 @@ STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
return S_OK;
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */,
- const UInt64 *outSize, ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
{
if (_inBuf == 0)
return S_FALSE;
diff --git a/CPP/7zip/Compress/LZMA/LZMADecoder.h b/CPP/7zip/Compress/LzmaDecoder.h
index 40dc3f36..e132d5cb 100755
--- a/CPP/7zip/Compress/LZMA/LZMADecoder.h
+++ b/CPP/7zip/Compress/LzmaDecoder.h
@@ -1,18 +1,18 @@
-// LZMADecoder.h
+// LzmaDecoder.h
#ifndef __LZMA_DECODER_H
#define __LZMA_DECODER_H
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
extern "C"
{
- #include "../../../../C/LzmaDec.h"
+#include "../../../C/LzmaDec.h"
}
+#include "../../Common/MyCom.h"
+#include "../ICoder.h"
+
namespace NCompress {
-namespace NLZMA {
+namespace NLzma {
class CDecoder:
public ICompressCoder,
@@ -49,14 +49,10 @@ public:
ICompressGetInStreamProcessedSize)
#endif
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *_inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
-
STDMETHOD(SetInStream)(ISequentialInStream *inStream);
STDMETHOD(ReleaseInStream)();
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
diff --git a/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp b/CPP/7zip/Compress/LzmaEncoder.cpp
index 43e1b772..986e1edb 100755
--- a/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
+++ b/CPP/7zip/Compress/LzmaEncoder.cpp
@@ -1,30 +1,16 @@
-// LZMA/Encoder.cpp
+// LzmaEncoder.cpp
#include "StdAfx.h"
-#include <stdio.h>
-
-#ifdef _WIN32
-#define USE_ALLOCA
-#endif
-
-#ifdef USE_ALLOCA
-#ifdef _WIN32
-#include <malloc.h>
-#else
-#include <stdlib.h>
-#endif
-#endif
-
-#include "LZMAEncoder.h"
-
-#include "../../Common/StreamUtils.h"
-
extern "C"
{
-#include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
+#include "../Common/StreamUtils.h"
+
+#include "LzmaEncoder.h"
+
static HRESULT SResToHRESULT(SRes res)
{
switch(res)
@@ -38,7 +24,7 @@ static HRESULT SResToHRESULT(SRes res)
}
namespace NCompress {
-namespace NLZMA {
+namespace NLzma {
static const UInt32 kStreamStepSize = (UInt32)1 << 31;
@@ -123,14 +109,14 @@ static int ParseMatchFinder(const wchar_t *s, int *btMode, int *numHashBytes)
}
STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
+ const PROPVARIANT *coderProps, UInt32 numProps)
{
CLzmaEncProps props;
LzmaEncProps_Init(&props);
- for (UInt32 i = 0; i < numProperties; i++)
+ for (UInt32 i = 0; i < numProps; i++)
{
- const PROPVARIANT &prop = properties[i];
+ const PROPVARIANT &prop = coderProps[i];
switch (propIDs[i])
{
case NCoderPropID::kNumFastBytes:
@@ -203,10 +189,8 @@ SRes CompressProgress(void *pp, UInt64 inSize, UInt64 outSize)
return (SRes)p->Res;
}
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */,
- const UInt64 * /* outSize */,
- ICompressProgressInfo *progress)
+STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
CCompressProgressImp progressImp;
progressImp.p.Progress = CompressProgress;
diff --git a/CPP/7zip/Compress/LZMA/LZMAEncoder.h b/CPP/7zip/Compress/LzmaEncoder.h
index 05583e74..4205d2b1 100755
--- a/CPP/7zip/Compress/LZMA/LZMAEncoder.h
+++ b/CPP/7zip/Compress/LzmaEncoder.h
@@ -1,18 +1,19 @@
-// LZMA/Encoder.h
+// LzmaEncoder.h
#ifndef __LZMA_ENCODER_H
#define __LZMA_ENCODER_H
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
extern "C"
{
- #include "../../../../C/LzmaEnc.h"
+#include "../../../C/LzmaEnc.h"
}
+#include "../../Common/MyCom.h"
+
+#include "../ICoder.h"
+
namespace NCompress {
-namespace NLZMA {
+namespace NLzma {
struct CSeqInStream
{
@@ -35,7 +36,7 @@ class CEncoder :
public CMyUnknownImp
{
CLzmaEncHandle _encoder;
-
+
CSeqInStream _seqInStream;
CSeqOutStream _seqOutStream;
@@ -48,19 +49,10 @@ public:
ICompressWriteCoderProperties
)
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- // ICompressSetCoderProperties2
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties);
-
- // ICompressWriteCoderProperties
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+ STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
-
STDMETHOD(SetOutStream)(ISequentialOutStream *outStream);
STDMETHOD(ReleaseOutStream)();
diff --git a/CPP/7zip/Compress/LZMA/LZMARegister.cpp b/CPP/7zip/Compress/LzmaRegister.cpp
index bc8f7262..96ed0bae 100755
--- a/CPP/7zip/Compress/LZMA/LZMARegister.cpp
+++ b/CPP/7zip/Compress/LzmaRegister.cpp
@@ -1,14 +1,15 @@
-// LZMARegister.cpp
+// LzmaRegister.cpp
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
-#include "LZMADecoder.h"
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLZMA::CDecoder); }
+#include "LzmaDecoder.h"
+
+static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CDecoder); }
#ifndef EXTRACT_ONLY
-#include "LZMAEncoder.h"
-static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLZMA::CEncoder); }
+#include "LzmaEncoder.h"
+static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NLzma::CEncoder); }
#else
#define CreateCodecOut 0
#endif
diff --git a/CPP/7zip/Compress/Lzx/Lzx.h b/CPP/7zip/Compress/Lzx.h
index 249cbe51..249cbe51 100755
--- a/CPP/7zip/Compress/Lzx/Lzx.h
+++ b/CPP/7zip/Compress/Lzx.h
diff --git a/CPP/7zip/Compress/Lzx/StdAfx.h b/CPP/7zip/Compress/Lzx/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Lzx/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Lzx/Lzx86Converter.cpp b/CPP/7zip/Compress/Lzx86Converter.cpp
index 0492b36c..9e53f18a 100755
--- a/CPP/7zip/Compress/Lzx/Lzx86Converter.cpp
+++ b/CPP/7zip/Compress/Lzx86Converter.cpp
@@ -2,7 +2,7 @@
#include "StdAfx.h"
-#include "Common/Defs.h"
+#include "../../Common/Defs.h"
#include "Lzx86Converter.h"
diff --git a/CPP/7zip/Compress/Lzx/Lzx86Converter.h b/CPP/7zip/Compress/Lzx86Converter.h
index c8757ad5..9f110c29 100755
--- a/CPP/7zip/Compress/Lzx/Lzx86Converter.h
+++ b/CPP/7zip/Compress/Lzx86Converter.h
@@ -1,10 +1,11 @@
-// Lzx/x86Converter.h
+// Lzx86Converter.h
-#ifndef __LZX_X86CONVERTER_H
-#define __LZX_X86CONVERTER_H
+#ifndef __LZX_86_CONVERTER_H
+#define __LZX_86_CONVERTER_H
-#include "Common/MyCom.h"
-#include "../../IStream.h"
+#include "../../Common/MyCom.h"
+
+#include "../IStream.h"
namespace NCompress {
namespace NLzx {
diff --git a/CPP/7zip/Compress/Lzx/LzxDecoder.cpp b/CPP/7zip/Compress/LzxDecoder.cpp
index ceeb25d3..373c902c 100755
--- a/CPP/7zip/Compress/Lzx/LzxDecoder.cpp
+++ b/CPP/7zip/Compress/LzxDecoder.cpp
@@ -2,14 +2,9 @@
#include "StdAfx.h"
-#include "LzxDecoder.h"
+#include "../../Common/Defs.h"
-#include "Common/Defs.h"
-extern "C"
-{
-#include "../../../../C/Alloc.h"
-}
-#include "Windows/Defs.h"
+#include "LzxDecoder.h"
namespace NCompress {
namespace NLzx {
@@ -306,10 +301,8 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
return S_OK;
}
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *, const UInt64 *outSize, ICompressProgressInfo *progress)
{
if (outSize == NULL)
return E_INVALIDARG;
@@ -343,12 +336,11 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
return Flush();
}
-HRESULT CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
- catch(const CLZOutWindowException &e) { return e.ErrorCode; }
+ catch(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Lzx/LzxDecoder.h b/CPP/7zip/Compress/LzxDecoder.h
index a9b41570..d7979231 100755
--- a/CPP/7zip/Compress/Lzx/LzxDecoder.h
+++ b/CPP/7zip/Compress/LzxDecoder.h
@@ -1,14 +1,14 @@
// LzxDecoder.h
-#ifndef __LZXDECODER_H
-#define __LZXDECODER_H
+#ifndef __LZX_DECODER_H
+#define __LZX_DECODER_H
-#include "../../ICoder.h"
+#include "../ICoder.h"
-#include "../../Compress/Huffman/HuffmanDecoder.h"
-#include "../../Compress/LZ/LZOutWindow.h"
-#include "../../Common/InBuffer.h"
+#include "../Common/InBuffer.h"
+#include "HuffmanDecoder.h"
+#include "LzOutWindow.h"
#include "Lzx.h"
#include "Lzx86Converter.h"
@@ -101,7 +101,7 @@ class CDecoder :
public CMyUnknownImp
{
NBitStream::CDecoder m_InBitStream;
- CLZOutWindow m_OutWindowStream;
+ CLzOutWindow m_OutWindowStream;
UInt32 m_RepDistances[kNumRepDistances];
UInt32 m_NumPosLenSlots;
@@ -135,10 +135,8 @@ class CDecoder :
HRESULT CodeSpec(UInt32 size);
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
public:
CDecoder(bool wimMode = false);
@@ -147,11 +145,8 @@ public:
void ReleaseStreams();
STDMETHOD(Flush)();
- // ICompressCoder interface
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetInStream)(ISequentialInStream *inStream);
STDMETHOD(ReleaseInStream)();
diff --git a/CPP/7zip/Compress/BWT/Mtf8.h b/CPP/7zip/Compress/Mtf8.h
index 470fd044..7a6b7fe6 100755
--- a/CPP/7zip/Compress/BWT/Mtf8.h
+++ b/CPP/7zip/Compress/Mtf8.h
@@ -1,63 +1,63 @@
// Mtf8.h
-#ifndef __MTF8_H
-#define __MTF8_H
+#ifndef __COMPRESS_MTF8_H
+#define __COMPRESS_MTF8_H
-#include "Common/Types.h"
+#include "../../Common/Types.h"
namespace NCompress {
-class CMtf8Encoder
+struct CMtf8Encoder
{
-public:
- Byte Buffer[256];
+ Byte Buf[256];
+
int FindAndMove(Byte v)
{
int pos;
- for (pos = 0; Buffer[pos] != v; pos++);
+ for (pos = 0; Buf[pos] != v; pos++);
int resPos = pos;
for (; pos >= 8; pos -= 8)
{
- Buffer[pos] = Buffer[pos - 1];
- Buffer[pos - 1] = Buffer[pos - 2];
- Buffer[pos - 2] = Buffer[pos - 3];
- Buffer[pos - 3] = Buffer[pos - 4];
- Buffer[pos - 4] = Buffer[pos - 5];
- Buffer[pos - 5] = Buffer[pos - 6];
- Buffer[pos - 6] = Buffer[pos - 7];
- Buffer[pos - 7] = Buffer[pos - 8];
+ Buf[pos] = Buf[pos - 1];
+ Buf[pos - 1] = Buf[pos - 2];
+ Buf[pos - 2] = Buf[pos - 3];
+ Buf[pos - 3] = Buf[pos - 4];
+ Buf[pos - 4] = Buf[pos - 5];
+ Buf[pos - 5] = Buf[pos - 6];
+ Buf[pos - 6] = Buf[pos - 7];
+ Buf[pos - 7] = Buf[pos - 8];
}
for (; pos > 0; pos--)
- Buffer[pos] = Buffer[pos - 1];
- Buffer[0] = v;
+ Buf[pos] = Buf[pos - 1];
+ Buf[0] = v;
return resPos;
}
};
/*
-class CMtf8Decoder
+struct CMtf8Decoder
{
-public:
- Byte Buffer[256];
+ Byte Buf[256];
+
void Init(int) {};
- Byte GetHead() const { return Buffer[0]; }
+ Byte GetHead() const { return Buf[0]; }
Byte GetAndMove(int pos)
{
- Byte res = Buffer[pos];
+ Byte res = Buf[pos];
for (; pos >= 8; pos -= 8)
{
- Buffer[pos] = Buffer[pos - 1];
- Buffer[pos - 1] = Buffer[pos - 2];
- Buffer[pos - 2] = Buffer[pos - 3];
- Buffer[pos - 3] = Buffer[pos - 4];
- Buffer[pos - 4] = Buffer[pos - 5];
- Buffer[pos - 5] = Buffer[pos - 6];
- Buffer[pos - 6] = Buffer[pos - 7];
- Buffer[pos - 7] = Buffer[pos - 8];
+ Buf[pos] = Buf[pos - 1];
+ Buf[pos - 1] = Buf[pos - 2];
+ Buf[pos - 2] = Buf[pos - 3];
+ Buf[pos - 3] = Buf[pos - 4];
+ Buf[pos - 4] = Buf[pos - 5];
+ Buf[pos - 5] = Buf[pos - 6];
+ Buf[pos - 6] = Buf[pos - 7];
+ Buf[pos - 7] = Buf[pos - 8];
}
for (; pos > 0; pos--)
- Buffer[pos] = Buffer[pos - 1];
- Buffer[0] = res;
+ Buf[pos] = Buf[pos - 1];
+ Buf[0] = res;
return res;
}
};
@@ -78,41 +78,41 @@ typedef UInt32 CMtfVar;
#define MTF_MASK ((1 << MTF_MOVS) - 1)
-class CMtf8Decoder
+struct CMtf8Decoder
{
-public:
- CMtfVar Buffer[256 >> MTF_MOVS];
- void StartInit() { memset(Buffer, 0, sizeof(Buffer)); }
- void Add(unsigned int pos, Byte val) { Buffer[pos >> MTF_MOVS] |= ((CMtfVar)val << ((pos & MTF_MASK) << 3)); }
- Byte GetHead() const { return (Byte)Buffer[0]; }
+ CMtfVar Buf[256 >> MTF_MOVS];
+
+ void StartInit() { memset(Buf, 0, sizeof(Buf)); }
+ void Add(unsigned int pos, Byte val) { Buf[pos >> MTF_MOVS] |= ((CMtfVar)val << ((pos & MTF_MASK) << 3)); }
+ Byte GetHead() const { return (Byte)Buf[0]; }
Byte GetAndMove(unsigned int pos)
{
UInt32 lim = ((UInt32)pos >> MTF_MOVS);
pos = (pos & MTF_MASK) << 3;
- CMtfVar prev = (Buffer[lim] >> pos) & 0xFF;
+ CMtfVar prev = (Buf[lim] >> pos) & 0xFF;
UInt32 i = 0;
if ((lim & 1) != 0)
{
- CMtfVar next = Buffer[0];
- Buffer[0] = (next << 8) | prev;
+ CMtfVar next = Buf[0];
+ Buf[0] = (next << 8) | prev;
prev = (next >> (MTF_MASK << 3));
i = 1;
lim -= 1;
}
for (; i < lim; i += 2)
{
- CMtfVar next = Buffer[i];
- Buffer[i] = (next << 8) | prev;
+ CMtfVar next = Buf[i];
+ Buf[i] = (next << 8) | prev;
prev = (next >> (MTF_MASK << 3));
- next = Buffer[i + 1];
- Buffer[i + 1] = (next << 8) | prev;
+ next = Buf[i + 1];
+ Buf[i + 1] = (next << 8) | prev;
prev = (next >> (MTF_MASK << 3));
}
- CMtfVar next = Buffer[i];
+ CMtfVar next = Buf[i];
CMtfVar mask = (((CMtfVar)0x100 << pos) - 1);
- Buffer[i] = (next & ~mask) | (((next << 8) | prev) & mask);
- return (Byte)Buffer[0];
+ Buf[i] = (next & ~mask) | (((next << 8) | prev) & mask);
+ return (Byte)Buf[0];
}
};
@@ -125,13 +125,13 @@ class CMtf8Decoder
Byte Counts[16];
int Size;
public:
- Byte Buffer[256];
+ Byte Buf[256];
Byte GetHead() const
{
if (SmallSize > 0)
return SmallBuffer[kSmallSize - SmallSize];
- return Buffer[0];
+ return Buf[0];
}
void Init(int size)
@@ -165,12 +165,12 @@ public:
g--;
int offset = (g << 4);
for (int t = Counts[g] - 1; t >= 0; t--, i--)
- Buffer[i] = Buffer[offset + t];
+ Buf[i] = Buf[offset + t];
}
while(g != 0);
for (i = kSmallSize - 1; i >= 0; i--)
- Buffer[i] = SmallBuffer[i];
+ Buf[i] = SmallBuffer[i];
Init(Size);
}
pos -= SmallSize;
@@ -178,9 +178,9 @@ public:
for (g = 0; pos >= Counts[g]; g++)
pos -= Counts[g];
int offset = (g << 4);
- Byte res = Buffer[offset + pos];
+ Byte res = Buf[offset + pos];
for (pos; pos < 16 - 1; pos++)
- Buffer[offset + pos] = Buffer[offset + pos + 1];
+ Buf[offset + pos] = Buf[offset + pos + 1];
SmallSize++;
SmallBuffer[kSmallSize - SmallSize] = res;
@@ -192,4 +192,5 @@ public:
*/
}
+
#endif
diff --git a/CPP/7zip/Compress/PPMD/StdAfx.h b/CPP/7zip/Compress/PPMD/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/PPMD/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/PPMD/PPMDContext.h b/CPP/7zip/Compress/PpmdContext.h
index 577d3b76..f4fa78e4 100755
--- a/CPP/7zip/Compress/PPMD/PPMDContext.h
+++ b/CPP/7zip/Compress/PpmdContext.h
@@ -1,16 +1,16 @@
-// Compress/PPMD/Context.h
+// PpmdContext.h
// This code is based on Dmitry Shkarin's PPMdH code
#ifndef __COMPRESS_PPMD_CONTEXT_H
#define __COMPRESS_PPMD_CONTEXT_H
-#include "../../../Common/Types.h"
+#include "../../Common/Types.h"
-#include "../RangeCoder/RangeCoder.h"
-#include "PPMDSubAlloc.h"
+#include "PpmdSubAlloc.h"
+#include "RangeCoder.h"
namespace NCompress {
-namespace NPPMD {
+namespace NPpmd {
const int INT_BITS=7, PERIOD_BITS=7, TOT_BITS=INT_BITS+PERIOD_BITS,
INTERVAL=1 << INT_BITS, BIN_SCALE=1 << TOT_BITS, MAX_FREQ=124;
diff --git a/CPP/7zip/Compress/PPMD/PPMDDecode.h b/CPP/7zip/Compress/PpmdDecode.h
index 1df2c9cd..860c65b4 100755
--- a/CPP/7zip/Compress/PPMD/PPMDDecode.h
+++ b/CPP/7zip/Compress/PpmdDecode.h
@@ -1,13 +1,13 @@
-// PPMDDecode.h
+// PpmdDecode.h
// This code is based on Dmitry Shkarin's PPMdH code
#ifndef __COMPRESS_PPMD_DECODE_H
#define __COMPRESS_PPMD_DECODE_H
-#include "PPMDContext.h"
+#include "PpmdContext.h"
namespace NCompress {
-namespace NPPMD {
+namespace NPpmd {
class CRangeDecoderVirt
{
diff --git a/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp b/CPP/7zip/Compress/PpmdDecoder.cpp
index cbb7e786..dea36d9a 100755
--- a/CPP/7zip/Compress/PPMD/PPMDDecoder.cpp
+++ b/CPP/7zip/Compress/PpmdDecoder.cpp
@@ -1,14 +1,14 @@
-// PPMDDecoder.cpp
+// PpmdDecoder.cpp
#include "StdAfx.h"
#include "Common/Defs.h"
#include "Windows/Defs.h"
-#include "PPMDDecoder.h"
+#include "PpmdDecoder.h"
namespace NCompress {
-namespace NPPMD {
+namespace NPpmd {
const int kLenIdFinished = -1;
const int kLenIdNeedInit = -2;
@@ -84,9 +84,8 @@ HRESULT CDecoder::CodeSpec(UInt32 size, Byte *memStream)
return S_OK;
}
-STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 *outSize, ICompressProgressInfo *progress)
{
if (!_outStream.Create(1 << 20))
return E_OUTOFMEMORY;
@@ -132,9 +131,8 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
#endif
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
PPMD_TRY_BEGIN
return CodeReal(inStream, outStream, inSize, outSize, progress);
diff --git a/CPP/7zip/Compress/PPMD/PPMDDecoder.h b/CPP/7zip/Compress/PpmdDecoder.h
index 7c7201bf..0d8817d4 100755
--- a/CPP/7zip/Compress/PPMD/PPMDDecoder.h
+++ b/CPP/7zip/Compress/PpmdDecoder.h
@@ -1,18 +1,19 @@
-// Compress/PPM/PPMDDecoder.h
+// PpmdDecoder.h
#ifndef __COMPRESS_PPMD_DECODER_H
#define __COMPRESS_PPMD_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/OutBuffer.h"
-#include "../RangeCoder/RangeCoder.h"
+#include "../ICoder.h"
-#include "PPMDDecode.h"
+#include "../Common/OutBuffer.h"
+
+#include "PpmdDecode.h"
+#include "RangeCoder.h"
namespace NCompress {
-namespace NPPMD {
+namespace NPpmd {
class CDecoder :
public ICompressCoder,
@@ -39,6 +40,7 @@ class CDecoder :
UInt64 _processedSize;
HRESULT CodeSpec(UInt32 num, Byte *memStream);
+
public:
#ifndef NO_READ_FROM_CODER
@@ -60,15 +62,11 @@ public:
HRESULT Flush() { return _outStream.Flush(); }
- STDMETHOD(CodeReal)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
@@ -81,7 +79,6 @@ public:
#endif
CDecoder(): _outSizeDefined(false) {}
-
};
}}
diff --git a/CPP/7zip/Compress/PPMD/PPMDEncode.h b/CPP/7zip/Compress/PpmdEncode.h
index 1e9d907c..0db92361 100755
--- a/CPP/7zip/Compress/PPMD/PPMDEncode.h
+++ b/CPP/7zip/Compress/PpmdEncode.h
@@ -1,17 +1,16 @@
-// PPMDEncode.h
+// PpmdEncode.h
// This code is based on Dmitry Shkarin's PPMdH code
#ifndef __COMPRESS_PPMD_ENCODE_H
#define __COMPRESS_PPMD_ENCODE_H
-#include "PPMDContext.h"
+#include "PpmdContext.h"
namespace NCompress {
-namespace NPPMD {
+namespace NPpmd {
struct CEncodeInfo: public CInfo
{
-
void EncodeBinSymbol(int symbol, NRangeCoder::CEncoder *rangeEncoder)
{
PPM_CONTEXT::STATE& rs = MinContext->oneState();
@@ -135,8 +134,8 @@ SYMBOL_FOUND:
}
NextContext();
}
-
};
+
}}
#endif
diff --git a/CPP/7zip/Compress/PPMD/PPMDEncoder.cpp b/CPP/7zip/Compress/PpmdEncoder.cpp
index c4cd1df2..1e98c091 100755
--- a/CPP/7zip/Compress/PPMD/PPMDEncoder.cpp
+++ b/CPP/7zip/Compress/PpmdEncoder.cpp
@@ -1,20 +1,16 @@
-// Compress/Associative/Encoder.h
+// PpmdEncoder.cpp
#include "StdAfx.h"
-#include "Windows/Defs.h"
-
// #include <fstream.h>
// #include <iomanip.h>
-#include "Common/Defs.h"
-
-#include "../../Common/StreamUtils.h"
+#include "../Common/StreamUtils.h"
-#include "PPMDEncoder.h"
+#include "PpmdEncoder.h"
namespace NCompress {
-namespace NPPMD {
+namespace NPpmd {
const UInt32 kMinMemSize = (1 << 11);
const UInt32 kMinOrder = 2;
@@ -45,12 +41,11 @@ public:
CCounter g_Counter;
*/
-STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
+STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps)
{
- for (UInt32 i = 0; i < numProperties; i++)
+ for (UInt32 i = 0; i < numProps; i++)
{
- const PROPVARIANT &prop = properties[i];
+ const PROPVARIANT &prop = props[i];
switch(propIDs[i])
{
case NCoderPropID::kUsedMemorySize:
@@ -77,11 +72,11 @@ STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
{
const UInt32 kPropSize = 5;
- Byte properties[kPropSize];
- properties[0] = _order;
+ Byte props[kPropSize];
+ props[0] = _order;
for (int i = 0; i < 4; i++)
- properties[1 + i] = Byte(_usedMemorySize >> (8 * i));
- return WriteStream(outStream, properties, kPropSize);
+ props[1 + i] = Byte(_usedMemorySize >> (8 * i));
+ return WriteStream(outStream, props, kPropSize);
}
const UInt32 kUsedMemorySizeDefault = (1 << 24);
@@ -94,10 +89,8 @@ CEncoder::CEncoder():
}
-HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 * /* inSize */, const UInt64 * /* outSize */,
- ICompressProgressInfo *progress)
+HRESULT CEncoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
if (!_inStream.Create(1 << 20))
return E_OUTOFMEMORY;
@@ -142,9 +135,8 @@ HRESULT CEncoder::CodeReal(ISequentialInStream *inStream,
}
}
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const COutBufferException &e) { return e.ErrorCode; }
diff --git a/CPP/7zip/Compress/PPMD/PPMDEncoder.h b/CPP/7zip/Compress/PpmdEncoder.h
index 0c027ff0..72b10651 100755
--- a/CPP/7zip/Compress/PPMD/PPMDEncoder.h
+++ b/CPP/7zip/Compress/PpmdEncoder.h
@@ -1,18 +1,19 @@
-// Compress/PPMD/Encoder.h
+// PpmdEncoder.h
#ifndef __COMPRESS_PPMD_ENCODER_H
#define __COMPRESS_PPMD_ENCODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/InBuffer.h"
-#include "../RangeCoder/RangeCoder.h"
+#include "../ICoder.h"
-#include "PPMDEncode.h"
+#include "../Common/InBuffer.h"
+
+#include "PpmdEncode.h"
+#include "RangeCoder.h"
namespace NCompress {
-namespace NPPMD {
+namespace NPpmd {
class CEncoder :
public ICompressCoder,
@@ -41,9 +42,8 @@ public:
_rangeEncoder.ReleaseStream();
}
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
class CEncoderFlusher
{
@@ -63,17 +63,14 @@ public:
ICompressSetCoderProperties,
ICompressWriteCoderProperties)
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties);
+ STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
CEncoder();
-
};
}}
diff --git a/CPP/7zip/Compress/PPMD/PPMDRegister.cpp b/CPP/7zip/Compress/PpmdRegister.cpp
index 2f6dd7cd..cac1fb85 100755
--- a/CPP/7zip/Compress/PPMD/PPMDRegister.cpp
+++ b/CPP/7zip/Compress/PpmdRegister.cpp
@@ -1,14 +1,15 @@
-// PPMDRegister.cpp
+// PpmdRegister.cpp
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
-#include "PPMDDecoder.h"
-static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NPPMD::CDecoder); }
+#include "PpmdDecoder.h"
+
+static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::NPpmd::CDecoder); }
#ifndef EXTRACT_ONLY
-#include "PPMDEncoder.h"
-static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NPPMD::CEncoder); }
+#include "PpmdEncoder.h"
+static void *CreateCodecOut() { return (void *)(ICompressCoder *)(new NCompress::NPpmd::CEncoder); }
#else
#define CreateCodecOut 0
#endif
diff --git a/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h b/CPP/7zip/Compress/PpmdSubAlloc.h
index 480ffa13..a7dd122c 100755
--- a/CPP/7zip/Compress/PPMD/PPMDSubAlloc.h
+++ b/CPP/7zip/Compress/PpmdSubAlloc.h
@@ -1,16 +1,16 @@
-// PPMDSubAlloc.h
+// PpmdSubAlloc.h
// This code is based on Dmitry Shkarin's PPMdH code
-#ifndef __PPMD_SUBALLOC_H
-#define __PPMD_SUBALLOC_H
-
-#include "PPMDType.h"
+#ifndef __COMPRESS_PPMD_SUB_ALLOC_H
+#define __COMPRESS_PPMD_SUB_ALLOC_H
extern "C"
{
-#include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
+#include "PpmdType.h"
+
const UINT N1=4, N2=4, N3=4, N4=(128+3-1*N1-2*N2-3*N3)/4;
const UINT UNIT_SIZE=12, N_INDEXES=N1+N2+N3+N4;
diff --git a/CPP/7zip/Compress/PPMD/PPMDType.h b/CPP/7zip/Compress/PpmdType.h
index aec68095..4f0e65e8 100755
--- a/CPP/7zip/Compress/PPMD/PPMDType.h
+++ b/CPP/7zip/Compress/PpmdType.h
@@ -7,8 +7,9 @@
* modified by Igor Pavlov (2004-08-29).
****************************************************************************/
-#ifndef __PPMD_TYPE_H
-#define __PPMD_TYPE_H
+
+#ifndef __COMPRESS_PPMD_TYPE_H
+#define __COMPRESS_PPMD_TYPE_H
const int kMaxOrderCompress = 32;
const int MAX_O = 255; /* maximum allowed model order */
diff --git a/CPP/7zip/Compress/Quantum/StdAfx.h b/CPP/7zip/Compress/Quantum/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Quantum/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Quantum/QuantumDecoder.cpp b/CPP/7zip/Compress/QuantumDecoder.cpp
index 03425578..b4c1c256 100755
--- a/CPP/7zip/Compress/Quantum/QuantumDecoder.cpp
+++ b/CPP/7zip/Compress/QuantumDecoder.cpp
@@ -2,8 +2,9 @@
#include "StdAfx.h"
+#include "../../Common/Defs.h"
+
#include "QuantumDecoder.h"
-#include "../../../Common/Defs.h"
namespace NCompress {
namespace NQuantum {
@@ -104,10 +105,8 @@ HRESULT CDecoder::CodeSpec(UInt32 curSize)
return _rangeDecoder.Stream.WasFinished() ? S_FALSE : S_OK;
}
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream,
- const UInt64 *, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *, const UInt64 *outSize, ICompressProgressInfo *progress)
{
if (outSize == NULL)
return E_INVALIDARG;
@@ -139,13 +138,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
return Flush();
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, 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(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Quantum/QuantumDecoder.h b/CPP/7zip/Compress/QuantumDecoder.h
index 5871f536..d9007a61 100755
--- a/CPP/7zip/Compress/Quantum/QuantumDecoder.h
+++ b/CPP/7zip/Compress/QuantumDecoder.h
@@ -1,13 +1,15 @@
// QuantumDecoder.h
-#ifndef __QUANTUM_DECODER_H
-#define __QUANTUM_DECODER_H
+#ifndef __COMPRESS_QUANTUM_DECODER_H
+#define __COMPRESS_QUANTUM_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../Common/InBuffer.h"
-#include "../../ICoder.h"
-#include "../LZ/LZOutWindow.h"
+#include "../ICoder.h"
+
+#include "../Common/InBuffer.h"
+
+#include "LzOutWindow.h"
namespace NCompress {
namespace NQuantum {
@@ -207,7 +209,7 @@ class CDecoder:
public ICompressSetOutStreamSize,
public CMyUnknownImp
{
- CLZOutWindow _outWindowStream;
+ CLzOutWindow _outWindowStream;
NRangeCoder::CDecoder _rangeDecoder;
///////////////////
@@ -256,13 +258,11 @@ public:
HRESULT Flush() { return _outWindowStream.Flush(); }
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetInStream)(ISequentialInStream *inStream);
STDMETHOD(ReleaseInStream)();
diff --git a/CPP/7zip/Compress/RangeCoder/RangeCoder.h b/CPP/7zip/Compress/RangeCoder.h
index b79c0fc8..1e14ac1f 100755
--- a/CPP/7zip/Compress/RangeCoder/RangeCoder.h
+++ b/CPP/7zip/Compress/RangeCoder.h
@@ -1,10 +1,10 @@
-// Compress/RangeCoder/RangeCoder.h
+// Compress/RangeCoder.h
-#ifndef __COMPRESS_RANGECODER_H
-#define __COMPRESS_RANGECODER_H
+#ifndef __COMPRESS_RANGE_CODER_H
+#define __COMPRESS_RANGE_CODER_H
-#include "../../Common/InBuffer.h"
-#include "../../Common/OutBuffer.h"
+#include "../Common/InBuffer.h"
+#include "../Common/OutBuffer.h"
namespace NCompress {
namespace NRangeCoder {
diff --git a/CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp b/CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp
deleted file mode 100755
index 2bfae0b8..00000000
--- a/CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// Compress/RangeCoder/RangeCoderBit.cpp
-
-#include "StdAfx.h"
-
-#include "RangeCoderBit.h"
-
-namespace NCompress {
-namespace NRangeCoder {
-
-UInt32 ProbPrices[kBitModelTotal >> kNumMoveReducingBits];
-
-struct CPriceTables { CPriceTables()
-{
- for (UInt32 i = (1 << kNumMoveReducingBits) / 2; i < kBitModelTotal; i += (1 << kNumMoveReducingBits))
- {
- const int kCyclesBits = kNumBitPriceShiftBits;
- UInt32 w = i;
- UInt32 bitCount = 0;
- for (int j = 0; j < kCyclesBits; j++)
- {
- w = w * w;
- bitCount <<= 1;
- while (w >= ((UInt32)1 << 16))
- {
- w >>= 1;
- bitCount++;
- }
- }
- ProbPrices[i >> kNumMoveReducingBits] = ((kNumBitModelTotalBits << kCyclesBits) - 15 - bitCount);
- }
-}
-};
-
-static CPriceTables g_PriceTables;
-
-}}
diff --git a/CPP/7zip/Compress/RangeCoder/RangeCoderBitTree.h b/CPP/7zip/Compress/RangeCoder/RangeCoderBitTree.h
deleted file mode 100755
index ee47eaad..00000000
--- a/CPP/7zip/Compress/RangeCoder/RangeCoderBitTree.h
+++ /dev/null
@@ -1,161 +0,0 @@
-// Compress/RangeCoder/RangeCoderBitTree.h
-
-#ifndef __COMPRESS_RANGECODER_BIT_TREE_H
-#define __COMPRESS_RANGECODER_BIT_TREE_H
-
-#include "RangeCoderBit.h"
-#include "RangeCoderOpt.h"
-
-namespace NCompress {
-namespace NRangeCoder {
-
-template <int numMoveBits, int NumBitLevels>
-class CBitTreeEncoder
-{
- CBitEncoder<numMoveBits> Models[1 << NumBitLevels];
-public:
- void Init()
- {
- for(UInt32 i = 0; i < (1 << NumBitLevels); i++)
- Models[i].Init();
- }
- void Encode(CEncoder *rangeEncoder, UInt32 symbol)
- {
- UInt32 modelIndex = 1;
- for (int bitIndex = NumBitLevels; bitIndex != 0 ;)
- {
- bitIndex--;
- UInt32 bit = (symbol >> bitIndex) & 1;
- Models[modelIndex].Encode(rangeEncoder, bit);
- modelIndex = (modelIndex << 1) | bit;
- }
- };
- void ReverseEncode(CEncoder *rangeEncoder, UInt32 symbol)
- {
- UInt32 modelIndex = 1;
- for (int i = 0; i < NumBitLevels; i++)
- {
- UInt32 bit = symbol & 1;
- Models[modelIndex].Encode(rangeEncoder, bit);
- modelIndex = (modelIndex << 1) | bit;
- symbol >>= 1;
- }
- }
- UInt32 GetPrice(UInt32 symbol) const
- {
- symbol |= (1 << NumBitLevels);
- UInt32 price = 0;
- while (symbol != 1)
- {
- price += Models[symbol >> 1].GetPrice(symbol & 1);
- symbol >>= 1;
- }
- return price;
- }
- UInt32 ReverseGetPrice(UInt32 symbol) const
- {
- UInt32 price = 0;
- UInt32 modelIndex = 1;
- for (int i = NumBitLevels; i != 0; i--)
- {
- UInt32 bit = symbol & 1;
- symbol >>= 1;
- price += Models[modelIndex].GetPrice(bit);
- modelIndex = (modelIndex << 1) | bit;
- }
- return price;
- }
-};
-
-template <int numMoveBits, int NumBitLevels>
-class CBitTreeDecoder
-{
- CBitDecoder<numMoveBits> Models[1 << NumBitLevels];
-public:
- void Init()
- {
- for(UInt32 i = 0; i < (1 << NumBitLevels); i++)
- Models[i].Init();
- }
- UInt32 Decode(CDecoder *rangeDecoder)
- {
- UInt32 modelIndex = 1;
- RC_INIT_VAR
- for(int bitIndex = NumBitLevels; bitIndex != 0; bitIndex--)
- {
- // modelIndex = (modelIndex << 1) + Models[modelIndex].Decode(rangeDecoder);
- RC_GETBIT(numMoveBits, Models[modelIndex].Prob, modelIndex)
- }
- RC_FLUSH_VAR
- return modelIndex - (1 << NumBitLevels);
- };
- UInt32 ReverseDecode(CDecoder *rangeDecoder)
- {
- UInt32 modelIndex = 1;
- UInt32 symbol = 0;
- RC_INIT_VAR
- for(int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
- {
- // UInt32 bit = Models[modelIndex].Decode(rangeDecoder);
- // modelIndex <<= 1;
- // modelIndex += bit;
- // symbol |= (bit << bitIndex);
- RC_GETBIT2(numMoveBits, Models[modelIndex].Prob, modelIndex, ; , symbol |= (1 << bitIndex))
- }
- RC_FLUSH_VAR
- return symbol;
- }
-};
-
-template <int numMoveBits>
-void ReverseBitTreeEncode(CBitEncoder<numMoveBits> *Models,
- CEncoder *rangeEncoder, int NumBitLevels, UInt32 symbol)
-{
- UInt32 modelIndex = 1;
- for (int i = 0; i < NumBitLevels; i++)
- {
- UInt32 bit = symbol & 1;
- Models[modelIndex].Encode(rangeEncoder, bit);
- modelIndex = (modelIndex << 1) | bit;
- symbol >>= 1;
- }
-}
-
-template <int numMoveBits>
-UInt32 ReverseBitTreeGetPrice(CBitEncoder<numMoveBits> *Models,
- UInt32 NumBitLevels, UInt32 symbol)
-{
- UInt32 price = 0;
- UInt32 modelIndex = 1;
- for (int i = NumBitLevels; i != 0; i--)
- {
- UInt32 bit = symbol & 1;
- symbol >>= 1;
- price += Models[modelIndex].GetPrice(bit);
- modelIndex = (modelIndex << 1) | bit;
- }
- return price;
-}
-
-template <int numMoveBits>
-UInt32 ReverseBitTreeDecode(CBitDecoder<numMoveBits> *Models,
- CDecoder *rangeDecoder, int NumBitLevels)
-{
- UInt32 modelIndex = 1;
- UInt32 symbol = 0;
- RC_INIT_VAR
- for(int bitIndex = 0; bitIndex < NumBitLevels; bitIndex++)
- {
- // UInt32 bit = Models[modelIndex].Decode(rangeDecoder);
- // modelIndex <<= 1;
- // modelIndex += bit;
- // symbol |= (bit << bitIndex);
- RC_GETBIT2(numMoveBits, Models[modelIndex].Prob, modelIndex, ; , symbol |= (1 << bitIndex))
- }
- RC_FLUSH_VAR
- return symbol;
-}
-
-}}
-
-#endif
diff --git a/CPP/7zip/Compress/RangeCoder/RangeCoderOpt.h b/CPP/7zip/Compress/RangeCoder/RangeCoderOpt.h
deleted file mode 100755
index 57792776..00000000
--- a/CPP/7zip/Compress/RangeCoder/RangeCoderOpt.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Compress/RangeCoder/RangeCoderOpt.h
-
-#ifndef __COMPRESS_RANGECODER_OPT_H
-#define __COMPRESS_RANGECODER_OPT_H
-
-#define RC_INIT_VAR \
- UInt32 range = rangeDecoder->Range; \
- UInt32 code = rangeDecoder->Code;
-
-#define RC_FLUSH_VAR \
- rangeDecoder->Range = range; \
- rangeDecoder->Code = code;
-
-#define RC_NORMALIZE \
- if (range < NCompress::NRangeCoder::kTopValue) \
- { code = (code << 8) | rangeDecoder->Stream.ReadByte(); range <<= 8; }
-
-#define RC_GETBIT2(numMoveBits, prob, mi, A0, A1) \
- { UInt32 bound = (range >> NCompress::NRangeCoder::kNumBitModelTotalBits) * prob; \
- if (code < bound) \
- { A0; range = bound; \
- prob += (NCompress::NRangeCoder::kBitModelTotal - prob) >> numMoveBits; \
- mi <<= 1; } \
- else \
- { A1; range -= bound; code -= bound; prob -= (prob) >> numMoveBits; \
- mi = (mi + mi) + 1; }} \
- RC_NORMALIZE
-
-#define RC_GETBIT(numMoveBits, prob, mi) RC_GETBIT2(numMoveBits, prob, mi, ; , ;)
-
-#endif
diff --git a/CPP/7zip/Compress/RangeCoder/StdAfx.h b/CPP/7zip/Compress/RangeCoder/StdAfx.h
deleted file mode 100755
index b637fd40..00000000
--- a/CPP/7zip/Compress/RangeCoder/StdAfx.h
+++ /dev/null
@@ -1,6 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#endif
diff --git a/CPP/7zip/Compress/RangeCoder/RangeCoderBit.h b/CPP/7zip/Compress/RangeCoderBit.h
index 0ac50dfe..566cdd41 100755
--- a/CPP/7zip/Compress/RangeCoder/RangeCoderBit.h
+++ b/CPP/7zip/Compress/RangeCoderBit.h
@@ -1,7 +1,7 @@
-// Compress/RangeCoder/RangeCoderBit.h
+// Compress/RangeCoderBit.h
-#ifndef __COMPRESS_RANGECODER_BIT_H
-#define __COMPRESS_RANGECODER_BIT_H
+#ifndef __COMPRESS_RANGE_CODER_BIT_H
+#define __COMPRESS_RANGE_CODER_BIT_H
#include "RangeCoder.h"
diff --git a/CPP/7zip/Compress/Rar/Rar29.dsp b/CPP/7zip/Compress/Rar/Rar29.dsp
deleted file mode 100755
index 9eb36ac3..00000000
--- a/CPP/7zip/Compress/Rar/Rar29.dsp
+++ /dev/null
@@ -1,319 +0,0 @@
-# Microsoft Developer Studio Project File - Name="Rar29" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=Rar29 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "Rar29.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "Rar29.mak" CFG="Rar29 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "Rar29 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "Rar29 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "Rar29 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR29_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR29_EXPORTS" /D "SILENT" /D "NOCRYPT" /D "NOVOLUME" /Yu"StdAfx.h" /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Rar29.dll" /opt:NOWIN98
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "Rar29 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 1
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR29_EXPORTS" /YX /FD /GZ /c
-# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "RAR29_EXPORTS" /D "SILENT" /D "NOCRYPT" /D "NOVOLUME" /Yu"StdAfx.h" /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x419 /d "_DEBUG"
-# ADD RSC /l 0x419 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-Zip\Codecs\Rar29.dll" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "Rar29 - Win32 Release"
-# Name "Rar29 - Win32 Debug"
-# Begin Group "Spec"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\Codec.def
-# End Source File
-# Begin Source File
-
-SOURCE=..\CodecExports.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\DllExports.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\resource.rc
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.cpp
-# ADD CPP /Yc"StdAfx.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\StdAfx.h
-# End Source File
-# End Group
-# Begin Group "7zip Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\InBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\MSBFDecoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\OutBuffer.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\RegisterCodec.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\Common\StreamUtils.h
-# End Source File
-# End Group
-# Begin Group "LZ"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\LZ\LZOutWindow.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\LZ\LZOutWindow.h
-# End Source File
-# End Group
-# Begin Group "Huffman"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\Huffman\HuffmanDecoder.h
-# End Source File
-# End Group
-# Begin Group "Common"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\Common\CRC.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\MyVector.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\Common\NewHandler.h
-# End Source File
-# End Group
-# Begin Group "Rar3"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\PPMD\PPMDContext.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\PPMD\PPMDDecode.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\PPMD\PPMDSubAlloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\PPMD\PPMDType.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar1Decoder.cpp
-
-!IF "$(CFG)" == "Rar29 - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "Rar29 - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar1Decoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar2Decoder.cpp
-
-!IF "$(CFG)" == "Rar29 - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "Rar29 - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar2Decoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar3Decoder.cpp
-
-!IF "$(CFG)" == "Rar29 - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "Rar29 - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar3Decoder.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar3Vm.cpp
-
-!IF "$(CFG)" == "Rar29 - Win32 Release"
-
-# ADD CPP /O2
-# SUBTRACT CPP /YX /Yc /Yu
-
-!ELSEIF "$(CFG)" == "Rar29 - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
-SOURCE=.\Rar3Vm.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\RarCodecsRegister.cpp
-# End Source File
-# End Group
-# Begin Group "C"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\7zCrc.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\C\Alloc.h
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/CPP/7zip/Compress/Rar/Rar29.dsw b/CPP/7zip/Compress/Rar/Rar29.dsw
deleted file mode 100755
index 70172e1a..00000000
--- a/CPP/7zip/Compress/Rar/Rar29.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "Rar29"=.\Rar29.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/CPP/7zip/Compress/Rar/StdAfx.cpp b/CPP/7zip/Compress/Rar/StdAfx.cpp
deleted file mode 100755
index d0feea85..00000000
--- a/CPP/7zip/Compress/Rar/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/CPP/7zip/Compress/Rar/StdAfx.h b/CPP/7zip/Compress/Rar/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Rar/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Rar/makefile b/CPP/7zip/Compress/Rar/makefile
deleted file mode 100755
index 27cedbd9..00000000
--- a/CPP/7zip/Compress/Rar/makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-PROG = Rar29.dll
-DEF_FILE = ../Codec.def
-CFLAGS = $(CFLAGS) -I ../../../
-LIBS = $(LIBS) oleaut32.lib
-
-COMPRESS_OBJS = \
- $O\CodecExports.obj \
- $O\DllExports.obj \
-
-RAR29_OPT_OBJS = \
- $O\Rar1Decoder.obj \
- $O\Rar2Decoder.obj \
- $O\Rar3Decoder.obj \
- $O\Rar3Vm.obj \
- $O\RarCodecsRegister.obj \
-
-COMMON_OBJS = \
- $O\CRC.obj \
- $O\MyVector.obj \
-
-7ZIP_COMMON_OBJS = \
- $O\InBuffer.obj \
- $O\OutBuffer.obj \
- $O\StreamUtils.obj \
-
-LZ_OBJS = \
- $O\LZOutWindow.obj \
-
-C_OBJS = \
- $O\Alloc.obj \
-
-!include "../../Crc2.mak"
-
-OBJS = \
- $O\StdAfx.obj \
- $(COMPRESS_OBJS) \
- $(RAR29_OPT_OBJS) \
- $(COMMON_OBJS) \
- $(7ZIP_COMMON_OBJS) \
- $(LZ_OBJS) \
- $(C_OBJS) \
- $(CRC_OBJS) \
- $O\resource.res
-
-!include "../../../Build.mak"
-
-$(COMPRESS_OBJS): ../$(*B).cpp
- $(COMPL)
-$(RAR29_OPT_OBJS): $(*B).cpp
- $(COMPL_O2)
-$(COMMON_OBJS): ../../../Common/$(*B).cpp
- $(COMPL)
-$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
- $(COMPL)
-$(LZ_OBJS): ../LZ/$(*B).cpp
- $(COMPL)
-$(C_OBJS): ../../../../C/$(*B).c
- $(COMPL_O2)
-
-!include "../../Crc.mak"
diff --git a/CPP/7zip/Compress/Rar/resource.rc b/CPP/7zip/Compress/Rar/resource.rc
deleted file mode 100755
index bb5e2ec9..00000000
--- a/CPP/7zip/Compress/Rar/resource.rc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "../../MyVersionInfo.rc"
-
-MY_VERSION_INFO_DLL("Rar29 Codec", "Rar29")
diff --git a/CPP/7zip/Compress/Rar/Rar1Decoder.cpp b/CPP/7zip/Compress/Rar1Decoder.cpp
index 38d4f4a9..c7540b92 100755
--- a/CPP/7zip/Compress/Rar/Rar1Decoder.cpp
+++ b/CPP/7zip/Compress/Rar1Decoder.cpp
@@ -370,9 +370,8 @@ void CDecoder::InitHuff()
CorrHuff(ChSetB, NToPlB);
}
-STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo * /* progress */)
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo * /* progress */)
{
if (inSize == NULL || outSize == NULL)
return E_INVALIDARG;
@@ -459,13 +458,12 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
return m_OutWindowStream.Flush();
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, 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(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Rar/Rar1Decoder.h b/CPP/7zip/Compress/Rar1Decoder.h
index 185ef10a..f7c08b38 100755
--- a/CPP/7zip/Compress/Rar/Rar1Decoder.h
+++ b/CPP/7zip/Compress/Rar1Decoder.h
@@ -1,25 +1,26 @@
-// Rar15Decoder.h
+// Rar1Decoder.h
// According to unRAR license, this code may not be used to develop
// a program that creates RAR archives
-#ifndef __RAR10_DECODER_H
-#define __RAR10_DECODER_H
+#ifndef __COMPRESS_RAR1_DECODER_H
+#define __COMPRESS_RAR1_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/MSBFDecoder.h"
-#include "../../Common/InBuffer.h"
+#include "../ICoder.h"
-#include "../LZ/LZOutWindow.h"
-#include "../Huffman/HuffmanDecoder.h"
+#include "../Common/InBuffer.h"
+
+#include "BitmDecoder.h"
+#include "HuffmanDecoder.h"
+#include "LzOutWindow.h"
namespace NCompress {
namespace NRar1 {
const UInt32 kNumRepDists = 4;
-typedef NStream::NMSBF::CDecoder<CInBuffer> CBitDecoder;
+typedef NBitm::CDecoder<CInBuffer> CBitDecoder;
class CDecoder :
public ICompressCoder,
@@ -27,7 +28,7 @@ class CDecoder :
public CMyUnknownImp
{
public:
- CLZOutWindow m_OutWindowStream;
+ CLzOutWindow m_OutWindowStream;
CBitDecoder m_InBitStream;
UInt32 m_RepDists[kNumRepDists];
@@ -61,6 +62,9 @@ public:
void InitStructures();
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+
public:
CDecoder();
@@ -72,13 +76,8 @@ public:
m_InBitStream.ReleaseStream();
}
- STDMETHOD(CodeReal)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
diff --git a/CPP/7zip/Compress/Rar/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar2Decoder.cpp
index ed10a408..16d6b30c 100755
--- a/CPP/7zip/Compress/Rar/Rar2Decoder.cpp
+++ b/CPP/7zip/Compress/Rar2Decoder.cpp
@@ -297,9 +297,8 @@ bool CDecoder::DecodeLz(Int32 pos)
return true;
}
-HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
if (inSize == NULL || outSize == NULL)
return E_INVALIDARG;
@@ -370,13 +369,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream,
return m_OutWindowStream.Flush();
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, 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(const CLzOutWindowException &e) { return e.ErrorCode; }
catch(...) { return S_FALSE; }
}
diff --git a/CPP/7zip/Compress/Rar/Rar2Decoder.h b/CPP/7zip/Compress/Rar2Decoder.h
index 8626a7d9..61a8b4da 100755
--- a/CPP/7zip/Compress/Rar/Rar2Decoder.h
+++ b/CPP/7zip/Compress/Rar2Decoder.h
@@ -2,17 +2,18 @@
// According to unRAR license, this code may not be used to develop
// a program that creates RAR archives
-#ifndef __RAR2DECODER_H
-#define __RAR2DECODER_H
+#ifndef __COMPRESS_RAR2_DECODER_H
+#define __COMPRESS_RAR2_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/MSBFDecoder.h"
-#include "../../Common/InBuffer.h"
+#include "../ICoder.h"
-#include "../LZ/LZOutWindow.h"
-#include "../Huffman/HuffmanDecoder.h"
+#include "../Common/InBuffer.h"
+
+#include "BitmDecoder.h"
+#include "HuffmanDecoder.h"
+#include "LzOutWindow.h"
namespace NCompress {
namespace NRar2 {
@@ -107,7 +108,7 @@ public:
}
-typedef NStream::NMSBF::CDecoder<CInBuffer> CBitDecoder;
+typedef NBitm::CDecoder<CInBuffer> CBitDecoder;
const int kNumHuffmanBits = 15;
@@ -116,7 +117,7 @@ class CDecoder :
public ICompressSetDecoderProperties2,
public CMyUnknownImp
{
- CLZOutWindow m_OutWindowStream;
+ CLzOutWindow m_OutWindowStream;
CBitDecoder m_InBitStream;
NHuffman::CDecoder<kNumHuffmanBits, kMainTableSize> m_MainDecoder;
NHuffman::CDecoder<kNumHuffmanBits, kDistTableSize> m_DistDecoder;
@@ -147,9 +148,8 @@ class CDecoder :
bool DecodeMm(UInt32 pos);
bool DecodeLz(Int32 pos);
- HRESULT CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
public:
CDecoder();
@@ -162,9 +162,8 @@ public:
m_InBitStream.ReleaseStream();
}
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
diff --git a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar3Decoder.cpp
index c2b18fc9..b7345eb0 100755
--- a/CPP/7zip/Compress/Rar/Rar3Decoder.cpp
+++ b/CPP/7zip/Compress/Rar3Decoder.cpp
@@ -4,8 +4,9 @@
#include "StdAfx.h"
+#include "../Common/StreamUtils.h"
+
#include "Rar3Decoder.h"
-#include "../../Common/StreamUtils.h"
namespace NCompress {
namespace NRar3 {
@@ -780,9 +781,8 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress)
return S_OK;
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try
{
diff --git a/CPP/7zip/Compress/Rar/Rar3Decoder.h b/CPP/7zip/Compress/Rar3Decoder.h
index cac769bd..73d4c224 100755
--- a/CPP/7zip/Compress/Rar/Rar3Decoder.h
+++ b/CPP/7zip/Compress/Rar3Decoder.h
@@ -2,18 +2,18 @@
// According to unRAR license, this code may not be used to develop
// a program that creates RAR archives
-#ifndef __RAR3DECODER_H
-#define __RAR3DECODER_H
+#ifndef __COMPRESS_RAR3_DECODER_H
+#define __COMPRESS_RAR3_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
-#include "../../Common/MSBFDecoder.h"
-#include "../../Common/InBuffer.h"
+#include "../ICoder.h"
-// #include "../LZ/LZOutWindow.h"
-#include "../Huffman/HuffmanDecoder.h"
-#include "../PPMD/PPMDDecode.h"
+#include "../Common/InBuffer.h"
+
+#include "BitmDecoder.h"
+#include "HuffmanDecoder.h"
+#include "PpmdDecode.h"
#include "Rar3Vm.h"
namespace NCompress {
@@ -101,7 +101,7 @@ const int kNumTopBits = 24;
const UInt32 kTopValue = (1 << kNumTopBits);
const UInt32 kBot = (1 << 15);
-class CRangeDecoder:public NPPMD::CRangeDecoderVirt, public CBitDecoder
+class CRangeDecoder:public NPpmd::CRangeDecoderVirt, public CBitDecoder
{
public:
UInt32 Range;
@@ -219,7 +219,7 @@ class CDecoder:
bool TablesRead;
- NPPMD::CDecodeInfo _ppm;
+ NPpmd::CDecodeInfo _ppm;
int PpmEscChar;
HRESULT WriteDataToStream(const Byte *data, UInt32 size);
@@ -255,10 +255,8 @@ public:
m_InBitStream.ReleaseStream();
}
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
diff --git a/CPP/7zip/Compress/Rar/Rar3Vm.cpp b/CPP/7zip/Compress/Rar3Vm.cpp
index daa083e4..ffca79d0 100755
--- a/CPP/7zip/Compress/Rar/Rar3Vm.cpp
+++ b/CPP/7zip/Compress/Rar3Vm.cpp
@@ -12,14 +12,14 @@ Note:
#include "StdAfx.h"
-#include "Rar3Vm.h"
-
extern "C"
{
-#include "../../../../C/Alloc.h"
-#include "../../../../C/7zCrc.h"
+#include "../../../C/7zCrc.h"
+#include "../../../C/Alloc.h"
}
+#include "Rar3Vm.h"
+
namespace NCompress {
namespace NRar3 {
diff --git a/CPP/7zip/Compress/Rar/Rar3Vm.h b/CPP/7zip/Compress/Rar3Vm.h
index f6cf11b4..c02534c6 100755
--- a/CPP/7zip/Compress/Rar/Rar3Vm.h
+++ b/CPP/7zip/Compress/Rar3Vm.h
@@ -2,13 +2,13 @@
// According to unRAR license, this code may not be used to develop
// a program that creates RAR archives
-#ifndef __RAR3VM_H
-#define __RAR3VM_H
+#ifndef __COMPRESS_RAR3_VM_H
+#define __COMPRESS_RAR3_VM_H
-#include "Common/Types.h"
-#include "Common/MyVector.h"
+#include "../../../C/CpuArch.h"
-#include "../../../../C/CpuArch.h"
+#include "Common/MyVector.h"
+#include "Common/Types.h"
#define RARVM_STANDARD_FILTERS
diff --git a/CPP/7zip/Compress/Rar/RarCodecsRegister.cpp b/CPP/7zip/Compress/RarCodecsRegister.cpp
index 5cf32ac8..e3f6a05c 100755
--- a/CPP/7zip/Compress/Rar/RarCodecsRegister.cpp
+++ b/CPP/7zip/Compress/RarCodecsRegister.cpp
@@ -2,7 +2,7 @@
#include "StdAfx.h"
-#include "../../Common/RegisterCodec.h"
+#include "../Common/RegisterCodec.h"
#include "Rar1Decoder.h"
#include "Rar2Decoder.h"
diff --git a/CPP/7zip/Compress/Shrink/StdAfx.h b/CPP/7zip/Compress/Shrink/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Shrink/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp b/CPP/7zip/Compress/ShrinkDecoder.cpp
index 5079a51a..6eaacd4b 100755
--- a/CPP/7zip/Compress/Shrink/ShrinkDecoder.cpp
+++ b/CPP/7zip/Compress/ShrinkDecoder.cpp
@@ -2,28 +2,27 @@
#include "StdAfx.h"
-#include "ShrinkDecoder.h"
-
extern "C"
{
-#include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
-#include "../../Common/InBuffer.h"
-#include "../../Common/OutBuffer.h"
-#include "../../Common/LSBFDecoder.h"
+
+#include "../Common/InBuffer.h"
+#include "../Common/OutBuffer.h"
+
+#include "BitlDecoder.h"
+#include "ShrinkDecoder.h"
namespace NCompress {
namespace NShrink {
static const UInt32 kBufferSize = (1 << 20);
-
static const int kNumMinBits = 9;
-STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 * /* outSize */,
- ICompressProgressInfo *progress)
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
- NStream::NLSBF::CBaseDecoder<CInBuffer> inBuffer;
+ NBitl::CBaseDecoder<CInBuffer> inBuffer;
COutBuffer outBuffer;
if (!inBuffer.Create(kBufferSize))
@@ -137,9 +136,8 @@ STDMETHODIMP CDecoder ::CodeReal(ISequentialInStream *inStream,
return outBuffer.Flush();
}
-STDMETHODIMP CDecoder ::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder ::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const CInBufferException &e) { return e.ErrorCode; }
diff --git a/CPP/7zip/Compress/Shrink/ShrinkDecoder.h b/CPP/7zip/Compress/ShrinkDecoder.h
index 0c1b8607..9bbecd41 100755
--- a/CPP/7zip/Compress/Shrink/ShrinkDecoder.h
+++ b/CPP/7zip/Compress/ShrinkDecoder.h
@@ -1,11 +1,11 @@
// ShrinkDecoder.h
-#ifndef __SHRINK_DECODER_H
-#define __SHRINK_DECODER_H
+#ifndef __COMPRESS_SHRINK_DECODER_H
+#define __COMPRESS_SHRINK_DECODER_H
-#include "../../../Common/MyCom.h"
+#include "../../Common/MyCom.h"
-#include "../../ICoder.h"
+#include "../ICoder.h"
namespace NCompress {
namespace NShrink {
@@ -22,16 +22,15 @@ class CDecoder :
Byte _stack[kNumItems];
bool _isFree[kNumItems];
bool _isParent[kNumItems];
+
public:
MY_UNKNOWN_IMP
- STDMETHOD(CodeReal)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
- const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
};
}}
diff --git a/CPP/7zip/Compress/Z/StdAfx.h b/CPP/7zip/Compress/Z/StdAfx.h
deleted file mode 100755
index e7fb6986..00000000
--- a/CPP/7zip/Compress/Z/StdAfx.h
+++ /dev/null
@@ -1,8 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../../Common/MyWindows.h"
-
-#endif
diff --git a/CPP/7zip/Compress/Z/ZDecoder.h b/CPP/7zip/Compress/Z/ZDecoder.h
deleted file mode 100755
index 70e40c20..00000000
--- a/CPP/7zip/Compress/Z/ZDecoder.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// ZDecoder.h
-
-#ifndef __COMPRESS_ZDECODER_H
-#define __COMPRESS_ZDECODER_H
-
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
-namespace NCompress {
-namespace NZ {
-
-class CDecoder :
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public CMyUnknownImp
-{
- BYTE _properties;
- int _numMaxBits;
- UInt16 *_parents;
- Byte *_suffixes;
- Byte *_stack;
-
-public:
- CDecoder(): _properties(0), _numMaxBits(0), _parents(0), _suffixes(0), _stack(0) {};
- ~CDecoder();
- void Free();
-
- MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
-
- STDMETHOD(CodeReal)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
-
- STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
-};
-
-}}
-
-#endif
diff --git a/CPP/7zip/Compress/Z/ZDecoder.cpp b/CPP/7zip/Compress/ZDecoder.cpp
index 4d435b6c..6982a7e0 100755
--- a/CPP/7zip/Compress/Z/ZDecoder.cpp
+++ b/CPP/7zip/Compress/ZDecoder.cpp
@@ -2,15 +2,15 @@
#include "StdAfx.h"
-#include "ZDecoder.h"
-
extern "C"
{
-#include "../../../../C/Alloc.h"
+#include "../../../C/Alloc.h"
}
-#include "../../Common/InBuffer.h"
-#include "../../Common/OutBuffer.h"
+#include "../Common/InBuffer.h"
+#include "../Common/OutBuffer.h"
+
+#include "ZDecoder.h"
namespace NCompress {
namespace NZ {
@@ -30,9 +30,8 @@ void CDecoder::Free()
CDecoder::~CDecoder() { Free(); }
-STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 * /* outSize */,
- ICompressProgressInfo *progress)
+HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 * /* inSize */, const UInt64 * /* outSize */, ICompressProgressInfo *progress)
{
CInBuffer inBuffer;
COutBuffer outBuffer;
@@ -143,9 +142,8 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
return outBuffer.Flush();
}
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
try { return CodeReal(inStream, outStream, inSize, outSize, progress); }
catch(const CInBufferException &e) { return e.ErrorCode; }
diff --git a/CPP/7zip/Compress/ZDecoder.h b/CPP/7zip/Compress/ZDecoder.h
new file mode 100755
index 00000000..2bd83a17
--- /dev/null
+++ b/CPP/7zip/Compress/ZDecoder.h
@@ -0,0 +1,42 @@
+// ZDecoder.h
+
+#ifndef __COMPRESS_Z_DECODER_H
+#define __COMPRESS_Z_DECODER_H
+
+#include "../../Common/MyCom.h"
+
+#include "../ICoder.h"
+
+namespace NCompress {
+namespace NZ {
+
+class CDecoder:
+ public ICompressCoder,
+ public ICompressSetDecoderProperties2,
+ public CMyUnknownImp
+{
+ UInt16 *_parents;
+ Byte *_suffixes;
+ Byte *_stack;
+ Byte _properties;
+ int _numMaxBits;
+
+public:
+ CDecoder(): _parents(0), _suffixes(0), _stack(0), _properties(0), _numMaxBits(0) {};
+ ~CDecoder();
+ void Free();
+
+ MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2)
+
+ HRESULT CodeReal(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
+
+ STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
+};
+
+}}
+
+#endif
diff --git a/CPP/7zip/Compress/Deflate/ZlibDecoder.cpp b/CPP/7zip/Compress/ZlibDecoder.cpp
index 6a55b717..a1bac27b 100755
--- a/CPP/7zip/Compress/Deflate/ZlibDecoder.cpp
+++ b/CPP/7zip/Compress/ZlibDecoder.cpp
@@ -2,9 +2,10 @@
#include "StdAfx.h"
-#include "ZlibDecoder.h"
+#include "../Common/StreamUtils.h"
+
#include "DeflateDecoder.h"
-#include "../../Common/StreamUtils.h"
+#include "ZlibDecoder.h"
namespace NCompress {
namespace NZlib {
@@ -46,9 +47,8 @@ STDMETHODIMP COutStreamWithAdler::Write(const void *data, UInt32 size, UInt32 *p
return result;
}
-HRESULT CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress)
+STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress)
{
DEFLATE_TRY_BEGIN
if (!AdlerStream)
diff --git a/CPP/7zip/Compress/Deflate/ZlibDecoder.h b/CPP/7zip/Compress/ZlibDecoder.h
index cb0cb3cc..906e241b 100755
--- a/CPP/7zip/Compress/Deflate/ZlibDecoder.h
+++ b/CPP/7zip/Compress/ZlibDecoder.h
@@ -35,9 +35,8 @@ class CDecoder:
NCompress::NDeflate::NDecoder::CCOMCoder *DeflateDecoderSpec;
CMyComPtr<ICompressCoder> DeflateDecoder;
public:
- STDMETHOD(Code)(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
- ICompressProgressInfo *progress);
+ STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
+ const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
MY_UNKNOWN_IMP
};