Compare commits

...

1 Commits
9.19 ... 9.20

Author SHA1 Message Date
Igor Pavlov
de4f8c22fe 9.20 2016-05-28 00:16:05 +01:00
14 changed files with 224 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 9 #define MY_VER_MAJOR 9
#define MY_VER_MINOR 19 #define MY_VER_MINOR 20
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION "9.19 beta" #define MY_VERSION "9.20"
#define MY_DATE "2010-11-11" #define MY_DATE "2010-11-18"
#define MY_COPYRIGHT ": Igor Pavlov : Public domain" #define MY_COPYRIGHT ": Igor Pavlov : Public domain"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " : " MY_DATE

View File

@@ -859,6 +859,8 @@ class CHandler:
NCompress::NZlib::CDecoder *_zlibDecoderSpec; NCompress::NZlib::CDecoder *_zlibDecoderSpec;
CMyComPtr<ICompressCoder> _zlibDecoder; CMyComPtr<ICompressCoder> _zlibDecoder;
CByteBuffer _inputBuffer;
CDynBufSeqOutStream *_dynOutStreamSpec; CDynBufSeqOutStream *_dynOutStreamSpec;
CMyComPtr<ISequentialOutStream> _dynOutStream; CMyComPtr<ISequentialOutStream> _dynOutStream;
@@ -870,7 +872,8 @@ class CHandler:
_cachedUnpackBlockSize = 0; _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 ReadMetadataBlock(UInt32 &packSize);
HRESULT ReadData(CData &data, UInt64 start, UInt64 end); HRESULT ReadData(CData &data, UInt64 start, UInt64 end);
@@ -932,8 +935,166 @@ static const STATPROPSTG kArcProps[] =
IMP_IInArchive_Props IMP_IInArchive_Props
IMP_IInArchive_ArcProps 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; UInt32 method = _h.Method;
if (_h.SeveralMethods) if (_h.SeveralMethods)
{ {
@@ -943,11 +1104,40 @@ HRESULT CHandler::Decompress(ISequentialOutStream *outStream, UInt32 inSize, UIn
RINOK(_stream->Seek(-1, STREAM_SEEK_CUR, NULL)); 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) if (!_lzmaDecoder)
{ {
_lzmaDecoderSpec = new NCompress::NLzma::CDecoder(); _lzmaDecoderSpec = new NCompress::NLzma::CDecoder();
_lzmaDecoderSpec->FinishStream = true;
_lzmaDecoder = _lzmaDecoderSpec; _lzmaDecoder = _lzmaDecoderSpec;
} }
const UInt32 kPropsSize = 5 + 8; const UInt32 kPropsSize = 5 + 8;
@@ -995,7 +1185,7 @@ HRESULT CHandler::ReadMetadataBlock(UInt32 &packSize)
if (isCompressed) if (isCompressed)
{ {
_limitedInStreamSpec->Init(size); _limitedInStreamSpec->Init(size);
RINOK(Decompress(_dynOutStream, size, kMetadataBlockSize)); RINOK(Decompress(_dynOutStream, NULL, NULL, NULL, size, kMetadataBlockSize));
} }
else else
{ {
@@ -1227,6 +1417,7 @@ HRESULT CHandler::Open2(IInStream *inStream)
{ {
case kMethod_ZLIB: case kMethod_ZLIB:
case kMethod_LZMA: case kMethod_LZMA:
case kMethod_LZO:
break; break;
default: default:
return E_NOTIMPL; return E_NOTIMPL;
@@ -1779,8 +1970,13 @@ HRESULT CHandler::ReadBlock(UInt64 blockIndex, Byte *dest, size_t blockSize)
if (compressed) if (compressed)
{ {
_outStreamSpec->Init((Byte *)_cachedBlock, _h.BlockSize); _outStreamSpec->Init((Byte *)_cachedBlock, _h.BlockSize);
HRESULT res = Decompress(_outStream, packBlockSize, _h.BlockSize); bool outBufWasWritten;
_cachedUnpackBlockSize = (UInt32)_outStreamSpec->GetPos(); UInt32 outBufWasWrittenSize;
HRESULT res = Decompress(_outStream, _cachedBlock, &outBufWasWritten, &outBufWasWrittenSize, packBlockSize, _h.BlockSize);
if (outBufWasWritten)
_cachedUnpackBlockSize = outBufWasWrittenSize;
else
_cachedUnpackBlockSize = (UInt32)_outStreamSpec->GetPos();
RINOK(res); RINOK(res);
} }
else else

View File

@@ -70,8 +70,8 @@ static const char *kMethods[] =
"Shrink", "Shrink",
"Reduced1", "Reduced1",
"Reduced2", "Reduced2",
"Reduced2",
"Reduced3", "Reduced3",
"Reduced4",
"Implode", "Implode",
"Tokenizing", "Tokenizing",
"Deflate", "Deflate",

View File

@@ -108,7 +108,7 @@ HRESULT CDecoder::CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *
if (_outSizeDefined) if (_outSizeDefined)
{ {
const UInt64 rem = _outSize - _outSizeProcessed; const UInt64 rem = _outSize - _outSizeProcessed;
if (rem < curSize) if (rem <= curSize)
{ {
curSize = (SizeT)rem; curSize = (SizeT)rem;
if (FinishStream) if (FinishStream)

View File

@@ -1,8 +1,8 @@
#define MY_VER_MAJOR 9 #define MY_VER_MAJOR 9
#define MY_VER_MINOR 19 #define MY_VER_MINOR 20
#define MY_VER_BUILD 0 #define MY_VER_BUILD 0
#define MY_VERSION "9.19 beta" #define MY_VERSION "9.20"
#define MY_7ZIP_VERSION "7-Zip 9.19 beta" #define MY_7ZIP_VERSION "7-Zip 9.20"
#define MY_DATE "2010-11-11" #define MY_DATE "2010-11-18"
#define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov" #define MY_COPYRIGHT "Copyright (c) 1999-2010 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -78,6 +78,8 @@ UString GetPassword(CStdOutStream *outStream)
UString res = g_StdIn.ScanUStringUntilNewLine(); UString res = g_StdIn.ScanUStringUntilNewLine();
if (wasChanged) if (wasChanged)
SetConsoleMode(console, mode); SetConsoleMode(console, mode);
(*outStream) << "\n";
outStream->Flush();
return res; return res;
#else #else
return g_StdIn.ScanUStringUntilNewLine(); return g_StdIn.ScanUStringUntilNewLine();

View File

@@ -103,7 +103,7 @@ int CPlugin::DeleteFiles(PluginPanelItem *panelItems, int numItems, int opMode)
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp; CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec ); CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
updateCallbackSpec->Init(/* m_ArchiveHandler, */ &progressBox); updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer);
result = outArchive->DeleteItems( result = outArchive->DeleteItems(

View File

@@ -234,7 +234,7 @@ NFileOperationReturnCode::EEnum CPlugin::PutFiles(
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp; CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec ); CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
updateCallbackSpec->Init(/* m_ArchiveHandler, */ &progressBox); updateCallbackSpec->Init(/* m_ArchiveHandler, */ progressBoxPointer);
if (SetOutProperties(outArchive, compressionInfo.Level) != S_OK) if (SetOutProperties(outArchive, compressionInfo.Level) != S_OK)
return NFileOperationReturnCode::kError; return NFileOperationReturnCode::kError;
@@ -742,7 +742,7 @@ HRESULT CompressFiles(const CObjectVector<PluginPanelItem> &pluginPanelItems)
CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp; CUpdateCallback100Imp *updateCallbackSpec = new CUpdateCallback100Imp;
CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec ); CMyComPtr<IFolderArchiveUpdateCallback> updateCallback(updateCallbackSpec );
updateCallbackSpec->Init(/* archiveHandler, */ &progressBox); updateCallbackSpec->Init(/* archiveHandler, */ progressBoxPointer);
RINOK(SetOutProperties(outArchive, compressionInfo.Level)); RINOK(SetOutProperties(outArchive, compressionInfo.Level));

View File

@@ -212,7 +212,7 @@ static const char *kStartExtensions =
" chm" " chm"
" msi doc xls ppt pps wps wpt wks xlr wdb vsd pub" " 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" " xlam pptx pptm potx potm ppam ppsx ppsm xsn"
" mpp" " mpp"
" msg" " msg"

View File

@@ -10,8 +10,8 @@ AppName = "7-Zip"
InstallDir = %CE1%\%AppName% InstallDir = %CE1%\%AppName%
[Strings] [Strings]
AppVer = "9.19" AppVer = "9.20"
AppDate = "2010-11-11" AppDate = "2010-11-18"
[CEDevice] [CEDevice]
; ProcessorType = 2577 ; ARM ; ProcessorType = 2577 ; ARM

View File

@@ -2,8 +2,8 @@
;Defines ;Defines
!define VERSION_MAJOR 9 !define VERSION_MAJOR 9
!define VERSION_MINOR 19 !define VERSION_MINOR 20
!define VERSION_POSTFIX_FULL " beta" !define VERSION_POSTFIX_FULL ""
!ifdef WIN64 !ifdef WIN64
!ifdef IA64 !ifdef IA64
!define VERSION_SYS_POSTFIX_FULL " for Windows IA-64" !define VERSION_SYS_POSTFIX_FULL " for Windows IA-64"

View File

@@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<?define VerMajor = "9" ?> <?define VerMajor = "9" ?>
<?define VerMinor = "19" ?> <?define VerMinor = "20" ?>
<?define VerBuild = "00" ?> <?define VerBuild = "00" ?>
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?> <?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?> <?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>

View File

@@ -1,4 +1,4 @@
LZMA SDK 9.19 LZMA SDK 9.20
------------- -------------
LZMA SDK provides the documentation, samples, header files, libraries, LZMA SDK provides the documentation, samples, header files, libraries,

View File

@@ -1,4 +1,4 @@
7-Zip 9.19 Sources 7-Zip 9.20 Sources
------------------ ------------------
7-Zip is a file archiver for Windows. 7-Zip is a file archiver for Windows.