Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Archive/Zip/ZipHandlerOut.cpp')
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandlerOut.cpp39
1 files changed, 11 insertions, 28 deletions
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;
}