From bd1fa36322ac27f5715433b388742893d6524516 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Thu, 6 Dec 2007 00:00:00 +0000 Subject: 4.57 --- CPP/7zip/Archive/Zip/ZipHeader.h | 1 + CPP/7zip/Archive/Zip/ZipIn.cpp | 20 +++++++++++++++++--- CPP/7zip/Archive/Zip/ZipIn.h | 1 + CPP/7zip/Archive/Zip/ZipItemEx.h | 5 +++++ CPP/7zip/Archive/Zip/ZipUpdate.cpp | 5 ++++- 5 files changed, 28 insertions(+), 4 deletions(-) (limited to 'CPP/7zip/Archive/Zip') diff --git a/CPP/7zip/Archive/Zip/ZipHeader.h b/CPP/7zip/Archive/Zip/ZipHeader.h index 8ce2718a..98ad17a3 100755 --- a/CPP/7zip/Archive/Zip/ZipHeader.h +++ b/CPP/7zip/Archive/Zip/ZipHeader.h @@ -109,6 +109,7 @@ namespace NFileHeader */ const UInt32 kDataDescriptorSize = 16; + // const UInt32 kDataDescriptor64Size = 16 + 8; /* struct CDataDescriptor { diff --git a/CPP/7zip/Archive/Zip/ZipIn.cpp b/CPP/7zip/Archive/Zip/ZipIn.cpp index bf3764f7..b579f9b4 100755 --- a/CPP/7zip/Archive/Zip/ZipIn.cpp +++ b/CPP/7zip/Archive/Zip/ZipIn.cpp @@ -437,8 +437,21 @@ HRESULT CInArchive::ReadLocalItemAfterCdItemFull(CItemEx &item) if (ReadUInt32() != NSignature::kDataDescriptor) return S_FALSE; UInt32 crc = ReadUInt32(); - UInt32 packSize = ReadUInt32(); - UInt32 unpackSize = ReadUInt32(); + UInt64 packSize, unpackSize; + + /* + if (IsZip64) + { + packSize = ReadUInt64(); + unpackSize = ReadUInt64(); + } + else + */ + { + packSize = ReadUInt32(); + unpackSize = ReadUInt32(); + } + if (crc != item.FileCRC || item.PackSize != packSize || item.UnPackSize != unpackSize) return S_FALSE; } @@ -681,6 +694,7 @@ HRESULT CInArchive::ReadHeaders(CObjectVector &items, CProgressVirt *pr // kEndOfCentralDirSignature // m_Position points to next byte after signature + IsZip64 = false; items.Clear(); if (progress != 0) { @@ -722,7 +736,7 @@ HRESULT CInArchive::ReadHeaders(CObjectVector &items, CProgressVirt *pr UInt64 zip64EcdStartOffset = m_Position - 4 - m_ArchiveInfo.Base; if(m_Signature == NSignature::kZip64EndOfCentralDir) { - isZip64 = true; + IsZip64 = isZip64 = true; UInt64 recordSize = ReadUInt64(); /* UInt16 versionMade = */ ReadUInt16(); /* UInt16 versionNeedExtract = */ ReadUInt16(); diff --git a/CPP/7zip/Archive/Zip/ZipIn.h b/CPP/7zip/Archive/Zip/ZipIn.h index 62be592b..b5a5a3ef 100755 --- a/CPP/7zip/Archive/Zip/ZipIn.h +++ b/CPP/7zip/Archive/Zip/ZipIn.h @@ -95,6 +95,7 @@ class CInArchive HRESULT ReadLocalsAndCd(CObjectVector &items, CProgressVirt *progress, UInt64 &cdOffset); public: CInArchiveInfo m_ArchiveInfo; + bool IsZip64; HRESULT ReadHeaders(CObjectVector &items, CProgressVirt *progress); HRESULT ReadLocalItemAfterCdItem(CItemEx &item); diff --git a/CPP/7zip/Archive/Zip/ZipItemEx.h b/CPP/7zip/Archive/Zip/ZipItemEx.h index 3cacc0e7..0c5ba0ca 100755 --- a/CPP/7zip/Archive/Zip/ZipItemEx.h +++ b/CPP/7zip/Archive/Zip/ZipItemEx.h @@ -18,6 +18,11 @@ public: UInt64 GetLocalFullSize() const { return FileHeaderWithNameSize + LocalExtraSize + PackSize + (HasDescriptor() ? NFileHeader::kDataDescriptorSize : 0); }; + /* + UInt64 GetLocalFullSize(bool isZip64) const + { return FileHeaderWithNameSize + LocalExtraSize + PackSize + + (HasDescriptor() ? (isZip64 ? NFileHeader::kDataDescriptor64Size : NFileHeader::kDataDescriptorSize) : 0); }; + */ UInt64 GetLocalExtraPosition() const { return LocalHeaderPosition + FileHeaderWithNameSize; }; UInt64 GetDataPosition() const diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp index b08545c6..6cfa64e2 100755 --- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp +++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp @@ -267,6 +267,7 @@ void CMtProgressMixer2::Create(IProgress *progress, bool inSizeIsMain) void CMtProgressMixer2::SetProgressOffset(UInt64 progressOffset) { CriticalSection.Enter(); + InSizes[1] = OutSizes[1] = 0; ProgressOffset = progressOffset; CriticalSection.Leave(); } @@ -323,7 +324,9 @@ STDMETHODIMP CMtProgressMixer::SetRatioInfo(const UInt64 *inSize, const UInt64 * static HRESULT UpdateItemOldData(COutArchive &archive, IInStream *inStream, - const CUpdateItem &updateItem, CItemEx &item, ICompressProgressInfo *progress, + const CUpdateItem &updateItem, CItemEx &item, + /* bool izZip64, */ + ICompressProgressInfo *progress, UInt64 &complexity) { if (updateItem.NewProperties) -- cgit v1.2.3