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/LZMA
parentc1f1243a70558e86e14b1ea09dc287737378894b (diff)
4.634.63
Diffstat (limited to 'CPP/7zip/Compress/LZMA')
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMA.dsp403
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMA.dsw29
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMADecoder.cpp191
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMADecoder.h77
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMAEncoder.cpp227
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMAEncoder.h72
-rwxr-xr-xCPP/7zip/Compress/LZMA/LZMARegister.cpp19
-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
11 files changed, 0 insertions, 1093 deletions
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/LZMADecoder.cpp b/CPP/7zip/Compress/LZMA/LZMADecoder.cpp
deleted file mode 100755
index ae5da5de..00000000
--- a/CPP/7zip/Compress/LZMA/LZMADecoder.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-// LZMADecoder.cpp
-
-#include "StdAfx.h"
-
-#include "LZMADecoder.h"
-#include "../../../Common/Defs.h"
-#include "../../Common/StreamUtils.h"
-
-extern "C"
-{
- #include "../../../../C/Alloc.h"
-}
-
-static HRESULT SResToHRESULT(SRes res)
-{
- switch(res)
- {
- case SZ_OK: return S_OK;
- case SZ_ERROR_MEM: return E_OUTOFMEMORY;
- case SZ_ERROR_PARAM: return E_INVALIDARG;
- case SZ_ERROR_UNSUPPORTED: return E_NOTIMPL;
- // case SZ_ERROR_PROGRESS: return E_ABORT;
- case SZ_ERROR_DATA: return S_FALSE;
- }
- return E_FAIL;
-}
-
-namespace NCompress {
-namespace NLZMA {
-
-static const UInt32 kInBufSize = 1 << 20;
-
-CDecoder::CDecoder(): _inBuf(0), _outSizeDefined(false), FinishStream(false)
-{
- LzmaDec_Construct(&_state);
-}
-
-static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
-static void SzFree(void *p, void *address) { p = p; MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CDecoder::~CDecoder()
-{
- LzmaDec_Free(&_state, &g_Alloc);
- MyFree(_inBuf);
-}
-
-STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *prop, UInt32 size)
-{
- RINOK(SResToHRESULT(LzmaDec_Allocate(&_state, prop, size, &g_Alloc)));
-
- if (_inBuf == 0)
- {
- _inBuf = (Byte *)MyAlloc(kInBufSize);
- if (_inBuf == 0)
- return E_OUTOFMEMORY;
- }
-
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value) { *value = _inSizeProcessed; return S_OK; }
-STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream) { _inStream = inStream; return S_OK; }
-STDMETHODIMP CDecoder::ReleaseInStream() { _inStream.Release(); return S_OK; }
-
-STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
-{
- _outSizeDefined = (outSize != NULL);
- if (_outSizeDefined)
- _outSize = *outSize;
-
- LzmaDec_Init(&_state);
-
- _inPos = _inSize = 0;
- _inSizeProcessed = _outSizeProcessed = 0;
- return S_OK;
-}
-
-STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */,
- const UInt64 *outSize, ICompressProgressInfo *progress)
-{
- if (_inBuf == 0)
- return S_FALSE;
- SetOutStreamSize(outSize);
-
- for (;;)
- {
- if (_inPos == _inSize)
- {
- _inPos = _inSize = 0;
- RINOK(inStream->Read(_inBuf, kInBufSize, &_inSize));
- }
-
- SizeT dicPos = _state.dicPos;
- SizeT curSize = _state.dicBufSize - dicPos;
- const UInt32 kStepSize = ((UInt32)1 << 22);
- if (curSize > kStepSize)
- curSize = (SizeT)kStepSize;
-
- ELzmaFinishMode finishMode = LZMA_FINISH_ANY;
- if (_outSizeDefined)
- {
- const UInt64 rem = _outSize - _outSizeProcessed;
- if (rem < curSize)
- {
- curSize = (SizeT)rem;
- if (FinishStream)
- finishMode = LZMA_FINISH_END;
- }
- }
-
- SizeT inSizeProcessed = _inSize - _inPos;
- ELzmaStatus status;
- SRes res = LzmaDec_DecodeToDic(&_state, dicPos + curSize, _inBuf + _inPos, &inSizeProcessed, finishMode, &status);
-
- _inPos += (UInt32)inSizeProcessed;
- _inSizeProcessed += inSizeProcessed;
- SizeT outSizeProcessed = _state.dicPos - dicPos;
- _outSizeProcessed += outSizeProcessed;
-
- bool finished = (inSizeProcessed == 0 && outSizeProcessed == 0);
- bool stopDecoding = (_outSizeDefined && _outSizeProcessed >= _outSize);
-
- if (res != 0 || _state.dicPos == _state.dicBufSize || finished || stopDecoding)
- {
- HRESULT res2 = WriteStream(outStream, _state.dic, _state.dicPos);
- if (res != 0)
- return S_FALSE;
- RINOK(res2);
- if (stopDecoding)
- return S_OK;
- if (finished)
- return (status == LZMA_STATUS_FINISHED_WITH_MARK ? S_OK : S_FALSE);
- }
- if (_state.dicPos == _state.dicBufSize)
- _state.dicPos = 0;
-
- if (progress != NULL)
- {
- RINOK(progress->SetRatioInfo(&_inSizeProcessed, &_outSizeProcessed));
- }
- }
-}
-
-#ifndef NO_READ_FROM_CODER
-
-STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize)
- *processedSize = 0;
- do
- {
- if (_inPos == _inSize)
- {
- _inPos = _inSize = 0;
- RINOK(_inStream->Read(_inBuf, kInBufSize, &_inSize));
- }
- {
- SizeT inProcessed = _inSize - _inPos;
-
- if (_outSizeDefined)
- {
- const UInt64 rem = _outSize - _outSizeProcessed;
- if (rem < size)
- size = (UInt32)rem;
- }
-
- SizeT outProcessed = size;
- ELzmaStatus status;
- SRes res = LzmaDec_DecodeToBuf(&_state, (Byte *)data, &outProcessed,
- _inBuf + _inPos, &inProcessed, LZMA_FINISH_ANY, &status);
- _inPos += (UInt32)inProcessed;
- _inSizeProcessed += inProcessed;
- _outSizeProcessed += outProcessed;
- size -= (UInt32)outProcessed;
- data = (Byte *)data + outProcessed;
- if (processedSize)
- *processedSize += (UInt32)outProcessed;
- RINOK(SResToHRESULT(res));
- if (inProcessed == 0 && outProcessed == 0)
- return S_OK;
- }
- }
- while (size != 0);
- return S_OK;
-}
-
-#endif
-
-}}
diff --git a/CPP/7zip/Compress/LZMA/LZMADecoder.h b/CPP/7zip/Compress/LZMA/LZMADecoder.h
deleted file mode 100755
index 40dc3f36..00000000
--- a/CPP/7zip/Compress/LZMA/LZMADecoder.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// LZMADecoder.h
-
-#ifndef __LZMA_DECODER_H
-#define __LZMA_DECODER_H
-
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
-extern "C"
-{
- #include "../../../../C/LzmaDec.h"
-}
-
-namespace NCompress {
-namespace NLZMA {
-
-class CDecoder:
- public ICompressCoder,
- public ICompressSetDecoderProperties2,
- public ICompressGetInStreamProcessedSize,
- #ifndef NO_READ_FROM_CODER
- public ICompressSetInStream,
- public ICompressSetOutStreamSize,
- public ISequentialInStream,
- #endif
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _inStream;
- Byte *_inBuf;
- UInt32 _inPos;
- UInt32 _inSize;
- CLzmaDec _state;
- bool _outSizeDefined;
- UInt64 _outSize;
- UInt64 _inSizeProcessed;
- UInt64 _outSizeProcessed;
-public:
-
- #ifndef NO_READ_FROM_CODER
- MY_UNKNOWN_IMP5(
- ICompressSetDecoderProperties2,
- ICompressGetInStreamProcessedSize,
- ICompressSetInStream,
- ICompressSetOutStreamSize,
- ISequentialInStream)
- #else
- MY_UNKNOWN_IMP2(
- ICompressSetDecoderProperties2,
- ICompressGetInStreamProcessedSize)
- #endif
-
- 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);
-
- #ifndef NO_READ_FROM_CODER
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- #endif
-
- bool FinishStream;
-
- CDecoder();
- virtual ~CDecoder();
-
-};
-
-}}
-
-#endif
diff --git a/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp b/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
deleted file mode 100755
index 43e1b772..00000000
--- a/CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-// LZMA/Encoder.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"
-}
-
-static HRESULT SResToHRESULT(SRes res)
-{
- switch(res)
- {
- case SZ_OK: return S_OK;
- case SZ_ERROR_MEM: return E_OUTOFMEMORY;
- case SZ_ERROR_PARAM: return E_INVALIDARG;
- // case SZ_ERROR_THREAD: return E_FAIL;
- }
- return E_FAIL;
-}
-
-namespace NCompress {
-namespace NLZMA {
-
-static const UInt32 kStreamStepSize = (UInt32)1 << 31;
-
-static SRes MyRead(void *object, void *data, size_t *size)
-{
- UInt32 curSize = ((*size < kStreamStepSize) ? (UInt32)*size : kStreamStepSize);
- HRESULT res = ((CSeqInStream *)object)->RealStream->Read(data, curSize, &curSize);
- *size = curSize;
- return (SRes)res;
-}
-
-static size_t MyWrite(void *object, const void *data, size_t size)
-{
- CSeqOutStream *p = (CSeqOutStream *)object;
- p->Res = WriteStream(p->RealStream, data, size);
- if (p->Res != 0)
- return 0;
- return size;
-}
-
-static void *SzBigAlloc(void *, size_t size) { return BigAlloc(size); }
-static void SzBigFree(void *, void *address) { BigFree(address); }
-static ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
-
-static void *SzAlloc(void *, size_t size) { return MyAlloc(size); }
-static void SzFree(void *, void *address) { MyFree(address); }
-static ISzAlloc g_Alloc = { SzAlloc, SzFree };
-
-CEncoder::CEncoder()
-{
- _seqInStream.SeqInStream.Read = MyRead;
- _seqOutStream.SeqOutStream.Write = MyWrite;
- _encoder = 0;
- _encoder = LzmaEnc_Create(&g_Alloc);
- if (_encoder == 0)
- throw 1;
-}
-
-CEncoder::~CEncoder()
-{
- if (_encoder != 0)
- LzmaEnc_Destroy(_encoder, &g_Alloc, &g_BigAlloc);
-}
-
-inline wchar_t GetUpperChar(wchar_t c)
-{
- if (c >= 'a' && c <= 'z')
- c -= 0x20;
- return c;
-}
-
-static int ParseMatchFinder(const wchar_t *s, int *btMode, int *numHashBytes)
-{
- wchar_t c = GetUpperChar(*s++);
- if (c == L'H')
- {
- if (GetUpperChar(*s++) != L'C')
- return 0;
- int numHashBytesLoc = (int)(*s++ - L'0');
- if (numHashBytesLoc < 4 || numHashBytesLoc > 4)
- return 0;
- if (*s++ != 0)
- return 0;
- *btMode = 0;
- *numHashBytes = numHashBytesLoc;
- return 1;
- }
- if (c != L'B')
- return 0;
-
- if (GetUpperChar(*s++) != L'T')
- return 0;
- int numHashBytesLoc = (int)(*s++ - L'0');
- if (numHashBytesLoc < 2 || numHashBytesLoc > 4)
- return 0;
- c = GetUpperChar(*s++);
- if (c != L'\0')
- return 0;
- *btMode = 1;
- *numHashBytes = numHashBytesLoc;
- return 1;
-}
-
-STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs,
- const PROPVARIANT *properties, UInt32 numProperties)
-{
- CLzmaEncProps props;
- LzmaEncProps_Init(&props);
-
- for (UInt32 i = 0; i < numProperties; i++)
- {
- const PROPVARIANT &prop = properties[i];
- switch (propIDs[i])
- {
- case NCoderPropID::kNumFastBytes:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.fb = prop.ulVal; break;
- case NCoderPropID::kMatchFinderCycles:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.mc = prop.ulVal; break;
- case NCoderPropID::kAlgorithm:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.algo = prop.ulVal; break;
- case NCoderPropID::kDictionarySize:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.dictSize = prop.ulVal; break;
- case NCoderPropID::kPosStateBits:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.pb = prop.ulVal; break;
- case NCoderPropID::kLitPosBits:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.lp = prop.ulVal; break;
- case NCoderPropID::kLitContextBits:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.lc = prop.ulVal; break;
- case NCoderPropID::kNumThreads:
- if (prop.vt != VT_UI4) return E_INVALIDARG; props.numThreads = prop.ulVal; break;
- case NCoderPropID::kMultiThread:
- if (prop.vt != VT_BOOL) return E_INVALIDARG; props.numThreads = ((prop.boolVal == VARIANT_TRUE) ? 2 : 1); break;
- case NCoderPropID::kEndMarker:
- if (prop.vt != VT_BOOL) return E_INVALIDARG; props.writeEndMark = (prop.boolVal == VARIANT_TRUE); break;
- case NCoderPropID::kMatchFinder:
- if (prop.vt != VT_BSTR) return E_INVALIDARG;
- if (!ParseMatchFinder(prop.bstrVal, &props.btMode, &props.numHashBytes /* , &_matchFinderBase.skipModeBits */))
- return E_INVALIDARG; break;
- default:
- return E_INVALIDARG;
- }
- }
- return SResToHRESULT(LzmaEnc_SetProps(_encoder, &props));
-}
-
-STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream)
-{
- Byte props[LZMA_PROPS_SIZE];
- size_t size = LZMA_PROPS_SIZE;
- RINOK(LzmaEnc_WriteProperties(_encoder, props, &size));
- return WriteStream(outStream, props, size);
-}
-
-STDMETHODIMP CEncoder::SetOutStream(ISequentialOutStream *outStream)
-{
- _seqOutStream.RealStream = outStream;
- _seqOutStream.Res = S_OK;
- return S_OK;
-}
-
-STDMETHODIMP CEncoder::ReleaseOutStream()
-{
- _seqOutStream.RealStream.Release();
- return S_OK;
-}
-
-typedef struct _CCompressProgressImp
-{
- ICompressProgress p;
- ICompressProgressInfo *Progress;
- HRESULT Res;
-} CCompressProgressImp;
-
-#define PROGRESS_UNKNOWN_VALUE ((UInt64)(Int64)-1)
-
-#define CONVERT_PR_VAL(x) (x == PROGRESS_UNKNOWN_VALUE ? NULL : &x)
-
-SRes CompressProgress(void *pp, UInt64 inSize, UInt64 outSize)
-{
- CCompressProgressImp *p = (CCompressProgressImp *)pp;
- p->Res = p->Progress->SetRatioInfo(CONVERT_PR_VAL(inSize), CONVERT_PR_VAL(outSize));
- return (SRes)p->Res;
-}
-
-STDMETHODIMP CEncoder::Code(ISequentialInStream *inStream,
- ISequentialOutStream *outStream, const UInt64 * /* inSize */,
- const UInt64 * /* outSize */,
- ICompressProgressInfo *progress)
-{
- CCompressProgressImp progressImp;
- progressImp.p.Progress = CompressProgress;
- progressImp.Progress = progress;
- progressImp.Res = SZ_OK;
-
- _seqInStream.RealStream = inStream;
- SetOutStream(outStream);
- SRes res = LzmaEnc_Encode(_encoder, &_seqOutStream.SeqOutStream, &_seqInStream.SeqInStream, progress ? &progressImp.p : NULL, &g_Alloc, &g_BigAlloc);
- ReleaseOutStream();
- if (res == SZ_ERROR_WRITE && _seqOutStream.Res != S_OK)
- return _seqOutStream.Res;
- if (res == SZ_ERROR_PROGRESS && progressImp.Res != S_OK)
- return progressImp.Res;
- return SResToHRESULT(res);
-}
-
-}}
diff --git a/CPP/7zip/Compress/LZMA/LZMAEncoder.h b/CPP/7zip/Compress/LZMA/LZMAEncoder.h
deleted file mode 100755
index 05583e74..00000000
--- a/CPP/7zip/Compress/LZMA/LZMAEncoder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// LZMA/Encoder.h
-
-#ifndef __LZMA_ENCODER_H
-#define __LZMA_ENCODER_H
-
-#include "../../../Common/MyCom.h"
-#include "../../ICoder.h"
-
-extern "C"
-{
- #include "../../../../C/LzmaEnc.h"
-}
-
-namespace NCompress {
-namespace NLZMA {
-
-struct CSeqInStream
-{
- ISeqInStream SeqInStream;
- ISequentialInStream *RealStream;
-};
-
-struct CSeqOutStream
-{
- ISeqOutStream SeqOutStream;
- CMyComPtr<ISequentialOutStream> RealStream;
- HRESULT Res;
-};
-
-class CEncoder :
- public ICompressCoder,
- public ICompressSetOutStream,
- public ICompressSetCoderProperties,
- public ICompressWriteCoderProperties,
- public CMyUnknownImp
-{
- CLzmaEncHandle _encoder;
-
- CSeqInStream _seqInStream;
- CSeqOutStream _seqOutStream;
-
-public:
- CEncoder();
-
- MY_UNKNOWN_IMP3(
- ICompressSetOutStream,
- ICompressSetCoderProperties,
- 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(WriteCoderProperties)(ISequentialOutStream *outStream);
-
- STDMETHOD(SetOutStream)(ISequentialOutStream *outStream);
- STDMETHOD(ReleaseOutStream)();
-
- virtual ~CEncoder();
-};
-
-}}
-
-#endif
diff --git a/CPP/7zip/Compress/LZMA/LZMARegister.cpp b/CPP/7zip/Compress/LZMA/LZMARegister.cpp
deleted file mode 100755
index bc8f7262..00000000
--- a/CPP/7zip/Compress/LZMA/LZMARegister.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// LZMARegister.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/RegisterCodec.h"
-
-#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); }
-#else
-#define CreateCodecOut 0
-#endif
-
-static CCodecInfo g_CodecInfo =
- { CreateCodec, CreateCodecOut, 0x030101, L"LZMA", 1, false };
-
-REGISTER_CODEC(LZMA)
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")