diff options
author | Vas Crabb <vas@vastheman.com> | 2016-05-12 00:06:54 +1000 |
---|---|---|
committer | Vas Crabb <vas@vastheman.com> | 2016-05-12 00:06:54 +1000 |
commit | 7a423d0160839b28446d4100087c07019a75399d (patch) | |
tree | 2e3e37c5be23772c894ce523608d139bb450d543 /3rdparty/lzma | |
parent | 6a53a6aeff4f6436210127eeb5dc9111b2da00f4 (diff) |
Update to LZMA 16.0 [Vas Crabb]
Diffstat (limited to '3rdparty/lzma')
38 files changed, 276 insertions, 113 deletions
diff --git a/3rdparty/lzma/C/7zArcIn.c b/3rdparty/lzma/C/7zArcIn.c index 06e35de0d4f..ca2d5f6eb03 100644 --- a/3rdparty/lzma/C/7zArcIn.c +++ b/3rdparty/lzma/C/7zArcIn.c @@ -1,5 +1,5 @@ /* 7zArcIn.c -- 7z Input functions -2015-11-18 : Igor Pavlov : Public domain */ +2016-03-31 : Igor Pavlov : Public domain */ #include "Precomp.h" @@ -788,13 +788,9 @@ static SRes ReadUnpackInfo(CSzAr *p, numCodersOutStreams += numCoders; if (numCodersOutStreams < numCoders) return SZ_ERROR_UNSUPPORTED; - - packStreamIndex += numPackStreams; - if (packStreamIndex < numPackStreams) - return SZ_ERROR_UNSUPPORTED; - - if (packStreamIndex > p->NumPackStreams) + if (numPackStreams > p->NumPackStreams - packStreamIndex) return SZ_ERROR_ARCHIVE; + packStreamIndex += numPackStreams; } } diff --git a/3rdparty/lzma/C/7zVersion.h b/3rdparty/lzma/C/7zVersion.h index c4f5c8e940c..d4c603678f8 100644 --- a/3rdparty/lzma/C/7zVersion.h +++ b/3rdparty/lzma/C/7zVersion.h @@ -1,14 +1,14 @@ -#define MY_VER_MAJOR 15 -#define MY_VER_MINOR 14 +#define MY_VER_MAJOR 16 +#define MY_VER_MINOR 00 #define MY_VER_BUILD 0 -#define MY_VERSION_NUMBERS "15.14" -#define MY_VERSION "15.14" -#define MY_DATE "2015-12-31" +#define MY_VERSION_NUMBERS "16.00" +#define MY_VERSION "16.00" +#define MY_DATE "2016-05-10" #undef MY_COPYRIGHT #undef MY_VERSION_COPYRIGHT_DATE #define MY_AUTHOR_NAME "Igor Pavlov" #define MY_COPYRIGHT_PD "Igor Pavlov : Public domain" -#define MY_COPYRIGHT_CR "Copyright (c) 1999-2015 Igor Pavlov" +#define MY_COPYRIGHT_CR "Copyright (c) 1999-2016 Igor Pavlov" #ifdef USE_COPYRIGHT_CR #define MY_COPYRIGHT MY_COPYRIGHT_CR diff --git a/3rdparty/lzma/C/CpuArch.c b/3rdparty/lzma/C/CpuArch.c index 36fc5bb4972..554ffa4fc7b 100644 --- a/3rdparty/lzma/C/CpuArch.c +++ b/3rdparty/lzma/C/CpuArch.c @@ -1,5 +1,5 @@ /* CpuArch.c -- CPU specific code -2015-03-25: Igor Pavlov : Public domain */ +2016-02-25: Igor Pavlov : Public domain */ #include "Precomp.h" @@ -45,7 +45,8 @@ static UInt32 CheckFlag(UInt32 flag) "push %%EDX\n\t" "popf\n\t" "andl %%EAX, %0\n\t": - "=c" (flag) : "c" (flag)); + "=c" (flag) : "c" (flag) : + "%eax", "%edx"); #endif return flag; } @@ -79,7 +80,13 @@ void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d) #else __asm__ __volatile__ ( - #if defined(MY_CPU_X86) && defined(__PIC__) + #if defined(MY_CPU_AMD64) && defined(__PIC__) + "mov %%rbx, %%rdi;" + "cpuid;" + "xchg %%rbx, %%rdi;" + : "=a" (*a) , + "=D" (*b) , + #elif defined(MY_CPU_X86) && defined(__PIC__) "mov %%ebx, %%edi;" "cpuid;" "xchgl %%ebx, %%edi;" diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp index fc527be653b..0634768b557 100644 --- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp +++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zIn.cpp @@ -93,6 +93,8 @@ void CStreamSwitch::Set(CInArchive *archive, const CObjectVector<CByteBuffer> *d Byte external = archive->ReadByte(); if (external != 0) { + if (!dataVector) + ThrowIncorrect(); CNum dataIndex = archive->ReadNum(); if (dataIndex >= dataVector->Size()) ThrowIncorrect(); @@ -761,6 +763,8 @@ void CInArchive::ReadUnpackInfo( folders.FoToCoderUnpackSizes[fo] = numCodersOutStreams; numCodersOutStreams += numCoders; folders.FoStartPackStreamIndex[fo] = packStreamIndex; + if (numPackStreams > folders.NumPackStreams - packStreamIndex) + ThrowIncorrect(); packStreamIndex += numPackStreams; folders.FoToMainUnpackSizeIndex[fo] = (Byte)indexOfMainStream; } @@ -770,6 +774,8 @@ void CInArchive::ReadUnpackInfo( folders.FoStartPackStreamIndex[fo] = packStreamIndex; folders.FoCodersDataOffset[fo] = _inByteBack->GetPtr() - startBufPtr; folders.CodersData.CopyFrom(startBufPtr, dataSize); + + // if (folders.NumPackStreams != packStreamIndex) ThrowUnsupported(); } WaitId(NID::kCodersUnpackSize); diff --git a/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp b/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp index 7e9478fc5ac..e1c7aad8793 100644 --- a/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp +++ b/3rdparty/lzma/CPP/7zip/Archive/7z/7zUpdate.cpp @@ -380,29 +380,33 @@ static inline bool IsExeFilter(CMethodId m) return false; } -static unsigned Get_FilterGroup_for_Folder(CRecordVector<CFilterMode2> &filters, const CFolderEx &f) +static unsigned Get_FilterGroup_for_Folder( + CRecordVector<CFilterMode2> &filters, const CFolderEx &f, bool extractFilter) { CFilterMode2 m; m.Id = 0; m.Delta = 0; m.Encrypted = f.IsEncrypted(); - const CCoderInfo &coder = f.Coders[f.UnpackCoder]; - - if (coder.MethodID == k_Delta) + if (extractFilter) { - if (coder.Props.Size() == 1) + const CCoderInfo &coder = f.Coders[f.UnpackCoder]; + + if (coder.MethodID == k_Delta) { - m.Delta = (unsigned)coder.Props[0] + 1; - m.Id = k_Delta; + if (coder.Props.Size() == 1) + { + m.Delta = (unsigned)coder.Props[0] + 1; + m.Id = k_Delta; + } + } + else if (IsExeFilter(coder.MethodID)) + { + m.Id = (UInt32)coder.MethodID; + if (m.Id == k_BCJ2) + m.Id = k_BCJ; + m.SetDelta(); } - } - else if (IsExeFilter(coder.MethodID)) - { - m.Id = (UInt32)coder.MethodID; - if (m.Id == k_BCJ2) - m.Id = k_BCJ; - m.SetDelta(); } return GetGroup(filters, m); @@ -1577,7 +1581,7 @@ HRESULT Update( return E_NOTIMPL; */ - UInt64 startBlockSize = db != 0 ? db->ArcInfo.StartPosition: 0; + UInt64 startBlockSize = db ? db->ArcInfo.StartPosition: 0; if (startBlockSize > 0 && !options.RemoveSfxBlock) { RINOK(WriteRange(inStream, seqOutStream, 0, startBlockSize, NULL)); @@ -1591,8 +1595,21 @@ HRESULT Update( CRecordVector<CFilterMode2> filters; CObjectVector<CSolidGroup> groups; bool thereAreRepacks = false; + + bool useFilters = options.UseFilters; + if (useFilters) + { + const CCompressionMethodMode &method = *options.Method; + + FOR_VECTOR (i, method.Methods) + if (IsFilterMethod(method.Methods[i].Id)) + { + useFilters = false; + break; + } + } - if (db != 0) + if (db) { fileIndexToUpdateIndexMap.Alloc(db->Files.Size()); unsigned i; @@ -1638,16 +1655,18 @@ HRESULT Update( CFolderEx f; db->ParseFolderEx(i, f); - bool isEncrypted = f.IsEncrypted(); - - unsigned groupIndex = Get_FilterGroup_for_Folder(filters, f); + const bool isEncrypted = f.IsEncrypted(); + const bool needCopy = (numCopyItems == numUnpackStreams); + const bool extractFilter = (useFilters || needCopy); + + unsigned groupIndex = Get_FilterGroup_for_Folder(filters, f, extractFilter); while (groupIndex >= groups.Size()) groups.AddNew(); groups[groupIndex].folderRefs.Add(rep); - if (numCopyItems == numUnpackStreams) + if (needCopy) complexity += db->GetFolderFullPackSize(i); else { @@ -1732,22 +1751,8 @@ HRESULT Update( // ---------- Split files to groups ---------- - bool useFilters = options.UseFilters; const CCompressionMethodMode &method = *options.Method; - if (useFilters) - for (i = 0; i < method.Methods.Size(); i++) - if (IsFilterMethod(method.Methods[i].Id)) - { - useFilters = false; - break; - } - - /* - if (!method.Bonds.IsEmpty()) - useFilters = false; - */ - for (i = 0; i < updateItems.Size(); i++) { const CUpdateItem &ui = updateItems[i]; @@ -2156,7 +2161,13 @@ HRESULT Update( #ifndef _7ZIP_ST if (options.MultiThreadMixer) { + // 16.00: hang was fixed : for case if decoding was not finished. + // We close CBinderInStream and it calls CStreamBinder::CloseRead() + inStreamSizeCount.Release(); + sbInStream.Release(); + threadDecoder.WaitExecuteFinish(); + HRESULT decodeRes = threadDecoder.Result; // if (res == k_My_HRESULT_CRC_ERROR) if (decodeRes == S_FALSE) diff --git a/3rdparty/lzma/CPP/7zip/Archive/LzmaHandler.cpp b/3rdparty/lzma/CPP/7zip/Archive/LzmaHandler.cpp index e4ac2a42567..121cd67cee5 100644 --- a/3rdparty/lzma/CPP/7zip/Archive/LzmaHandler.cpp +++ b/3rdparty/lzma/CPP/7zip/Archive/LzmaHandler.cpp @@ -110,7 +110,7 @@ HRESULT CDecoder::Create(bool filteredMode, ISequentialInStream *inStream) { _filterCoder = new CFilterCoder(false); CMyComPtr<ICompressCoder> coder = _filterCoder; - _filterCoder->Filter = new CBcjCoder(false); + _filterCoder->Filter = new NCompress::NBcj::CCoder(false); _bcjStream = _filterCoder; } } diff --git a/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp b/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp index 23187064fab..4ca417e009d 100644 --- a/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp +++ b/3rdparty/lzma/CPP/7zip/Archive/SplitHandler.cpp @@ -187,11 +187,15 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback) UInt64 size; { + /* NCOM::CPropVariant prop; RINOK(volumeCallback->GetProperty(kpidSize, &prop)); if (prop.vt != VT_UI8) return E_INVALIDARG; size = prop.uhVal.QuadPart; + */ + RINOK(stream->Seek(0, STREAM_SEEK_END, &size)); + RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL)); } _totalSize += size; @@ -217,11 +221,15 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback) if (!stream) break; { + /* NCOM::CPropVariant prop; RINOK(volumeCallback->GetProperty(kpidSize, &prop)); if (prop.vt != VT_UI8) return E_INVALIDARG; size = prop.uhVal.QuadPart; + */ + RINOK(stream->Seek(0, STREAM_SEEK_END, &size)); + RINOK(stream->Seek(0, STREAM_SEEK_SET, NULL)); } _totalSize += size; _sizes.Add(size); diff --git a/3rdparty/lzma/CPP/7zip/Archive/XzHandler.cpp b/3rdparty/lzma/CPP/7zip/Archive/XzHandler.cpp index 11f4b44427c..318be190a79 100644 --- a/3rdparty/lzma/CPP/7zip/Archive/XzHandler.cpp +++ b/3rdparty/lzma/CPP/7zip/Archive/XzHandler.cpp @@ -10,6 +10,8 @@ #include "../../Common/Defs.h" #include "../../Common/IntToString.h" +#include "../../Windows/PropVariant.h" + #include "../ICoder.h" #include "../Common/CWrappers.h" @@ -21,7 +23,9 @@ #include "IArchive.h" +#ifndef EXTRACT_ONLY #include "Common/HandlerOut.h" +#endif #include "XzHandler.h" @@ -83,14 +87,19 @@ class CHandler: CMyComPtr<IInStream> _stream; CMyComPtr<ISequentialInStream> _seqStream; - UInt32 _filterId; AString _methodsString; + #ifndef EXTRACT_ONLY + + UInt32 _filterId; + void Init() { _filterId = 0; CMultiMethodProps::Init(); } + + #endif HRESULT Open2(IInStream *inStream, /* UInt32 flags, */ IArchiveOpenCallback *callback); @@ -126,9 +135,12 @@ public: CHandler::CHandler() { + #ifndef EXTRACT_ONLY Init(); + #endif } + static const Byte kProps[] = { kpidSize, diff --git a/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.cpp b/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.cpp index c7962167ffc..8e032561662 100644 --- a/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.cpp +++ b/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.cpp @@ -5,16 +5,19 @@ #include <string.h> #include "LimitedStreams.h" -#include "../../Common/Defs.h" STDMETHODIMP CLimitedSequentialInStream::Read(void *data, UInt32 size, UInt32 *processedSize) { UInt32 realProcessedSize = 0; - UInt32 sizeToRead = (UInt32)MyMin((_size - _pos), (UInt64)size); + { + const UInt64 rem = _size - _pos; + if (size > rem) + size = (UInt32)rem; + } HRESULT result = S_OK; - if (sizeToRead > 0) + if (size != 0) { - result = _stream->Read(data, sizeToRead, &realProcessedSize); + result = _stream->Read(data, size, &realProcessedSize); _pos += realProcessedSize; if (realProcessedSize == 0) _wasFinished = true; @@ -34,9 +37,11 @@ STDMETHODIMP CLimitedInStream::Read(void *data, UInt32 size, UInt32 *processedSi return S_OK; // return (_virtPos == _size) ? S_OK: E_FAIL; // ERROR_HANDLE_EOF } - UInt64 rem = _size - _virtPos; - if (rem < size) - size = (UInt32)rem; + { + const UInt64 rem = _size - _virtPos; + if (size > rem) + size = (UInt32)rem; + } UInt64 newPos = _startOffset + _virtPos; if (newPos != _physPos) { diff --git a/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.h b/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.h index b521eeb933c..fb1ac3cd6bd 100644 --- a/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.h +++ b/3rdparty/lzma/CPP/7zip/Common/LimitedStreams.h @@ -30,6 +30,7 @@ public: STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); UInt64 GetSize() const { return _pos; } + UInt64 GetRem() const { return _size - _pos; } bool WasFinished() const { return _wasFinished; } }; diff --git a/3rdparty/lzma/CPP/7zip/Compress/Bcj2Register.cpp b/3rdparty/lzma/CPP/7zip/Compress/Bcj2Register.cpp index ef37ae0cba4..7a48f91cfac 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/Bcj2Register.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/Bcj2Register.cpp @@ -6,9 +6,12 @@ #include "Bcj2Coder.h" -REGISTER_CODEC_CREATE_2(CreateCodec, NCompress::NBcj2::CDecoder(), ICompressCoder2) +namespace NCompress { +namespace NBcj2 { + +REGISTER_CODEC_CREATE_2(CreateCodec, CDecoder(), ICompressCoder2) #ifndef EXTRACT_ONLY -REGISTER_CODEC_CREATE_2(CreateCodecOut, NCompress::NBcj2::CEncoder(), ICompressCoder2) +REGISTER_CODEC_CREATE_2(CreateCodecOut, CEncoder(), ICompressCoder2) #else #define CreateCodecOut NULL #endif @@ -17,3 +20,5 @@ REGISTER_CODEC_VAR { CreateCodec, CreateCodecOut, 0x303011B, "BCJ2", 4, false }; REGISTER_CODEC(BCJ2) + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.cpp b/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.cpp index 37815dceb17..32aa1762cdd 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.cpp @@ -4,16 +4,21 @@ #include "BcjCoder.h" -STDMETHODIMP CBcjCoder::Init() +namespace NCompress { +namespace NBcj { + +STDMETHODIMP CCoder::Init() { _bufferPos = 0; x86_Convert_Init(_prevMask); return S_OK; } -STDMETHODIMP_(UInt32) CBcjCoder::Filter(Byte *data, UInt32 size) +STDMETHODIMP_(UInt32) CCoder::Filter(Byte *data, UInt32 size) { UInt32 processed = (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, _encode); _bufferPos += processed; return processed; } + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.h b/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.h index 275fd4f2431..7883906e4a0 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.h +++ b/3rdparty/lzma/CPP/7zip/Compress/BcjCoder.h @@ -9,7 +9,10 @@ #include "../ICoder.h" -class CBcjCoder: +namespace NCompress { +namespace NBcj { + +class CCoder: public ICompressFilter, public CMyUnknownImp { @@ -17,10 +20,12 @@ class CBcjCoder: UInt32 _prevMask; int _encode; public: - MY_UNKNOWN_IMP; + MY_UNKNOWN_IMP1(ICompressFilter); INTERFACE_ICompressFilter(;) - CBcjCoder(int encode): _bufferPos(0), _encode(encode) { x86_Convert_Init(_prevMask); } + CCoder(int encode): _bufferPos(0), _encode(encode) { x86_Convert_Init(_prevMask); } }; +}} + #endif diff --git a/3rdparty/lzma/CPP/7zip/Compress/BcjRegister.cpp b/3rdparty/lzma/CPP/7zip/Compress/BcjRegister.cpp index 83c6830fbc9..f06dcfe9f6d 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/BcjRegister.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/BcjRegister.cpp @@ -6,7 +6,12 @@ #include "BcjCoder.h" +namespace NCompress { +namespace NBcj { + REGISTER_FILTER_E(BCJ, - CBcjCoder(false), - CBcjCoder(true), + CCoder(false), + CCoder(true), 0x3030103, "BCJ") + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.cpp b/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.cpp index 0bf39b79ca0..d0e75e83bf1 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.cpp @@ -4,15 +4,20 @@ #include "BranchMisc.h" -STDMETHODIMP CBranchCoder::Init() +namespace NCompress { +namespace NBranch { + +STDMETHODIMP CCoder::Init() { _bufferPos = 0; return S_OK; } -STDMETHODIMP_(UInt32) CBranchCoder::Filter(Byte *data, UInt32 size) +STDMETHODIMP_(UInt32) CCoder::Filter(Byte *data, UInt32 size) { UInt32 processed = (UInt32)BraFunc(data, size, _bufferPos, _encode); _bufferPos += processed; return processed; } + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.h b/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.h index bbb5add9c5d..66fc23d2cd1 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.h +++ b/3rdparty/lzma/CPP/7zip/Compress/BranchMisc.h @@ -13,7 +13,10 @@ typedef SizeT (*Func_Bra)(Byte *data, SizeT size, UInt32 ip, int encoding); EXTERN_C_END -class CBranchCoder: +namespace NCompress { +namespace NBranch { + +class CCoder: public ICompressFilter, public CMyUnknownImp { @@ -21,10 +24,12 @@ class CBranchCoder: int _encode; Func_Bra BraFunc; public: - MY_UNKNOWN_IMP; + MY_UNKNOWN_IMP1(ICompressFilter); INTERFACE_ICompressFilter(;) - CBranchCoder(Func_Bra bra, int encode): _bufferPos(0), _encode(encode), BraFunc(bra) {} + CCoder(Func_Bra bra, int encode): _bufferPos(0), _encode(encode), BraFunc(bra) {} }; +}} + #endif diff --git a/3rdparty/lzma/CPP/7zip/Compress/BranchRegister.cpp b/3rdparty/lzma/CPP/7zip/Compress/BranchRegister.cpp index e1fcff6dcd4..6331c1b9e12 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/BranchRegister.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/BranchRegister.cpp @@ -8,9 +8,12 @@ #include "BranchMisc.h" +namespace NCompress { +namespace NBranch { + #define CREATE_BRA(n) \ - REGISTER_FILTER_CREATE(CreateBra_Decoder_ ## n, CBranchCoder(n ## _Convert, false)) \ - REGISTER_FILTER_CREATE(CreateBra_Encoder_ ## n, CBranchCoder(n ## _Convert, true)) \ + REGISTER_FILTER_CREATE(CreateBra_Decoder_ ## n, CCoder(n ## _Convert, false)) \ + REGISTER_FILTER_CREATE(CreateBra_Encoder_ ## n, CCoder(n ## _Convert, true)) \ CREATE_BRA(PPC) CREATE_BRA(IA64) @@ -34,3 +37,5 @@ REGISTER_CODECS_VAR }; REGISTER_CODECS(Branch) + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/ByteSwap.cpp b/3rdparty/lzma/CPP/7zip/Compress/ByteSwap.cpp index f5620d6ce42..4c11806eb73 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/ByteSwap.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/ByteSwap.cpp @@ -8,12 +8,15 @@ #include "../Common/RegisterCodec.h" +namespace NCompress { +namespace NByteSwap { + class CByteSwap2: public ICompressFilter, public CMyUnknownImp { public: - MY_UNKNOWN_IMP + MY_UNKNOWN_IMP1(ICompressFilter); INTERFACE_ICompressFilter(;) }; @@ -22,7 +25,7 @@ class CByteSwap4: public CMyUnknownImp { public: - MY_UNKNOWN_IMP + MY_UNKNOWN_IMP1(ICompressFilter); INTERFACE_ICompressFilter(;) }; @@ -85,3 +88,5 @@ REGISTER_CODECS_VAR }; REGISTER_CODECS(ByteSwap) + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/CopyRegister.cpp b/3rdparty/lzma/CPP/7zip/Compress/CopyRegister.cpp index 703c52ca6e0..7141ab580f3 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/CopyRegister.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/CopyRegister.cpp @@ -6,6 +6,10 @@ #include "CopyCoder.h" -REGISTER_CODEC_CREATE(CreateCodec, NCompress::CCopyCoder()) +namespace NCompress { + +REGISTER_CODEC_CREATE(CreateCodec, CCopyCoder()) REGISTER_CODEC_2(Copy, CreateCodec, CreateCodec, 0, "Copy") + +} diff --git a/3rdparty/lzma/CPP/7zip/Compress/DeltaFilter.cpp b/3rdparty/lzma/CPP/7zip/Compress/DeltaFilter.cpp index d90f62f59f4..3986ae4fddb 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/DeltaFilter.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/DeltaFilter.cpp @@ -10,6 +10,9 @@ #include "../Common/RegisterCodec.h" +namespace NCompress { +namespace NDelta { + struct CDelta { unsigned _delta; @@ -22,7 +25,7 @@ struct CDelta #ifndef EXTRACT_ONLY -class CDeltaEncoder: +class CEncoder: public ICompressFilter, public ICompressSetCoderProperties, public ICompressWriteCoderProperties, @@ -30,25 +33,25 @@ class CDeltaEncoder: public CMyUnknownImp { public: - MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties) + MY_UNKNOWN_IMP3(ICompressFilter, ICompressSetCoderProperties, ICompressWriteCoderProperties) INTERFACE_ICompressFilter(;) STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps); STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream); }; -STDMETHODIMP CDeltaEncoder::Init() +STDMETHODIMP CEncoder::Init() { DeltaInit(); return S_OK; } -STDMETHODIMP_(UInt32) CDeltaEncoder::Filter(Byte *data, UInt32 size) +STDMETHODIMP_(UInt32) CEncoder::Filter(Byte *data, UInt32 size) { Delta_Encode(_state, _delta, data, size); return size; } -STDMETHODIMP CDeltaEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps) +STDMETHODIMP CEncoder::SetCoderProperties(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps) { UInt32 delta = _delta; for (UInt32 i = 0; i < numProps; i++) @@ -75,7 +78,7 @@ STDMETHODIMP CDeltaEncoder::SetCoderProperties(const PROPID *propIDs, const PROP return S_OK; } -STDMETHODIMP CDeltaEncoder::WriteCoderProperties(ISequentialOutStream *outStream) +STDMETHODIMP CEncoder::WriteCoderProperties(ISequentialOutStream *outStream) { Byte prop = (Byte)(_delta - 1); return outStream->Write(&prop, 1, NULL); @@ -84,31 +87,31 @@ STDMETHODIMP CDeltaEncoder::WriteCoderProperties(ISequentialOutStream *outStream #endif -class CDeltaDecoder: +class CDecoder: public ICompressFilter, public ICompressSetDecoderProperties2, CDelta, public CMyUnknownImp { public: - MY_UNKNOWN_IMP1(ICompressSetDecoderProperties2) + MY_UNKNOWN_IMP2(ICompressFilter, ICompressSetDecoderProperties2) INTERFACE_ICompressFilter(;) STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); }; -STDMETHODIMP CDeltaDecoder::Init() +STDMETHODIMP CDecoder::Init() { DeltaInit(); return S_OK; } -STDMETHODIMP_(UInt32) CDeltaDecoder::Filter(Byte *data, UInt32 size) +STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size) { Delta_Decode(_state, _delta, data, size); return size; } -STDMETHODIMP CDeltaDecoder::SetDecoderProperties2(const Byte *props, UInt32 size) +STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *props, UInt32 size) { if (size != 1) return E_INVALIDARG; @@ -118,6 +121,8 @@ STDMETHODIMP CDeltaDecoder::SetDecoderProperties2(const Byte *props, UInt32 size REGISTER_FILTER_E(Delta, - CDeltaDecoder(), - CDeltaEncoder(), + CDecoder(), + CEncoder(), 3, "Delta") + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/Lzma2Encoder.h b/3rdparty/lzma/CPP/7zip/Compress/Lzma2Encoder.h index f0fb74d337d..8ff6e838351 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/Lzma2Encoder.h +++ b/3rdparty/lzma/CPP/7zip/Compress/Lzma2Encoder.h @@ -20,7 +20,7 @@ class CEncoder: { CLzma2EncHandle _encoder; public: - MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties) + MY_UNKNOWN_IMP3(ICompressCoder, ICompressSetCoderProperties, ICompressWriteCoderProperties) STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); diff --git a/3rdparty/lzma/CPP/7zip/Compress/Lzma2Register.cpp b/3rdparty/lzma/CPP/7zip/Compress/Lzma2Register.cpp index d684d9d02f0..8f279ebf166 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/Lzma2Register.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/Lzma2Register.cpp @@ -10,8 +10,13 @@ #include "Lzma2Encoder.h" #endif +namespace NCompress { +namespace NLzma2 { + REGISTER_CODEC_E(LZMA2, - NCompress::NLzma2::CDecoder(), - NCompress::NLzma2::CEncoder(), + CDecoder(), + CEncoder(), 0x21, "LZMA2") + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/LzmaEncoder.h b/3rdparty/lzma/CPP/7zip/Compress/LzmaEncoder.h index 3ed067f14d3..f919ac2cc49 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/LzmaEncoder.h +++ b/3rdparty/lzma/CPP/7zip/Compress/LzmaEncoder.h @@ -21,7 +21,7 @@ class CEncoder: CLzmaEncHandle _encoder; UInt64 _inputProcessed; public: - MY_UNKNOWN_IMP2(ICompressSetCoderProperties, ICompressWriteCoderProperties) + MY_UNKNOWN_IMP3(ICompressCoder, ICompressSetCoderProperties, ICompressWriteCoderProperties) STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress); diff --git a/3rdparty/lzma/CPP/7zip/Compress/LzmaRegister.cpp b/3rdparty/lzma/CPP/7zip/Compress/LzmaRegister.cpp index c12416f2cd3..c802a99fa0e 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/LzmaRegister.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/LzmaRegister.cpp @@ -10,8 +10,13 @@ #include "LzmaEncoder.h" #endif +namespace NCompress { +namespace NLzma { + REGISTER_CODEC_E(LZMA, - NCompress::NLzma::CDecoder(), - NCompress::NLzma::CEncoder(), + CDecoder(), + CEncoder(), 0x30101, "LZMA") + +}} diff --git a/3rdparty/lzma/CPP/7zip/Compress/PpmdEncoder.h b/3rdparty/lzma/CPP/7zip/Compress/PpmdEncoder.h index fb74cf57be0..671a5353e7a 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/PpmdEncoder.h +++ b/3rdparty/lzma/CPP/7zip/Compress/PpmdEncoder.h @@ -41,7 +41,8 @@ class CEncoder : CPpmd7 _ppmd; CEncProps _props; public: - MY_UNKNOWN_IMP2( + MY_UNKNOWN_IMP3( + ICompressCoder, ICompressSetCoderProperties, ICompressWriteCoderProperties) STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, diff --git a/3rdparty/lzma/CPP/7zip/Compress/PpmdRegister.cpp b/3rdparty/lzma/CPP/7zip/Compress/PpmdRegister.cpp index 17f84bd03b9..a3ebb5f3d87 100644 --- a/3rdparty/lzma/CPP/7zip/Compress/PpmdRegister.cpp +++ b/3rdparty/lzma/CPP/7zip/Compress/PpmdRegister.cpp @@ -10,8 +10,13 @@ #include "PpmdEncoder.h" #endif +namespace NCompress { +namespace NPpmd { + REGISTER_CODEC_E(PPMD, - NCompress::NPpmd::CDecoder(), - NCompress::NPpmd::CEncoder(), + CDecoder(), + CEncoder(), 0x30401, "PPMD") + +}} diff --git a/3rdparty/lzma/CPP/7zip/Crypto/7zAes.h b/3rdparty/lzma/CPP/7zip/Crypto/7zAes.h index 4bd7d2911cc..84e07ac9613 100644 --- a/3rdparty/lzma/CPP/7zip/Crypto/7zAes.h +++ b/3rdparty/lzma/CPP/7zip/Crypto/7zAes.h @@ -86,7 +86,8 @@ class CEncoder: public ICryptoResetInitVector { public: - MY_UNKNOWN_IMP3( + MY_UNKNOWN_IMP4( + ICompressFilter, ICryptoSetPassword, ICompressWriteCoderProperties, // ICryptoResetSalt, @@ -104,7 +105,8 @@ class CDecoder: public ICompressSetDecoderProperties2 { public: - MY_UNKNOWN_IMP2( + MY_UNKNOWN_IMP3( + ICompressFilter, ICryptoSetPassword, ICompressSetDecoderProperties2) STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size); diff --git a/3rdparty/lzma/CPP/7zip/Crypto/7zAesRegister.cpp b/3rdparty/lzma/CPP/7zip/Crypto/7zAesRegister.cpp index f1916cb15f1..f9d59699b7c 100644 --- a/3rdparty/lzma/CPP/7zip/Crypto/7zAesRegister.cpp +++ b/3rdparty/lzma/CPP/7zip/Crypto/7zAesRegister.cpp @@ -6,7 +6,12 @@ #include "7zAes.h" +namespace NCrypto { +namespace N7z { + REGISTER_FILTER_E(7zAES, - NCrypto::N7z::CDecoder(), - NCrypto::N7z::CEncoder(), + CDecoder(), + CEncoder(), 0x6F10701, "7zAES") + +}} diff --git a/3rdparty/lzma/CPP/7zip/Crypto/MyAes.h b/3rdparty/lzma/CPP/7zip/Crypto/MyAes.h index 289935ebc36..84c21de30e7 100644 --- a/3rdparty/lzma/CPP/7zip/Crypto/MyAes.h +++ b/3rdparty/lzma/CPP/7zip/Crypto/MyAes.h @@ -30,7 +30,7 @@ class CAesCbcCoder: public: CAesCbcCoder(bool encodeMode, unsigned keySize); - MY_UNKNOWN_IMP2(ICryptoProperties, ICompressSetCoderProperties) + MY_UNKNOWN_IMP3(ICompressFilter, ICryptoProperties, ICompressSetCoderProperties) INTERFACE_ICompressFilter(;) diff --git a/3rdparty/lzma/CPP/7zip/Crypto/MyAesReg.cpp b/3rdparty/lzma/CPP/7zip/Crypto/MyAesReg.cpp index 34035da6888..28006835549 100644 --- a/3rdparty/lzma/CPP/7zip/Crypto/MyAesReg.cpp +++ b/3rdparty/lzma/CPP/7zip/Crypto/MyAesReg.cpp @@ -6,7 +6,11 @@ #include "MyAes.h" +namespace NCrypto { + REGISTER_FILTER_E(AES256CBC, - NCrypto::CAesCbcDecoder(32), - NCrypto::CAesCbcEncoder(32), + CAesCbcDecoder(32), + CAesCbcEncoder(32), 0x6F00181, "AES256CBC") + +} diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp index 1bd202edbcd..61a781af16b 100644 --- a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp +++ b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp @@ -1053,7 +1053,7 @@ void CArcCmdLineParser::Parse2(CArcCmdLineOptions &options) const UStringVector &nonSwitchStrings = parser.NonSwitchStrings; unsigned numNonSwitchStrings = nonSwitchStrings.Size(); if (numNonSwitchStrings < kMinNonSwitchWords) - throw CArcCmdLineException("The command must be spcified"); + throw CArcCmdLineException("The command must be specified"); if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], options.Command)) throw CArcCmdLineException("Unsupported command:", nonSwitchStrings[kCommandIndex]); diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp index 359835d3c2c..fd2807ac149 100644 --- a/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp +++ b/3rdparty/lzma/CPP/7zip/UI/Common/ArchiveOpenCallback.cpp @@ -43,6 +43,7 @@ STDMETHODIMP COpenCallbackImp::GetProperty(PROPID propID, PROPVARIANT *value) switch (propID) { case kpidName: prop = _subArchiveName; break; + // case kpidSize: prop = _subArchiveSize; break; // we don't use it now } else switch (propID) diff --git a/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp b/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp index e323abd2197..4081b0a67d4 100644 --- a/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp +++ b/3rdparty/lzma/CPP/7zip/UI/Common/OpenArchive.cpp @@ -1632,6 +1632,36 @@ HRESULT CArc::OpenStream2(const COpenOptions &op) #endif { + #ifndef _SFX + + bool isZip = false; + bool isRar = false; + + const wchar_t c = extension[0]; + if (c == 'z' || c == 'Z' || c == 'r' || c == 'R') + { + bool isNumber = false; + for (unsigned k = 1;; k++) + { + const wchar_t d = extension[k]; + if (d == 0) + break; + if (d < '0' || d > '9') + { + isNumber = false; + break; + } + isNumber = true; + } + if (isNumber) + if (c == 'z' || c == 'Z') + isZip = true; + else + isRar = true; + } + + #endif + FOR_VECTOR (i, op.codecs->Formats) { const CArcInfoEx &ai = op.codecs->Formats[i]; @@ -1647,7 +1677,12 @@ HRESULT CArc::OpenStream2(const COpenOptions &op) isPrearcExt = true; #endif - if (ai.FindExtension(extension) >= 0) + if (ai.FindExtension(extension) >= 0 + #ifndef _SFX + || isZip && StringsAreEqualNoCase_Ascii(ai.Name, "zip") + || isRar && StringsAreEqualNoCase_Ascii(ai.Name, "rar") + #endif + ) { // PrintNumber("orderIndices.Insert", i); orderIndices.Insert(numFinded++, i); diff --git a/3rdparty/lzma/CPP/Common/CrcReg.cpp b/3rdparty/lzma/CPP/Common/CrcReg.cpp index 2c343b3108a..4b662f52251 100644 --- a/3rdparty/lzma/CPP/Common/CrcReg.cpp +++ b/3rdparty/lzma/CPP/Common/CrcReg.cpp @@ -34,7 +34,7 @@ class CCrcHasher: public: CCrcHasher(): _crc(CRC_INIT_VAL) { SetFunctions(0); } - MY_UNKNOWN_IMP1(ICompressSetCoderProperties) + MY_UNKNOWN_IMP2(IHasher, ICompressSetCoderProperties) INTERFACE_IHasher(;) STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps); }; diff --git a/3rdparty/lzma/CPP/Common/Sha256Reg.cpp b/3rdparty/lzma/CPP/Common/Sha256Reg.cpp index 6c822cc7b8e..66941699e61 100644 --- a/3rdparty/lzma/CPP/Common/Sha256Reg.cpp +++ b/3rdparty/lzma/CPP/Common/Sha256Reg.cpp @@ -18,7 +18,7 @@ class CSha256Hasher: public: CSha256Hasher() { Sha256_Init(&_sha); } - MY_UNKNOWN_IMP + MY_UNKNOWN_IMP1(IHasher) INTERFACE_IHasher(;) }; diff --git a/3rdparty/lzma/CPP/Common/XzCrc64Reg.cpp b/3rdparty/lzma/CPP/Common/XzCrc64Reg.cpp index d1a51338646..33b524932c9 100644 --- a/3rdparty/lzma/CPP/Common/XzCrc64Reg.cpp +++ b/3rdparty/lzma/CPP/Common/XzCrc64Reg.cpp @@ -19,7 +19,7 @@ class CXzCrc64Hasher: public: CXzCrc64Hasher(): _crc(CRC64_INIT_VAL) {} - MY_UNKNOWN_IMP + MY_UNKNOWN_IMP1(IHasher) INTERFACE_IHasher(;) }; diff --git a/3rdparty/lzma/DOC/lzma-history.txt b/3rdparty/lzma/DOC/lzma-history.txt index 9ce878cc743..f55f8962ad3 100644 --- a/3rdparty/lzma/DOC/lzma-history.txt +++ b/3rdparty/lzma/DOC/lzma-history.txt @@ -1,6 +1,11 @@ HISTORY of the LZMA SDK ----------------------- +16.00 2016-05-10 +------------------------- +- Some bugs were fixed, + + 15.12 2015-11-19 ------------------------- - The BUG in C version of 7z decoder was fixed: diff --git a/3rdparty/lzma/DOC/lzma-sdk.txt b/3rdparty/lzma/DOC/lzma-sdk.txt index 0367867c725..b41b5d5c381 100644 --- a/3rdparty/lzma/DOC/lzma-sdk.txt +++ b/3rdparty/lzma/DOC/lzma-sdk.txt @@ -1,4 +1,4 @@ -LZMA SDK 15.14 +LZMA SDK 16.00 -------------- LZMA SDK provides the documentation, samples, header files, |