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:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2007-05-25 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:51 +0300
commitc574fc0f4bba94e693b0e22f730d355b75d4f4ce (patch)
treeda4ebd90c776d508ac679d50492f29461db80be0 /CPP/7zip/Archive/GZip
parenta145bfc7cf17f7bbcfae8f0064333c8ea75b455c (diff)
4.46 beta
Diffstat (limited to 'CPP/7zip/Archive/GZip')
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipHandler.h6
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipHandlerOut.cpp13
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipIn.cpp4
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipUpdate.cpp2
-rwxr-xr-xCPP/7zip/Archive/GZip/GZipUpdate.h1
5 files changed, 21 insertions, 5 deletions
diff --git a/CPP/7zip/Archive/GZip/GZipHandler.h b/CPP/7zip/Archive/GZip/GZipHandler.h
index ace3c657..c1f8968b 100755
--- a/CPP/7zip/Archive/GZip/GZipHandler.h
+++ b/CPP/7zip/Archive/GZip/GZipHandler.h
@@ -23,8 +23,7 @@ class CHandler:
public CMyUnknownImp
{
public:
- MY_QUERYINTERFACE_BEGIN
- MY_QUERYINTERFACE_ENTRY(IInArchive)
+ MY_QUERYINTERFACE_BEGIN2(IInArchive)
MY_QUERYINTERFACE_ENTRY(IOutArchive)
MY_QUERYINTERFACE_ENTRY(ISetProperties)
QUERY_ENTRY_ISetCompressCodecsInfo
@@ -79,7 +78,8 @@ private:
void InitMethodProperties()
{
m_Method.NumMatchFinderCyclesDefined = false;
- m_Level = m_Method.NumPasses = m_Method.NumFastBytes = m_Method.NumMatchFinderCycles = 0xFFFFFFFF;
+ m_Level = m_Method.NumPasses = m_Method.NumFastBytes =
+ m_Method.NumMatchFinderCycles = m_Method.Algo = 0xFFFFFFFF;
}
};
diff --git a/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp b/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp
index 906a324a..76cfd642 100755
--- a/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp
+++ b/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp
@@ -21,6 +21,9 @@ using namespace NTime;
namespace NArchive {
namespace NGZip {
+static const UInt32 kAlgoX1 = 0;
+static const UInt32 kAlgoX5 = 1;
+
static const UInt32 kNumPassesX1 = 1;
static const UInt32 kNumPassesX7 = 3;
static const UInt32 kNumPassesX9 = 10;
@@ -137,6 +140,10 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
m_Method.NumFastBytes = (level >= 9 ? kNumFastBytesX9 :
(level >= 7 ? kNumFastBytesX7 :
kNumFastBytesX1));
+ if (m_Method.Algo == 0xFFFFFFFF)
+ m_Method.Algo =
+ (level >= 5 ? kAlgoX5 :
+ kAlgoX1);
return UpdateArchive(
EXTERNAL_CODECS_VARS
@@ -193,6 +200,12 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
m_Method.NumMatchFinderCycles = num;
m_Method.NumMatchFinderCyclesDefined = true;
}
+ else if (name.Left(1) == L"A")
+ {
+ UInt32 num = kAlgoX5;
+ RINOK(ParsePropValue(name.Mid(1), prop, num));
+ m_Method.Algo = num;
+ }
else
return E_INVALIDARG;
}
diff --git a/CPP/7zip/Archive/GZip/GZipIn.cpp b/CPP/7zip/Archive/GZip/GZipIn.cpp
index 69eb491e..44ed62f6 100755
--- a/CPP/7zip/Archive/GZip/GZipIn.cpp
+++ b/CPP/7zip/Archive/GZip/GZipIn.cpp
@@ -30,9 +30,9 @@ HRESULT CInArchive::ReadBytes(ISequentialInStream *inStream, void *data, UInt32
HRESULT CInArchive::ReadByte(ISequentialInStream *inStream, Byte &value, UInt32 &crc)
{
- HRESULT res = ReadBytes(inStream, &value, 1);
+ RINOK(ReadBytes(inStream, &value, 1));
crc = CRC_UPDATE_BYTE(crc, value);
- return res;
+ return S_OK;
}
HRESULT CInArchive::ReadUInt16(ISequentialInStream *inStream, UInt16 &value, UInt32 &crc)
diff --git a/CPP/7zip/Archive/GZip/GZipUpdate.cpp b/CPP/7zip/Archive/GZip/GZipUpdate.cpp
index c9567245..17e27c9f 100755
--- a/CPP/7zip/Archive/GZip/GZipUpdate.cpp
+++ b/CPP/7zip/Archive/GZip/GZipUpdate.cpp
@@ -83,12 +83,14 @@ HRESULT UpdateArchive(
NWindows::NCOM::CPropVariant properties[] =
{
+ compressionMethod.Algo,
compressionMethod.NumPasses,
compressionMethod.NumFastBytes,
compressionMethod.NumMatchFinderCycles
};
PROPID propIDs[] =
{
+ NCoderPropID::kAlgorithm,
NCoderPropID::kNumPasses,
NCoderPropID::kNumFastBytes,
NCoderPropID::kMatchFinderCycles
diff --git a/CPP/7zip/Archive/GZip/GZipUpdate.h b/CPP/7zip/Archive/GZip/GZipUpdate.h
index 7ab92848..27a396bf 100755
--- a/CPP/7zip/Archive/GZip/GZipUpdate.h
+++ b/CPP/7zip/Archive/GZip/GZipUpdate.h
@@ -17,6 +17,7 @@ struct CCompressionMethodMode
{
UInt32 NumPasses;
UInt32 NumFastBytes;
+ UInt32 Algo;
bool NumMatchFinderCyclesDefined;
UInt32 NumMatchFinderCycles;
};