mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 13:14:59 -06:00
4.41 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
bd9a40b0ed
commit
631462beb2
@@ -167,17 +167,6 @@ private:
|
||||
bool _compressHeadersFull;
|
||||
bool _encryptHeaders;
|
||||
|
||||
bool _copyMode;
|
||||
|
||||
UInt32 _defaultDicSize;
|
||||
UInt32 _defaultAlgorithm;
|
||||
UInt32 _defaultFastBytes;
|
||||
UInt32 _defaultPasses;
|
||||
UString _defaultMatchFinder;
|
||||
|
||||
UInt32 _defaultPpmdMemSize;
|
||||
UInt32 _defaultPpmdOrder;
|
||||
|
||||
bool _autoFilter;
|
||||
UInt32 _level;
|
||||
|
||||
@@ -221,30 +210,6 @@ private:
|
||||
_solidExtension = false;
|
||||
_numSolidBytesDefined = false;
|
||||
}
|
||||
/*
|
||||
void InitSolidPart()
|
||||
{
|
||||
if (_numSolidFiles <= 1)
|
||||
InitSolidFiles();
|
||||
}
|
||||
*/
|
||||
void SetSolidBytesLimit()
|
||||
{
|
||||
_numSolidBytes = ((UInt64)_defaultDicSize) << 7;
|
||||
const UInt64 kMinSize = (1<<24);
|
||||
if (_numSolidBytes < kMinSize)
|
||||
_numSolidBytes = kMinSize;
|
||||
}
|
||||
void CheckAndSetSolidBytesLimit()
|
||||
{
|
||||
if (!_numSolidBytesDefined)
|
||||
{
|
||||
if (_copyMode)
|
||||
_numSolidBytes = 0;
|
||||
else
|
||||
SetSolidBytesLimit();
|
||||
}
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
@@ -255,22 +220,11 @@ private:
|
||||
#ifdef COMPRESS_MT
|
||||
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
_copyMode = false;
|
||||
|
||||
_defaultDicSize =
|
||||
_defaultAlgorithm =
|
||||
_defaultFastBytes =
|
||||
_defaultPasses =
|
||||
_defaultPpmdMemSize =
|
||||
_defaultPpmdOrder = 0xFFFFFFFF;
|
||||
_defaultMatchFinder.Empty();
|
||||
|
||||
|
||||
_level = 5;
|
||||
_autoFilter = true;
|
||||
_volumeMode = false;
|
||||
InitSolid();
|
||||
SetSolidBytesLimit();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -117,6 +117,9 @@ static const UInt32 kDictionaryForHeaders = 1 << 20;
|
||||
static const UInt32 kNumFastBytesForHeaders = 273;
|
||||
static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5;
|
||||
|
||||
static bool IsCopyMethod(const UString &methodName)
|
||||
{ return (methodName.CompareNoCase(kCopyMethod) == 0); }
|
||||
|
||||
static bool IsLZMAMethod(const UString &methodName)
|
||||
{ return (methodName.CompareNoCase(kLZMAMethodName) == 0); }
|
||||
static bool IsLZMethod(const UString &methodName)
|
||||
@@ -304,47 +307,45 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
#endif
|
||||
|
||||
|
||||
UInt32 level = _level;
|
||||
|
||||
if (methodsInfo.IsEmpty())
|
||||
{
|
||||
COneMethodInfo oneMethodInfo;
|
||||
oneMethodInfo.MethodName = _copyMode ? kCopyMethod : kDefaultMethodName;
|
||||
oneMethodInfo.MethodName = ((level == 0) ? kCopyMethod : kDefaultMethodName);
|
||||
methodsInfo.Add(oneMethodInfo);
|
||||
}
|
||||
|
||||
UInt32 level = _level;
|
||||
|
||||
bool needSolid = false;
|
||||
for(int i = 0; i < methodsInfo.Size(); i++)
|
||||
{
|
||||
COneMethodInfo &oneMethodInfo = methodsInfo[i];
|
||||
if (oneMethodInfo.MethodName.IsEmpty())
|
||||
oneMethodInfo.MethodName = kDefaultMethodName;
|
||||
|
||||
if (!IsCopyMethod(oneMethodInfo.MethodName))
|
||||
needSolid = true;
|
||||
|
||||
if (IsLZMAMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 dicSize = _defaultDicSize;
|
||||
if (dicSize == 0xFFFFFFFF)
|
||||
dicSize = (level >= 9 ? kLzmaDicSizeX9 :
|
||||
UInt32 dicSize =
|
||||
(level >= 9 ? kLzmaDicSizeX9 :
|
||||
(level >= 7 ? kLzmaDicSizeX7 :
|
||||
(level >= 5 ? kLzmaDicSizeX5 :
|
||||
(level >= 3 ? kLzmaDicSizeX3 :
|
||||
kLzmaDicSizeX1))));
|
||||
|
||||
UInt32 algorithm = _defaultAlgorithm;
|
||||
if (algorithm == 0xFFFFFFFF)
|
||||
algorithm = (level >= 5 ? kLzmaAlgorithmX5 :
|
||||
UInt32 algorithm =
|
||||
(level >= 5 ? kLzmaAlgorithmX5 :
|
||||
kLzmaAlgorithmX1);
|
||||
|
||||
UInt32 fastBytes = _defaultFastBytes;
|
||||
if (fastBytes == 0xFFFFFFFF)
|
||||
fastBytes = (level >= 7 ? kLzmaFastBytesX7 :
|
||||
UInt32 fastBytes =
|
||||
(level >= 7 ? kLzmaFastBytesX7 :
|
||||
kLzmaFastBytesX1);
|
||||
|
||||
const wchar_t *matchFinder = 0;
|
||||
if (_defaultMatchFinder.IsEmpty())
|
||||
matchFinder = (level >= 5 ? kLzmaMatchFinderX5 :
|
||||
const wchar_t *matchFinder =
|
||||
(level >= 5 ? kLzmaMatchFinderX5 :
|
||||
kLzmaMatchFinderX1);
|
||||
else
|
||||
matchFinder = (const wchar_t *)_defaultMatchFinder;
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algorithm);
|
||||
@@ -356,15 +357,13 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
}
|
||||
else if (IsDeflateMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 fastBytes = _defaultFastBytes;
|
||||
if (fastBytes == 0xFFFFFFFF)
|
||||
fastBytes = (level >= 9 ? kDeflateFastBytesX9 :
|
||||
UInt32 fastBytes =
|
||||
(level >= 9 ? kDeflateFastBytesX9 :
|
||||
(level >= 7 ? kDeflateFastBytesX7 :
|
||||
kDeflateFastBytesX1));
|
||||
|
||||
UInt32 numPasses = _defaultPasses;
|
||||
if (numPasses == 0xFFFFFFFF)
|
||||
numPasses = (level >= 9 ? kDeflatePassesX9 :
|
||||
UInt32 numPasses =
|
||||
(level >= 9 ? kDeflatePassesX9 :
|
||||
(level >= 7 ? kDeflatePassesX7 :
|
||||
kDeflatePassesX1));
|
||||
|
||||
@@ -373,15 +372,13 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
}
|
||||
else if (IsBZip2Method(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 numPasses = _defaultPasses;
|
||||
if (numPasses == 0xFFFFFFFF)
|
||||
numPasses = (level >= 9 ? kBZip2NumPassesX9 :
|
||||
UInt32 numPasses =
|
||||
(level >= 9 ? kBZip2NumPassesX9 :
|
||||
(level >= 7 ? kBZip2NumPassesX7 :
|
||||
kBZip2NumPassesX1));
|
||||
|
||||
UInt32 dicSize = _defaultDicSize;
|
||||
if (dicSize == 0xFFFFFFFF)
|
||||
dicSize = (level >= 5 ? kBZip2DicSizeX5 :
|
||||
UInt32 dicSize =
|
||||
(level >= 5 ? kBZip2DicSizeX5 :
|
||||
(level >= 3 ? kBZip2DicSizeX3 :
|
||||
kBZip2DicSizeX1));
|
||||
|
||||
@@ -393,16 +390,14 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
}
|
||||
else if (IsPpmdMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 useMemSize = _defaultPpmdMemSize;
|
||||
if (useMemSize == 0xFFFFFFFF)
|
||||
useMemSize = (level >= 9 ? kPpmdMemSizeX9 :
|
||||
UInt32 useMemSize =
|
||||
(level >= 9 ? kPpmdMemSizeX9 :
|
||||
(level >= 7 ? kPpmdMemSizeX7 :
|
||||
(level >= 5 ? kPpmdMemSizeX5 :
|
||||
kPpmdMemSizeX1)));
|
||||
|
||||
UInt32 order = _defaultPpmdOrder;
|
||||
if (order == 0xFFFFFFFF)
|
||||
order = (level >= 9 ? kPpmdOrderX9 :
|
||||
UInt32 order =
|
||||
(level >= 9 ? kPpmdOrderX9 :
|
||||
(level >= 7 ? kPpmdOrderX7 :
|
||||
(level >= 5 ? kPpmdOrderX5 :
|
||||
kPpmdOrderX1)));
|
||||
@@ -509,6 +504,30 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
return E_FAIL;
|
||||
|
||||
methodMode.Methods.Add(methodFull);
|
||||
|
||||
if (!_numSolidBytesDefined)
|
||||
{
|
||||
for (int j = 0; j < methodFull.CoderProperties.Size(); j++)
|
||||
{
|
||||
const CProperty &prop = methodFull.CoderProperties[j];
|
||||
if ((prop.PropID == NCoderPropID::kDictionarySize ||
|
||||
prop.PropID == NCoderPropID::kUsedMemorySize) && prop.Value.vt == VT_UI4)
|
||||
{
|
||||
_numSolidBytes = ((UInt64)prop.Value.ulVal) << 7;
|
||||
const UInt64 kMinSize = (1 << 24);
|
||||
if (_numSolidBytes < kMinSize)
|
||||
_numSolidBytes = kMinSize;
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!needSolid && !_numSolidBytesDefined)
|
||||
{
|
||||
_numSolidBytesDefined = true;
|
||||
_numSolidBytes = 0;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
@@ -671,28 +690,9 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
if (updateItem.Size != 0 && updateItem.IsAnti)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
/*
|
||||
else
|
||||
thereIsCopyData = true;
|
||||
*/
|
||||
|
||||
updateItems.Add(updateItem);
|
||||
}
|
||||
|
||||
/*
|
||||
if (thereIsCopyData)
|
||||
{
|
||||
for(int i = 0; i < _database.NumUnPackStreamsVector.Size(); i++)
|
||||
if (_database.NumUnPackStreamsVector[i] != 1)
|
||||
return E_NOTIMPL;
|
||||
if (!_solidIsSpecified)
|
||||
_solid = false;
|
||||
if (_solid)
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
CCompressionMethodMode methodMode, headerMethod;
|
||||
RINOK(SetCompressionMethod(methodMode, headerMethod));
|
||||
#ifdef COMPRESS_MT
|
||||
@@ -747,29 +747,6 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
COM_TRY_END
|
||||
}
|
||||
|
||||
/*
|
||||
static HRESULT SetComplexProperty(bool &boolStatus, UInt32 &number,
|
||||
const PROPVARIANT &value)
|
||||
{
|
||||
switch(value.vt)
|
||||
{
|
||||
case VT_EMPTY:
|
||||
case VT_BSTR:
|
||||
{
|
||||
RINOK(SetBoolProperty(boolStatus, value));
|
||||
return S_OK;
|
||||
}
|
||||
case VT_UI4:
|
||||
boolStatus = true;
|
||||
number = (value.ulVal);
|
||||
break;
|
||||
default:
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
static HRESULT GetBindInfoPart(UString &srcString, UInt32 &coder, UInt32 &stream)
|
||||
{
|
||||
stream = 0;
|
||||
@@ -988,6 +965,9 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
|
||||
UInt32 mainDicSize = 0xFFFFFFFF;
|
||||
UInt32 mainDicMethodIndex = 0xFFFFFFFF;
|
||||
|
||||
UInt32 minNumber = 0;
|
||||
|
||||
for (int i = 0; i < numProperties; i++)
|
||||
@@ -1002,11 +982,8 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
if (name[0] == 'X')
|
||||
{
|
||||
name.Delete(0);
|
||||
|
||||
_level = 9;
|
||||
RINOK(ParsePropValue(name, value, _level));
|
||||
if (_level == 0)
|
||||
_copyMode = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1109,6 +1086,8 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
property.PropID = NCoderPropID::kDictionarySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
else if (realName.Left(3).CompareNoCase(L"MEM") == 0)
|
||||
{
|
||||
@@ -1117,6 +1096,8 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
property.PropID = NCoderPropID::kUsedMemorySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1134,7 +1115,6 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckAndSetSolidBytesLimit();
|
||||
|
||||
return S_OK;
|
||||
COM_TRY_END
|
||||
|
||||
@@ -300,7 +300,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
|
||||
outStreamSpec->InitCRC();
|
||||
|
||||
switch(m_Item.CompressionMethod)
|
||||
switch(item.CompressionMethod)
|
||||
{
|
||||
case NFileHeader::NCompressionMethod::kDeflate:
|
||||
{
|
||||
|
||||
@@ -100,7 +100,11 @@ STDMETHODIMP CHandler::Close()
|
||||
|
||||
STDMETHODIMP CHandler::GetNumberOfItems(UInt32 *numItems)
|
||||
{
|
||||
*numItems = _archive.Items.Size() + 1;
|
||||
*numItems = _archive.Items.Size()
|
||||
#ifdef NSIS_SCRIPT
|
||||
+ 1
|
||||
#endif
|
||||
;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -179,6 +183,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
NWindows::NCOM::CPropVariant propVariant;
|
||||
#ifdef NSIS_SCRIPT
|
||||
if (index >= (UInt32)_archive.Items.Size())
|
||||
{
|
||||
switch(propID)
|
||||
@@ -199,6 +204,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const CItem &item = _archive.Items[index];
|
||||
switch(propID)
|
||||
@@ -277,9 +283,11 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
for(i = 0; i < numItems; i++)
|
||||
{
|
||||
UInt32 index = (allFilesMode ? i : indices[i]);
|
||||
#ifdef NSIS_SCRIPT
|
||||
if (index >= (UInt32)_archive.Items.Size())
|
||||
totalSize += _archive.Script.Length();
|
||||
else
|
||||
#endif
|
||||
{
|
||||
UInt32 size;
|
||||
if (_archive.IsSolid)
|
||||
@@ -321,6 +329,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
|
||||
RINOK(extractCallback->GetStream(index, &realOutStream, askMode));
|
||||
|
||||
#ifdef NSIS_SCRIPT
|
||||
if (index >= (UInt32)_archive.Items.Size())
|
||||
{
|
||||
currentItemSize = _archive.Script.Length();
|
||||
@@ -331,6 +340,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
RINOK(realOutStream->Write((const char *)_archive.Script, (UInt32)_archive.Script.Length(), NULL));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const CItem &item = _archive.Items[index];
|
||||
|
||||
|
||||
@@ -559,14 +559,54 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
|
||||
e.Which = ReadUInt32();
|
||||
for (UInt32 j = 0; j < kNumEntryParams; j++)
|
||||
e.Params[j] = ReadUInt32();
|
||||
#ifdef NSIS_SCRIPT
|
||||
if (e.Which != EW_PUSHPOP && e.Which < sizeof(kCommandPairs) / sizeof(kCommandPairs[0]))
|
||||
{
|
||||
const CCommandPair &pair = kCommandPairs[e.Which];
|
||||
Script += pair.Name;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (e.Which)
|
||||
{
|
||||
case EW_CREATEDIR:
|
||||
{
|
||||
prefix.Empty();
|
||||
prefix = ReadString2(e.Params[0]);
|
||||
#ifdef NSIS_SCRIPT
|
||||
Script += " ";
|
||||
Script += prefix;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case EW_EXTRACTFILE:
|
||||
{
|
||||
CItem item;
|
||||
item.Prefix = prefix;
|
||||
UInt32 overwriteFlag = e.Params[0];
|
||||
item.Name = ReadString2(e.Params[1]);
|
||||
item.Pos = e.Params[2];
|
||||
item.DateTime.dwLowDateTime = e.Params[3];
|
||||
item.DateTime.dwHighDateTime = e.Params[4];
|
||||
UInt32 allowIgnore = e.Params[5];
|
||||
if (Items.Size() > 0)
|
||||
{
|
||||
/*
|
||||
if (item.Pos == Items.Back().Pos)
|
||||
continue;
|
||||
*/
|
||||
}
|
||||
Items.Add(item);
|
||||
#ifdef NSIS_SCRIPT
|
||||
Script += " ";
|
||||
Script += item.Name;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NSIS_SCRIPT
|
||||
case EW_UPDATETEXT:
|
||||
{
|
||||
Script += " ";
|
||||
@@ -583,14 +623,6 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
|
||||
Script += UIntToString(e.Params[1]);
|
||||
break;
|
||||
}
|
||||
case EW_CREATEDIR:
|
||||
{
|
||||
prefix.Empty();
|
||||
Script += " ";
|
||||
prefix = ReadString2(e.Params[0]);
|
||||
Script += prefix;
|
||||
break;
|
||||
}
|
||||
case EW_IFFILEEXISTS:
|
||||
{
|
||||
Script += " ";
|
||||
@@ -639,28 +671,6 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
|
||||
break;
|
||||
}
|
||||
|
||||
case EW_EXTRACTFILE:
|
||||
{
|
||||
CItem item;
|
||||
item.Prefix = prefix;
|
||||
UInt32 overwriteFlag = e.Params[0];
|
||||
item.Name = ReadString2(e.Params[1]);
|
||||
item.Pos = e.Params[2];
|
||||
item.DateTime.dwLowDateTime = e.Params[3];
|
||||
item.DateTime.dwHighDateTime = e.Params[4];
|
||||
UInt32 allowIgnore = e.Params[5];
|
||||
if (Items.Size() > 0)
|
||||
{
|
||||
/*
|
||||
if (item.Pos == Items.Back().Pos)
|
||||
continue;
|
||||
*/
|
||||
}
|
||||
Items.Add(item);
|
||||
Script += " ";
|
||||
Script += item.Name;
|
||||
break;
|
||||
}
|
||||
case EW_DELETEFILE:
|
||||
{
|
||||
UInt64 flag = e.Params[1];
|
||||
@@ -871,8 +881,11 @@ HRESULT CInArchive::ReadEntries(const CBlockHeader &bh)
|
||||
}
|
||||
Script += e.GetParamsString(numParams);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef NSIS_SCRIPT
|
||||
Script += kCrLf;
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1138,7 +1151,9 @@ HRESULT CInArchive::Open(IInStream *inStream, const UInt64 *maxCheckStartPositio
|
||||
|
||||
void CInArchive::Clear()
|
||||
{
|
||||
#ifdef NSIS_SCRIPT
|
||||
Script.Empty();
|
||||
#endif
|
||||
Items.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#include "NsisDecode.h"
|
||||
|
||||
// #define NSIS_SCRIPT
|
||||
|
||||
namespace NArchive {
|
||||
namespace NNsis {
|
||||
|
||||
@@ -128,7 +130,9 @@ public:
|
||||
UInt32 DictionarySize;
|
||||
bool FilterFlag;
|
||||
|
||||
#ifdef NSIS_SCRIPT
|
||||
AString Script;
|
||||
#endif
|
||||
UInt32 GetOffset() const { return IsSolid ? 4 : 0; }
|
||||
UInt64 GetDataPos(int index)
|
||||
{
|
||||
|
||||
@@ -85,11 +85,12 @@ void CState::Free()
|
||||
}
|
||||
|
||||
#ifdef COMPRESS_BZIP2_MT
|
||||
void CState::FinishStream()
|
||||
void CState::FinishStream(bool needLeave)
|
||||
{
|
||||
Decoder->StreamWasFinished = true;
|
||||
StreamWasFinishedEvent.Set();
|
||||
Decoder->CS.Leave();
|
||||
if (needLeave)
|
||||
Decoder->CS.Leave();
|
||||
Decoder->CanStartWaitingEvent.Lock();
|
||||
WaitingWasStartedEvent.Set();
|
||||
}
|
||||
@@ -106,10 +107,11 @@ DWORD CState::ThreadFunc()
|
||||
}
|
||||
if (Decoder->StreamWasFinished)
|
||||
{
|
||||
FinishStream();
|
||||
FinishStream(true);
|
||||
continue;
|
||||
}
|
||||
HRESULT res = S_OK;
|
||||
bool neadLeave = true;
|
||||
try
|
||||
{
|
||||
UInt32 blockIndex = Decoder->NextBlockIndex;
|
||||
@@ -124,13 +126,13 @@ DWORD CState::ThreadFunc()
|
||||
if (res != S_OK)
|
||||
{
|
||||
Decoder->Result = res;
|
||||
FinishStream();
|
||||
FinishStream(true);
|
||||
continue;
|
||||
}
|
||||
if (wasFinished)
|
||||
{
|
||||
Decoder->Result = res;
|
||||
FinishStream();
|
||||
FinishStream(true);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -139,9 +141,10 @@ DWORD CState::ThreadFunc()
|
||||
if (res != S_OK)
|
||||
{
|
||||
Decoder->Result = res;
|
||||
FinishStream();
|
||||
FinishStream(true);
|
||||
continue;
|
||||
}
|
||||
neadLeave = false;
|
||||
Decoder->CS.Leave();
|
||||
|
||||
DecodeBlock1();
|
||||
@@ -151,7 +154,7 @@ DWORD CState::ThreadFunc()
|
||||
if (DecodeBlock2(Decoder->m_OutStream) != crc)
|
||||
{
|
||||
Decoder->Result = S_FALSE;
|
||||
FinishStream();
|
||||
FinishStream(neadLeave);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -169,7 +172,7 @@ DWORD CState::ThreadFunc()
|
||||
if (res != S_OK)
|
||||
{
|
||||
Decoder->Result = res;
|
||||
FinishStream();
|
||||
FinishStream(neadLeave);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ struct CState
|
||||
|
||||
Byte MtPad[1 << 8]; // It's pad for Multi-Threading. Must be >= Cache_Line_Size.
|
||||
|
||||
void FinishStream();
|
||||
void FinishStream(bool needLeave);
|
||||
DWORD ThreadFunc();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,11 +46,12 @@ void CThreadInfo::Free()
|
||||
}
|
||||
|
||||
#ifdef COMPRESS_BZIP2_MT
|
||||
void CThreadInfo::FinishStream()
|
||||
void CThreadInfo::FinishStream(bool needLeave)
|
||||
{
|
||||
Encoder->StreamWasFinished = true;
|
||||
StreamWasFinishedEvent.Set();
|
||||
Encoder->CS.Leave();
|
||||
if (needLeave)
|
||||
Encoder->CS.Leave();
|
||||
Encoder->CanStartWaitingEvent.Lock();
|
||||
WaitingWasStartedEvent.Set();
|
||||
}
|
||||
@@ -67,10 +68,11 @@ DWORD CThreadInfo::ThreadFunc()
|
||||
}
|
||||
if (Encoder->StreamWasFinished)
|
||||
{
|
||||
FinishStream();
|
||||
FinishStream(true);
|
||||
continue;
|
||||
}
|
||||
HRESULT res = S_OK;
|
||||
bool needLeave = true;
|
||||
try
|
||||
{
|
||||
UInt32 blockSize = Encoder->ReadRleBlock(m_Block);
|
||||
@@ -80,10 +82,11 @@ DWORD CThreadInfo::ThreadFunc()
|
||||
Encoder->NextBlockIndex = 0;
|
||||
if (blockSize == 0)
|
||||
{
|
||||
FinishStream();
|
||||
FinishStream(true);
|
||||
continue;
|
||||
}
|
||||
Encoder->CS.Leave();
|
||||
needLeave = false;
|
||||
res = EncodeBlock3(blockSize);
|
||||
}
|
||||
catch(const CInBufferException &e) { res = e.ErrorCode; }
|
||||
@@ -92,7 +95,7 @@ DWORD CThreadInfo::ThreadFunc()
|
||||
if (res != S_OK)
|
||||
{
|
||||
Encoder->Result = res;
|
||||
FinishStream();
|
||||
FinishStream(needLeave);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ private:
|
||||
|
||||
int m_BlockIndex;
|
||||
|
||||
void FinishStream();
|
||||
void FinishStream(bool needLeave);
|
||||
|
||||
void WriteBits2(UInt32 value, UInt32 numBits);
|
||||
void WriteByte2(Byte b);
|
||||
|
||||
@@ -145,6 +145,7 @@ public:
|
||||
class CDecoder:
|
||||
public ICompressCoder,
|
||||
public ICompressSetDecoderProperties2,
|
||||
public ICompressGetInStreamProcessedSize,
|
||||
#ifdef _ST_MODE
|
||||
public ICompressSetInStream,
|
||||
public ICompressSetOutStreamSize,
|
||||
@@ -187,14 +188,16 @@ class CDecoder:
|
||||
public:
|
||||
|
||||
#ifdef _ST_MODE
|
||||
MY_UNKNOWN_IMP4(
|
||||
MY_UNKNOWN_IMP5(
|
||||
ICompressSetDecoderProperties2,
|
||||
ICompressGetInStreamProcessedSize,
|
||||
ICompressSetInStream,
|
||||
ICompressSetOutStreamSize,
|
||||
ISequentialInStream)
|
||||
#else
|
||||
MY_UNKNOWN_IMP1(
|
||||
ICompressSetDecoderProperties2)
|
||||
MY_UNKNOWN_IMP2(
|
||||
ICompressSetDecoderProperties2,
|
||||
ICompressGetInStreamProcessedSize)
|
||||
#endif
|
||||
|
||||
void ReleaseStreams()
|
||||
|
||||
@@ -775,6 +775,17 @@ void CPanel::AddToArchive()
|
||||
// KillSelection();
|
||||
}
|
||||
|
||||
static UString GetSubFolderNameForExtract(const UString &archiveName)
|
||||
{
|
||||
int slashPos = archiveName.ReverseFind(L'\\');
|
||||
int dotPos = archiveName.ReverseFind(L'.');
|
||||
if (dotPos < 0 || slashPos > dotPos)
|
||||
return archiveName + UString(L"~");
|
||||
UString res = archiveName.Left(dotPos);
|
||||
res.TrimRight();
|
||||
return res;
|
||||
}
|
||||
|
||||
void CPanel::ExtractArchives()
|
||||
{
|
||||
if (_parentFolders.Size() > 0)
|
||||
@@ -800,7 +811,12 @@ void CPanel::ExtractArchives()
|
||||
}
|
||||
paths.Add(_currentFolderPrefix + GetItemRelPath(index));
|
||||
}
|
||||
::ExtractArchives(paths, _currentFolderPrefix, true);
|
||||
UString folderName;
|
||||
if (indices.Size() == 1)
|
||||
folderName = GetSubFolderNameForExtract(GetItemRelPath(indices[0]));
|
||||
else
|
||||
folderName = L"*";
|
||||
::ExtractArchives(paths, _currentFolderPrefix + folderName + UString(L"\\"), true);
|
||||
}
|
||||
|
||||
void CPanel::TestArchives()
|
||||
|
||||
@@ -115,6 +115,7 @@ Handler GUIDs:
|
||||
07 7z
|
||||
08 Cab
|
||||
09 Nsis
|
||||
0A Lzma
|
||||
|
||||
E7 Iso
|
||||
E8 Bkf
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#define MY_VER_MAJOR 4
|
||||
#define MY_VER_MINOR 40
|
||||
#define MY_VER_MINOR 41
|
||||
#define MY_VER_BUILD 0
|
||||
#define MY_VERSION "4.40 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.40 beta"
|
||||
#define MY_DATE "2006-05-01"
|
||||
#define MY_VERSION "4.41 beta"
|
||||
#define MY_7ZIP_VERSION "7-Zip 4.41 beta"
|
||||
#define MY_DATE "2006-05-09"
|
||||
#define MY_COPYRIGHT "Copyright (c) 1999-2006 Igor Pavlov"
|
||||
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
||||
|
||||
@@ -246,14 +246,12 @@ static bool MyInsertMenu(CMenu &menu, int pos, UINT id, const UString &s)
|
||||
|
||||
static UString GetSubFolderNameForExtract(const UString &archiveName)
|
||||
{
|
||||
int dotPos = archiveName.ReverseFind('.');
|
||||
if (dotPos >= 0)
|
||||
{
|
||||
UString res = archiveName.Left(dotPos);
|
||||
res.TrimRight();
|
||||
return res;
|
||||
}
|
||||
return archiveName + UString(L"~");
|
||||
int dotPos = archiveName.ReverseFind(L'.');
|
||||
if (dotPos < 0)
|
||||
return archiveName + UString(L"~");
|
||||
UString res = archiveName.Left(dotPos);
|
||||
res.TrimRight();
|
||||
return res;
|
||||
}
|
||||
|
||||
static UString GetReducedString(const UString &s)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
;Defines
|
||||
|
||||
!define VERSION_MAJOR 4
|
||||
!define VERSION_MINOR 40
|
||||
!define VERSION_MINOR 41
|
||||
!define VERSION_POSTFIX_FULL " beta"
|
||||
!ifdef WIN64
|
||||
!ifdef IA64
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<?define VerMajor = "4" ?>
|
||||
<?define VerMinor = "40" ?>
|
||||
<?define VerMinor = "41" ?>
|
||||
<?define VerBuild = "00" ?>
|
||||
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
|
||||
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>
|
||||
@@ -370,7 +370,7 @@
|
||||
<ComponentRef Id="InstallRegAppPath" />
|
||||
|
||||
</Feature>
|
||||
<Feature Id="LanguageFiles" Title="Localization files" Description="Localization files for 62 languages."
|
||||
<Feature Id="LanguageFiles" Title="Localization files" Description="Localization files for 63 languages."
|
||||
Level="1" AllowAdvertise="no">
|
||||
<ComponentRef Id="Lang" />
|
||||
</Feature>
|
||||
|
||||
28
DOC/lzma_format.txt
Executable file
28
DOC/lzma_format.txt
Executable file
@@ -0,0 +1,28 @@
|
||||
6 Signature 0xFF 'L' 'Z' 'M' 'A' 0x00
|
||||
1 Flags
|
||||
0 Has CRC16 of the header
|
||||
1 Has CRC32 of the data
|
||||
2 Has filter
|
||||
3 Need initial dictionary
|
||||
4-7 Reserved, *must* be zero for now.
|
||||
1 CompressionMethod
|
||||
0 No compression
|
||||
1 Lzma
|
||||
1 Filter ID
|
||||
0 none
|
||||
1 BCJ
|
||||
2 LZMA properties
|
||||
1 (uint8_t)((pb * 5 + lp) * 9 + lc) (like in LZMA_Alone)
|
||||
1 Dictionary size.
|
||||
eppnnnnn
|
||||
e: 1 - there is end marker
|
||||
Dictionary size = (1 << nnnnn) + (pp) << (nnnnn - 2);
|
||||
2 CRC16 of the header
|
||||
|
||||
Compressed data
|
||||
... ...
|
||||
(-16) 4 CRC32 of the uncompressed data as big endian uint32_t
|
||||
-12 8 Uncompressed size as big endian uint64_t
|
||||
-4 4 Footer magic bytes: 0x0A 'I' 'P' 0x0A
|
||||
0 (End of file; the last byte of the file is at offset -1.)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
7-Zip 4.40 Sources
|
||||
7-Zip 4.41 Sources
|
||||
------------------
|
||||
|
||||
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.
|
||||
|
||||
Reference in New Issue
Block a user