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>2008-08-13 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:56 +0300
commit173c07e166fdf6fcd20f18ea73008f1b628945df (patch)
tree13ebea85cdc4c16ae93714ff0627ee9f91ad7e08 /CPP/7zip/Archive/Zip
parent3901bf0ab88106a5b031cba7bc18d60cdebf7eef (diff)
4.59 beta
Diffstat (limited to 'CPP/7zip/Archive/Zip')
-rwxr-xr-xCPP/7zip/Archive/Zip/StdAfx.cpp3
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipAddCommon.cpp32
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipAddCommon.h2
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipCompressionMode.h12
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandler.cpp161
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandler.h11
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHandlerOut.cpp70
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHeader.cpp6
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipHeader.h17
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipIn.cpp342
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipIn.h23
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipItem.cpp41
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipItem.h30
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipItemEx.h12
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipOut.cpp2
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipUpdate.cpp193
-rwxr-xr-xCPP/7zip/Archive/Zip/ZipUpdate.h4
-rwxr-xr-xCPP/7zip/Archive/Zip/zip.icobin3638 -> 0 bytes
18 files changed, 483 insertions, 478 deletions
diff --git a/CPP/7zip/Archive/Zip/StdAfx.cpp b/CPP/7zip/Archive/Zip/StdAfx.cpp
deleted file mode 100755
index d0feea85..00000000
--- a/CPP/7zip/Archive/Zip/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp
index 0f76b04a..ca16ef97 100755
--- a/CPP/7zip/Archive/Zip/ZipAddCommon.cpp
+++ b/CPP/7zip/Archive/Zip/ZipAddCommon.cpp
@@ -2,8 +2,8 @@
#include "StdAfx.h"
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/7zCrc.h"
}
@@ -49,7 +49,7 @@ static HRESULT GetStreamCRC(ISequentialInStream *inStream, UInt32 &resultCRC)
HRESULT CAddCommon::Compress(
DECL_EXTERNAL_CODECS_LOC_VARS
- ISequentialInStream *inStream, IOutStream *outStream,
+ ISequentialInStream *inStream, IOutStream *outStream,
ICompressProgressInfo *progress, CCompressingResult &operationResult)
{
CSequentialInStreamWithCRC *inSecCrcStreamSpec = 0;
@@ -57,7 +57,7 @@ HRESULT CAddCommon::Compress(
CMyComPtr<ISequentialInStream> inCrcStream;
{
CMyComPtr<IInStream> inStream2;
- // we don't support stdin, since stream from stdin can require 64-bit size header
+ // we don't support stdin, since stream from stdin can require 64-bit size header
RINOK(inStream->QueryInterface(IID_IInStream, (void **)&inStream2));
if (inStream2)
{
@@ -149,10 +149,10 @@ HRESULT CAddCommon::Compress(
switch(method)
{
case NFileHeader::NCompressionMethod::kBZip2:
- methodId = kMethodId_BZip2;
+ methodId = kMethodId_BZip2;
break;
default:
- methodId = kMethodId_ZipBase + method;
+ methodId = kMethodId_ZipBase + method;
break;
}
RINOK(CreateCoder(
@@ -164,14 +164,14 @@ HRESULT CAddCommon::Compress(
if (method == NFileHeader::NCompressionMethod::kDeflated ||
method == NFileHeader::NCompressionMethod::kDeflated64)
{
- NWindows::NCOM::CPropVariant properties[] =
+ NWindows::NCOM::CPropVariant properties[] =
{
- _options.Algo,
- _options.NumPasses,
+ _options.Algo,
+ _options.NumPasses,
_options.NumFastBytes,
_options.NumMatchFinderCycles
};
- PROPID propIDs[] =
+ PROPID propIDs[] =
{
NCoderPropID::kAlgorithm,
NCoderPropID::kNumPasses,
@@ -187,18 +187,18 @@ HRESULT CAddCommon::Compress(
{
RINOK(setCoderProperties->SetCoderProperties(propIDs, properties, numProps));
}
- }
+ }
else if (method == NFileHeader::NCompressionMethod::kBZip2)
{
- NWindows::NCOM::CPropVariant properties[] =
+ NWindows::NCOM::CPropVariant properties[] =
{
- _options.DicSize,
+ _options.DicSize,
_options.NumPasses
#ifdef COMPRESS_MT
, _options.NumThreads
#endif
};
- PROPID propIDs[] =
+ PROPID propIDs[] =
{
NCoderPropID::kDictionarySize,
NCoderPropID::kNumPasses
@@ -240,11 +240,11 @@ HRESULT CAddCommon::Compress(
if (_options.PasswordIsDefined)
{
- if (operationResult.PackSize < operationResult.UnpackSize +
+ if (operationResult.PackSize < operationResult.UnpackSize +
(_options.IsAesMode ? _filterAesSpec->GetHeaderSize() : NCrypto::NZip::kHeaderSize))
break;
}
- else if (operationResult.PackSize < operationResult.UnpackSize)
+ else if (operationResult.PackSize < operationResult.UnpackSize)
break;
}
if (_options.IsAesMode)
diff --git a/CPP/7zip/Archive/Zip/ZipAddCommon.h b/CPP/7zip/Archive/Zip/ZipAddCommon.h
index 7bce0cbe..6c766037 100755
--- a/CPP/7zip/Archive/Zip/ZipAddCommon.h
+++ b/CPP/7zip/Archive/Zip/ZipAddCommon.h
@@ -48,7 +48,7 @@ public:
CAddCommon(const CCompressionMethodMode &options);
HRESULT Compress(
DECL_EXTERNAL_CODECS_LOC_VARS
- ISequentialInStream *inStream, IOutStream *outStream,
+ ISequentialInStream *inStream, IOutStream *outStream,
ICompressProgressInfo *progress, CCompressingResult &operationResult);
};
diff --git a/CPP/7zip/Archive/Zip/ZipCompressionMode.h b/CPP/7zip/Archive/Zip/ZipCompressionMode.h
index 37f22f77..ae29a5a4 100755
--- a/CPP/7zip/Archive/Zip/ZipCompressionMode.h
+++ b/CPP/7zip/Archive/Zip/ZipCompressionMode.h
@@ -26,12 +26,12 @@ struct CCompressionMethodMode
bool IsAesMode;
Byte AesKeyMode;
- CCompressionMethodMode():
- NumMatchFinderCyclesDefined(false),
- PasswordIsDefined(false),
- IsAesMode(false),
- AesKeyMode(3)
- {}
+ CCompressionMethodMode():
+ NumMatchFinderCyclesDefined(false),
+ PasswordIsDefined(false),
+ IsAesMode(false),
+ AesKeyMode(3)
+ {}
};
}}
diff --git a/CPP/7zip/Archive/Zip/ZipHandler.cpp b/CPP/7zip/Archive/Zip/ZipHandler.cpp
index 7d478a36..aba36b3b 100755
--- a/CPP/7zip/Archive/Zip/ZipHandler.cpp
+++ b/CPP/7zip/Archive/Zip/ZipHandler.cpp
@@ -36,7 +36,6 @@
#endif
using namespace NWindows;
-using namespace NTime;
namespace NArchive {
namespace NZip {
@@ -45,7 +44,7 @@ namespace NZip {
static const CMethodId kMethodId_ZipBase = 0x040100;
static const CMethodId kMethodId_BZip2 = 0x040202;
-const wchar_t *kHostOS[] =
+const wchar_t *kHostOS[] =
{
L"FAT",
L"AMIGA",
@@ -74,17 +73,17 @@ static const int kNumHostOSes = sizeof(kHostOS) / sizeof(kHostOS[0]);
static const wchar_t *kUnknownOS = L"Unknown";
-STATPROPSTG kProps[] =
+STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
- { NULL, kpidIsFolder, VT_BOOL},
+ { NULL, kpidIsDir, VT_BOOL},
{ NULL, kpidSize, VT_UI8},
- { NULL, kpidPackedSize, VT_UI8},
- { NULL, kpidLastWriteTime, VT_FILETIME},
- { NULL, kpidCreationTime, VT_FILETIME},
- { NULL, kpidLastAccessTime, VT_FILETIME},
+ { NULL, kpidPackSize, VT_UI8},
+ { NULL, kpidMTime, VT_FILETIME},
+ { NULL, kpidCTime, VT_FILETIME},
+ { NULL, kpidATime, VT_FILETIME},
- { NULL, kpidAttributes, VT_UI4},
+ { NULL, kpidAttrib, VT_UI4},
{ NULL, kpidEncrypted, VT_BOOL},
{ NULL, kpidComment, VT_BSTR},
@@ -97,7 +96,7 @@ STATPROPSTG kProps[] =
// { NULL, kpidUnpackVer, VT_UI1},
};
-const wchar_t *kMethods[] =
+const wchar_t *kMethods[] =
{
L"Store",
L"Shrink",
@@ -116,6 +115,7 @@ const wchar_t *kMethods[] =
const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
// const wchar_t *kUnknownMethod = L"Unknown";
+const wchar_t *kWavPackMethod = L"WavPack";
const wchar_t *kPPMdMethod = L"PPMd";
const wchar_t *kAESMethod = L"AES";
const wchar_t *kZipCryptoMethod = L"ZipCrypto";
@@ -127,7 +127,7 @@ struct CStrongCryptoPair
const wchar_t *Name;
};
-CStrongCryptoPair g_StrongCryptoPairs[] =
+CStrongCryptoPair g_StrongCryptoPairs[] =
{
{ NStrongCryptoFlags::kDES, L"DES" },
{ NStrongCryptoFlags::kRC2old, L"RC2a" },
@@ -142,13 +142,13 @@ CStrongCryptoPair g_StrongCryptoPairs[] =
{ NStrongCryptoFlags::kRC4, L"RC4" }
};
-STATPROPSTG kArcProps[] =
+STATPROPSTG kArcProps[] =
{
+ { NULL, kpidBit64, VT_BOOL},
{ NULL, kpidComment, VT_BSTR}
};
-CHandler::CHandler():
- m_ArchiveIsOpen(false)
+CHandler::CHandler()
{
InitMethodProperties();
}
@@ -176,6 +176,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
NWindows::NCOM::CPropVariant prop;
switch(propID)
{
+ case kpidBit64: if (m_Archive.IsZip64) prop = m_Archive.IsZip64; break;
case kpidComment:
prop = MultiByteToUnicodeString(BytesToString(m_Archive.m_ArchiveInfo.Comment), CP_ACP);
break;
@@ -198,44 +199,38 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
const CItemEx &item = m_Items[index];
switch(propID)
{
- case kpidPath:
- prop = NItemName::GetOSName2(item.GetUnicodeString(item.Name));
- break;
- case kpidIsFolder:
- prop = item.IsDirectory();
- break;
- case kpidSize:
- prop = item.UnPackSize;
- break;
- case kpidPackedSize:
- prop = item.PackSize;
- break;
+ case kpidPath: prop = NItemName::GetOSName2(item.GetUnicodeString(item.Name)); break;
+ case kpidIsDir: prop = item.IsDir(); break;
+ case kpidSize: prop = item.UnPackSize; break;
+ case kpidPackSize: prop = item.PackSize; break;
case kpidTimeType:
+ {
FILETIME utcFileTime;
if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kTagTime, utcFileTime))
prop = (UInt32)NFileTimeType::kWindows;
break;
- case kpidCreationTime:
+ }
+ case kpidCTime:
{
FILETIME ft;
if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kCTime, ft))
prop = ft;
break;
}
- case kpidLastAccessTime:
+ case kpidATime:
{
FILETIME ft;
if (item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kATime, ft))
prop = ft;
break;
}
- case kpidLastWriteTime:
+ case kpidMTime:
{
FILETIME utcFileTime;
if (!item.CentralExtra.GetNtfsTime(NFileHeader::NNtfsExtra::kMTime, utcFileTime))
{
FILETIME localFileTime;
- if (DosTimeToFileTime(item.Time, localFileTime))
+ if (NTime::DosTimeToFileTime(item.Time, localFileTime))
{
if (!LocalFileTimeToFileTime(&localFileTime, &utcFileTime))
utcFileTime.dwHighDateTime = utcFileTime.dwLowDateTime = 0;
@@ -246,21 +241,10 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
prop = utcFileTime;
break;
}
- case kpidAttributes:
- prop = item.GetWinAttributes();
- break;
- case kpidEncrypted:
- prop = item.IsEncrypted();
- break;
- case kpidComment:
- {
- prop = item.GetUnicodeString(BytesToString(item.Comment));
- break;
- }
- case kpidCRC:
- if (item.IsThereCrc())
- prop = item.FileCRC;
- break;
+ case kpidAttrib: prop = item.GetWinAttributes(); break;
+ case kpidEncrypted: prop = item.IsEncrypted(); break;
+ case kpidComment: prop = item.GetUnicodeString(BytesToString(item.Comment)); break;
+ case kpidCRC: if (item.IsThereCrc()) prop = item.FileCRC; break;
case kpidMethod:
{
UInt16 methodId = item.CompressionMethod;
@@ -310,8 +294,10 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
}
if (methodId < kNumMethods)
method += kMethods[methodId];
- else if (methodId == NFileHeader::NCompressionMethod::kWzPPMd)
+ else if (methodId == NFileHeader::NCompressionMethod::kPPMd)
method += kPPMdMethod;
+ else if (methodId == NFileHeader::NCompressionMethod::kWavPack)
+ method += kWavPackMethod;
else
{
wchar_t s[32];
@@ -331,55 +317,50 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
COM_TRY_END
}
-class CPropgressImp: public CProgressVirt
+class CProgressImp: public CProgressVirt
{
- CMyComPtr<IArchiveOpenCallback> m_OpenArchiveCallback;
+ CMyComPtr<IArchiveOpenCallback> _callback;
public:
- STDMETHOD(SetCompleted)(const UInt64 *numFiles);
- void Init(IArchiveOpenCallback *openArchiveCallback)
- { m_OpenArchiveCallback = openArchiveCallback; }
+ STDMETHOD(SetTotal)(UInt64 numFiles);
+ STDMETHOD(SetCompleted)(UInt64 numFiles);
+ CProgressImp(IArchiveOpenCallback *callback): _callback(callback) {}
};
-STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles)
+STDMETHODIMP CProgressImp::SetTotal(UInt64 numFiles)
+{
+ if (_callback)
+ return _callback->SetTotal(&numFiles, NULL);
+ return S_OK;
+}
+
+STDMETHODIMP CProgressImp::SetCompleted(UInt64 numFiles)
{
- if (m_OpenArchiveCallback)
- return m_OpenArchiveCallback->SetCompleted(numFiles, NULL);
+ if (_callback)
+ return _callback->SetCompleted(&numFiles, NULL);
return S_OK;
}
-STDMETHODIMP CHandler::Open(IInStream *inStream,
- const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback)
+STDMETHODIMP CHandler::Open(IInStream *inStream,
+ const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *callback)
{
COM_TRY_BEGIN
- // try
+ try
{
- if(!m_Archive.Open(inStream, maxCheckStartPosition))
- return S_FALSE;
- m_ArchiveIsOpen = true;
- m_Items.Clear();
- if (openArchiveCallback != NULL)
- {
- RINOK(openArchiveCallback->SetTotal(NULL, NULL));
- }
- CPropgressImp propgressImp;
- propgressImp.Init(openArchiveCallback);
- RINOK(m_Archive.ReadHeaders(m_Items, &propgressImp));
- }
- /*
- catch(...)
- {
- return S_FALSE;
+ Close();
+ RINOK(inStream->Seek(0, STREAM_SEEK_SET, NULL));
+ RINOK(m_Archive.Open(inStream, maxCheckStartPosition));
+ CProgressImp progressImp(callback);
+ return m_Archive.ReadHeaders(m_Items, &progressImp);
}
- */
+ catch(const CInArchiveException &) { Close(); return S_FALSE; }
+ catch(...) { Close(); throw; }
COM_TRY_END
- return S_OK;
}
STDMETHODIMP CHandler::Close()
{
m_Items.Clear();
m_Archive.Close();
- m_ArchiveIsOpen = false;
return S_OK;
}
@@ -412,17 +393,17 @@ public:
HRESULT Decode(
DECL_EXTERNAL_CODECS_LOC_VARS
- CInArchive &archive, const CItemEx &item,
- ISequentialOutStream *realOutStream,
- IArchiveExtractCallback *extractCallback,
+ CInArchive &archive, const CItemEx &item,
+ ISequentialOutStream *realOutStream,
+ IArchiveExtractCallback *extractCallback,
ICompressProgressInfo *compressProgress,
UInt32 numThreads, Int32 &res);
};
HRESULT CZipDecoder::Decode(
DECL_EXTERNAL_CODECS_LOC_VARS
- CInArchive &archive, const CItemEx &item,
- ISequentialOutStream *realOutStream,
+ CInArchive &archive, const CItemEx &item,
+ ISequentialOutStream *realOutStream,
IArchiveExtractCallback *extractCallback,
ICompressProgressInfo *compressProgress,
UInt32 numThreads, Int32 &res)
@@ -534,7 +515,7 @@ HRESULT CZipDecoder::Decode(
CMyComBSTR password;
RINOK(getTextPassword->CryptoGetTextPassword(&password));
AString charPassword;
- if (aesMode
+ if (aesMode
#ifdef ZIP_STRONG_SUPORT
|| pkAesMode
#endif
@@ -662,7 +643,7 @@ HRESULT CZipDecoder::Decode(
}
RINOK(filterStreamSpec->SetInStream(inStream));
inStreamReleaser.FilterCoder = filterStreamSpec;
- inStreamNew = filterStream;
+ inStreamNew = filterStream;
if (aesMode)
{
@@ -671,7 +652,7 @@ HRESULT CZipDecoder::Decode(
}
}
else
- inStreamNew = inStream;
+ inStreamNew = inStream;
result = coder->Code(inStreamNew, outStream, NULL, &item.UnPackSize, compressProgress);
if (result == S_FALSE)
return S_OK;
@@ -688,7 +669,7 @@ HRESULT CZipDecoder::Decode(
authOk = false;
}
- res = ((crcOK && authOk) ?
+ res = ((crcOK && authOk) ?
NArchive::NExtract::NOperationResult::kOK :
NArchive::NExtract::NOperationResult::kCRCError);
return S_OK;
@@ -734,7 +715,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
RINOK(lps->SetCur());
CMyComPtr<ISequentialOutStream> realOutStream;
- Int32 askMode = testMode ?
+ Int32 askMode = testMode ?
NArchive::NExtract::NAskMode::kTest :
NArchive::NExtract::NAskMode::kExtract;
Int32 index = allFilesMode ? i : indices[i];
@@ -747,7 +728,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
HRESULT res = m_Archive.ReadLocalItemAfterCdItem(item);
if (res == S_FALSE)
{
- if (item.IsDirectory() || realOutStream || testMode)
+ if (item.IsDir() || realOutStream || testMode)
{
RINOK(extractCallback->PrepareOperation(askMode));
realOutStream.Release();
@@ -758,7 +739,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
RINOK(res);
}
- if (item.IsDirectory() || item.IgnoreItem())
+ if (item.IsDir() || item.IgnoreItem())
{
// if (!testMode)
{
@@ -772,7 +753,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
currentItemUnPacked = item.UnPackSize;
currentItemPacked = item.PackSize;
- if (!testMode && (!realOutStream))
+ if (!testMode && (!realOutStream))
continue;
RINOK(extractCallback->PrepareOperation(askMode));
@@ -780,7 +761,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
Int32 res;
RINOK(myDecoder.Decode(
EXTERNAL_CODECS_VARS
- m_Archive, item, realOutStream, extractCallback,
+ m_Archive, item, realOutStream, extractCallback,
progress, _numThreads, res));
realOutStream.Release();
diff --git a/CPP/7zip/Archive/Zip/ZipHandler.h b/CPP/7zip/Archive/Zip/ZipHandler.h
index c8fa392c..09179111 100755
--- a/CPP/7zip/Archive/Zip/ZipHandler.h
+++ b/CPP/7zip/Archive/Zip/ZipHandler.h
@@ -19,7 +19,7 @@
namespace NArchive {
namespace NZip {
-class CHandler:
+class CHandler:
public IInArchive,
public IOutArchive,
public ISetProperties,
@@ -45,7 +45,6 @@ public:
private:
CObjectVector<CItemEx> m_Items;
CInArchive m_Archive;
- bool m_ArchiveIsOpen;
int m_Level;
int m_MainMethod;
@@ -73,10 +72,10 @@ private:
{
m_Level = -1;
m_MainMethod = -1;
- m_Algo =
- m_DicSize =
- m_NumPasses =
- m_NumFastBytes =
+ m_Algo =
+ m_DicSize =
+ m_NumPasses =
+ m_NumFastBytes =
m_NumMatchFinderCycles = 0xFFFFFFFF;
m_NumMatchFinderCyclesDefined = false;
m_IsAesMode = false;
diff --git a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp
index 2846c988..c493b0c9 100755
--- a/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp
+++ b/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp
@@ -83,7 +83,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
{
COM_TRY_BEGIN2
CObjectVector<CUpdateItem> updateItems;
- for(UInt32 i = 0; i < numItems; i++)
+ for (UInt32 i = 0; i < numItems; i++)
{
CUpdateItem ui;
Int32 newData;
@@ -91,10 +91,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
UInt32 indexInArchive;
if (!callback)
return E_FAIL;
- RINOK(callback->GetUpdateItemInfo(i,
- &newData, // 1 - compress 0 - copy
- &newProperties,
- &indexInArchive));
+ RINOK(callback->GetUpdateItemInfo(i, &newData, &newProperties, &indexInArchive));
ui.NewProperties = IntToBool(newProperties);
ui.NewData = IntToBool(newData);
ui.IndexInArchive = indexInArchive;
@@ -103,10 +100,9 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
if (IntToBool(newProperties))
{
UString name;
- bool isDirectoryStatusDefined;
{
NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidAttributes, &prop));
+ RINOK(callback->GetProperty(i, kpidAttrib, &prop));
if (prop.vt == VT_EMPTY)
ui.Attributes = 0;
else if (prop.vt != VT_UI4)
@@ -127,16 +123,13 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
}
{
NCOM::CPropVariant prop;
- RINOK(callback->GetProperty(i, kpidIsFolder, &prop));
+ RINOK(callback->GetProperty(i, kpidIsDir, &prop));
if (prop.vt == VT_EMPTY)
- isDirectoryStatusDefined = false;
+ ui.IsDir = false;
else if (prop.vt != VT_BOOL)
return E_INVALIDARG;
else
- {
- ui.IsDirectory = (prop.boolVal != VARIANT_FALSE);
- isDirectoryStatusDefined = true;
- }
+ ui.IsDir = (prop.boolVal != VARIANT_FALSE);
}
{
@@ -147,9 +140,9 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
else
ui.NtfsTimeIsDefined = m_WriteNtfsTimeExtra;
}
- RINOK(GetTime(callback, i, kpidLastWriteTime, ui.NtfsMTime));
- RINOK(GetTime(callback, i, kpidLastAccessTime, ui.NtfsATime));
- RINOK(GetTime(callback, i, kpidCreationTime, ui.NtfsCTime));
+ RINOK(GetTime(callback, i, kpidMTime, ui.NtfsMTime));
+ RINOK(GetTime(callback, i, kpidATime, ui.NtfsATime));
+ RINOK(GetTime(callback, i, kpidCTime, ui.NtfsCTime));
{
FILETIME localFileTime = { 0, 0 };
@@ -160,17 +153,14 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
FileTimeToDosTime(localFileTime, ui.Time);
}
- if (!isDirectoryStatusDefined)
- ui.IsDirectory = ((ui.Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
-
name = NItemName::MakeLegalName(name);
- bool needSlash = ui.IsDirectory;
+ bool needSlash = ui.IsDir;
const wchar_t kSlash = L'/';
if (!name.IsEmpty())
{
if (name[name.Length() - 1] == kSlash)
{
- if (!ui.IsDirectory)
+ if (!ui.IsDir)
return E_INVALIDARG;
needSlash = false;
}
@@ -205,12 +195,12 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
ui.IndexInClient = i;
/*
- if(existInArchive)
+ if (existInArchive)
{
const CItemEx &itemInfo = m_Items[indexInArchive];
// ui.Commented = itemInfo.IsCommented();
ui.Commented = false;
- if(ui.Commented)
+ if (ui.Commented)
{
ui.CommentRange.Position = itemInfo.GetCommentPosition();
ui.CommentRange.Size = itemInfo.CommentSize;
@@ -280,7 +270,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
options.MethodSequence.Add(mainMethod);
if (mainMethod != NFileHeader::NCompressionMethod::kStored)
options.MethodSequence.Add(NFileHeader::NCompressionMethod::kStored);
- bool isDeflate = (mainMethod == NFileHeader::NCompressionMethod::kDeflated) ||
+ bool isDeflate = (mainMethod == NFileHeader::NCompressionMethod::kDeflated) ||
(mainMethod == NFileHeader::NCompressionMethod::kDeflated64);
bool isBZip2 = (mainMethod == NFileHeader::NCompressionMethod::kBZip2);
options.NumPasses = m_NumPasses;
@@ -295,34 +285,34 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
if (isDeflate)
{
if (options.NumPasses == 0xFFFFFFFF)
- options.NumPasses = (level >= 9 ? kDeflateNumPassesX9 :
- (level >= 7 ? kDeflateNumPassesX7 :
+ options.NumPasses = (level >= 9 ? kDeflateNumPassesX9 :
+ (level >= 7 ? kDeflateNumPassesX7 :
kDeflateNumPassesX1));
if (options.NumFastBytes == 0xFFFFFFFF)
- options.NumFastBytes = (level >= 9 ? kNumFastBytesX9 :
- (level >= 7 ? kNumFastBytesX7 :
+ options.NumFastBytes = (level >= 9 ? kNumFastBytesX9 :
+ (level >= 7 ? kNumFastBytesX7 :
kNumFastBytesX1));
if (options.Algo == 0xFFFFFFFF)
- options.Algo =
- (level >= 5 ? kDeflateAlgoX5 :
- kDeflateAlgoX1);
+ options.Algo =
+ (level >= 5 ? kDeflateAlgoX5 :
+ kDeflateAlgoX1);
}
if (isBZip2)
{
if (options.NumPasses == 0xFFFFFFFF)
- options.NumPasses = (level >= 9 ? kBZip2NumPassesX9 :
- (level >= 7 ? kBZip2NumPassesX7 :
+ options.NumPasses = (level >= 9 ? kBZip2NumPassesX9 :
+ (level >= 7 ? kBZip2NumPassesX7 :
kBZip2NumPassesX1));
if (options.DicSize == 0xFFFFFFFF)
- options.DicSize = (level >= 5 ? kBZip2DicSizeX5 :
- (level >= 3 ? kBZip2DicSizeX3 :
+ options.DicSize = (level >= 5 ? kBZip2DicSizeX5 :
+ (level >= 3 ? kBZip2DicSizeX3 :
kBZip2DicSizeX1));
}
return Update(
EXTERNAL_CODECS_VARS
- m_Items, updateItems, outStream,
- m_ArchiveIsOpen ? &m_Archive : NULL, &options, callback);
+ m_Items, updateItems, outStream,
+ m_Archive.IsOpen() ? &m_Archive : NULL, &options, callback);
COM_TRY_END2
}
@@ -363,7 +353,7 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
m_MainMethod = NFileHeader::NCompressionMethod::kDeflated64;
else if (valueString == L"BZIP2")
m_MainMethod = NFileHeader::NCompressionMethod::kBZip2;
- else
+ else
return E_INVALIDARG;
}
else if (prop.vt == VT_UI4)
@@ -463,10 +453,10 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
m_ForseLocal = false;
return S_OK;
}
- else
+ else
return E_INVALIDARG;
}
return S_OK;
-}
+}
}}
diff --git a/CPP/7zip/Archive/Zip/ZipHeader.cpp b/CPP/7zip/Archive/Zip/ZipHeader.cpp
index fd8856bb..582187b5 100755
--- a/CPP/7zip/Archive/Zip/ZipHeader.cpp
+++ b/CPP/7zip/Archive/Zip/ZipHeader.cpp
@@ -19,9 +19,9 @@ namespace NSignature
class CMarkersInitializer
{
public:
- CMarkersInitializer()
- {
- kLocalFileHeader--;
+ CMarkersInitializer()
+ {
+ kLocalFileHeader--;
kDataDescriptor--;
kCentralFileHeader--;
kEndOfCentralDir--;
diff --git a/CPP/7zip/Archive/Zip/ZipHeader.h b/CPP/7zip/Archive/Zip/ZipHeader.h
index 0c978a7c..3af72369 100755
--- a/CPP/7zip/Archive/Zip/ZipHeader.h
+++ b/CPP/7zip/Archive/Zip/ZipHeader.h
@@ -55,7 +55,7 @@ namespace NFileHeader
namespace NCompressionMethod
{
enum EType
- {
+ {
kStored = 0,
kShrunk = 1,
kReduced1 = 2,
@@ -64,12 +64,13 @@ namespace NFileHeader
kReduced4 = 5,
kImploded = 6,
kReservedTokenizing = 7, // reserved for tokenizing
- kDeflated = 8,
+ kDeflated = 8,
kDeflated64 = 9,
kPKImploding = 10,
kBZip2 = 12,
- kWzPPMd = 0x62,
+ kWavPack = 0x61,
+ kPPMd = 0x62,
kWzAES = 0x63
};
const int kNumCompressionMethods = 11;
@@ -83,8 +84,8 @@ namespace NFileHeader
namespace NExtraID
{
- enum
- {
+ enum
+ {
kZip64 = 0x01,
kNTFS = 0x0A,
kStrongEncrypt = 0x17,
@@ -166,7 +167,7 @@ namespace NFileHeader
};
*/
- namespace NFlags
+ namespace NFlags
{
const int kEncrypted = 1 << 0;
const int kDescriptorUsedMask = 1 << 3;
@@ -196,8 +197,8 @@ 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
diff --git a/CPP/7zip/Archive/Zip/ZipIn.cpp b/CPP/7zip/Archive/Zip/ZipIn.cpp
index f8e81c59..d67713ce 100755
--- a/CPP/7zip/Archive/Zip/ZipIn.cpp
+++ b/CPP/7zip/Archive/Zip/ZipIn.cpp
@@ -9,18 +9,29 @@
#include "../../Common/LimitedStreams.h"
#include "../../Common/StreamUtils.h"
+extern "C"
+{
+ #include "../../../../C/CpuArch.h"
+}
+
+#define Get16(p) GetUi16(p)
+#define Get32(p) GetUi32(p)
+#define Get64(p) GetUi64(p)
+
namespace NArchive {
namespace NZip {
// static const char kEndOfString = '\0';
-
-bool CInArchive::Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit)
+
+HRESULT CInArchive::Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
{
- m_Stream = inStream;
- if(m_Stream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition) != S_OK)
- return false;
+ Close();
+ RINOK(stream->Seek(0, STREAM_SEEK_CUR, &m_StreamStartPosition));
m_Position = m_StreamStartPosition;
- return FindAndReadMarker(searchHeaderSizeLimit);
+ RINOK(FindAndReadMarker(stream, searchHeaderSizeLimit));
+ RINOK(stream->Seek(m_Position, STREAM_SEEK_SET, NULL));
+ m_Stream = stream;
+ return S_OK;
}
void CInArchive::Close()
@@ -38,85 +49,76 @@ HRESULT CInArchive::Seek(UInt64 offset)
static inline bool TestMarkerCandidate(const Byte *p, UInt32 &value)
{
- value = p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24);
- return (value == NSignature::kLocalFileHeader) ||
+ value = Get32(p);
+ return
+ (value == NSignature::kLocalFileHeader) ||
(value == NSignature::kEndOfCentralDir);
}
static const UInt32 kNumMarkerAddtionalBytes = 2;
static inline bool TestMarkerCandidate2(const Byte *p, UInt32 &value)
{
- value = p[0] | (((UInt32)p[1]) << 8) | (((UInt32)p[2]) << 16) | (((UInt32)p[3]) << 24);
+ value = Get32(p);
if (value == NSignature::kEndOfCentralDir)
- {
- UInt16 nextWord = p[0] | (((UInt16)p[1]) << 8);
- return (nextWord == 0);
- }
- if (value != NSignature::kLocalFileHeader)
- return false;
- if (p[0] > 128)
- return false;
- return true;
+ return (Get16(p + 4) == 0);
+ return (value == NSignature::kLocalFileHeader && p[4] < 128);
}
-bool CInArchive::FindAndReadMarker(const UInt64 *searchHeaderSizeLimit)
+HRESULT CInArchive::FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit)
{
m_ArchiveInfo.Clear();
m_Position = m_StreamStartPosition;
- if(Seek(m_StreamStartPosition) != S_OK)
- return false;
Byte marker[NSignature::kMarkerSize];
- UInt32 processedSize;
- ReadBytes(marker, NSignature::kMarkerSize, &processedSize);
- if(processedSize != NSignature::kMarkerSize)
- return false;
+ RINOK(ReadStream_FALSE(stream, marker, NSignature::kMarkerSize));
+ m_Position += NSignature::kMarkerSize;
if (TestMarkerCandidate(marker, m_Signature))
- return true;
+ return S_OK;
CByteDynamicBuffer dynamicBuffer;
- static const UInt32 kSearchMarkerBufferSize = 0x10000;
+ const UInt32 kSearchMarkerBufferSize = 0x10000;
dynamicBuffer.EnsureCapacity(kSearchMarkerBufferSize);
Byte *buffer = dynamicBuffer;
UInt32 numBytesPrev = NSignature::kMarkerSize - 1;
- memmove(buffer, marker + 1, numBytesPrev);
+ memcpy(buffer, marker + 1, numBytesPrev);
UInt64 curTestPos = m_StreamStartPosition + 1;
for (;;)
{
if (searchHeaderSizeLimit != NULL)
if (curTestPos - m_StreamStartPosition > *searchHeaderSizeLimit)
break;
- UInt32 numReadBytes = kSearchMarkerBufferSize - numBytesPrev;
- ReadBytes(buffer + numBytesPrev, numReadBytes, &processedSize);
- UInt32 numBytesInBuffer = numBytesPrev + processedSize;
+ size_t numReadBytes = kSearchMarkerBufferSize - numBytesPrev;
+ RINOK(ReadStream(stream, buffer + numBytesPrev, &numReadBytes));
+ m_Position += numReadBytes;
+ UInt32 numBytesInBuffer = numBytesPrev + (UInt32)numReadBytes;
const UInt32 kMarker2Size = NSignature::kMarkerSize + kNumMarkerAddtionalBytes;
if (numBytesInBuffer < kMarker2Size)
break;
UInt32 numTests = numBytesInBuffer - kMarker2Size + 1;
- for(UInt32 pos = 0; pos < numTests; pos++, curTestPos++)
- {
+ for (UInt32 pos = 0; pos < numTests; pos++)
+ {
+ if (buffer[pos] != 0x50)
+ continue;
if (TestMarkerCandidate2(buffer + pos, m_Signature))
{
+ curTestPos += pos;
m_ArchiveInfo.StartPosition = curTestPos;
- // m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition;
- // m_ArchiveInfo.Base = 0;
m_Position = curTestPos + NSignature::kMarkerSize;
- if(Seek(m_Position) != S_OK)
- return false;
- return true;
+ return S_OK;
}
}
+ curTestPos += numTests;
numBytesPrev = numBytesInBuffer - numTests;
memmove(buffer, buffer + numTests, numBytesPrev);
}
- return false;
+ return S_FALSE;
}
HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize)
{
size_t realProcessedSize = size;
HRESULT result = ReadStream(m_Stream, data, &realProcessedSize);
- if(processedSize != NULL)
+ if (processedSize != NULL)
*processedSize = (UInt32)realProcessedSize;
m_Position += realProcessedSize;
return result;
@@ -124,21 +126,21 @@ HRESULT CInArchive::ReadBytes(void *data, UInt32 size, UInt32 *processedSize)
void CInArchive::IncreaseRealPosition(UInt64 addValue)
{
- if(m_Stream->Seek(addValue, STREAM_SEEK_CUR, &m_Position) != S_OK)
+ if (m_Stream->Seek(addValue, STREAM_SEEK_CUR, &m_Position) != S_OK)
throw CInArchiveException(CInArchiveException::kSeekStreamError);
}
bool CInArchive::ReadBytesAndTestSize(void *data, UInt32 size)
{
UInt32 realProcessedSize;
- if(ReadBytes(data, size, &realProcessedSize) != S_OK)
+ if (ReadBytes(data, size, &realProcessedSize) != S_OK)
throw CInArchiveException(CInArchiveException::kReadStreamError);
return (realProcessedSize == size);
}
void CInArchive::SafeReadBytes(void *data, UInt32 size)
{
- if(!ReadBytesAndTestSize(data, size))
+ if (!ReadBytesAndTestSize(data, size))
throw CInArchiveException(CInArchiveException::kUnexpectedEndOfArchive);
}
@@ -198,8 +200,10 @@ AString CInArchive::ReadFileName(UInt32 nameSize)
{
if (nameSize == 0)
return AString();
- SafeReadBytes(m_NameBuffer.GetBuffer(nameSize), nameSize);
- m_NameBuffer.ReleaseBuffer(nameSize);
+ char *p = m_NameBuffer.GetBuffer(nameSize);
+ SafeReadBytes(p, nameSize);
+ p[nameSize] = 0;
+ m_NameBuffer.ReleaseBuffer();
return m_NameBuffer;
}
@@ -217,7 +221,7 @@ void CInArchive::ThrowIncorrectArchiveException()
static UInt32 GetUInt32(const Byte *data)
{
- return
+ return
((UInt32)(Byte)data[0]) |
(((UInt32)(Byte)data[1]) << 8) |
(((UInt32)(Byte)data[2]) << 16) |
@@ -227,7 +231,7 @@ static UInt32 GetUInt32(const Byte *data)
/*
static UInt16 GetUInt16(const Byte *data)
{
- return
+ return
((UInt16)(Byte)data[0]) |
(((UInt16)(Byte)data[1]) << 8);
}
@@ -240,7 +244,7 @@ static UInt64 GetUInt64(const Byte *data)
-void CInArchive::ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
+void CInArchive::ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber)
{
extraBlock.Clear();
@@ -318,11 +322,11 @@ HRESULT CInArchive::ReadLocalItem(CItemEx &item)
{
UInt64 localHeaderOffset = 0;
UInt32 diskStartNumber = 0;
- ReadExtra(item.LocalExtraSize, item.LocalExtra, item.UnPackSize, item.PackSize,
+ ReadExtra(item.LocalExtraSize, item.LocalExtra, item.UnPackSize, item.PackSize,
localHeaderOffset, diskStartNumber);
}
/*
- if (item.IsDirectory())
+ if (item.IsDir())
item.UnPackSize = 0; // check It
*/
return S_OK;
@@ -354,10 +358,10 @@ HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item)
if (item.CompressionMethod != localItem.CompressionMethod ||
// item.Time != localItem.Time ||
- (!localItem.HasDescriptor() &&
- (
+ (!localItem.HasDescriptor() &&
+ (
item.FileCRC != localItem.FileCRC ||
- item.PackSize != localItem.PackSize ||
+ item.PackSize != localItem.PackSize ||
item.UnPackSize != localItem.UnPackSize
)
) ||
@@ -394,7 +398,7 @@ HRESULT CInArchive::ReadLocalItemDescriptor(CItemEx &item)
UInt32 i;
for (i = 0; i <= numBytesInBuffer - NFileHeader::kDataDescriptorSize; i++)
{
- // descriptorSignature field is Info-ZIP's extension
+ // descriptorSignature field is Info-ZIP's extension
// to Zip specification.
UInt32 descriptorSignature = GetUInt32(buffer + i);
@@ -415,7 +419,7 @@ HRESULT CInArchive::ReadLocalItemDescriptor(CItemEx &item)
packedSize += i;
int j;
for (j = 0; i < numBytesInBuffer; i++, j++)
- buffer[j] = buffer[i];
+ buffer[j] = buffer[i];
numBytesInBuffer = j;
}
}
@@ -463,28 +467,31 @@ HRESULT CInArchive::ReadLocalItemAfterCdItemFull(CItemEx &item)
HRESULT CInArchive::ReadCdItem(CItemEx &item)
{
item.FromCentral = true;
- item.MadeByVersion.Version = ReadByte();
- item.MadeByVersion.HostOS = ReadByte();
- item.ExtractVersion.Version = ReadByte();
- item.ExtractVersion.HostOS = ReadByte();
- item.Flags = ReadUInt16();
- item.CompressionMethod = ReadUInt16();
- item.Time = ReadUInt32();
- item.FileCRC = ReadUInt32();
- item.PackSize = ReadUInt32();
- item.UnPackSize = ReadUInt32();
- UInt16 headerNameSize = ReadUInt16();
- UInt16 headerExtraSize = ReadUInt16();
- UInt16 headerCommentSize = ReadUInt16();
- UInt32 headerDiskNumberStart = ReadUInt16();
- item.InternalAttributes = ReadUInt16();
- item.ExternalAttributes = ReadUInt32();
- item.LocalHeaderPosition = ReadUInt32();
+ const int kBufSize = 42;
+ Byte p[kBufSize];
+ SafeReadBytes(p, kBufSize);
+ item.MadeByVersion.Version = p[0];
+ item.MadeByVersion.HostOS = p[1];
+ item.ExtractVersion.Version = p[2];
+ item.ExtractVersion.HostOS = p[3];
+ item.Flags = Get16(p + 4);
+ item.CompressionMethod = Get16(p + 6);
+ item.Time = Get32(p + 8);
+ item.FileCRC = Get32(p + 12);
+ item.PackSize = Get32(p + 16);
+ item.UnPackSize = Get32(p + 20);
+ UInt16 headerNameSize = Get16(p + 24);
+ UInt16 headerExtraSize = Get16(p + 26);
+ UInt16 headerCommentSize = Get16(p + 28);
+ UInt32 headerDiskNumberStart = Get16(p + 30);
+ item.InternalAttributes = Get16(p + 32);
+ item.ExternalAttributes = Get32(p + 34);
+ item.LocalHeaderPosition = Get32(p + 38);
item.Name = ReadFileName(headerNameSize);
if (headerExtraSize > 0)
{
- ReadExtra(headerExtraSize, item.CentralExtra, item.UnPackSize, item.PackSize,
+ ReadExtra(headerExtraSize, item.CentralExtra, item.UnPackSize, item.PackSize,
item.LocalHeaderPosition, headerDiskNumberStart);
}
@@ -493,7 +500,7 @@ HRESULT CInArchive::ReadCdItem(CItemEx &item)
// May be these strings must be deleted
/*
- if (item.IsDirectory())
+ if (item.IsDir())
item.UnPackSize = 0;
*/
@@ -506,7 +513,7 @@ HRESULT CInArchive::TryEcd64(UInt64 offset, CCdInfo &cdInfo)
RINOK(Seek(offset));
const UInt32 kEcd64Size = 56;
Byte buf[kEcd64Size];
- if(!ReadBytesAndTestSize(buf, kEcd64Size))
+ if (!ReadBytesAndTestSize(buf, kEcd64Size))
return S_FALSE;
if (GetUInt32(buf) != NSignature::kZip64EndOfCentralDir)
return S_FALSE;
@@ -531,7 +538,7 @@ HRESULT CInArchive::FindCd(CCdInfo &cdInfo)
return S_FALSE;
if (!ReadBytesAndTestSize(buf, bufSize))
return S_FALSE;
- for (int i = (int)(bufSize - kEcdSize); i >= 0; i--)
+ for (int i = (int)(bufSize - kEcdSize); i >= 0; i--)
{
if (GetUInt32(buf + i) == NSignature::kEndOfCentralDir)
{
@@ -566,7 +573,7 @@ HRESULT CInArchive::FindCd(CCdInfo &cdInfo)
return S_FALSE;
}
-HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize)
+HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize, CProgressVirt *progress)
{
items.Clear();
RINOK(m_Stream->Seek(cdOffset, STREAM_SEEK_SET, &m_Position));
@@ -574,16 +581,18 @@ HRESULT CInArchive::TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UI
return S_FALSE;
while(m_Position - cdOffset < cdSize)
{
- if(ReadUInt32() != NSignature::kCentralFileHeader)
+ if (ReadUInt32() != NSignature::kCentralFileHeader)
return S_FALSE;
CItemEx cdItem;
RINOK(ReadCdItem(cdItem));
items.Add(cdItem);
+ if (progress && items.Size() % 1000 == 0)
+ RINOK(progress->SetCompleted(items.Size()));
}
return (m_Position - cdOffset == cdSize) ? S_OK : S_FALSE;
}
-HRESULT CInArchive::ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize)
+HRESULT CInArchive::ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress)
{
m_ArchiveInfo.Base = 0;
CCdInfo cdInfo;
@@ -591,10 +600,10 @@ HRESULT CInArchive::ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt
HRESULT res = S_FALSE;
cdSize = cdInfo.Size;
cdOffset = cdInfo.Offset;
- res = TryReadCd(items, m_ArchiveInfo.Base + cdOffset, cdSize);
+ res = TryReadCd(items, m_ArchiveInfo.Base + cdOffset, cdSize, progress);
if (res == S_FALSE && m_ArchiveInfo.Base == 0)
{
- res = TryReadCd(items, cdInfo.Offset + m_ArchiveInfo.StartPosition, cdSize);
+ res = TryReadCd(items, cdInfo.Offset + m_ArchiveInfo.StartPosition, cdSize, progress);
if (res == S_OK)
m_ArchiveInfo.Base = m_ArchiveInfo.StartPosition;
}
@@ -616,23 +625,17 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
item.FromLocal = true;
ReadLocalItemDescriptor(item);
items.Add(item);
- if (progress != 0)
- {
- UInt64 numItems = items.Size();
- RINOK(progress->SetCompleted(&numItems));
- }
+ if (progress && items.Size() % 100 == 0)
+ RINOK(progress->SetCompleted(items.Size()));
if (!ReadUInt32(m_Signature))
break;
}
cdOffset = m_Position - 4;
- for(int i = 0; i < items.Size(); i++)
+ for (int i = 0; i < items.Size(); i++)
{
- if (progress != 0)
- {
- UInt64 numItems = items.Size();
- RINOK(progress->SetCompleted(&numItems));
- }
- if(m_Signature != NSignature::kCentralFileHeader)
+ if (progress && i % 1000 == 0)
+ RINOK(progress->SetCompleted(items.Size()));
+ if (m_Signature != NSignature::kCentralFileHeader)
return S_FALSE;
CItemEx cdItem;
@@ -688,6 +691,58 @@ HRESULT CInArchive::ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt
return S_OK;
}
+struct CEcd
+{
+ UInt16 thisDiskNumber;
+ UInt16 startCDDiskNumber;
+ UInt16 numEntriesInCDOnThisDisk;
+ UInt16 numEntriesInCD;
+ UInt32 cdSize;
+ UInt32 cdStartOffset;
+ UInt16 commentSize;
+ void Parse(const Byte *p);
+};
+
+void CEcd::Parse(const Byte *p)
+{
+ thisDiskNumber = Get16(p);
+ startCDDiskNumber = Get16(p + 2);
+ numEntriesInCDOnThisDisk = Get16(p + 4);
+ numEntriesInCD = Get16(p + 6);
+ cdSize = Get32(p + 8);
+ cdStartOffset = Get32(p + 12);
+ commentSize = Get16(p + 16);
+}
+
+struct CEcd64
+{
+ UInt16 versionMade;
+ UInt16 versionNeedExtract;
+ UInt32 thisDiskNumber;
+ UInt32 startCDDiskNumber;
+ UInt64 numEntriesInCDOnThisDisk;
+ UInt64 numEntriesInCD;
+ UInt64 cdSize;
+ UInt64 cdStartOffset;
+ void Parse(const Byte *p);
+ CEcd64() { memset(this, 0, sizeof(*this)); }
+};
+
+void CEcd64::Parse(const Byte *p)
+{
+ versionMade = Get16(p);
+ versionNeedExtract = Get16(p + 2);
+ thisDiskNumber = Get32(p + 4);
+ startCDDiskNumber = Get32(p + 8);
+ numEntriesInCDOnThisDisk = Get64(p + 12);
+ numEntriesInCD = Get64(p + 20);
+ cdSize = Get64(p + 28);
+ cdStartOffset = Get64(p + 36);
+}
+
+#define COPY_ECD_ITEM_16(n) if (!isZip64 || ecd. ## n != 0xFFFF) ecd64. ## n = ecd. ## n;
+#define COPY_ECD_ITEM_32(n) if (!isZip64 || ecd. ## n != 0xFFFFFFFF) ecd64. ## n = ecd. ## n;
+
HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress)
{
// m_Signature must be kLocalFileHeaderSignature or
@@ -696,14 +751,9 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
IsZip64 = false;
items.Clear();
- if (progress != 0)
- {
- UInt64 numItems = items.Size();
- RINOK(progress->SetCompleted(&numItems));
- }
UInt64 cdSize, cdStartOffset;
- HRESULT res = ReadCd(items, cdStartOffset, cdSize);
+ HRESULT res = ReadCd(items, cdStartOffset, cdSize, progress);
if (res != S_FALSE && res != S_OK)
return res;
@@ -726,39 +776,32 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
cdStartOffset -= m_ArchiveInfo.Base;
}
- UInt32 thisDiskNumber = 0;
- UInt32 startCDDiskNumber = 0;
- UInt64 numEntriesInCDOnThisDisk = 0;
- UInt64 numEntriesInCD = 0;
- UInt64 cdSizeFromRecord = 0;
- UInt64 cdStartOffsetFromRecord = 0;
+ CEcd64 ecd64;
bool isZip64 = false;
UInt64 zip64EcdStartOffset = m_Position - 4 - m_ArchiveInfo.Base;
- if(m_Signature == NSignature::kZip64EndOfCentralDir)
+ if (m_Signature == NSignature::kZip64EndOfCentralDir)
{
IsZip64 = isZip64 = true;
UInt64 recordSize = ReadUInt64();
- /* UInt16 versionMade = */ ReadUInt16();
- /* UInt16 versionNeedExtract = */ ReadUInt16();
- thisDiskNumber = ReadUInt32();
- startCDDiskNumber = ReadUInt32();
- numEntriesInCDOnThisDisk = ReadUInt64();
- numEntriesInCD = ReadUInt64();
- cdSizeFromRecord = ReadUInt64();
- cdStartOffsetFromRecord = ReadUInt64();
+
+ const int kBufSize = kZip64EcdSize;
+ Byte buf[kBufSize];
+ SafeReadBytes(buf, kBufSize);
+ ecd64.Parse(buf);
+
IncreaseRealPosition(recordSize - kZip64EcdSize);
if (!ReadUInt32(m_Signature))
return S_FALSE;
- if (thisDiskNumber != 0 || startCDDiskNumber != 0)
+ if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0)
throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
- if (numEntriesInCDOnThisDisk != items.Size() ||
- numEntriesInCD != items.Size() ||
- cdSizeFromRecord != cdSize ||
- (cdStartOffsetFromRecord != cdStartOffset &&
+ if (ecd64.numEntriesInCDOnThisDisk != items.Size() ||
+ ecd64.numEntriesInCD != items.Size() ||
+ ecd64.cdSize != cdSize ||
+ (ecd64.cdStartOffset != cdStartOffset &&
(!items.IsEmpty())))
return S_FALSE;
}
- if(m_Signature == NSignature::kZip64EndOfCentralDirLocator)
+ if (m_Signature == NSignature::kZip64EndOfCentralDirLocator)
{
/* UInt32 startEndCDDiskNumber = */ ReadUInt32();
UInt64 endCDStartOffset = ReadUInt64();
@@ -768,42 +811,30 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
if (!ReadUInt32(m_Signature))
return S_FALSE;
}
- if(m_Signature != NSignature::kEndOfCentralDir)
+ if (m_Signature != NSignature::kEndOfCentralDir)
return S_FALSE;
- UInt16 thisDiskNumber16 = ReadUInt16();
- if (!isZip64 || thisDiskNumber16 != 0xFFFF)
- thisDiskNumber = thisDiskNumber16;
-
- UInt16 startCDDiskNumber16 = ReadUInt16();
- if (!isZip64 || startCDDiskNumber16 != 0xFFFF)
- startCDDiskNumber = startCDDiskNumber16;
-
- UInt16 numEntriesInCDOnThisDisk16 = ReadUInt16();
- if (!isZip64 || numEntriesInCDOnThisDisk16 != 0xFFFF)
- numEntriesInCDOnThisDisk = numEntriesInCDOnThisDisk16;
+ const int kBufSize = kEcdSize - 4;
+ Byte buf[kBufSize];
+ SafeReadBytes(buf, kBufSize);
+ CEcd ecd;
+ ecd.Parse(buf);
- UInt16 numEntriesInCD16 = ReadUInt16();
- if (!isZip64 || numEntriesInCD16 != 0xFFFF)
- numEntriesInCD = numEntriesInCD16;
+ COPY_ECD_ITEM_16(thisDiskNumber);
+ COPY_ECD_ITEM_16(startCDDiskNumber);
+ COPY_ECD_ITEM_16(numEntriesInCDOnThisDisk);
+ COPY_ECD_ITEM_16(numEntriesInCD);
+ COPY_ECD_ITEM_32(cdSize);
+ COPY_ECD_ITEM_32(cdStartOffset);
- UInt32 cdSizeFromRecord32 = ReadUInt32();
- if (!isZip64 || cdSizeFromRecord32 != 0xFFFFFFFF)
- cdSizeFromRecord = cdSizeFromRecord32;
+ ReadBuffer(m_ArchiveInfo.Comment, ecd.commentSize);
- UInt32 cdStartOffsetFromRecord32 = ReadUInt32();
- if (!isZip64 || cdStartOffsetFromRecord32 != 0xFFFFFFFF)
- cdStartOffsetFromRecord = cdStartOffsetFromRecord32;
-
- UInt16 commentSize = ReadUInt16();
- ReadBuffer(m_ArchiveInfo.Comment, commentSize);
-
- if (thisDiskNumber != 0 || startCDDiskNumber != 0)
+ if (ecd64.thisDiskNumber != 0 || ecd64.startCDDiskNumber != 0)
throw CInArchiveException(CInArchiveException::kMultiVolumeArchiveAreNotSupported);
- if ((UInt16)numEntriesInCDOnThisDisk != ((UInt16)items.Size()) ||
- (UInt16)numEntriesInCD != ((UInt16)items.Size()) ||
- (UInt32)cdSizeFromRecord != (UInt32)cdSize ||
- ((UInt32)(cdStartOffsetFromRecord) != (UInt32)cdStartOffset &&
+ if ((UInt16)ecd64.numEntriesInCDOnThisDisk != ((UInt16)items.Size()) ||
+ (UInt16)ecd64.numEntriesInCD != ((UInt16)items.Size()) ||
+ (UInt32)ecd64.cdSize != (UInt32)cdSize ||
+ ((UInt32)(ecd64.cdStartOffset) != (UInt32)cdStartOffset &&
(!items.IsEmpty())))
return S_FALSE;
@@ -813,26 +844,25 @@ HRESULT CInArchive::ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *pr
ISequentialInStream* CInArchive::CreateLimitedStream(UInt64 position, UInt64 size)
{
CLimitedSequentialInStream *streamSpec = new CLimitedSequentialInStream;
- CMyComPtr<ISequentialInStream> inStream(streamSpec);
+ CMyComPtr<ISequentialInStream> stream(streamSpec);
SeekInArchive(m_ArchiveInfo.Base + position);
streamSpec->SetStream(m_Stream);
streamSpec->Init(size);
- return inStream.Detach();
+ return stream.Detach();
}
IInStream* CInArchive::CreateStream()
{
- CMyComPtr<IInStream> inStream = m_Stream;
- return inStream.Detach();
+ CMyComPtr<IInStream> stream = m_Stream;
+ return stream.Detach();
}
bool CInArchive::SeekInArchive(UInt64 position)
{
UInt64 newPosition;
- if(m_Stream->Seek(position, STREAM_SEEK_SET, &newPosition) != S_OK)
+ if (m_Stream->Seek(position, STREAM_SEEK_SET, &newPosition) != S_OK)
return false;
return (newPosition == position);
}
}}
-
diff --git a/CPP/7zip/Archive/Zip/ZipIn.h b/CPP/7zip/Archive/Zip/ZipIn.h
index b5a5a3ef..750095d6 100755
--- a/CPP/7zip/Archive/Zip/ZipIn.h
+++ b/CPP/7zip/Archive/Zip/ZipIn.h
@@ -25,7 +25,7 @@ public:
kMultiVolumeArchiveAreNotSupported,
kReadStreamError,
kSeekStreamError
- }
+ }
Cause;
CInArchiveException(ECauseType cause): Cause(cause) {}
};
@@ -37,18 +37,19 @@ public:
UInt64 StartPosition;
CByteBuffer Comment;
CInArchiveInfo(): Base(0), StartPosition(0) {}
- void Clear()
- {
+ void Clear()
+ {
Base = 0;
StartPosition = 0;
- Comment.SetCapacity(0);
+ Comment.SetCapacity(0);
}
};
class CProgressVirt
{
public:
- STDMETHOD(SetCompleted)(const UInt64 *numFiles) PURE;
+ STDMETHOD(SetTotal)(UInt64 numFiles) PURE;
+ STDMETHOD(SetCompleted)(UInt64 numFiles) PURE;
};
struct CCdInfo
@@ -68,7 +69,7 @@ class CInArchive
HRESULT Seek(UInt64 offset);
- bool FindAndReadMarker(const UInt64 *searchHeaderSizeLimit);
+ HRESULT FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
bool ReadUInt32(UInt32 &signature);
AString ReadFileName(UInt32 nameSize);
@@ -83,15 +84,15 @@ class CInArchive
void IncreaseRealPosition(UInt64 addValue);
- void ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
+ void ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber);
HRESULT ReadLocalItem(CItemEx &item);
HRESULT ReadLocalItemDescriptor(CItemEx &item);
HRESULT ReadCdItem(CItemEx &item);
HRESULT TryEcd64(UInt64 offset, CCdInfo &cdInfo);
HRESULT FindCd(CCdInfo &cdInfo);
- HRESULT TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize);
- HRESULT ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize);
+ HRESULT TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize, CProgressVirt *progress);
+ HRESULT ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress);
HRESULT ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset);
public:
CInArchiveInfo m_ArchiveInfo;
@@ -100,12 +101,14 @@ public:
HRESULT ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress);
HRESULT ReadLocalItemAfterCdItem(CItemEx &item);
HRESULT ReadLocalItemAfterCdItemFull(CItemEx &item);
- bool Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit);
+ HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit);
void Close();
void GetArchiveInfo(CInArchiveInfo &archiveInfo) const;
bool SeekInArchive(UInt64 position);
ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size);
IInStream* CreateStream();
+
+ bool IsOpen() const { return m_Stream != NULL; }
};
}}
diff --git a/CPP/7zip/Archive/Zip/ZipItem.cpp b/CPP/7zip/Archive/Zip/ZipItem.cpp
index 484696f5..9bbf3882 100755
--- a/CPP/7zip/Archive/Zip/ZipItem.cpp
+++ b/CPP/7zip/Archive/Zip/ZipItem.cpp
@@ -18,7 +18,7 @@ bool operator==(const CVersion &v1, const CVersion &v2)
bool operator!=(const CVersion &v1, const CVersion &v2)
{
return !(v1 == v2);
-}
+}
bool CExtraSubBlock::ExtractNtfsTime(int index, FILETIME &ft) const
{
@@ -52,26 +52,26 @@ bool CExtraSubBlock::ExtractNtfsTime(int index, FILETIME &ft) const
}
bool CLocalItem::IsImplodeBigDictionary() const
-{
+{
if (CompressionMethod != NFileHeader::NCompressionMethod::kImploded)
throw 12312212;
- return (Flags & NFileHeader::NFlags::kImplodeDictionarySizeMask) != 0;
+ return (Flags & NFileHeader::NFlags::kImplodeDictionarySizeMask) != 0;
}
bool CLocalItem::IsImplodeLiteralsOn() const
{
if (CompressionMethod != NFileHeader::NCompressionMethod::kImploded)
throw 12312213;
- return (Flags & NFileHeader::NFlags::kImplodeLiteralsOnMask) != 0;
+ return (Flags & NFileHeader::NFlags::kImplodeLiteralsOnMask) != 0;
}
-bool CLocalItem::IsDirectory() const
-{
+bool CLocalItem::IsDir() const
+{
return NItemName::HasTailSlash(Name, GetCodePage());
}
-bool CItem::IsDirectory() const
-{
+bool CItem::IsDir() const
+{
if (NItemName::HasTailSlash(Name, GetCodePage()))
return true;
if (!FromCentral)
@@ -80,14 +80,11 @@ bool CItem::IsDirectory() const
switch(MadeByVersion.HostOS)
{
case NFileHeader::NHostOS::kAMIGA:
- switch (highAttributes & NFileHeader::NAmigaAttribute::kIFMT)
+ switch (highAttributes & NFileHeader::NAmigaAttribute::kIFMT)
{
- case NFileHeader::NAmigaAttribute::kIFDIR:
- return true;
- case NFileHeader::NAmigaAttribute::kIFREG:
- return false;
- default:
- return false; // change it throw kUnknownAttributes;
+ case NFileHeader::NAmigaAttribute::kIFDIR: return true;
+ case NFileHeader::NAmigaAttribute::kIFREG: return false;
+ default: return false; // change it throw kUnknownAttributes;
}
case NFileHeader::NHostOS::kFAT:
case NFileHeader::NHostOS::kNTFS:
@@ -103,7 +100,7 @@ bool CItem::IsDirectory() const
return false; // change it throw kUnknownAttributes;
default:
/*
- switch (highAttributes & NFileHeader::NUnixAttribute::kIFMT)
+ switch (highAttributes & NFileHeader::NUnixAttribute::kIFMT)
{
case NFileHeader::NUnixAttribute::kIFDIR:
return true;
@@ -118,7 +115,7 @@ bool CItem::IsDirectory() const
UInt32 CLocalItem::GetWinAttributes() const
{
DWORD winAttributes = 0;
- if (IsDirectory())
+ if (IsDir())
winAttributes |= FILE_ATTRIBUTE_DIRECTORY;
return winAttributes;
}
@@ -131,26 +128,26 @@ UInt32 CItem::GetWinAttributes() const
case NFileHeader::NHostOS::kFAT:
case NFileHeader::NHostOS::kNTFS:
if (FromCentral)
- winAttributes = ExternalAttributes;
+ winAttributes = ExternalAttributes;
break;
default:
winAttributes = 0; // must be converted from unix value;
}
- if (IsDirectory()) // test it;
+ if (IsDir()) // test it;
winAttributes |= FILE_ATTRIBUTE_DIRECTORY;
return winAttributes;
}
void CLocalItem::SetFlagBits(int startBitNumber, int numBits, int value)
-{
+{
UInt16 mask = (UInt16)(((1 << numBits) - 1) << startBitNumber);
Flags &= ~mask;
Flags |= value << startBitNumber;
}
void CLocalItem::SetBitMask(int bitMask, bool enable)
-{
- if(enable)
+{
+ if(enable)
Flags |= bitMask;
else
Flags &= ~bitMask;
diff --git a/CPP/7zip/Archive/Zip/ZipItem.h b/CPP/7zip/Archive/Zip/ZipItem.h
index 8d7cc3b4..bc1b27c0 100755
--- a/CPP/7zip/Archive/Zip/ZipItem.h
+++ b/CPP/7zip/Archive/Zip/ZipItem.h
@@ -32,8 +32,8 @@ struct CExtraSubBlock
struct CWzAesExtraField
{
- UInt16 VendorVersion; // 0x0001 - AE-1, 0x0002 - AE-2,
- // UInt16 VendorId; // "AE"
+ UInt16 VendorVersion; // 0x0001 - AE-1, 0x0002 - AE-2,
+ // UInt16 VendorId; // "AE"
Byte Strength; // 1 - 128-bit , 2 - 192-bit , 3 - 256-bit
UInt16 Method;
@@ -111,14 +111,14 @@ struct CExtraBlock
{
CObjectVector<CExtraSubBlock> SubBlocks;
void Clear() { SubBlocks.Clear(); }
- size_t GetSize() const
+ size_t GetSize() const
{
size_t res = 0;
for (int i = 0; i < SubBlocks.Size(); i++)
res += SubBlocks[i].Data.GetCapacity() + 2 + 2;
return res;
}
- bool GetWzAesField(CWzAesExtraField &aesField) const
+ bool GetWzAesField(CWzAesExtraField &aesField) const
{
for (int i = 0; i < SubBlocks.Size(); i++)
if (aesField.ParseFromSubBlock(SubBlocks[i]))
@@ -126,7 +126,7 @@ struct CExtraBlock
return false;
}
- bool GetStrongCryptoField(CStrongCryptoField &f) const
+ bool GetStrongCryptoField(CStrongCryptoField &f) const
{
for (int i = 0; i < SubBlocks.Size(); i++)
if (f.ParseFromSubBlock(SubBlocks[i]))
@@ -134,13 +134,13 @@ struct CExtraBlock
return false;
}
- bool HasWzAesField() const
+ bool HasWzAesField() const
{
CWzAesExtraField aesField;
return GetWzAesField(aesField);
}
- bool GetNtfsTime(int index, FILETIME &ft) const
+ bool GetNtfsTime(int index, FILETIME &ft) const
{
for (int i = 0; i < SubBlocks.Size(); i++)
{
@@ -152,7 +152,7 @@ struct CExtraBlock
}
/*
- bool HasStrongCryptoField() const
+ bool HasStrongCryptoField() const
{
CStrongCryptoField f;
return GetStrongCryptoField(f);
@@ -191,14 +191,14 @@ public:
bool IsImplodeBigDictionary() const;
bool IsImplodeLiteralsOn() const;
- bool IsDirectory() const;
+ bool IsDir() const;
bool IgnoreItem() const { return false; }
UInt32 GetWinAttributes() const;
bool HasDescriptor() const { return (Flags & NFileHeader::NFlags::kDescriptorUsedMask) != 0; }
- UString GetUnicodeString(const AString &s) const
- {
+ UString GetUnicodeString(const AString &s) const
+ {
UString res;
if (IsUtf8())
if (!ConvertUTF8ToUnicode(s, res))
@@ -239,10 +239,10 @@ public:
bool FromCentral;
bool NtfsTimeIsDefined;
- bool IsDirectory() const;
+ bool IsDir() const;
UInt32 GetWinAttributes() const;
- bool IsThereCrc() const
+ bool IsThereCrc() const
{
if (CompressionMethod == NFileHeader::NCompressionMethod::kWzAES)
{
@@ -250,12 +250,12 @@ public:
if (CentralExtra.GetWzAesField(aesField))
return aesField.NeedCrc();
}
- return (FileCRC != 0 || !IsDirectory());
+ return (FileCRC != 0 || !IsDir());
}
WORD GetCodePage() const
{
- return (WORD)((MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT
+ return (WORD)((MadeByVersion.HostOS == NFileHeader::NHostOS::kFAT
|| MadeByVersion.HostOS == NFileHeader::NHostOS::kNTFS
) ? CP_OEMCP : CP_ACP);
}
diff --git a/CPP/7zip/Archive/Zip/ZipItemEx.h b/CPP/7zip/Archive/Zip/ZipItemEx.h
index 0c5ba0ca..ab62cdbb 100755
--- a/CPP/7zip/Archive/Zip/ZipItemEx.h
+++ b/CPP/7zip/Archive/Zip/ZipItemEx.h
@@ -15,17 +15,17 @@ public:
UInt32 FileHeaderWithNameSize;
UInt16 LocalExtraSize;
- UInt64 GetLocalFullSize() const
- { return FileHeaderWithNameSize + LocalExtraSize + PackSize +
+ UInt64 GetLocalFullSize() const
+ { return FileHeaderWithNameSize + LocalExtraSize + PackSize +
(HasDescriptor() ? NFileHeader::kDataDescriptorSize : 0); };
/*
- UInt64 GetLocalFullSize(bool isZip64) const
- { return FileHeaderWithNameSize + LocalExtraSize + PackSize +
+ UInt64 GetLocalFullSize(bool isZip64) const
+ { return FileHeaderWithNameSize + LocalExtraSize + PackSize +
(HasDescriptor() ? (isZip64 ? NFileHeader::kDataDescriptor64Size : NFileHeader::kDataDescriptorSize) : 0); };
*/
- UInt64 GetLocalExtraPosition() const
+ UInt64 GetLocalExtraPosition() const
{ return LocalHeaderPosition + FileHeaderWithNameSize; };
- UInt64 GetDataPosition() const
+ UInt64 GetDataPosition() const
{ return GetLocalExtraPosition() + LocalExtraSize; };
};
diff --git a/CPP/7zip/Archive/Zip/ZipOut.cpp b/CPP/7zip/Archive/Zip/ZipOut.cpp
index fd89b1e8..5b1bdeee 100755
--- a/CPP/7zip/Archive/Zip/ZipOut.cpp
+++ b/CPP/7zip/Archive/Zip/ZipOut.cpp
@@ -36,7 +36,7 @@ void COutArchive::PrepareWriteCompressedDataZip64(UInt16 fileNameLength, bool is
void COutArchive::PrepareWriteCompressedData(UInt16 fileNameLength, UInt64 unPackSize, bool aesEncryption)
{
- // We test it to 0xF8000000 to support case when compressed size
+ // We test it to 0xF8000000 to support case when compressed size
// can be larger than uncompressed size.
PrepareWriteCompressedDataZip64(fileNameLength, unPackSize >= 0xF8000000, aesEncryption);
}
diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.cpp b/CPP/7zip/Archive/Zip/ZipUpdate.cpp
index 2ec08981..3294ad78 100755
--- a/CPP/7zip/Archive/Zip/ZipUpdate.cpp
+++ b/CPP/7zip/Archive/Zip/ZipUpdate.cpp
@@ -30,13 +30,20 @@ using namespace NSynchronization;
namespace NArchive {
namespace NZip {
-static const Byte kMadeByHostOS = NFileHeader::NHostOS::kFAT;
-static const Byte kExtractHostOS = NFileHeader::NHostOS::kFAT;
+static const Byte kHostOS =
+ #ifdef _WIN32
+ NFileHeader::NHostOS::kFAT;
+ #else
+ NFileHeader::NHostOS::kUnix;
+ #endif
+
+static const Byte kMadeByHostOS = kHostOS;
+static const Byte kExtractHostOS = kHostOS;
static const Byte kMethodForDirectory = NFileHeader::NCompressionMethod::kStored;
static const Byte kExtractVersionForDirectory = NFileHeader::NCompressionMethod::kStoreExtractVersion;
-static HRESULT CopyBlockToArchive(ISequentialInStream *inStream,
+static HRESULT CopyBlockToArchive(ISequentialInStream *inStream,
COutArchive &outArchive, ICompressProgressInfo *progress)
{
CMyComPtr<ISequentialOutStream> outStream;
@@ -45,7 +52,7 @@ static HRESULT CopyBlockToArchive(ISequentialInStream *inStream,
return copyCoder->Code(inStream, outStream, NULL, NULL, progress);
}
-static HRESULT WriteRange(IInStream *inStream, COutArchive &outArchive,
+static HRESULT WriteRange(IInStream *inStream, COutArchive &outArchive,
const CUpdateRange &range, ICompressProgressInfo *progress)
{
UInt64 position;
@@ -61,30 +68,30 @@ static HRESULT WriteRange(IInStream *inStream, COutArchive &outArchive,
}
static void SetFileHeader(
- COutArchive &archive,
+ COutArchive &archive,
const CCompressionMethodMode &options,
- const CUpdateItem &updateItem,
+ const CUpdateItem &ui,
CItem &item)
{
- item.UnPackSize = updateItem.Size;
- bool isDirectory;
+ item.UnPackSize = ui.Size;
+ bool isDir;
item.ClearFlags();
- if (updateItem.NewProperties)
+ if (ui.NewProperties)
{
- isDirectory = updateItem.IsDirectory;
- item.Name = updateItem.Name;
- item.SetUtf8(updateItem.IsUtf8);
- item.ExternalAttributes = updateItem.Attributes;
- item.Time = updateItem.Time;
- item.NtfsMTime = updateItem.NtfsMTime;
- item.NtfsATime = updateItem.NtfsATime;
- item.NtfsCTime = updateItem.NtfsCTime;
- item.NtfsTimeIsDefined = updateItem.NtfsTimeIsDefined;
+ isDir = ui.IsDir;
+ item.Name = ui.Name;
+ item.SetUtf8(ui.IsUtf8);
+ item.ExternalAttributes = ui.Attributes;
+ item.Time = ui.Time;
+ item.NtfsMTime = ui.NtfsMTime;
+ item.NtfsATime = ui.NtfsATime;
+ item.NtfsCTime = ui.NtfsCTime;
+ item.NtfsTimeIsDefined = ui.NtfsTimeIsDefined;
}
else
- isDirectory = item.IsDirectory();
+ isDir = item.IsDir();
item.LocalHeaderPosition = archive.GetCurrentPosition();
item.MadeByVersion.HostOS = kMadeByHostOS;
@@ -93,8 +100,8 @@ static void SetFileHeader(
item.ExtractVersion.HostOS = kExtractHostOS;
item.InternalAttributes = 0; // test it
- item.SetEncrypted(!isDirectory && options.PasswordIsDefined);
- if (isDirectory)
+ item.SetEncrypted(!isDir && options.PasswordIsDefined);
+ if (isDir)
{
item.ExtractVersion.Version = kExtractVersionForDirectory;
item.CompressionMethod = kMethodForDirectory;
@@ -103,7 +110,7 @@ static void SetFileHeader(
}
}
-static void SetItemInfoFromCompressingResult(const CCompressingResult &compressingResult,
+static void SetItemInfoFromCompressingResult(const CCompressingResult &compressingResult,
bool isAesMode, Byte aesKeyMode, CItem &item)
{
item.ExtractVersion.Version = compressingResult.ExtractVersion;
@@ -196,7 +203,7 @@ void CThreadInfo::WaitAndCode()
return;
Result = Coder.Compress(
#ifdef EXTERNAL_CODECS
- _codecsInfo, _externalCodecs,
+ _codecsInfo, _externalCodecs,
#endif
InStream, OutStream, Progress, CompressingResult);
if (Result == S_OK && Progress)
@@ -289,7 +296,7 @@ HRESULT CMtProgressMixer2::SetRatioInfo(int index, const UInt64 *inSize, const U
InSizes[index] = *inSize;
if (outSize != 0)
OutSizes[index] = *outSize;
- UInt64 v = ProgressOffset + (_inSizeIsMain ?
+ UInt64 v = ProgressOffset + (_inSizeIsMain ?
(InSizes[0] + InSizes[1]) :
(OutSizes[0] + OutSizes[1]));
return Progress->SetCompleted(&v);
@@ -300,7 +307,7 @@ STDMETHODIMP CMtProgressMixer2::SetRatioInfo(const UInt64 *inSize, const UInt64
return SetRatioInfo(0, inSize, outSize);
}
-class CMtProgressMixer:
+class CMtProgressMixer:
public ICompressProgressInfo,
public CMyUnknownImp
{
@@ -328,14 +335,14 @@ STDMETHODIMP CMtProgressMixer::SetRatioInfo(const UInt64 *inSize, const UInt64 *
#endif
-static HRESULT UpdateItemOldData(COutArchive &archive,
+static HRESULT UpdateItemOldData(COutArchive &archive,
IInStream *inStream,
- const CUpdateItem &updateItem, CItemEx &item,
+ const CUpdateItem &ui, CItemEx &item,
/* bool izZip64, */
ICompressProgressInfo *progress,
UInt64 &complexity)
{
- if (updateItem.NewProperties)
+ if (ui.NewProperties)
{
if (item.HasDescriptor())
return E_NOTIMPL;
@@ -344,15 +351,15 @@ static HRESULT UpdateItemOldData(COutArchive &archive,
// CUpdateRange range(item.GetLocalExtraPosition(), item.LocalExtraSize + item.PackSize);
CUpdateRange range(item.GetDataPosition(), item.PackSize);
- // item.ExternalAttributes = updateItem.Attributes;
+ // item.ExternalAttributes = ui.Attributes;
// Test it
- item.Name = updateItem.Name;
- item.SetUtf8(updateItem.IsUtf8);
- item.Time = updateItem.Time;
- item.NtfsMTime = updateItem.NtfsMTime;
- item.NtfsATime = updateItem.NtfsATime;
- item.NtfsCTime = updateItem.NtfsCTime;
- item.NtfsTimeIsDefined = updateItem.NtfsTimeIsDefined;
+ item.Name = ui.Name;
+ item.SetUtf8(ui.IsUtf8);
+ item.Time = ui.Time;
+ item.NtfsMTime = ui.NtfsMTime;
+ item.NtfsATime = ui.NtfsATime;
+ item.NtfsCTime = ui.NtfsCTime;
+ item.NtfsTimeIsDefined = ui.NtfsTimeIsDefined;
item.CentralExtra.RemoveUnknownSubBlocks();
item.LocalExtra.RemoveUnknownSubBlocks();
@@ -369,7 +376,7 @@ static HRESULT UpdateItemOldData(COutArchive &archive,
CUpdateRange range(item.LocalHeaderPosition, item.GetLocalFullSize());
// set new header position
- item.LocalHeaderPosition = archive.GetCurrentPosition();
+ item.LocalHeaderPosition = archive.GetCurrentPosition();
RINOK(WriteRange(inStream, archive, range, progress));
complexity += range.Size;
@@ -379,21 +386,21 @@ static HRESULT UpdateItemOldData(COutArchive &archive,
}
static void WriteDirHeader(COutArchive &archive, const CCompressionMethodMode *options,
- const CUpdateItem &updateItem, CItemEx &item)
+ const CUpdateItem &ui, CItemEx &item)
{
- SetFileHeader(archive, *options, updateItem, item);
- archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), updateItem.Size, options->IsAesMode);
+ SetFileHeader(archive, *options, ui, item);
+ archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode);
archive.WriteLocalHeader(item);
}
static HRESULT Update2St(
DECL_EXTERNAL_CODECS_LOC_VARS
- COutArchive &archive,
+ COutArchive &archive,
CInArchive *inArchive,
IInStream *inStream,
const CObjectVector<CItemEx> &inputItems,
const CObjectVector<CUpdateItem> &updateItems,
- const CCompressionMethodMode *options,
+ const CCompressionMethodMode *options,
const CByteBuffer &comment,
IArchiveUpdateCallback *updateCallback)
{
@@ -411,37 +418,37 @@ static HRESULT Update2St(
lps->InSize = unpackSizeTotal;
lps->OutSize = packSizeTotal;
RINOK(lps->SetCur());
- const CUpdateItem &updateItem = updateItems[itemIndex];
+ const CUpdateItem &ui = updateItems[itemIndex];
CItemEx item;
- if (!updateItem.NewProperties || !updateItem.NewData)
+ if (!ui.NewProperties || !ui.NewData)
{
- item = inputItems[updateItem.IndexInArchive];
+ item = inputItems[ui.IndexInArchive];
if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK)
return E_NOTIMPL;
}
- if (updateItem.NewData)
+ if (ui.NewData)
{
- bool isDirectory = ((updateItem.NewProperties) ? updateItem.IsDirectory : item.IsDirectory());
- if (isDirectory)
+ bool isDir = ((ui.NewProperties) ? ui.IsDir : item.IsDir());
+ if (isDir)
{
- WriteDirHeader(archive, options, updateItem, item);
+ WriteDirHeader(archive, options, ui, item);
}
else
{
CMyComPtr<ISequentialInStream> fileInStream;
- HRESULT res = updateCallback->GetStream(updateItem.IndexInClient, &fileInStream);
+ HRESULT res = updateCallback->GetStream(ui.IndexInClient, &fileInStream);
if (res == S_FALSE)
{
- lps->ProgressOffset += updateItem.Size;
+ lps->ProgressOffset += ui.Size;
RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
continue;
}
RINOK(res);
// file Size can be 64-bit !!!
- SetFileHeader(archive, *options, updateItem, item);
- archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), updateItem.Size, options->IsAesMode);
+ SetFileHeader(archive, *options, ui, item);
+ archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode);
CCompressingResult compressingResult;
CMyComPtr<IOutStream> outStream;
archive.CreateStreamForCompressing(&outStream);
@@ -459,7 +466,7 @@ static HRESULT Update2St(
{
UInt64 complexity = 0;
lps->SendRatio = false;
- RINOK(UpdateItemOldData(archive, inStream, updateItem, item, progress, complexity));
+ RINOK(UpdateItemOldData(archive, inStream, ui, item, progress, complexity));
lps->SendRatio = true;
lps->ProgressOffset += complexity;
}
@@ -472,12 +479,12 @@ static HRESULT Update2St(
static HRESULT Update2(
DECL_EXTERNAL_CODECS_LOC_VARS
- COutArchive &archive,
+ COutArchive &archive,
CInArchive *inArchive,
IInStream *inStream,
const CObjectVector<CItemEx> &inputItems,
const CObjectVector<CUpdateItem> &updateItems,
- const CCompressionMethodMode *options,
+ const CCompressionMethodMode *options,
const CByteBuffer &comment,
IArchiveUpdateCallback *updateCallback)
{
@@ -488,20 +495,20 @@ static HRESULT Update2(
int i;
for(i = 0; i < updateItems.Size(); i++)
{
- const CUpdateItem &updateItem = updateItems[i];
- if (updateItem.NewData)
+ const CUpdateItem &ui = updateItems[i];
+ if (ui.NewData)
{
- complexity += updateItem.Size;
- numBytesToCompress += updateItem.Size;
+ complexity += ui.Size;
+ numBytesToCompress += ui.Size;
numFilesToCompress++;
/*
- if (updateItem.Commented)
- complexity += updateItem.CommentRange.Size;
+ if (ui.Commented)
+ complexity += ui.CommentRange.Size;
*/
}
else
{
- CItemEx inputItem = inputItems[updateItem.IndexInArchive];
+ CItemEx inputItem = inputItems[ui.IndexInArchive];
if (inArchive->ReadLocalItemAfterCdItemFull(inputItem) != S_OK)
return E_NOTIMPL;
complexity += inputItem.GetLocalFullSize();
@@ -580,7 +587,7 @@ static HRESULT Update2(
mtProgressMixerSpec->Create(updateCallback, true);
CMtCompressProgressMixer mtCompressProgressMixer;
- mtCompressProgressMixer.Init(numThreads, mtProgressMixerSpec->RatioProgress);
+ mtCompressProgressMixer.Init(numThreads, mtProgressMixerSpec->RatioProgress);
CMemBlockManagerMt memManager(kBlockSize);
CMemRefs refs(&memManager);
@@ -625,30 +632,30 @@ static HRESULT Update2(
{
if ((UInt32)threadIndices.Size() < numThreads && mtItemIndex < updateItems.Size())
{
- const CUpdateItem &updateItem = updateItems[mtItemIndex++];
- if (!updateItem.NewData)
+ const CUpdateItem &ui = updateItems[mtItemIndex++];
+ if (!ui.NewData)
continue;
CItemEx item;
- if (updateItem.NewProperties)
+ if (ui.NewProperties)
{
- if (updateItem.IsDirectory)
+ if (ui.IsDir)
continue;
}
else
{
- item = inputItems[updateItem.IndexInArchive];
+ item = inputItems[ui.IndexInArchive];
if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK)
return E_NOTIMPL;
- if (item.IsDirectory())
+ if (item.IsDir())
continue;
}
CMyComPtr<ISequentialInStream> fileInStream;
{
NWindows::NSynchronization::CCriticalSectionLock lock(mtProgressMixerSpec->Mixer2->CriticalSection);
- HRESULT res = updateCallback->GetStream(updateItem.IndexInClient, &fileInStream);
+ HRESULT res = updateCallback->GetStream(ui.IndexInClient, &fileInStream);
if (res == S_FALSE)
{
- complexity += updateItem.Size;
+ complexity += ui.Size;
complexity += NFileHeader::kLocalBlockSize;
mtProgressMixerSpec->Mixer2->SetProgressOffset(complexity);
RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
@@ -667,9 +674,9 @@ static HRESULT Update2(
threadInfo.IsFree = false;
threadInfo.InStream = fileInStream;
- // !!!!! we must release ref before sending event
+ // !!!!! we must release ref before sending event
// BUG was here in v4.43 and v4.44. It could change ref counter in two threads in same time
- fileInStream.Release();
+ fileInStream.Release();
threadInfo.OutStreamSpec->Init();
threadInfo.ProgressSpec->Reinit();
@@ -690,31 +697,31 @@ static HRESULT Update2(
continue;
}
- const CUpdateItem &updateItem = updateItems[itemIndex];
+ const CUpdateItem &ui = updateItems[itemIndex];
CItemEx item;
- if (!updateItem.NewProperties || !updateItem.NewData)
+ if (!ui.NewProperties || !ui.NewData)
{
- item = inputItems[updateItem.IndexInArchive];
+ item = inputItems[ui.IndexInArchive];
if (inArchive->ReadLocalItemAfterCdItemFull(item) != S_OK)
return E_NOTIMPL;
}
- if (updateItem.NewData)
+ if (ui.NewData)
{
- bool isDirectory = ((updateItem.NewProperties) ? updateItem.IsDirectory : item.IsDirectory());
- if (isDirectory)
+ bool isDir = ((ui.NewProperties) ? ui.IsDir : item.IsDir());
+ if (isDir)
{
- WriteDirHeader(archive, options, updateItem, item);
+ WriteDirHeader(archive, options, ui, item);
}
else
{
if (lastRealStreamItemIndex < itemIndex)
{
lastRealStreamItemIndex = itemIndex;
- SetFileHeader(archive, *options, updateItem, item);
+ SetFileHeader(archive, *options, ui, item);
// file Size can be 64-bit !!!
- archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), updateItem.Size, options->IsAesMode);
+ archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), ui.Size, options->IsAesMode);
}
CMemBlocks2 &memRef = refs.Refs[itemIndex];
@@ -725,7 +732,7 @@ static HRESULT Update2(
memRef.WriteToStream(memManager.GetBlockSize(), outStream);
SetItemInfoFromCompressingResult(memRef.CompressingResult,
options->IsAesMode, options->AesKeyMode, item);
- SetFileHeader(archive, *options, updateItem, item);
+ SetFileHeader(archive, *options, ui, item);
archive.WriteLocalHeader(item);
// RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
memRef.FreeOpt(&memManager);
@@ -743,7 +750,7 @@ static HRESULT Update2(
}
}
- DWORD result = ::WaitForMultipleObjects(compressingCompletedEvents.Size(),
+ DWORD result = ::WaitForMultipleObjects(compressingCompletedEvents.Size(),
&compressingCompletedEvents.Front(), FALSE, INFINITE);
int t = (int)(result - WAIT_OBJECT_0);
CThreadInfo &threadInfo = threads.Threads[threadIndices[t]];
@@ -756,9 +763,9 @@ static HRESULT Update2(
{
RINOK(threadInfo.OutStreamSpec->WriteToRealStream());
threadInfo.OutStreamSpec->ReleaseOutStream();
- SetItemInfoFromCompressingResult(threadInfo.CompressingResult,
+ SetItemInfoFromCompressingResult(threadInfo.CompressingResult,
options->IsAesMode, options->AesKeyMode, item);
- SetFileHeader(archive, *options, updateItem, item);
+ SetFileHeader(archive, *options, ui, item);
archive.WriteLocalHeader(item);
}
else
@@ -774,7 +781,7 @@ static HRESULT Update2(
}
else
{
- RINOK(UpdateItemOldData(archive, inStream, updateItem, item, progress, complexity));
+ RINOK(UpdateItemOldData(archive, inStream, ui, item, progress, complexity));
}
items.Add(item);
complexity += NFileHeader::kLocalBlockSize;
@@ -783,10 +790,10 @@ static HRESULT Update2(
}
archive.WriteCentralDir(items, comment);
return S_OK;
- #endif
+ #endif
}
-HRESULT Update(
+HRESULT Update(
DECL_EXTERNAL_CODECS_LOC_VARS
const CObjectVector<CItemEx> &inputItems,
const CObjectVector<CUpdateItem> &updateItems,
@@ -825,9 +832,9 @@ HRESULT Update(
return Update2(
EXTERNAL_CODECS_LOC_VARS
- outArchive, inArchive, inStream,
- inputItems, updateItems,
- compressionMethodMode,
+ outArchive, inArchive, inStream,
+ inputItems, updateItems,
+ compressionMethodMode,
archiveInfo.Comment, updateCallback);
}
diff --git a/CPP/7zip/Archive/Zip/ZipUpdate.h b/CPP/7zip/Archive/Zip/ZipUpdate.h
index 5e67bead..eee16738 100755
--- a/CPP/7zip/Archive/Zip/ZipUpdate.h
+++ b/CPP/7zip/Archive/Zip/ZipUpdate.h
@@ -16,7 +16,7 @@ namespace NZip {
struct CUpdateRange
{
- UInt64 Position;
+ UInt64 Position;
UInt64 Size;
CUpdateRange() {};
CUpdateRange(UInt64 position, UInt64 size): Position(position), Size(size) {};
@@ -26,7 +26,7 @@ struct CUpdateItem
{
bool NewData;
bool NewProperties;
- bool IsDirectory;
+ bool IsDir;
bool NtfsTimeIsDefined;
bool IsUtf8;
int IndexInArchive;
diff --git a/CPP/7zip/Archive/Zip/zip.ico b/CPP/7zip/Archive/Zip/zip.ico
deleted file mode 100755
index 2af46066..00000000
--- a/CPP/7zip/Archive/Zip/zip.ico
+++ /dev/null
Binary files differ