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>2018-12-30 17:01:47 +0300
committerKornel <kornel@geekhood.net>2018-12-30 17:01:47 +0300
commit5b2a99c548a6c9c90d4cc63cddca29af009c2479 (patch)
treefb4af843548b762bdb6cc8dc2ec65457a9fdf7da /CPP/7zip/Archive/Zip
parent18dc2b41613055f0daf7f6a1d4311368798ea12a (diff)
18.0618.06
Diffstat (limited to 'CPP/7zip/Archive/Zip')
-rw-r--r--CPP/7zip/Archive/Zip/ZipHandler.cpp8
-rw-r--r--CPP/7zip/Archive/Zip/ZipIn.cpp21
-rw-r--r--CPP/7zip/Archive/Zip/ZipIn.h6
-rw-r--r--CPP/7zip/Archive/Zip/ZipItem.h14
-rw-r--r--CPP/7zip/Archive/Zip/ZipUpdate.cpp5
5 files changed, 49 insertions, 5 deletions
diff --git a/CPP/7zip/Archive/Zip/ZipHandler.cpp b/CPP/7zip/Archive/Zip/ZipHandler.cpp
index 494b9d70..a4794f51 100644
--- a/CPP/7zip/Archive/Zip/ZipHandler.cpp
+++ b/CPP/7zip/Archive/Zip/ZipHandler.cpp
@@ -599,8 +599,12 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
case kpidHostOS:
{
- const Byte hostOS = item.GetHostOS();
- TYPE_TO_PROP(kHostOS, hostOS, prop);
+ if (item.FromCentral)
+ {
+ // 18.06: now we use HostOS only from Central::MadeByVersion
+ const Byte hostOS = item.MadeByVersion.HostOS;
+ TYPE_TO_PROP(kHostOS, hostOS, prop);
+ }
break;
}
diff --git a/CPP/7zip/Archive/Zip/ZipIn.cpp b/CPP/7zip/Archive/Zip/ZipIn.cpp
index aa7184af..509753c2 100644
--- a/CPP/7zip/Archive/Zip/ZipIn.cpp
+++ b/CPP/7zip/Archive/Zip/ZipIn.cpp
@@ -155,6 +155,7 @@ void CInArchive::Close()
HeadersError = false;
HeadersWarning = false;
ExtraMinorError = false;
+
UnexpectedEnd = false;
LocalsWereRead = false;
LocalsCenterMerged = false;
@@ -1729,6 +1730,9 @@ HRESULT CInArchive::FindCd(bool checkOffsetMode)
HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, const CCdInfo &cdInfo, UInt64 cdOffset, UInt64 cdSize)
{
items.Clear();
+
+ // _startLocalFromCd_Disk = (UInt32)(Int32)-1;
+ // _startLocalFromCd_Offset = (UInt64)(Int64)-1;
RINOK(SeekToVol(IsMultiVol ? cdInfo.CdDisk : -1, cdOffset));
@@ -1752,6 +1756,17 @@ HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, const CCdInfo &cdIn
{
CItemEx cdItem;
RINOK(ReadCdItem(cdItem));
+
+ /*
+ if (cdItem.Disk < _startLocalFromCd_Disk ||
+ cdItem.Disk == _startLocalFromCd_Disk &&
+ cdItem.LocalHeaderPos < _startLocalFromCd_Offset)
+ {
+ _startLocalFromCd_Disk = cdItem.Disk;
+ _startLocalFromCd_Offset = cdItem.LocalHeaderPos;
+ }
+ */
+
items.Add(cdItem);
}
if (Callback && (items.Size() & 0xFFF) == 0)
@@ -2509,6 +2524,8 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items)
{
ArcInfo.CdWasRead = true;
ArcInfo.FirstItemRelatOffset = items[0].LocalHeaderPos;
+
+ // ArcInfo.FirstItemRelatOffset = _startLocalFromCd_Offset;
}
}
}
@@ -2535,6 +2552,10 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items)
items.Clear();
localsWereRead = true;
+ HeadersError = false;
+ HeadersWarning = false;
+ ExtraMinorError = false;
+
// we can use any mode: with buffer and without buffer
// without buffer : skips packed data : fast for big files : slow for small files
// with buffer : reads packed data : slow for big files : fast for small files
diff --git a/CPP/7zip/Archive/Zip/ZipIn.h b/CPP/7zip/Archive/Zip/ZipIn.h
index 88f29569..f46f1f07 100644
--- a/CPP/7zip/Archive/Zip/ZipIn.h
+++ b/CPP/7zip/Archive/Zip/ZipIn.h
@@ -250,6 +250,9 @@ class CInArchive
UInt64 _streamPos;
UInt64 _cnt;
+ // UInt32 _startLocalFromCd_Disk;
+ // UInt64 _startLocalFromCd_Offset;
+
size_t GetAvail() const { return _bufCached - _bufPos; }
void InitBuf() { _bufPos = 0; _bufCached = 0; }
@@ -383,6 +386,9 @@ public:
UInt64 GetEmbeddedStubSize() const
{
+ // it's possible that first item in CD doesn refers to first local item
+ // so FirstItemRelatOffset is not first local item
+
if (ArcInfo.CdWasRead)
return ArcInfo.FirstItemRelatOffset;
if (IsMultiVol)
diff --git a/CPP/7zip/Archive/Zip/ZipItem.h b/CPP/7zip/Archive/Zip/ZipItem.h
index 78e3e01c..e5769711 100644
--- a/CPP/7zip/Archive/Zip/ZipItem.h
+++ b/CPP/7zip/Archive/Zip/ZipItem.h
@@ -214,6 +214,12 @@ class CLocalItem
public:
UInt16 Flags;
UInt16 Method;
+
+ /*
+ Zip specification doesn't mention that ExtractVersion field uses HostOS subfield.
+ 18.06: 7-Zip now doesn't use ExtractVersion::HostOS to detect codePage
+ */
+
CVersion ExtractVersion;
UInt64 Size;
@@ -309,7 +315,8 @@ public:
UInt32 GetWinAttrib() const;
bool GetPosixAttrib(UInt32 &attrib) const;
- Byte GetHostOS() const { return FromCentral ? MadeByVersion.HostOS : ExtractVersion.HostOS; }
+ // 18.06: 0 instead of ExtractVersion.HostOS for local item
+ Byte GetHostOS() const { return FromCentral ? MadeByVersion.HostOS : (Byte)0; }
void GetUnicodeString(UString &res, const AString &s, bool isComment, bool useSpecifiedCodePage, UINT codePage) const;
@@ -326,7 +333,10 @@ public:
UINT GetCodePage() const
{
- Byte hostOS = GetHostOS();
+ // 18.06: now we use HostOS only from Central::MadeByVersion
+ if (!FromCentral)
+ return CP_OEMCP;
+ Byte hostOS = MadeByVersion.HostOS;
return (UINT)((
hostOS == NFileHeader::NHostOS::kFAT
|| hostOS == NFileHeader::NHostOS::kNTFS
diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp
index 2289203b..e65c2b8b 100644
--- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp
+++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp
@@ -40,7 +40,10 @@ static const Byte kHostOS =
#endif
static const Byte kMadeByHostOS = kHostOS;
-static const Byte kExtractHostOS = kHostOS;
+
+// 18.06: now we always write zero to high byte of ExtractVersion field.
+// Previous versions of p7zip wrote (NFileHeader::NHostOS::kUnix) there, that is not correct
+static const Byte kExtractHostOS = 0;
static const Byte kMethodForDirectory = NFileHeader::NCompressionMethod::kStore;