From 76b173af78d09dea806d3ed35c0f67a09b496357 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Wed, 24 Mar 2010 00:00:00 +0000 Subject: 9.12 --- CPP/7zip/Archive/Zip/ZipAddCommon.cpp | 4 ++-- CPP/7zip/Archive/Zip/ZipHandlerOut.cpp | 39 ++++++++++------------------------ 2 files changed, 13 insertions(+), 30 deletions(-) (limited to 'CPP/7zip/Archive/Zip') diff --git a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp index 7fed3cab..3451e3f1 100755 --- a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +++ b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp @@ -244,14 +244,14 @@ HRESULT CAddCommon::Compress( _compressEncoder = encoder; NWindows::NCOM::CPropVariant props[] = { - // _options.Algo, + _options.Algo, _options.MemSize, _options.Order }; PROPID propIDs[] = { - // NCoderPropID::kAlgorithm, + NCoderPropID::kAlgorithm, NCoderPropID::kUsedMemorySize, NCoderPropID::kOrder }; diff --git a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp index b190dd2f..fa7a4480 100755 --- a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +++ b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp @@ -51,18 +51,6 @@ static const UInt32 kLzmaDicSizeX5 = 1 << 24; static const UInt32 kLzmaDicSizeX7 = 1 << 25; static const UInt32 kLzmaDicSizeX9 = 1 << 26; -static const UInt32 kPpmdMemSizeX1 = (1 << 20); -static const UInt32 kPpmdMemSizeX3 = (1 << 22); -static const UInt32 kPpmdMemSizeX5 = (1 << 24); -static const UInt32 kPpmdMemSizeX7 = (1 << 26); -static const UInt32 kPpmdMemSizeX9 = (1 << 27); - -static const UInt32 kPpmdOrderX1 = 4; -static const UInt32 kPpmdOrderX3 = 6; -static const UInt32 kPpmdOrderX5 = 8; -static const UInt32 kPpmdOrderX7 = 10; -static const UInt32 kPpmdOrderX9 = 16; - static const UInt32 kBZip2NumPassesX1 = 1; static const UInt32 kBZip2NumPassesX7 = 2; static const UInt32 kBZip2NumPassesX9 = 7; @@ -362,23 +350,18 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt } if (mainMethod == NFileHeader::NCompressionMethod::kPPMd) { + int level2 = level; + if (level2 < 1) level2 = 1; + if (level2 > 9) level2 = 9; + if (options.MemSize == 0xFFFFFFFF) - options.MemSize = - (level >= 9 ? kPpmdMemSizeX9 : - (level >= 7 ? kPpmdMemSizeX7 : - (level >= 5 ? kPpmdMemSizeX5 : - (level >= 3 ? kPpmdMemSizeX3 : - kPpmdMemSizeX1)))); + options.MemSize = (1 << (19 + (level2 > 8 ? 8 : level2))); if (options.Order == 0xFFFFFFFF) - options.Order = - (level >= 9 ? kPpmdOrderX9 : - (level >= 7 ? kPpmdOrderX7 : - (level >= 5 ? kPpmdOrderX5 : - (level >= 3 ? kPpmdOrderX3 : - kPpmdOrderX1)))); - - options.Algo = 0; + options.Order = 3 + level2; + + if (options.Algo == 0xFFFFFFFF) + options.Algo = (level2 >= 7 ? 1 : 0); } return Update( @@ -482,13 +465,13 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v } else if (name.Left(3) == L"MEM") { - UInt32 memSize = kPpmdMemSizeX5; + UInt32 memSize = 1 << 24; RINOK(ParsePropDictionaryValue(name.Mid(3), prop, memSize)); m_MemSize = memSize; } else if (name[0] == L'O') { - UInt32 order = kPpmdOrderX5; + UInt32 order = 8; RINOK(ParsePropValue(name.Mid(1), prop, order)); m_Order = order; } -- cgit v1.2.3