This commit is contained in:
Igor Pavlov
2010-03-24 00:00:00 +00:00
committed by Kornel Lesiński
parent 993daef9cb
commit 76b173af78
15 changed files with 153 additions and 142 deletions

View File

@@ -450,6 +450,7 @@ struct CResItem
bool IsIcon() const { return Type == 3; }
bool IsString() const { return Type == 6; }
bool IsRcData() const { return Type == 10; }
bool IsRcDataOrUnknown() const { return IsRcData() || Type > 64; }
};
struct CStringItem
@@ -1410,7 +1411,7 @@ HRESULT CHandler::Open2(IInStream *stream, IArchiveOpenCallback *callback)
{
mixItem.ResourceIndex = j;
mixItem.StringIndex = -1;
if (item.IsRcData())
if (item.IsRcDataOrUnknown())
{
if (item.Size >= mainSize)
{

View File

@@ -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
};

View File

@@ -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.Order = 3 + level2;
options.Algo = 0;
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;
}