diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-06-26 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:52 +0300 |
commit | fd8b1d78b496fe38193bf8c5e86af3b43f0b022d (patch) | |
tree | 5b1e3812ed4d8b6037e5035faf3b638849f618e2 /CPP/7zip/Compress | |
parent | 0b33f700a66fcf7f55f92b92e0b3e5c7014d769a (diff) |
4.48 beta
Diffstat (limited to 'CPP/7zip/Compress')
-rwxr-xr-x | CPP/7zip/Compress/Branch/BCJ2Register.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Branch/x86.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Branch/x86.h | 3 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Branch/x86_2.cpp | 151 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Branch/x86_2.h | 38 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Copy/CopyCoder.cpp | 6 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Copy/CopyCoder.h | 4 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp | 32 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp | 8 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp | 6 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp | 7 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c | 7 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/makefile | 12 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LZMA_Alone/makefile.gcc | 36 | ||||
-rwxr-xr-x | CPP/7zip/Compress/Rar/Rar3Vm.h | 2 |
16 files changed, 155 insertions, 169 deletions
diff --git a/CPP/7zip/Compress/Branch/BCJ2Register.cpp b/CPP/7zip/Compress/Branch/BCJ2Register.cpp index 24855dd7..88ebbac6 100755 --- a/CPP/7zip/Compress/Branch/BCJ2Register.cpp +++ b/CPP/7zip/Compress/Branch/BCJ2Register.cpp @@ -5,9 +5,9 @@ #include "../../Common/RegisterCodec.h" #include "x86_2.h" -static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new CBCJ2_x86_Decoder()); } +static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CDecoder()); } #ifndef EXTRACT_ONLY -static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new CBCJ2_x86_Encoder()); } +static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CEncoder()); } #else #define CreateCodecOut 0 #endif diff --git a/CPP/7zip/Compress/Branch/x86.cpp b/CPP/7zip/Compress/Branch/x86.cpp index c4d11a75..79d49657 100755 --- a/CPP/7zip/Compress/Branch/x86.cpp +++ b/CPP/7zip/Compress/Branch/x86.cpp @@ -5,10 +5,10 @@ UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size) { - return ::x86_Convert(data, size, _bufferPos, &_prevMask, &_prevPos, 1); + return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 1); } UInt32 CBCJ_x86_Decoder::SubFilter(Byte *data, UInt32 size) { - return ::x86_Convert(data, size, _bufferPos, &_prevMask, &_prevPos, 0); + return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 0); } diff --git a/CPP/7zip/Compress/Branch/x86.h b/CPP/7zip/Compress/Branch/x86.h index 39ba5ae5..58176600 100755 --- a/CPP/7zip/Compress/Branch/x86.h +++ b/CPP/7zip/Compress/Branch/x86.h @@ -12,8 +12,7 @@ extern "C" struct CBranch86 { UInt32 _prevMask; - UInt32 _prevPos; - void x86Init() { x86_Convert_Init(_prevMask, _prevPos); } + void x86Init() { x86_Convert_Init(_prevMask); } }; MyClassB(BCJ_x86, 0x01, 3, CBranch86 , diff --git a/CPP/7zip/Compress/Branch/x86_2.cpp b/CPP/7zip/Compress/Branch/x86_2.cpp index 178587b6..61f0c55a 100755 --- a/CPP/7zip/Compress/Branch/x86_2.cpp +++ b/CPP/7zip/Compress/Branch/x86_2.cpp @@ -8,10 +8,12 @@ extern "C" #include "../../../../C/Alloc.h" } -inline bool IsJcc(Byte b0, Byte b1) -{ - return (b0 == 0x0F && (b1 & 0xF0) == 0x80); -} +namespace NCompress { +namespace NBcj2 { + +inline bool IsJcc(Byte b0, Byte b1) { return (b0 == 0x0F && (b1 & 0xF0) == 0x80); } +inline bool IsJ(Byte b0, Byte b1) { return ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1)); } +inline unsigned GetIndex(Byte b0, Byte b1) { return ((b1 == 0xE8) ? b0 : ((b1 == 0xE9) ? 256 : 257)); } #ifndef EXTRACT_ONLY @@ -22,7 +24,7 @@ static bool inline Test86MSByte(Byte b) return (b == 0 || b == 0xFF); } -bool CBCJ2_x86_Encoder::Create() +bool CEncoder::Create() { if (!_mainStream.Create(1 << 16)) return false; @@ -41,12 +43,12 @@ bool CBCJ2_x86_Encoder::Create() return true; } -CBCJ2_x86_Encoder::~CBCJ2_x86_Encoder() +CEncoder::~CEncoder() { ::MidFree(_buffer); } -HRESULT CBCJ2_x86_Encoder::Flush() +HRESULT CEncoder::Flush() { RINOK(_mainStream.Flush()); RINOK(_callStream.Flush()); @@ -57,7 +59,7 @@ HRESULT CBCJ2_x86_Encoder::Flush() const UInt32 kDefaultLimit = (1 << 24); -HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams, +HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams, ISequentialOutStream **outStreams, @@ -91,10 +93,8 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams, _jumpStream.Init(); _rangeEncoder.SetStream(outStreams[3]); _rangeEncoder.Init(); - for (int i = 0; i < 256; i++) - _statusE8Encoder[i].Init(); - _statusE9Encoder.Init(); - _statusJccEncoder.Init(); + for (int i = 0; i < 256 + 2; i++) + _statusEncoder[i].Init(); CCoderReleaser releaser(this); CMyComPtr<ICompressGetSubStreamSize> getSubStreamSize; @@ -135,12 +135,19 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams, { Byte b = _buffer[bufferPos]; _mainStream.WriteByte(b); + UInt32 index; if (b == 0xE8) - _statusE8Encoder[prevByte].Encode(&_rangeEncoder, 0); + index = prevByte; else if (b == 0xE9) - _statusE9Encoder.Encode(&_rangeEncoder, 0); + index = 256; else if (IsJcc(prevByte, b)) - _statusJccEncoder.Encode(&_rangeEncoder, 0); + index = 257; + else + { + prevByte = b; + continue; + } + _statusEncoder[index].Encode(&_rangeEncoder, 0); prevByte = b; } return Flush(); @@ -153,7 +160,7 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams, { Byte b = _buffer[bufferPos]; _mainStream.WriteByte(b); - if (b != 0xE8 && b != 0xE9 && !IsJcc(prevByte, b)) + if (!IsJ(prevByte, b)) { bufferPos++; prevByte = b; @@ -209,40 +216,19 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams, convert = (dest < inSize); else convert = Test86MSByte(nextByte); + unsigned index = GetIndex(prevByte, b); if (convert) { - if (b == 0xE8) - _statusE8Encoder[prevByte].Encode(&_rangeEncoder, 1); - else if (b == 0xE9) - _statusE9Encoder.Encode(&_rangeEncoder, 1); - else - _statusJccEncoder.Encode(&_rangeEncoder, 1); - + _statusEncoder[index].Encode(&_rangeEncoder, 1); bufferPos += 5; - if (b == 0xE8) - { - _callStream.WriteByte((Byte)(dest >> 24)); - _callStream.WriteByte((Byte)(dest >> 16)); - _callStream.WriteByte((Byte)(dest >> 8)); - _callStream.WriteByte((Byte)(dest)); - } - else - { - _jumpStream.WriteByte((Byte)(dest >> 24)); - _jumpStream.WriteByte((Byte)(dest >> 16)); - _jumpStream.WriteByte((Byte)(dest >> 8)); - _jumpStream.WriteByte((Byte)(dest)); - } + COutBuffer &s = (b == 0xE8) ? _callStream : _jumpStream; + for (int i = 24; i >= 0; i -= 8) + s.WriteByte((Byte)(dest >> i)); prevByte = nextByte; } else { - if (b == 0xE8) - _statusE8Encoder[prevByte].Encode(&_rangeEncoder, 0); - else if (b == 0xE9) - _statusE9Encoder.Encode(&_rangeEncoder, 0); - else - _statusJccEncoder.Encode(&_rangeEncoder, 0); + _statusEncoder[index].Encode(&_rangeEncoder, 0); bufferPos++; prevByte = b; } @@ -262,7 +248,7 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams, } } -STDMETHODIMP CBCJ2_x86_Encoder::Code(ISequentialInStream **inStreams, +STDMETHODIMP CEncoder::Code(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams, ISequentialOutStream **outStreams, @@ -281,7 +267,7 @@ STDMETHODIMP CBCJ2_x86_Encoder::Code(ISequentialInStream **inStreams, #endif -HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams, +HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams, const UInt64 ** /* inSizes */, UInt32 numInStreams, ISequentialOutStream **outStreams, @@ -315,10 +301,8 @@ HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams, _rangeDecoder.Init(); _outStream.Init(); - for (int i = 0; i < 256; i++) - _statusE8Decoder[i].Init(); - _statusE9Decoder.Init(); - _statusJccDecoder.Init(); + for (int i = 0; i < 256 + 2; i++) + _statusDecoder[i].Init(); CCoderReleaser releaser(this); @@ -326,62 +310,38 @@ HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams, UInt32 processedBytes = 0; for (;;) { - if (processedBytes > (1 << 20) && progress != NULL) + if (processedBytes >= (1 << 20) && progress != NULL) { UInt64 nowPos64 = _outStream.GetProcessedSize(); RINOK(progress->SetRatioInfo(NULL, &nowPos64)); processedBytes = 0; } - processedBytes++; - Byte b; - if (!_mainInStream.ReadByte(b)) - return Flush(); - _outStream.WriteByte(b); - if (b != 0xE8 && b != 0xE9 && !IsJcc(prevByte, b)) + UInt32 i; + Byte b = 0; + const UInt32 kBurstSize = (1 << 18); + for (i = 0; i < kBurstSize; i++) { + if (!_mainInStream.ReadByte(b)) + return Flush(); + _outStream.WriteByte(b); + if (IsJ(prevByte, b)) + break; prevByte = b; - continue; } - bool status; - if (b == 0xE8) - status = (_statusE8Decoder[prevByte].Decode(&_rangeDecoder) == 1); - else if (b == 0xE9) - status = (_statusE9Decoder.Decode(&_rangeDecoder) == 1); - else - status = (_statusJccDecoder.Decode(&_rangeDecoder) == 1); - if (status) + processedBytes += i; + if (i == kBurstSize) + continue; + unsigned index = GetIndex(prevByte, b); + if (_statusDecoder[index].Decode(&_rangeDecoder) == 1) { - UInt32 src; - if (b == 0xE8) + UInt32 src = 0; + CInBuffer &s = (b == 0xE8) ? _callStream : _jumpStream; + for (int i = 0; i < 4; i++) { Byte b0; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src = ((UInt32)b0) << 24; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 16; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 8; - if(!_callStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0); - } - else - { - Byte b0; - if(!_jumpStream.ReadByte(b0)) - return S_FALSE; - src = ((UInt32)b0) << 24; - if(!_jumpStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 16; - if(!_jumpStream.ReadByte(b0)) - return S_FALSE; - src |= ((UInt32)b0) << 8; - if(!_jumpStream.ReadByte(b0)) + if(!s.ReadByte(b0)) return S_FALSE; + src <<= 8; src |= ((UInt32)b0); } UInt32 dest = src - (UInt32(_outStream.GetProcessedSize()) + 4) ; @@ -397,7 +357,7 @@ HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams, } } -STDMETHODIMP CBCJ2_x86_Decoder::Code(ISequentialInStream **inStreams, +STDMETHODIMP CDecoder::Code(ISequentialInStream **inStreams, const UInt64 **inSizes, UInt32 numInStreams, ISequentialOutStream **outStreams, @@ -410,6 +370,9 @@ STDMETHODIMP CBCJ2_x86_Decoder::Code(ISequentialInStream **inStreams, return CodeReal(inStreams, inSizes, numInStreams, outStreams, outSizes,numOutStreams, progress); } + catch(const CInBufferException &e) { return e.ErrorCode; } catch(const COutBufferException &e) { return e.ErrorCode; } catch(...) { return S_FALSE; } } + +}} diff --git a/CPP/7zip/Compress/Branch/x86_2.h b/CPP/7zip/Compress/Branch/x86_2.h index 3d34eb8d..2e4a5267 100755 --- a/CPP/7zip/Compress/Branch/x86_2.h +++ b/CPP/7zip/Compress/Branch/x86_2.h @@ -7,38 +7,28 @@ #include "../RangeCoder/RangeCoderBit.h" #include "../../ICoder.h" -// {23170F69-40C1-278B-0303-010100000100} -#define MyClass2_a(Name, id, subId, encodingId) \ -DEFINE_GUID(CLSID_CCompressConvert ## Name, \ -0x23170F69, 0x40C1, 0x278B, 0x03, 0x03, id, subId, 0x00, 0x00, encodingId, 0x00); - -#define MyClass_a(Name, id, subId) \ -MyClass2_a(Name ## _Encoder, id, subId, 0x01) \ -MyClass2_a(Name ## _Decoder, id, subId, 0x00) - -MyClass_a(BCJ2_x86, 0x01, 0x1B) +namespace NCompress { +namespace NBcj2 { const int kNumMoveBits = 5; #ifndef EXTRACT_ONLY -class CBCJ2_x86_Encoder: +class CEncoder: public ICompressCoder2, public CMyUnknownImp { Byte *_buffer; public: - CBCJ2_x86_Encoder(): _buffer(0) {}; - ~CBCJ2_x86_Encoder(); + CEncoder(): _buffer(0) {}; + ~CEncoder(); bool Create(); COutBuffer _mainStream; COutBuffer _callStream; COutBuffer _jumpStream; NCompress::NRangeCoder::CEncoder _rangeEncoder; - NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusE8Encoder[256]; - NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusE9Encoder; - NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusJccEncoder; + NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusEncoder[256 + 2]; HRESULT Flush(); void ReleaseStreams() @@ -51,9 +41,9 @@ public: class CCoderReleaser { - CBCJ2_x86_Encoder *_coder; + CEncoder *_coder; public: - CCoderReleaser(CBCJ2_x86_Encoder *coder): _coder(coder) {} + CCoderReleaser(CEncoder *coder): _coder(coder) {} ~CCoderReleaser() { _coder->ReleaseStreams(); } }; @@ -79,7 +69,7 @@ public: #endif -class CBCJ2_x86_Decoder: +class CDecoder: public ICompressCoder2, public CMyUnknownImp { @@ -88,9 +78,7 @@ public: CInBuffer _callStream; CInBuffer _jumpStream; NCompress::NRangeCoder::CDecoder _rangeDecoder; - NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusE8Decoder[256]; - NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusE9Decoder; - NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusJccDecoder; + NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusDecoder[256 + 2]; COutBuffer _outStream; @@ -106,9 +94,9 @@ public: HRESULT Flush() { return _outStream.Flush(); } class CCoderReleaser { - CBCJ2_x86_Decoder *_coder; + CDecoder *_coder; public: - CCoderReleaser(CBCJ2_x86_Decoder *coder): _coder(coder) {} + CCoderReleaser(CDecoder *coder): _coder(coder) {} ~CCoderReleaser() { _coder->ReleaseStreams(); } }; @@ -130,4 +118,6 @@ public: ICompressProgressInfo *progress); }; +}} + #endif diff --git a/CPP/7zip/Compress/Copy/CopyCoder.cpp b/CPP/7zip/Compress/Copy/CopyCoder.cpp index 141bcf3f..b9af74db 100755 --- a/CPP/7zip/Compress/Copy/CopyCoder.cpp +++ b/CPP/7zip/Compress/Copy/CopyCoder.cpp @@ -52,5 +52,11 @@ STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream, return S_OK; } +STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value) +{ + *value = TotalSize; + return S_OK; +} + } diff --git a/CPP/7zip/Compress/Copy/CopyCoder.h b/CPP/7zip/Compress/Copy/CopyCoder.h index d2a26a89..d4530697 100755 --- a/CPP/7zip/Compress/Copy/CopyCoder.h +++ b/CPP/7zip/Compress/Copy/CopyCoder.h @@ -10,6 +10,7 @@ namespace NCompress { class CCopyCoder: public ICompressCoder, + public ICompressGetInStreamProcessedSize, public CMyUnknownImp { Byte *_buffer; @@ -18,12 +19,13 @@ public: CCopyCoder(): TotalSize(0) , _buffer(0) {}; ~CCopyCoder(); - MY_UNKNOWN_IMP + MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize) STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); + STDMETHOD(GetInStreamProcessedSize)(UInt64 *value); }; } diff --git a/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp b/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp index 9cea4cb1..39fee934 100755 --- a/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp +++ b/CPP/7zip/Compress/LZMA_Alone/AloneLZMA.dsp @@ -237,6 +237,14 @@ SOURCE=..\..\..\Windows\Synchronization.h # End Source File # Begin Source File +SOURCE=..\..\..\Windows\System.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\Windows\System.h +# End Source File +# Begin Source File + SOURCE=..\..\..\Windows\Thread.h # End Source File # End Group @@ -277,51 +285,51 @@ SOURCE=..\..\..\Common\MyCom.h # End Source File # Begin Source File -SOURCE=..\..\..\Common\MyWindows.h +SOURCE=..\..\..\Common\MyString.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Common\NewHandler.cpp +SOURCE=..\..\..\Common\MyString.h # End Source File # Begin Source File -SOURCE=..\..\..\Common\NewHandler.h +SOURCE=..\..\..\Common\MyVector.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Common\String.cpp +SOURCE=..\..\..\Common\MyVector.h # End Source File # Begin Source File -SOURCE=..\..\..\Common\String.h +SOURCE=..\..\..\Common\MyWindows.h # End Source File # Begin Source File -SOURCE=..\..\..\Common\StringConvert.cpp +SOURCE=..\..\..\Common\NewHandler.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Common\StringConvert.h +SOURCE=..\..\..\Common\NewHandler.h # End Source File # Begin Source File -SOURCE=..\..\..\Common\StringToInt.cpp +SOURCE=..\..\..\Common\StringConvert.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Common\StringToInt.h +SOURCE=..\..\..\Common\StringConvert.h # End Source File # Begin Source File -SOURCE=..\..\..\Common\Types.h +SOURCE=..\..\..\Common\StringToInt.cpp # End Source File # Begin Source File -SOURCE=..\..\..\Common\Vector.cpp +SOURCE=..\..\..\Common\StringToInt.h # End Source File # Begin Source File -SOURCE=..\..\..\Common\Vector.h +SOURCE=..\..\..\Common\Types.h # End Source File # End Group # Begin Group "7zip Common" diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp index 69a06207..90c122fc 100755 --- a/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +++ b/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp @@ -29,7 +29,7 @@ #include "LzmaRam.h" #ifdef COMPRESS_MF_MT -#include "Windows/System.h" +#include "../../../Windows/System.h" #endif extern "C" @@ -92,7 +92,7 @@ static const CSwitchForm kSwitchForms[] = { L"EOS", NSwitchType::kSimple, false }, { L"SI", NSwitchType::kSimple, false }, { L"SO", NSwitchType::kSimple, false }, - { L"F86", NSwitchType::kSimple, false } + { L"F86", NSwitchType::kPostChar, false, 0, 0, L"+" } }; static const int kNumSwitches = sizeof(kSwitchForms) / sizeof(kSwitchForms[0]); @@ -159,7 +159,7 @@ int main2(int n, const char *args[]) g_IsNT = IsItWindowsNT(); #endif - fprintf(stderr, "\nLZMA 4.45 Copyright (c) 1999-2007 Igor Pavlov 2007-04-03\n"); + fprintf(stderr, "\nLZMA 4.48 Copyright (c) 1999-2007 Igor Pavlov 2007-06-24\n"); if (n == 1) { @@ -335,7 +335,7 @@ int main2(int n, const char *args[]) if (!dictionaryIsDefined) dictionary = 1 << 23; int res = LzmaRamEncode(inBuffer, inSize, outBuffer, outSize, &outSizeProcessed, - dictionary, SZ_FILTER_AUTO); + dictionary, parser[NKey::kFilter86].PostCharIndex == 0 ? SZ_FILTER_YES : SZ_FILTER_AUTO); if (res != 0) { fprintf(stderr, "\nEncoder error = %d\n", (int)res); diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp index b0f01099..124f559b 100755 --- a/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +++ b/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp @@ -37,12 +37,12 @@ extern "C" #include "../../ICoder.h" #ifdef BENCH_MT -#include "Windows/Thread.h" -#include "Windows/Synchronization.h" +#include "../../../Windows/Thread.h" +#include "../../../Windows/Synchronization.h" #endif #ifdef EXTERNAL_LZMA -#include "Windows/PropVariant.h" +#include "../../../Windows/PropVariant.h" #else #include "../LZMA/LZMADecoder.h" #include "../LZMA/LZMAEncoder.h" diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp index fef5a9ad..e55b4bc7 100755 --- a/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +++ b/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp @@ -6,10 +6,10 @@ #include "LzmaBench.h" #include "LzmaBenchCon.h" -#include "Common/IntToString.h" +#include "../../../Common/IntToString.h" #if defined(BENCH_MT) || defined(_WIN32) -#include "Windows/System.h" +#include "../../../Windows/System.h" #endif #ifdef BREAK_HANDLER diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp b/CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp index 31ca1c74..b86d1ea9 100755 --- a/CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp +++ b/CPP/7zip/Compress/LZMA_Alone/LzmaRam.cpp @@ -169,10 +169,9 @@ int LzmaRamEncode( return SZ_RAM_E_OUTOFMEMORY; memmove(filteredStream, inBuffer, inSize); } - UInt32 _prevMask; - UInt32 _prevPos; - x86_Convert_Init(_prevMask, _prevPos); - x86_Convert(filteredStream, (UInt32)inSize, 0, &_prevMask, &_prevPos, 1); + UInt32 x86State; + x86_Convert_Init(x86State); + x86_Convert(filteredStream, (SizeT)inSize, 0, &x86State, 1); } size_t minSize = 0; diff --git a/CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c b/CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c index 0767ba21..29f798be 100755 --- a/CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c +++ b/CPP/7zip/Compress/LZMA_Alone/LzmaRamDecode.c @@ -70,10 +70,9 @@ int LzmaRamDecompress( *outSizeProcessed = (size_t)outSizeProcessedLoc; if (useFilter == 1) { - UInt32 _prevMask; - UInt32 _prevPos; - x86_Convert_Init(_prevMask, _prevPos); - x86_Convert(outBuffer, (UInt32)outSizeProcessedLoc, 0, &_prevMask, &_prevPos, 0); + UInt32 x86State; + x86_Convert_Init(x86State); + x86_Convert(outBuffer, (SizeT)outSizeProcessedLoc, 0, &x86State, 0); } return 0; } diff --git a/CPP/7zip/Compress/LZMA_Alone/makefile b/CPP/7zip/Compress/LZMA_Alone/makefile index b7e6ca0e..16e76376 100755 --- a/CPP/7zip/Compress/LZMA_Alone/makefile +++ b/CPP/7zip/Compress/LZMA_Alone/makefile @@ -1,5 +1,5 @@ PROG = lzma.exe -CFLAGS = $(CFLAGS) -I ../../../ \ +CFLAGS = $(CFLAGS) \ -DCOMPRESS_MF_MT \ -DBENCH_MT \ @@ -53,10 +53,13 @@ COMMON_OBJS = \ $O\CommandLineParser.obj \ $O\CRC.obj \ $O\IntToString.obj \ - $O\String.obj \ + $O\MyString.obj \ $O\StringConvert.obj \ $O\StringToInt.obj \ - $O\Vector.obj + $O\MyVector.obj + +WIN_OBJS = \ + $O\System.obj 7ZIP_COMMON_OBJS = \ $O\InBuffer.obj \ @@ -79,6 +82,7 @@ OBJS = \ $(LZMA_OBJS) \ $(LZMA_OPT_OBJS) \ $(COMMON_OBJS) \ + $(WIN_OBJS) \ $(7ZIP_COMMON_OBJS) \ $(LZ_OBJS) \ $(C_OBJS) \ @@ -108,6 +112,8 @@ $(LZMA_OPT_OBJS): ../LZMA/$(*B).cpp $(COMPL_O2) $(COMMON_OBJS): ../../../Common/$(*B).cpp $(COMPL) +$(WIN_OBJS): ../../../Windows/$(*B).cpp + $(COMPL) $(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp $(COMPL) $(LZ_OBJS): ../LZ/$(*B).cpp diff --git a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc index 7696021e..4fed05e6 100755 --- a/CPP/7zip/Compress/LZMA_Alone/makefile.gcc +++ b/CPP/7zip/Compress/LZMA_Alone/makefile.gcc @@ -3,7 +3,20 @@ CXX = g++ -O2 -Wall CXX_C = gcc -O2 -Wall LIB = -lm RM = rm -f -CFLAGS = -c -I ../../../ +CFLAGS = -c + +ifdef SystemDrive +IS_MINGW = 1 +endif + +ifdef IS_MINGW +FILE_IO =FileIO +FILE_IO_2 =Windows/$(FILE_IO) +LIB2 = -luuid +else +FILE_IO =C_FileIO +FILE_IO_2 =Common/$(FILE_IO) +endif OBJS = \ LzmaAlone.o \ @@ -18,14 +31,14 @@ OBJS = \ OutBuffer.o \ FileStreams.o \ StreamUtils.o \ - C_FileIO.o \ + $(FILE_IO).o \ CommandLineParser.o \ CRC.o \ IntToString.o \ - String.o \ + MyString.o \ StringConvert.o \ StringToInt.o \ - Vector.o \ + MyVector.o \ 7zCrc.o \ Alloc.o \ BranchX86.o \ @@ -37,7 +50,7 @@ OBJS = \ all: $(PROG) $(PROG): $(OBJS) - $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) + $(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2) LzmaAlone.o: LzmaAlone.cpp $(CXX) $(CFLAGS) LzmaAlone.cpp @@ -75,8 +88,9 @@ FileStreams.o: ../../Common/FileStreams.cpp StreamUtils.o: ../../Common/StreamUtils.cpp $(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp -C_FileIO.o: ../../../Common/C_FileIO.cpp - $(CXX) $(CFLAGS) ../../../Common/C_FileIO.cpp +$(FILE_IO).o: ../../../$(FILE_IO_2).cpp + $(CXX) $(CFLAGS) ../../../$(FILE_IO_2).cpp + CommandLineParser.o: ../../../Common/CommandLineParser.cpp $(CXX) $(CFLAGS) ../../../Common/CommandLineParser.cpp @@ -90,8 +104,8 @@ MyWindows.o: ../../../Common/MyWindows.cpp IntToString.o: ../../../Common/IntToString.cpp $(CXX) $(CFLAGS) ../../../Common/IntToString.cpp -String.o: ../../../Common/String.cpp - $(CXX) $(CFLAGS) ../../../Common/String.cpp +MyString.o: ../../../Common/MyString.cpp + $(CXX) $(CFLAGS) ../../../Common/MyString.cpp StringConvert.o: ../../../Common/StringConvert.cpp $(CXX) $(CFLAGS) ../../../Common/StringConvert.cpp @@ -99,8 +113,8 @@ StringConvert.o: ../../../Common/StringConvert.cpp StringToInt.o: ../../../Common/StringToInt.cpp $(CXX) $(CFLAGS) ../../../Common/StringToInt.cpp -Vector.o: ../../../Common/Vector.cpp - $(CXX) $(CFLAGS) ../../../Common/Vector.cpp +MyVector.o: ../../../Common/MyVector.cpp + $(CXX) $(CFLAGS) ../../../Common/MyVector.cpp 7zCrc.o: ../../../../C/7zCrc.c $(CXX_C) $(CFLAGS) ../../../../C/7zCrc.c diff --git a/CPP/7zip/Compress/Rar/Rar3Vm.h b/CPP/7zip/Compress/Rar/Rar3Vm.h index cc8bbcd7..99a4f624 100755 --- a/CPP/7zip/Compress/Rar/Rar3Vm.h +++ b/CPP/7zip/Compress/Rar/Rar3Vm.h @@ -7,7 +7,7 @@ #define __RAR3VM_H #include "Common/Types.h" -#include "Common/Vector.h" +#include "Common/MyVector.h" #define RARVM_STANDARD_FILTERS #if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__) // || defined(_M_IA64) || defined(__ia64__) |