diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2008-08-13 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:56 +0300 |
commit | 173c07e166fdf6fcd20f18ea73008f1b628945df (patch) | |
tree | 13ebea85cdc4c16ae93714ff0627ee9f91ad7e08 /CPP/7zip/Archive/GZip | |
parent | 3901bf0ab88106a5b031cba7bc18d60cdebf7eef (diff) |
4.59 beta
Diffstat (limited to 'CPP/7zip/Archive/GZip')
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipHandler.cpp | 56 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipHandler.h | 4 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipHandlerOut.cpp | 46 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipHeader.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipHeader.h | 12 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipIn.cpp | 6 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipItem.h | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipRegister.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipUpdate.cpp | 23 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/GZipUpdate.h | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/StdAfx.cpp | 3 | ||||
-rwxr-xr-x | CPP/7zip/Archive/GZip/gz.ico | bin | 3638 -> 0 bytes |
12 files changed, 64 insertions, 94 deletions
diff --git a/CPP/7zip/Archive/GZip/GZipHandler.cpp b/CPP/7zip/Archive/GZip/GZipHandler.cpp index 48d85fa4..96ae85f1 100755 --- a/CPP/7zip/Archive/GZip/GZipHandler.cpp +++ b/CPP/7zip/Archive/GZip/GZipHandler.cpp @@ -22,7 +22,7 @@ namespace NGZip { static const CMethodId kMethodId_Deflate = 0x040108; -const wchar_t *kHostOS[] = +const wchar_t *kHostOS[] = { L"FAT", L"AMIGA", @@ -34,14 +34,14 @@ const wchar_t *kHostOS[] = L"Mac", L"Z_System", L"CPM", - L"TOPS20", // pkzip 2.50 NTFS - L"NTFS", // filesystem used by Windows NT + L"TOPS20", // pkzip 2.50 NTFS + L"NTFS", // filesystem used by Windows NT L"QDOS ", // SMS/QDOS L"Acorn", // Archimedes Acorn RISC OS L"VFAT", // filesystem used by Windows 95, NT L"MVS", L"BeOS", // hybrid POSIX/database filesystem - // BeBOX or PowerMac + // BeBOX or PowerMac L"Tandem", L"THEOS" }; @@ -59,16 +59,14 @@ enum // PropID }; */ -STATPROPSTG kProps[] = +STATPROPSTG kProps[] = { { NULL, kpidPath, VT_BSTR}, { NULL, kpidSize, VT_UI8}, - { NULL, kpidPackedSize, VT_UI8}, - - { NULL, kpidLastWriteTime, VT_FILETIME}, + { NULL, kpidPackSize, VT_UI8}, + { NULL, kpidMTime, VT_FILETIME}, // { NULL, kpidMethod, VT_UI1}, { NULL, kpidHostOS, VT_BSTR}, - { NULL, kpidCRC, VT_UI4} // { L"Extra", kpidExtraIsPresent, VT_BOOL} // { L"Extra flags", kpidExtraFlags, VT_UI1}, @@ -94,7 +92,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIA if (m_Item.NameIsPresent()) prop = MultiByteToUnicodeString(m_Item.Name, CP_ACP); break; - case kpidLastWriteTime: + case kpidMTime: { FILETIME utcTime; if (m_Item.Time != 0) @@ -109,35 +107,19 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIA } break; } - case kpidSize: - prop = UInt64(m_Item.UnPackSize32); - break; - case kpidPackedSize: - prop = m_PackSize; - break; - case kpidCommented: - prop = m_Item.CommentIsPresent(); - break; + case kpidSize: prop = UInt64(m_Item.UnPackSize32); break; + case kpidPackSize: prop = m_PackSize; break; + case kpidCommented: prop = m_Item.CommentIsPresent(); break; case kpidHostOS: prop = (m_Item.HostOS < kNumHostOSes) ? kHostOS[m_Item.HostOS] : kUnknownOS; break; - case kpidMethod: - prop = m_Item.CompressionMethod; - break; - case kpidCRC: - prop = m_Item.FileCRC; - break; + case kpidMethod: prop = m_Item.CompressionMethod; break; + case kpidCRC: prop = m_Item.FileCRC; break; /* - case kpidExtraFlags: - prop = m_Item.ExtraFlags; - break; - case kpidIsText: - prop = m_Item.IsText(); - break; - case kpidExtraIsPresent: - prop = m_Item.ExtraFieldIsPresent(); - break; + case kpidExtraFlags: prop = m_Item.ExtraFlags; break; + case kpidIsText: prop = m_Item.IsText(); break; + case kpidExtraIsPresent: prop = m_Item.ExtraFieldIsPresent(); break; */ } prop.Detach(value); @@ -145,7 +127,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIA COM_TRY_END } -STDMETHODIMP CHandler::Open(IInStream *inStream, +STDMETHODIMP CHandler::Open(IInStream *inStream, const UInt64 * /* maxCheckStartPosition */, IArchiveOpenCallback * /* openArchiveCallback */) { @@ -155,7 +137,7 @@ STDMETHODIMP CHandler::Open(IInStream *inStream, CInArchive archive; RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition)); RINOK(archive.ReadHeader(inStream, m_Item)); - m_DataOffset = archive.GetOffset(); + m_DataOffset = archive.GetOffset(); UInt64 newPosition; RINOK(inStream->Seek(-8, STREAM_SEEK_END, &newPosition)); m_PackSize = newPosition - (m_StreamStartPosition + m_DataOffset); @@ -274,7 +256,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems, } CMyComPtr<ICompressGetInStreamProcessedSize> getInStreamProcessedSize; - RINOK(deflateDecoder.QueryInterface(IID_ICompressGetInStreamProcessedSize, + RINOK(deflateDecoder.QueryInterface(IID_ICompressGetInStreamProcessedSize, &getInStreamProcessedSize)); UInt64 packSize; RINOK(getInStreamProcessedSize->GetInStreamProcessedSize(&packSize)); diff --git a/CPP/7zip/Archive/GZip/GZipHandler.h b/CPP/7zip/Archive/GZip/GZipHandler.h index 3f5a1acd..49a01a8d 100755 --- a/CPP/7zip/Archive/GZip/GZipHandler.h +++ b/CPP/7zip/Archive/GZip/GZipHandler.h @@ -15,7 +15,7 @@ namespace NArchive { namespace NGZip { -class CHandler: +class CHandler: public IInArchive, public IOutArchive, public ISetProperties, @@ -53,7 +53,7 @@ private: void InitMethodProperties() { m_Method.NumMatchFinderCyclesDefined = false; - m_Level = m_Method.NumPasses = m_Method.NumFastBytes = + 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 f2776adb..1fb1547d 100755 --- a/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp +++ b/CPP/7zip/Archive/GZip/GZipHandlerOut.cpp @@ -9,7 +9,6 @@ #include "Common/StringToInt.h" #include "Windows/Time.h" -#include "Windows/FileFind.h" #include "Windows/PropVariant.h" #include "../../Compress/Copy/CopyCoder.h" @@ -65,23 +64,11 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt newItem.Flags = 0; if (IntToBool(newProperties)) { - UInt32 attributes; FILETIME utcTime; UString name; - bool isDirectory; { NCOM::CPropVariant prop; - RINOK(updateCallback->GetProperty(itemIndex, kpidAttributes, &prop)); - if (prop.vt == VT_EMPTY) - attributes = 0; - else if (prop.vt != VT_UI4) - return E_INVALIDARG; - else - attributes = prop.ulVal; - } - { - NCOM::CPropVariant prop; - RINOK(updateCallback->GetProperty(itemIndex, kpidLastWriteTime, &prop)); + RINOK(updateCallback->GetProperty(itemIndex, kpidMTime, &prop)); if (prop.vt != VT_FILETIME) return E_INVALIDARG; utcTime = prop.filetime; @@ -98,16 +85,15 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt } { NCOM::CPropVariant prop; - RINOK(updateCallback->GetProperty(itemIndex, kpidIsFolder, &prop)); - if (prop.vt == VT_EMPTY) - isDirectory = false; - else if (prop.vt != VT_BOOL) + RINOK(updateCallback->GetProperty(itemIndex, kpidIsDir, &prop)); + if (prop.vt == VT_BOOL) + { + if (prop.boolVal != VARIANT_FALSE) + return E_INVALIDARG; + } + else if (prop.vt != VT_EMPTY) return E_INVALIDARG; - else - isDirectory = (prop.boolVal != VARIANT_FALSE); } - if (isDirectory || NFile::NFind::NAttributes::IsDirectory(attributes)) - return E_INVALIDARG; if(!FileTimeToUnixTime(utcTime, newItem.Time)) return E_INVALIDARG; newItem.Name = UnicodeStringToMultiByte(name, CP_ACP); @@ -133,17 +119,17 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt if (level == 0xFFFFFFFF) level = 5; if (m_Method.NumPasses == 0xFFFFFFFF) - m_Method.NumPasses = (level >= 9 ? kNumPassesX9 : - (level >= 7 ? kNumPassesX7 : + m_Method.NumPasses = (level >= 9 ? kNumPassesX9 : + (level >= 7 ? kNumPassesX7 : kNumPassesX1)); if (m_Method.NumFastBytes == 0xFFFFFFFF) - m_Method.NumFastBytes = (level >= 9 ? kNumFastBytesX9 : - (level >= 7 ? kNumFastBytesX7 : + m_Method.NumFastBytes = (level >= 9 ? kNumFastBytesX9 : + (level >= 7 ? kNumFastBytesX7 : kNumFastBytesX1)); if (m_Method.Algo == 0xFFFFFFFF) - m_Method.Algo = - (level >= 5 ? kAlgoX5 : - kAlgoX1); + m_Method.Algo = + (level >= 5 ? kAlgoX5 : + kAlgoX1); return UpdateArchive( EXTERNAL_CODECS_VARS @@ -210,6 +196,6 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v return E_INVALIDARG; } return S_OK; -} +} }} diff --git a/CPP/7zip/Archive/GZip/GZipHeader.cpp b/CPP/7zip/Archive/GZip/GZipHeader.cpp index 5e697fa9..88b34e86 100755 --- a/CPP/7zip/Archive/GZip/GZipHeader.cpp +++ b/CPP/7zip/Archive/GZip/GZipHeader.cpp @@ -12,7 +12,7 @@ extern UInt16 kSignature = 0x8B1F + 1; static class CMarkersInitializer { public: - CMarkersInitializer() + CMarkersInitializer() { kSignature--; } } g_MarkerInitializer; diff --git a/CPP/7zip/Archive/GZip/GZipHeader.h b/CPP/7zip/Archive/GZip/GZipHeader.h index e83548eb..010a60aa 100755 --- a/CPP/7zip/Archive/GZip/GZipHeader.h +++ b/CPP/7zip/Archive/GZip/GZipHeader.h @@ -25,7 +25,7 @@ namespace NFileHeader }; */ - namespace NFlags + namespace NFlags { const int kDataIsText = 1 << 0; const int kHeaderCRCIsPresent = 1 << 1; @@ -34,7 +34,7 @@ namespace NFileHeader const int kComentIsPresent = 1 << 4; } - namespace NExtraFlags + namespace NExtraFlags { enum EEnum { @@ -52,7 +52,7 @@ namespace NFileHeader { enum EEnum { - kFAT = 0, // filesystem used by MS-DOS, OS/2, Win32 + kFAT = 0, // filesystem used by MS-DOS, OS/2, Win32 // pkzip 2.50 (FAT / VFAT / FAT32 file systems) kAMIGA = 1, kVMS = 2, // VAX/VMS @@ -63,14 +63,14 @@ namespace NFileHeader kMac = 7, kZ_System = 8, kCPM = 9, - kTOPS20 = 10, // pkzip 2.50 NTFS - kNTFS = 11, // filesystem used by Windows NT + kTOPS20 = 10, // pkzip 2.50 NTFS + kNTFS = 11, // filesystem used by Windows NT kQDOS = 12, // SMS/QDOS kAcorn = 13, // Archimedes Acorn RISC OS kVFAT = 14, // filesystem used by Windows 95, NT kMVS = 15, kBeOS = 16, // hybrid POSIX/database filesystem - // BeBOX or PowerMac + // BeBOX or PowerMac kTandem = 17, kTHEOS = 18, diff --git a/CPP/7zip/Archive/GZip/GZipIn.cpp b/CPP/7zip/Archive/GZip/GZipIn.cpp index 33b0ac47..d754c045 100755 --- a/CPP/7zip/Archive/GZip/GZipIn.cpp +++ b/CPP/7zip/Archive/GZip/GZipIn.cpp @@ -10,9 +10,9 @@ #include "../../Common/StreamUtils.h" -extern "C" -{ - #include "../../../../C/7zCrc.h" +extern "C" +{ + #include "../../../../C/7zCrc.h" } namespace NArchive { diff --git a/CPP/7zip/Archive/GZip/GZipItem.h b/CPP/7zip/Archive/GZip/GZipItem.h index cd5e59f0..678962a9 100755 --- a/CPP/7zip/Archive/GZip/GZipItem.h +++ b/CPP/7zip/Archive/GZip/GZipItem.h @@ -39,7 +39,7 @@ public: { return TestFlag(NFileHeader::NFlags::kComentIsPresent); } void SetNameIsPresentFlag(bool nameIsPresent) - { + { if (nameIsPresent) Flags |= NFileHeader::NFlags::kNameIsPresent; else diff --git a/CPP/7zip/Archive/GZip/GZipRegister.cpp b/CPP/7zip/Archive/GZip/GZipRegister.cpp index e293cfc3..b4bc6ded 100755 --- a/CPP/7zip/Archive/GZip/GZipRegister.cpp +++ b/CPP/7zip/Archive/GZip/GZipRegister.cpp @@ -13,6 +13,6 @@ static IOutArchive *CreateArcOut() { return new NArchive::NGZip::CHandler; } #endif static CArcInfo g_ArcInfo = - { L"GZip", L"gz gzip tgz tpz", L"* * .tar .tar", 0xEF, { 0x1F, 0x8B }, 2, true, CreateArc, CreateArcOut }; + { L"GZip", L"gz gzip tgz tpz", L"* * .tar .tar", 0xEF, { 0x1F, 0x8B, 8 }, 3, true, CreateArc, CreateArcOut }; REGISTER_ARC(GZip) diff --git a/CPP/7zip/Archive/GZip/GZipUpdate.cpp b/CPP/7zip/Archive/GZip/GZipUpdate.cpp index 1f5ebd0e..8f8a2c4f 100755 --- a/CPP/7zip/Archive/GZip/GZipUpdate.cpp +++ b/CPP/7zip/Archive/GZip/GZipUpdate.cpp @@ -22,11 +22,16 @@ namespace NGZip { static const CMethodId kMethodId_Deflate = 0x040108; -static const Byte kHostOS = NFileHeader::NHostOS::kFAT; +static const Byte kHostOS = + #ifdef _WIN32 + NFileHeader::NHostOS::kFAT; + #else + NFileHeader::NHostOS::kUnix; + #endif HRESULT UpdateArchive( DECL_EXTERNAL_CODECS_LOC_VARS - IInStream * /* inStream */, + IInStream * /* inStream */, UInt64 unpackSize, ISequentialOutStream *outStream, const CItem &newItem, @@ -73,17 +78,17 @@ HRESULT UpdateArchive( if (!deflateEncoder) return E_NOTIMPL; - NWindows::NCOM::CPropVariant properties[] = - { - compressionMethod.Algo, - compressionMethod.NumPasses, + NWindows::NCOM::CPropVariant properties[] = + { + compressionMethod.Algo, + compressionMethod.NumPasses, compressionMethod.NumFastBytes, compressionMethod.NumMatchFinderCycles }; - PROPID propIDs[] = - { + PROPID propIDs[] = + { NCoderPropID::kAlgorithm, - NCoderPropID::kNumPasses, + NCoderPropID::kNumPasses, NCoderPropID::kNumFastBytes, NCoderPropID::kMatchFinderCycles }; diff --git a/CPP/7zip/Archive/GZip/GZipUpdate.h b/CPP/7zip/Archive/GZip/GZipUpdate.h index 27a396bf..231d7972 100755 --- a/CPP/7zip/Archive/GZip/GZipUpdate.h +++ b/CPP/7zip/Archive/GZip/GZipUpdate.h @@ -24,7 +24,7 @@ struct CCompressionMethodMode HRESULT UpdateArchive( DECL_EXTERNAL_CODECS_LOC_VARS - IInStream *inStream, + IInStream *inStream, UInt64 unpackSize, ISequentialOutStream *outStream, const CItem &newItem, diff --git a/CPP/7zip/Archive/GZip/StdAfx.cpp b/CPP/7zip/Archive/GZip/StdAfx.cpp deleted file mode 100755 index d0feea85..00000000 --- a/CPP/7zip/Archive/GZip/StdAfx.cpp +++ /dev/null @@ -1,3 +0,0 @@ -// StdAfx.cpp - -#include "StdAfx.h" diff --git a/CPP/7zip/Archive/GZip/gz.ico b/CPP/7zip/Archive/GZip/gz.ico Binary files differdeleted file mode 100755 index f50d8c08..00000000 --- a/CPP/7zip/Archive/GZip/gz.ico +++ /dev/null |