Imported Upstream version 4.42.dfsg.1

parent 503cee7f
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -52,7 +52,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, ...@@ -52,7 +52,6 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
bool testMode = (testModeSpec != 0); bool testMode = (testModeSpec != 0);
CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec; CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
UInt64 importantTotalUnPacked = 0; UInt64 importantTotalUnPacked = 0;
UInt64 censoredTotalUnPacked = 0, censoredTotalPacked = 0;
bool allFilesMode = (numItems == UInt32(-1)); bool allFilesMode = (numItems == UInt32(-1));
if (allFilesMode) if (allFilesMode)
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -167,17 +167,6 @@ private: ...@@ -167,17 +167,6 @@ private:
bool _compressHeadersFull; bool _compressHeadersFull;
bool _encryptHeaders; bool _encryptHeaders;
bool _copyMode;
UInt32 _defaultDicSize;
UInt32 _defaultAlgorithm;
UInt32 _defaultFastBytes;
UInt32 _defaultPasses;
UString _defaultMatchFinder;
UInt32 _defaultPpmdMemSize;
UInt32 _defaultPpmdOrder;
bool _autoFilter; bool _autoFilter;
UInt32 _level; UInt32 _level;
...@@ -221,30 +210,6 @@ private: ...@@ -221,30 +210,6 @@ private:
_solidExtension = false; _solidExtension = false;
_numSolidBytesDefined = 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() void Init()
{ {
...@@ -255,22 +220,11 @@ private: ...@@ -255,22 +220,11 @@ private:
#ifdef COMPRESS_MT #ifdef COMPRESS_MT
_numThreads = NWindows::NSystem::GetNumberOfProcessors(); _numThreads = NWindows::NSystem::GetNumberOfProcessors();
#endif #endif
_copyMode = false;
_defaultDicSize =
_defaultAlgorithm =
_defaultFastBytes =
_defaultPasses =
_defaultPpmdMemSize =
_defaultPpmdOrder = 0xFFFFFFFF;
_defaultMatchFinder.Empty();
_level = 5; _level = 5;
_autoFilter = true; _autoFilter = true;
_volumeMode = false; _volumeMode = false;
InitSolid(); InitSolid();
SetSolidBytesLimit();
} }
#endif #endif
}; };
......
...@@ -117,6 +117,9 @@ static const UInt32 kDictionaryForHeaders = 1 << 20; ...@@ -117,6 +117,9 @@ static const UInt32 kDictionaryForHeaders = 1 << 20;
static const UInt32 kNumFastBytesForHeaders = 273; static const UInt32 kNumFastBytesForHeaders = 273;
static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5; static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5;
static bool IsCopyMethod(const UString &methodName)
{ return (methodName.CompareNoCase(kCopyMethod) == 0); }
static bool IsLZMAMethod(const UString &methodName) static bool IsLZMAMethod(const UString &methodName)
{ return (methodName.CompareNoCase(kLZMAMethodName) == 0); } { return (methodName.CompareNoCase(kLZMAMethodName) == 0); }
static bool IsLZMethod(const UString &methodName) static bool IsLZMethod(const UString &methodName)
...@@ -304,47 +307,45 @@ HRESULT CHandler::SetCompressionMethod( ...@@ -304,47 +307,45 @@ HRESULT CHandler::SetCompressionMethod(
#endif #endif
UInt32 level = _level;
if (methodsInfo.IsEmpty()) if (methodsInfo.IsEmpty())
{ {
COneMethodInfo oneMethodInfo; COneMethodInfo oneMethodInfo;
oneMethodInfo.MethodName = _copyMode ? kCopyMethod : kDefaultMethodName; oneMethodInfo.MethodName = ((level == 0) ? kCopyMethod : kDefaultMethodName);
methodsInfo.Add(oneMethodInfo); methodsInfo.Add(oneMethodInfo);
} }
UInt32 level = _level; bool needSolid = false;
for(int i = 0; i < methodsInfo.Size(); i++) for(int i = 0; i < methodsInfo.Size(); i++)
{ {
COneMethodInfo &oneMethodInfo = methodsInfo[i]; COneMethodInfo &oneMethodInfo = methodsInfo[i];
if (oneMethodInfo.MethodName.IsEmpty()) if (oneMethodInfo.MethodName.IsEmpty())
oneMethodInfo.MethodName = kDefaultMethodName; oneMethodInfo.MethodName = kDefaultMethodName;
if (!IsCopyMethod(oneMethodInfo.MethodName))
needSolid = true;
if (IsLZMAMethod(oneMethodInfo.MethodName)) if (IsLZMAMethod(oneMethodInfo.MethodName))
{ {
UInt32 dicSize = _defaultDicSize; UInt32 dicSize =
if (dicSize == 0xFFFFFFFF) (level >= 9 ? kLzmaDicSizeX9 :
dicSize = (level >= 9 ? kLzmaDicSizeX9 :
(level >= 7 ? kLzmaDicSizeX7 : (level >= 7 ? kLzmaDicSizeX7 :
(level >= 5 ? kLzmaDicSizeX5 : (level >= 5 ? kLzmaDicSizeX5 :
(level >= 3 ? kLzmaDicSizeX3 : (level >= 3 ? kLzmaDicSizeX3 :
kLzmaDicSizeX1)))); kLzmaDicSizeX1))));
UInt32 algorithm = _defaultAlgorithm; UInt32 algorithm =
if (algorithm == 0xFFFFFFFF) (level >= 5 ? kLzmaAlgorithmX5 :
algorithm = (level >= 5 ? kLzmaAlgorithmX5 :
kLzmaAlgorithmX1); kLzmaAlgorithmX1);
UInt32 fastBytes = _defaultFastBytes; UInt32 fastBytes =
if (fastBytes == 0xFFFFFFFF) (level >= 7 ? kLzmaFastBytesX7 :
fastBytes = (level >= 7 ? kLzmaFastBytesX7 :
kLzmaFastBytesX1); kLzmaFastBytesX1);
const wchar_t *matchFinder = 0; const wchar_t *matchFinder =
if (_defaultMatchFinder.IsEmpty()) (level >= 5 ? kLzmaMatchFinderX5 :
matchFinder = (level >= 5 ? kLzmaMatchFinderX5 :
kLzmaMatchFinderX1); kLzmaMatchFinderX1);
else
matchFinder = (const wchar_t *)_defaultMatchFinder;
SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize); SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algorithm); SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algorithm);
...@@ -356,15 +357,13 @@ HRESULT CHandler::SetCompressionMethod( ...@@ -356,15 +357,13 @@ HRESULT CHandler::SetCompressionMethod(
} }
else if (IsDeflateMethod(oneMethodInfo.MethodName)) else if (IsDeflateMethod(oneMethodInfo.MethodName))
{ {
UInt32 fastBytes = _defaultFastBytes; UInt32 fastBytes =
if (fastBytes == 0xFFFFFFFF) (level >= 9 ? kDeflateFastBytesX9 :
fastBytes = (level >= 9 ? kDeflateFastBytesX9 :
(level >= 7 ? kDeflateFastBytesX7 : (level >= 7 ? kDeflateFastBytesX7 :
kDeflateFastBytesX1)); kDeflateFastBytesX1));
UInt32 numPasses = _defaultPasses; UInt32 numPasses =
if (numPasses == 0xFFFFFFFF) (level >= 9 ? kDeflatePassesX9 :
numPasses = (level >= 9 ? kDeflatePassesX9 :
(level >= 7 ? kDeflatePassesX7 : (level >= 7 ? kDeflatePassesX7 :
kDeflatePassesX1)); kDeflatePassesX1));
...@@ -373,15 +372,13 @@ HRESULT CHandler::SetCompressionMethod( ...@@ -373,15 +372,13 @@ HRESULT CHandler::SetCompressionMethod(
} }
else if (IsBZip2Method(oneMethodInfo.MethodName)) else if (IsBZip2Method(oneMethodInfo.MethodName))
{ {
UInt32 numPasses = _defaultPasses; UInt32 numPasses =
if (numPasses == 0xFFFFFFFF) (level >= 9 ? kBZip2NumPassesX9 :
numPasses = (level >= 9 ? kBZip2NumPassesX9 :
(level >= 7 ? kBZip2NumPassesX7 : (level >= 7 ? kBZip2NumPassesX7 :
kBZip2NumPassesX1)); kBZip2NumPassesX1));
UInt32 dicSize = _defaultDicSize; UInt32 dicSize =
if (dicSize == 0xFFFFFFFF) (level >= 5 ? kBZip2DicSizeX5 :
dicSize = (level >= 5 ? kBZip2DicSizeX5 :
(level >= 3 ? kBZip2DicSizeX3 : (level >= 3 ? kBZip2DicSizeX3 :
kBZip2DicSizeX1)); kBZip2DicSizeX1));
...@@ -393,16 +390,14 @@ HRESULT CHandler::SetCompressionMethod( ...@@ -393,16 +390,14 @@ HRESULT CHandler::SetCompressionMethod(
} }
else if (IsPpmdMethod(oneMethodInfo.MethodName)) else if (IsPpmdMethod(oneMethodInfo.MethodName))
{ {
UInt32 useMemSize = _defaultPpmdMemSize; UInt32 useMemSize =
if (useMemSize == 0xFFFFFFFF) (level >= 9 ? kPpmdMemSizeX9 :
useMemSize = (level >= 9 ? kPpmdMemSizeX9 :
(level >= 7 ? kPpmdMemSizeX7 : (level >= 7 ? kPpmdMemSizeX7 :
(level >= 5 ? kPpmdMemSizeX5 : (level >= 5 ? kPpmdMemSizeX5 :
kPpmdMemSizeX1))); kPpmdMemSizeX1)));
UInt32 order = _defaultPpmdOrder; UInt32 order =
if (order == 0xFFFFFFFF) (level >= 9 ? kPpmdOrderX9 :
order = (level >= 9 ? kPpmdOrderX9 :
(level >= 7 ? kPpmdOrderX7 : (level >= 7 ? kPpmdOrderX7 :
(level >= 5 ? kPpmdOrderX5 : (level >= 5 ? kPpmdOrderX5 :
kPpmdOrderX1))); kPpmdOrderX1)));
...@@ -509,6 +504,30 @@ HRESULT CHandler::SetCompressionMethod( ...@@ -509,6 +504,30 @@ HRESULT CHandler::SetCompressionMethod(
return E_FAIL; return E_FAIL;
methodMode.Methods.Add(methodFull); 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; return S_OK;
} }
...@@ -540,7 +559,6 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt ...@@ -540,7 +559,6 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
// CMyComPtr<IUpdateCallback2> updateCallback2; // CMyComPtr<IUpdateCallback2> updateCallback2;
// updateCallback->QueryInterface(&updateCallback2); // updateCallback->QueryInterface(&updateCallback2);
int index = 0;
for(UInt32 i = 0; i < numItems; i++) for(UInt32 i = 0; i < numItems; i++)
{ {
Int32 newData; Int32 newData;
...@@ -672,28 +690,9 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt ...@@ -672,28 +690,9 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
if (updateItem.Size != 0 && updateItem.IsAnti) if (updateItem.Size != 0 && updateItem.IsAnti)
return E_INVALIDARG; return E_INVALIDARG;
} }
/*
else
thereIsCopyData = true;
*/
updateItems.Add(updateItem); 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; CCompressionMethodMode methodMode, headerMethod;
RINOK(SetCompressionMethod(methodMode, headerMethod)); RINOK(SetCompressionMethod(methodMode, headerMethod));
#ifdef COMPRESS_MT #ifdef COMPRESS_MT
...@@ -748,29 +747,6 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt ...@@ -748,29 +747,6 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
COM_TRY_END 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) static HRESULT GetBindInfoPart(UString &srcString, UInt32 &coder, UInt32 &stream)
{ {
stream = 0; stream = 0;
...@@ -989,6 +965,9 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v ...@@ -989,6 +965,9 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
const UInt32 numProcessors = NSystem::GetNumberOfProcessors(); const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
#endif #endif
UInt32 mainDicSize = 0xFFFFFFFF;
UInt32 mainDicMethodIndex = 0xFFFFFFFF;
UInt32 minNumber = 0; UInt32 minNumber = 0;
for (int i = 0; i < numProperties; i++) for (int i = 0; i < numProperties; i++)
...@@ -1003,11 +982,8 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v ...@@ -1003,11 +982,8 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
if (name[0] == 'X') if (name[0] == 'X')
{ {
name.Delete(0); name.Delete(0);
_level = 9; _level = 9;
RINOK(ParsePropValue(name, value, _level)); RINOK(ParsePropValue(name, value, _level));
if (_level == 0)
_copyMode = true;