diff options
-rwxr-xr-x | C/7zVersion.h | 6 | ||||
-rwxr-xr-x | CPP/7zip/Archive/SquashfsHandler.cpp | 208 | ||||
-rwxr-xr-x | CPP/7zip/Archive/Zip/ZipHandler.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Compress/LzmaDecoder.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/MyVersion.h | 8 | ||||
-rwxr-xr-x | CPP/7zip/UI/Console/UserInputUtils.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/UI/Far/PluginDelete.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/UI/Far/PluginWrite.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/PanelItemOpen.cpp | 2 | ||||
-rwxr-xr-x | DOC/7zip.inf | 4 | ||||
-rwxr-xr-x | DOC/7zip.nsi | 4 | ||||
-rwxr-xr-x | DOC/7zip.wxs | 2 | ||||
-rwxr-xr-x | DOC/lzma.txt | 2 | ||||
-rwxr-xr-x | DOC/readme.txt | 2 |
14 files changed, 224 insertions, 26 deletions
diff --git a/C/7zVersion.h b/C/7zVersion.h index ee46f252..9d99c5df 100755 --- a/C/7zVersion.h +++ b/C/7zVersion.h @@ -1,7 +1,7 @@ #define MY_VER_MAJOR 9 -#define MY_VER_MINOR 19 +#define MY_VER_MINOR 20 #define MY_VER_BUILD 0 -#define MY_VERSION "9.19 beta" -#define MY_DATE "2010-11-11" +#define MY_VERSION "9.20" +#define MY_DATE "2010-11-18" #define MY_COPYRIGHT ": Igor Pavlov : Public domain" #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE diff --git a/CPP/7zip/Archive/SquashfsHandler.cpp b/CPP/7zip/Archive/SquashfsHandler.cpp index e09c09de..2cc1219a 100755 --- a/CPP/7zip/Archive/SquashfsHandler.cpp +++ b/CPP/7zip/Archive/SquashfsHandler.cpp @@ -859,6 +859,8 @@ class CHandler: NCompress::NZlib::CDecoder *_zlibDecoderSpec; CMyComPtr<ICompressCoder> _zlibDecoder; + + CByteBuffer _inputBuffer; CDynBufSeqOutStream *_dynOutStreamSpec; CMyComPtr<ISequentialOutStream> _dynOutStream; @@ -870,7 +872,8 @@ class CHandler: _cachedUnpackBlockSize = 0; } - HRESULT Decompress(ISequentialOutStream *outStream, UInt32 inSize, UInt32 outSizeMax); + HRESULT Decompress(ISequentialOutStream *outStream, Byte *outBuf, bool *outBufWasWritten, UInt32 *outBufWasWrittenSize, + UInt32 inSize, UInt32 outSizeMax); HRESULT ReadMetadataBlock(UInt32 &packSize); HRESULT ReadData(CData &data, UInt64 start, UInt64 end); @@ -932,8 +935,166 @@ static const STATPROPSTG kArcProps[] = IMP_IInArchive_Props IMP_IInArchive_ArcProps -HRESULT CHandler::Decompress(ISequentialOutStream *outStream, UInt32 inSize, UInt32 outSizeMax) +static HRESULT LzoDecode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen) +{ + SizeT destRem = *destLen; + SizeT srcRem = *srcLen; + *destLen = 0; + *srcLen = 0; + const Byte *destStart = dest; + const Byte *srcStart = src; + unsigned mode = 2; + + { + if (srcRem == 0) + return S_FALSE; + UInt32 b = *src; + if (b > 17) + { + src++; + srcRem--; + b -= 17; + mode = (b < 4 ? 0 : 1); + if (b > srcRem || b > destRem) + return S_FALSE; + srcRem -= b; + destRem -= b; + do + *dest++ = *src++; + while (--b); + } + } + + for (;;) + { + if (srcRem < 3) + return S_FALSE; + UInt32 b = *src++; + srcRem--; + UInt32 len, back; + if (b >= 64) + { + srcRem--; + back = ((b >> 2) & 7) + ((UInt32)*src++ << 3); + len = (b >> 5) + 1; + } + else if (b < 16) + { + if (mode == 2) + { + if (b == 0) + { + for (b = 15;; b += 255) + { + if (srcRem == 0) + return S_FALSE; + UInt32 b2 = *src++; + srcRem--; + if (b2 != 0) + { + b += b2; + break; + } + } + } + b += 3; + if (b > srcRem || b > destRem) + return S_FALSE; + srcRem -= b; + destRem -= b; + mode = 1; + do + *dest++ = *src++; + while (--b); + continue; + } + srcRem--; + back = (b >> 2) + (*src++ << 2); + len = 2; + if (mode == 1) + { + back += (1 << 11); + len = 3; + } + } + else + { + UInt32 bOld = b; + b = (b < 32 ? 7 : 31); + len = bOld & b; + if (len == 0) + { + for (len = b;; len += 255) + { + if (srcRem == 0) + return S_FALSE; + UInt32 b2 = *src++; + srcRem--; + if (b2 != 0) + { + len += b2; + break; + } + } + } + len += 2; + if (srcRem < 2) + return S_FALSE; + b = *src; + back = (b >> 2) + ((UInt32)src[1] << 6); + src += 2; + srcRem -= 2; + if (bOld < 32) + { + if (back == 0) + { + *destLen = dest - destStart; + *srcLen = src - srcStart; + return S_OK; + } + back += ((bOld & 8) << 11) + (1 << 14) - 1; + } + } + back++; + if (len > destRem || (size_t)(dest - destStart) < back) + return S_FALSE; + destRem -= len; + Byte *destTemp = dest - back; + dest += len; + do + { + *(destTemp + back) = *destTemp; + destTemp++; + } + while (--len); + b &= 3; + if (b == 0) + { + mode = 2; + continue; + } + if (b > srcRem || b > destRem) + return S_FALSE; + srcRem -= b; + destRem -= b; + mode = 0; + *dest++ = *src++; + if (b > 1) + { + *dest++ = *src++; + if (b > 2) + *dest++ = *src++; + } + } +} + +HRESULT CHandler::Decompress(ISequentialOutStream *outStream, Byte *outBuf, bool *outBufWasWritten, UInt32 *outBufWasWrittenSize, UInt32 inSize, UInt32 outSizeMax) { + if (outBuf) + { + *outBufWasWritten = false; + *outBufWasWrittenSize = 0; + } UInt32 method = _h.Method; if (_h.SeveralMethods) { @@ -943,11 +1104,40 @@ HRESULT CHandler::Decompress(ISequentialOutStream *outStream, UInt32 inSize, UIn RINOK(_stream->Seek(-1, STREAM_SEEK_CUR, NULL)); } - if (method == kMethod_LZMA) + if (method == kMethod_LZO) + { + if (_inputBuffer.GetCapacity() < inSize) + { + _inputBuffer.Free(); + _inputBuffer.SetCapacity(inSize); + } + RINOK(ReadStream_FALSE(_stream, _inputBuffer, inSize)); + + Byte *dest = outBuf; + if (!outBuf) + { + dest = _dynOutStreamSpec->GetBufPtrForWriting(outSizeMax); + if (!dest) + return E_OUTOFMEMORY; + } + SizeT destLen = outSizeMax, srcLen = inSize; + RINOK(LzoDecode(dest, &destLen, _inputBuffer, &srcLen)); + if (inSize != srcLen) + return S_FALSE; + if (outBuf) + { + *outBufWasWritten = true; + *outBufWasWrittenSize = (UInt32)destLen; + } + else + _dynOutStreamSpec->UpdateSize(destLen); + } + else if (method == kMethod_LZMA) { if (!_lzmaDecoder) { _lzmaDecoderSpec = new NCompress::NLzma::CDecoder(); + _lzmaDecoderSpec->FinishStream = true; _lzmaDecoder = _lzmaDecoderSpec; } const UInt32 kPropsSize = 5 + 8; @@ -995,7 +1185,7 @@ HRESULT CHandler::ReadMetadataBlock(UInt32 &packSize) if (isCompressed) { _limitedInStreamSpec->Init(size); - RINOK(Decompress(_dynOutStream, size, kMetadataBlockSize)); + RINOK(Decompress(_dynOutStream, NULL, NULL, NULL, size, kMetadataBlockSize)); } else { @@ -1227,6 +1417,7 @@ HRESULT CHandler::Open2(IInStream *inStream) { case kMethod_ZLIB: case kMethod_LZMA: + case kMethod_LZO: break; default: return E_NOTIMPL; @@ -1779,8 +1970,13 @@ HRESULT CHandler::ReadBlock(UInt64 blockIndex, Byte *dest, size_t blockSize) if (compressed) { _outStreamSpec->Init((Byte *)_cachedBlock, _h.BlockSize); - HRESULT res = Decompress(_outStream, packBlockSize, _h.BlockSize); - _cachedUnpackBlockSize = (UInt32)_outStreamSpec->GetPos(); + bool outBufWasWritten; + UInt32 outBufWasWrittenSize; + HRESULT res = Decompress(_outStream, _cachedBlock, &outBufWasWritten, &outBufWasWrittenSize, packBlockSize, _h.BlockSize); + if (outBufWasWritten) + _cachedUnpackBlockSize = outBufWasWrittenSize; + else + _cachedUnpackBlockSize = (UInt32)_outStreamSpec->GetPos(); RINOK(res); } else diff --git a/CPP/7zip/Archive/Zip/ZipHandler.cpp b/CPP/7zip/Archive/Zip/ZipHandler.cpp index e54b15ba..bd156322 100755 --- a/CPP/7zip/Archive/Zip/ZipHandler.cpp +++ b/CPP/7zip/Archive/Zip/ZipHandler.cpp @@ -70,8 +70,8 @@ static const char *kMethods[] = "Shrink", "Reduced1", "Reduced2", - "Reduced2", "Reduced3", + "Reduced4", "Implode", "Tokenizing", "Deflate", diff --git a/CPP/7zip/Compress/LzmaDecoder.cpp b/CPP/7zip/Compress/LzmaDecoder.cpp index dadd3aba..b7c260bd 100755 --- a/CPP/7zip/Compress/LzmaDecoder.cpp +++ b/CPP/7zip/Compress/LzmaDecoder.cpp @@ -108,7 +108,7 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream *inStream, ISequentialOutStream * if (_outSizeDefined) { const UInt64 rem = _outSize - _outSizeProcessed; - if (rem < curSize) + if (rem <= curSize) { curSize = (SizeT)rem; if (FinishStream) diff --git a/CPP/7zip/MyVersion.h b/CPP/7zip/MyVersion.h index f3c49653..eda88db0 100755 --- a/CPP/7zip/MyVersion.h +++ b/CPP/7zip/MyVersion.h @@ -1,8 +1,8 @@ #define MY_VER_MAJOR 9 -#define MY_VER_MINOR 19 +#define MY_VER_MINOR 20 #define MY_VER_BUILD 0 -#define MY_VERSION "9.19 beta" -#define MY_7ZIP_VERSION "7-Zip 9.19 beta" -#define MY_DATE "2010-11-11" +#define MY_VERSION "9.20" +#define MY_7ZIP_VERSION "7-Zip 9.20" +#define MY_DATE "2010-11-18" #define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov" #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE diff --git a/CPP/7zip/UI/Console/UserInputUtils.cpp b/CPP/7zip/UI/Console/UserInputUtils.cpp index 30ed5f99..75468009 100755 --- a/CPP/7zip/UI/Console/UserInputUtils.cpp +++ b/CPP/7zip/UI/Console/UserInputUtils.cpp @@ -78,6 +78,8 @@ UString GetPassword(CStdOutStream *outStream) UString res = g_StdIn.ScanUStringUntilNewLine(); if (wasChanged) SetConsoleMode(console, mode); + (*outStream) << "\n"; + outStream->Flush(); return res; #else return g_StdIn.ScanUStringUntilNewLine(); diff --git a/CPP/7zip/UI/Far/PluginDelete.cpp b/CPP/7zip/UI/Far/PluginDelete.cpp index 182fbfb0..c8d784c3 100755 --- a/CPP/7zip/UI/Far/PluginDelete.cpp +++ b/CPP/7zip/UI/Far/PluginDelete.cpp @@ -103,7 +103,7 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode) CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp; CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec ); - updateCallbackSpec->Init(/* m_ArchiveHandler, */ &progressBox); + updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer); result = outArchive->DeleteItems( diff --git a/CPP/7zip/UI/Far/PluginWrite.cpp b/CPP/7zip/UI/Far/PluginWrite.cpp index ca515c42..be9616a4 100755 --- a/CPP/7zip/UI/Far/PluginWrite.cpp +++ b/CPP/7zip/UI/Far/PluginWrite.cpp @@ -234,7 +234,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles( CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp; CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec ); - updateCallbackSpec->Init(/* m_ArchiveHandler, */ &progressBox); + updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer); if (SetOutProperties(outArchive, compressionInfo.Level) != S_OK) return NFileOperationReturnCode::kError; @@ -742,7 +742,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems) CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp; CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec ); - updateCallbackSpec->Init(/* archiveHandler, */ &progressBox); + updateCallbackSpec->Init(/* archiveHandler, */ progressBoxPointer); RINOK(SetOutProperties(outArchive, compressionInfo.Level)); diff --git a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp index 10a8b73c..934e98d3 100755 --- a/CPP/7zip/UI/FileManager/PanelItemOpen.cpp +++ b/CPP/7zip/UI/FileManager/PanelItemOpen.cpp @@ -212,7 +212,7 @@ static const char *kStartExtensions = " chm" " msi doc xls ppt pps wps wpt wks xlr wdb vsd pub" - " docx docm dotx dotm xlsx xlsm xltx xltm xlsb" + " docx docm dotx dotm xlsx xlsm xltx xltm xlsb xps" " xlam pptx pptm potx potm ppam ppsx ppsm xsn" " mpp" " msg" diff --git a/DOC/7zip.inf b/DOC/7zip.inf index 6dbc9fc1..ff235405 100755 --- a/DOC/7zip.inf +++ b/DOC/7zip.inf @@ -10,8 +10,8 @@ AppName = "7-Zip" InstallDir = %CE1%\%AppName% [Strings] -AppVer = "9.19" -AppDate = "2010-11-11" +AppVer = "9.20" +AppDate = "2010-11-18" [CEDevice] ; ProcessorType = 2577 ; ARM diff --git a/DOC/7zip.nsi b/DOC/7zip.nsi index f242a166..06af769c 100755 --- a/DOC/7zip.nsi +++ b/DOC/7zip.nsi @@ -2,8 +2,8 @@ ;Defines !define VERSION_MAJOR 9 -!define VERSION_MINOR 19 -!define VERSION_POSTFIX_FULL " beta" +!define VERSION_MINOR 20 +!define VERSION_POSTFIX_FULL "" !ifdef WIN64 !ifdef IA64 !define VERSION_SYS_POSTFIX_FULL " for Windows IA-64" diff --git a/DOC/7zip.wxs b/DOC/7zip.wxs index 6e576b25..984e6687 100755 --- a/DOC/7zip.wxs +++ b/DOC/7zip.wxs @@ -1,7 +1,7 @@ <?xml version="1.0"?> <?define VerMajor = "9" ?> -<?define VerMinor = "19" ?> +<?define VerMinor = "20" ?> <?define VerBuild = "00" ?> <?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?> <?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?> diff --git a/DOC/lzma.txt b/DOC/lzma.txt index da98265e..65932323 100755 --- a/DOC/lzma.txt +++ b/DOC/lzma.txt @@ -1,4 +1,4 @@ -LZMA SDK 9.19 +LZMA SDK 9.20 ------------- LZMA SDK provides the documentation, samples, header files, libraries, diff --git a/DOC/readme.txt b/DOC/readme.txt index 89b7369e..aad46264 100755 --- a/DOC/readme.txt +++ b/DOC/readme.txt @@ -1,4 +1,4 @@ -7-Zip 9.19 Sources +7-Zip 9.20 Sources ------------------ 7-Zip is a file archiver for Windows. |