diff options
author | kh1 <karsten.heimrich@digia.com> | 2013-05-02 15:28:22 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2013-05-08 13:01:55 +0200 |
commit | d89674f944c419c9473da688993ee69671f2c295 (patch) | |
tree | 8422461a5b45d97b6d32dfa8e060e69d600210c9 /src/libs/7zip/win/CPP/7zip/Archive/DeflateProps.cpp | |
parent | 5ed380ebcf8ef1157f651cbdef8393ccac897ee2 (diff) |
Reset to only use the basic LZMA SDK (Windows).
Change-Id: I8088cc4775f6c5397991f00512354836d614ea4e
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src/libs/7zip/win/CPP/7zip/Archive/DeflateProps.cpp')
-rw-r--r-- | src/libs/7zip/win/CPP/7zip/Archive/DeflateProps.cpp | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/src/libs/7zip/win/CPP/7zip/Archive/DeflateProps.cpp b/src/libs/7zip/win/CPP/7zip/Archive/DeflateProps.cpp deleted file mode 100644 index 8498e0565..000000000 --- a/src/libs/7zip/win/CPP/7zip/Archive/DeflateProps.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// DeflateProps.cpp - -#include "StdAfx.h" - -#include "Windows/PropVariant.h" - -#include "Common/ParseProperties.h" - -#include "DeflateProps.h" - -namespace NArchive { - -static const UInt32 kAlgo1 = 0; -static const UInt32 kAlgo5 = 1; - -static const UInt32 kPasses1 = 1; -static const UInt32 kPasses7 = 3; -static const UInt32 kPasses9 = 10; - -static const UInt32 kFb1 = 32; -static const UInt32 kFb7 = 64; -static const UInt32 kFb9 = 128; - -void CDeflateProps::Normalize() -{ - UInt32 level = Level; - if (level == 0xFFFFFFFF) - level = 5; - - if (Algo == 0xFFFFFFFF) - Algo = (level >= 5 ? - kAlgo5 : - kAlgo1); - - if (NumPasses == 0xFFFFFFFF) - NumPasses = - (level >= 9 ? kPasses9 : - (level >= 7 ? kPasses7 : - kPasses1)); - if (Fb == 0xFFFFFFFF) - Fb = - (level >= 9 ? kFb9 : - (level >= 7 ? kFb7 : - kFb1)); -} - -HRESULT CDeflateProps::SetCoderProperties(ICompressSetCoderProperties *setCoderProperties) -{ - Normalize(); - - NWindows::NCOM::CPropVariant props[] = - { - Algo, - NumPasses, - Fb, - Mc - }; - PROPID propIDs[] = - { - NCoderPropID::kAlgorithm, - NCoderPropID::kNumPasses, - NCoderPropID::kNumFastBytes, - NCoderPropID::kMatchFinderCycles - }; - int numProps = sizeof(propIDs) / sizeof(propIDs[0]); - if (!McDefined) - numProps--; - return setCoderProperties->SetCoderProperties(propIDs, props, numProps); -} - -HRESULT CDeflateProps::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProps) -{ - Init(); - for (int i = 0; i < numProps; i++) - { - UString name = names[i]; - name.MakeUpper(); - if (name.IsEmpty()) - return E_INVALIDARG; - const PROPVARIANT &prop = values[i]; - if (name[0] == L'X') - { - UInt32 a = 9; - RINOK(ParsePropValue(name.Mid(1), prop, a)); - Level = a; - } - else if (name.Left(1) == L"A") - { - UInt32 a = kAlgo5; - RINOK(ParsePropValue(name.Mid(1), prop, a)); - Algo = a; - } - else if (name.Left(4) == L"PASS") - { - UInt32 a = kPasses9; - RINOK(ParsePropValue(name.Mid(4), prop, a)); - NumPasses = a; - } - else if (name.Left(2) == L"FB") - { - UInt32 a = kFb9; - RINOK(ParsePropValue(name.Mid(2), prop, a)); - Fb = a; - } - else if (name.Left(2) == L"MC") - { - UInt32 a = 0xFFFFFFFF; - RINOK(ParsePropValue(name.Mid(2), prop, a)); - Mc = a; - McDefined = true; - } - else - return E_INVALIDARG; - } - return S_OK; -} - -} |