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/Cab
parent3901bf0ab88106a5b031cba7bc18d60cdebf7eef (diff)
4.59 beta
Diffstat (limited to 'CPP/7zip/Archive/Cab')
-rwxr-xr-xCPP/7zip/Archive/Cab/CabBlockInStream.cpp8
-rwxr-xr-xCPP/7zip/Archive/Cab/CabBlockInStream.h2
-rwxr-xr-xCPP/7zip/Archive/Cab/CabHandler.cpp92
-rwxr-xr-xCPP/7zip/Archive/Cab/CabHandler.h2
-rwxr-xr-xCPP/7zip/Archive/Cab/CabHeader.cpp8
-rwxr-xr-xCPP/7zip/Archive/Cab/CabHeader.h8
-rwxr-xr-xCPP/7zip/Archive/Cab/CabIn.cpp61
-rwxr-xr-xCPP/7zip/Archive/Cab/CabIn.h8
-rwxr-xr-xCPP/7zip/Archive/Cab/CabItem.h23
-rwxr-xr-xCPP/7zip/Archive/Cab/StdAfx.cpp3
-rwxr-xr-xCPP/7zip/Archive/Cab/cab.icobin3638 -> 0 bytes
11 files changed, 89 insertions, 126 deletions
diff --git a/CPP/7zip/Archive/Cab/CabBlockInStream.cpp b/CPP/7zip/Archive/Cab/CabBlockInStream.cpp
index 343ef821..308616b8 100755
--- a/CPP/7zip/Archive/Cab/CabBlockInStream.cpp
+++ b/CPP/7zip/Archive/Cab/CabBlockInStream.cpp
@@ -2,8 +2,8 @@
#include "StdAfx.h"
-extern "C"
-{
+extern "C"
+{
#include "../../../../C/Alloc.h"
}
@@ -45,7 +45,7 @@ public:
m_Value ^= ((UInt32)(m_Hist[i])) << (8 * (m_Pos - i - 1));
}
void UpdateUInt32(UInt32 v) { m_Value ^= v; }
- UInt32 GetResult() const { return m_Value; }
+ UInt32 GetResult() const { return m_Value; }
};
void CCheckSum2::Update(const void *data, UInt32 size)
@@ -65,7 +65,7 @@ void CCheckSum2::Update(const void *data, UInt32 size)
int numWords = size / 4;
- while (numWords-- != 0)
+ while (numWords-- != 0)
{
UInt32 temp = *dataPointer++;
temp |= ((UInt32)(*dataPointer++)) << 8;
diff --git a/CPP/7zip/Archive/Cab/CabBlockInStream.h b/CPP/7zip/Archive/Cab/CabBlockInStream.h
index b8b5d8b9..1db3835b 100755
--- a/CPP/7zip/Archive/Cab/CabBlockInStream.h
+++ b/CPP/7zip/Archive/Cab/CabBlockInStream.h
@@ -9,7 +9,7 @@
namespace NArchive {
namespace NCab {
-class CCabBlockInStream:
+class CCabBlockInStream:
public ISequentialInStream,
public CMyUnknownImp
{
diff --git a/CPP/7zip/Archive/Cab/CabHandler.cpp b/CPP/7zip/Archive/Cab/CabHandler.cpp
index b3e65d90..f4a11afb 100755
--- a/CPP/7zip/Archive/Cab/CabHandler.cpp
+++ b/CPP/7zip/Archive/Cab/CabHandler.cpp
@@ -31,19 +31,18 @@ namespace NCab {
// #define _CAB_DETAILS
#ifdef _CAB_DETAILS
-enum
+enum
{
kpidBlockReal = kpidUserDefined
};
#endif
-STATPROPSTG kProps[] =
+STATPROPSTG kProps[] =
{
{ NULL, kpidPath, VT_BSTR},
- // { NULL, kpidIsFolder, VT_BOOL},
{ NULL, kpidSize, VT_UI8},
- { NULL, kpidLastWriteTime, VT_FILETIME},
- { NULL, kpidAttributes, VT_UI4},
+ { NULL, kpidMTime, VT_FILETIME},
+ { NULL, kpidAttrib, VT_UI4},
{ NULL, kpidMethod, VT_BSTR},
{ NULL, kpidBlock, VT_I4}
#ifdef _CAB_DETAILS
@@ -54,7 +53,7 @@ STATPROPSTG kProps[] =
#endif
};
-static const wchar_t *kMethods[] =
+static const wchar_t *kMethods[] =
{
L"None",
L"MSZip",
@@ -65,7 +64,7 @@ static const wchar_t *kMethods[] =
static const int kNumMethods = sizeof(kMethods) / sizeof(kMethods[0]);
static const wchar_t *kUnknownMethod = L"Unknown";
-STATPROPSTG kArcProps[] =
+STATPROPSTG kArcProps[] =
{
{ NULL, kpidMethod, VT_BSTR},
// { NULL, kpidSolid, VT_BOOL},
@@ -101,7 +100,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
resString += L' ';
resString += method;
}
- prop = resString;
+ prop = resString;
break;
}
// case kpidSolid: prop = _database.IsSolid(); break;
@@ -145,13 +144,11 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
prop = (const wchar_t *)NItemName::WinNameToOSName(unicodeName);
break;
}
- case kpidIsFolder:
- prop = item.IsDirectory();
- break;
- case kpidSize:
- prop = item.Size;
- break;
- case kpidLastWriteTime:
+ case kpidIsDir: prop = item.IsDir(); break;
+ case kpidSize: prop = item.Size; break;
+ case kpidAttrib: prop = item.GetWinAttributes(); break;
+
+ case kpidMTime:
{
FILETIME localFileTime, utcFileTime;
if (NTime::DosTimeToFileTime(item.Time, localFileTime))
@@ -164,9 +161,6 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
prop = utcFileTime;
break;
}
- case kpidAttributes:
- prop = item.GetWinAttributes();
- break;
case kpidMethod:
{
@@ -174,7 +168,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
const CFolder &folder = db.Folders[realFolderIndex];
int methodIndex = folder.GetCompressionMethod();
UString method = (methodIndex < kNumMethods) ? kMethods[methodIndex] : kUnknownMethod;
- if (methodIndex == NHeader::NCompressionMethodMajor::kLZX ||
+ if (methodIndex == NHeader::NCompressionMethodMajor::kLZX ||
methodIndex == NHeader::NCompressionMethodMajor::kQuantum)
{
method += L":";
@@ -185,21 +179,13 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
prop = method;
break;
}
- case kpidBlock:
- prop = (Int32)m_Database.GetFolderIndex(&mvItem);
- break;
+ case kpidBlock: prop = (Int32)m_Database.GetFolderIndex(&mvItem); break;
#ifdef _CAB_DETAILS
- case kpidBlockReal:
- prop = UInt32(item.FolderIndex);
- break;
- case kpidOffset:
- prop = (UInt32)item.Offset;
- break;
- case kpidVolume:
- prop = (UInt32)mvItem.VolumeIndex;
- break;
+ case kpidBlockReal: prop = (UInt32)item.FolderIndex; break;
+ case kpidOffset: prop = (UInt32)item.Offset; break;
+ case kpidVolume: prop = (UInt32)mvItem.VolumeIndex; break;
#endif
}
@@ -209,7 +195,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
}
/*
-class CPropgressImp: public CProgressVirt
+class CProgressImp: public CProgressVirt
{
CMyComPtr<IArchiveOpenCallback> m_OpenArchiveCallback;
public:
@@ -219,14 +205,14 @@ public:
{ m_OpenArchiveCallback = openArchiveCallback; }
};
-STDMETHODIMP CPropgressImp::SetTotal(const UInt64 *numFiles)
+STDMETHODIMP CProgressImp::SetTotal(const UInt64 *numFiles)
{
if (m_OpenArchiveCallback)
return m_OpenArchiveCallback->SetCompleted(numFiles, NULL);
return S_OK;
}
-STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles)
+STDMETHODIMP CProgressImp::SetCompleted(const UInt64 *numFiles)
{
if (m_OpenArchiveCallback)
return m_OpenArchiveCallback->SetCompleted(numFiles, NULL);
@@ -234,9 +220,9 @@ STDMETHODIMP CPropgressImp::SetCompleted(const UInt64 *numFiles)
}
*/
-STDMETHODIMP CHandler::Open(IInStream *inStream,
+STDMETHODIMP CHandler::Open(IInStream *inStream,
const UInt64 *maxCheckStartPosition,
- IArchiveOpenCallback *openArchiveCallback)
+ IArchiveOpenCallback *callback)
{
COM_TRY_BEGIN
Close();
@@ -244,7 +230,7 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
CInArchive archive;
CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
{
- CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = openArchiveCallback;
+ CMyComPtr<IArchiveOpenCallback> openArchiveCallbackWrap = callback;
openArchiveCallbackWrap.QueryInterface(IID_IArchiveOpenVolumeCallback, &openVolumeCallback);
}
@@ -264,7 +250,7 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
{
const CDatabaseEx &dbPrev = m_Database.Volumes[prevChecked ? m_Database.Volumes.Size() - 1 : 0];
if (dbPrev.ArchiveInfo.SetID != db.ArchiveInfo.SetID ||
- dbPrev.ArchiveInfo.CabinetNumber + (prevChecked ? 1: - 1) !=
+ dbPrev.ArchiveInfo.CabinetNumber + (prevChecked ? 1: - 1) !=
db.ArchiveInfo.CabinetNumber)
res = S_FALSE;
}
@@ -273,7 +259,7 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
m_Database.Volumes.Insert(prevChecked ? m_Database.Volumes.Size() : 0, db);
else if (res != S_FALSE)
return res;
- else
+ else
{
if (m_Database.Volumes.IsEmpty())
return S_FALSE;
@@ -283,7 +269,7 @@ STDMETHODIMP CHandler::Open(IInStream *inStream,
}
numItems += db.Items.Size();
- RINOK(openArchiveCallback->SetCompleted(&numItems, NULL));
+ RINOK(callback->SetCompleted(&numItems, NULL));
nextStream = 0;
for (;;)
@@ -342,7 +328,7 @@ STDMETHODIMP CHandler::Close()
return S_OK;
}
-class CCabFolderOutStream:
+class CCabFolderOutStream:
public ISequentialOutStream,
public CMyUnknownImp
{
@@ -373,8 +359,8 @@ public:
void Init(
const CMvDatabaseEx *database,
- const CRecordVector<bool> *extractStatuses,
- int startIndex,
+ const CRecordVector<bool> *extractStatuses,
+ int startIndex,
UInt64 folderSize,
IArchiveExtractCallback *extractCallback,
bool testMode);
@@ -387,8 +373,8 @@ public:
void CCabFolderOutStream::Init(
const CMvDatabaseEx *database,
- const CRecordVector<bool> *extractStatuses,
- int startIndex,
+ const CRecordVector<bool> *extractStatuses,
+ int startIndex,
UInt64 folderSize,
IArchiveExtractCallback *extractCallback,
bool testMode)
@@ -409,7 +395,7 @@ void CCabFolderOutStream::Init(
HRESULT CCabFolderOutStream::OpenFile()
{
- Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ?
+ Int32 askMode = (*m_ExtractStatuses)[m_CurrentIndex] ? (m_TestMode ?
NExtract::NAskMode::kTest :
NExtract::NAskMode::kExtract) :
NExtract::NAskMode::kSkip;
@@ -474,7 +460,7 @@ HRESULT CCabFolderOutStream::Write2(const void *data, UInt32 size, UInt32 *proce
{
m_RealOutStream.Release();
RINOK(m_ExtractCallback->SetOperationResult(
- m_IsOk ?
+ m_IsOk ?
NArchive::NExtract::NOperationResult::kOK:
NArchive::NExtract::NOperationResult::kDataError));
m_FileIsOpen = false;
@@ -574,7 +560,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
int index = allFilesMode ? i : indices[i];
const CMvItem &mvItem = m_Database.Items[index];
const CItem &item = m_Database.Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- if (item.IsDirectory())
+ if (item.IsDir())
continue;
int folderIndex = m_Database.GetFolderIndex(&mvItem);
if (folderIndex != lastFolder)
@@ -622,9 +608,9 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
const CItem &item = db.Items[itemIndex];
i++;
- if (item.IsDirectory())
+ if (item.IsDir())
{
- Int32 askMode= testMode ?
+ Int32 askMode= testMode ?
NArchive::NExtract::NAskMode::kTest :
NArchive::NExtract::NAskMode::kExtract;
CMyComPtr<ISequentialOutStream> realOutStream;
@@ -638,7 +624,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
if (folderIndex < 0)
{
// If we need previous archive
- Int32 askMode= testMode ?
+ Int32 askMode= testMode ?
NArchive::NExtract::NAskMode::kTest :
NArchive::NExtract::NAskMode::kExtract;
CMyComPtr<ISequentialOutStream> realOutStream;
@@ -661,7 +647,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
int indexNext = allFilesMode ? i : indices[i];
const CMvItem &mvItem = m_Database.Items[indexNext];
const CItem &item = m_Database.Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- if (item.IsDirectory())
+ if (item.IsDir())
continue;
int newFolderIndex = m_Database.GetFolderIndex(&mvItem);
@@ -683,7 +669,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
const CFolder &folder = db.Folders[item.GetFolderIndex(db.Folders.Size())];
- cabFolderOutStream->Init(&m_Database, &extractStatuses, startIndex2,
+ cabFolderOutStream->Init(&m_Database, &extractStatuses, startIndex2,
curUnpack, extractCallback, testMode);
cabBlockInStreamSpec->MsZip = false;
diff --git a/CPP/7zip/Archive/Cab/CabHandler.h b/CPP/7zip/Archive/Cab/CabHandler.h
index e17c3a7d..1edcd11e 100755
--- a/CPP/7zip/Archive/Cab/CabHandler.h
+++ b/CPP/7zip/Archive/Cab/CabHandler.h
@@ -10,7 +10,7 @@
namespace NArchive {
namespace NCab {
-class CHandler:
+class CHandler:
public IInArchive,
public CMyUnknownImp
{
diff --git a/CPP/7zip/Archive/Cab/CabHeader.cpp b/CPP/7zip/Archive/Cab/CabHeader.cpp
index 37533dff..d1f71df3 100755
--- a/CPP/7zip/Archive/Cab/CabHeader.cpp
+++ b/CPP/7zip/Archive/Cab/CabHeader.cpp
@@ -8,12 +8,8 @@ namespace NArchive{
namespace NCab{
namespace NHeader{
-namespace NArchive {
+Byte kMarker[kMarkerSize] = {'M' + 1, 'S', 'C', 'F', 0, 0, 0, 0 };
-UInt32 kSignature = 0x4643534d + 1;
-static class CSignatureInitializer
-{ public: CSignatureInitializer() { kSignature--; }} g_SignatureInitializer;
-
-}
+struct SignatureInitializer { SignatureInitializer() { kMarker[0]--; }; } g_SignatureInitializer;
}}}
diff --git a/CPP/7zip/Archive/Cab/CabHeader.h b/CPP/7zip/Archive/Cab/CabHeader.h
index 5c122743..0f0d2af3 100755
--- a/CPP/7zip/Archive/Cab/CabHeader.h
+++ b/CPP/7zip/Archive/Cab/CabHeader.h
@@ -7,11 +7,13 @@
namespace NArchive {
namespace NCab {
-namespace NHeader{
+namespace NHeader {
-namespace NArchive
+const unsigned kMarkerSize = 8;
+extern Byte kMarker[kMarkerSize];
+
+namespace NArchive
{
- extern UInt32 kSignature;
namespace NFlags
{
const int kPrevCabinet = 0x0001;
diff --git a/CPP/7zip/Archive/Cab/CabIn.cpp b/CPP/7zip/Archive/Cab/CabIn.cpp
index ae774f19..072e4076 100755
--- a/CPP/7zip/Archive/Cab/CabIn.cpp
+++ b/CPP/7zip/Archive/Cab/CabIn.cpp
@@ -2,15 +2,12 @@
#include "StdAfx.h"
-#include "Common/StringConvert.h"
-#include "Common/MyCom.h"
#include "CabIn.h"
-#include "Windows/Defs.h"
-#include "../../Common/StreamUtils.h"
+#include "../Common/FindSignature.h"
-namespace NArchive{
-namespace NCab{
+namespace NArchive {
+namespace NCab {
/*
static HRESULT ReadBytes(IInStream *inStream, void *data, UInt32 size)
@@ -94,39 +91,21 @@ void CInArchive::Skeep(size_t size)
ReadByte();
}
-HRESULT CInArchive::Open2(IInStream *inStream,
+HRESULT CInArchive::Open2(IInStream *stream,
const UInt64 *searchHeaderSizeLimit,
CDatabase &database)
{
database.Clear();
- RINOK(inStream->Seek(0, STREAM_SEEK_CUR, &database.StartPosition));
+ RINOK(stream->Seek(0, STREAM_SEEK_SET, &database.StartPosition));
- {
- if (!inBuffer.Create(1 << 17))
- return E_OUTOFMEMORY;
- inBuffer.SetStream(inStream);
- inBuffer.Init();
- UInt64 value = 0;
- const int kSignatureSize = 8;
- UInt64 kSignature64 = NHeader::NArchive::kSignature;
- for (;;)
- {
- Byte b;
- if (!inBuffer.ReadByte(b))
- return S_FALSE;
- value >>= 8;
- value |= ((UInt64)b) << ((kSignatureSize - 1) * 8);
- if (inBuffer.GetProcessedSize() >= kSignatureSize)
- {
- if (value == kSignature64)
- break;
- if (searchHeaderSizeLimit != NULL)
- if (inBuffer.GetProcessedSize() > (*searchHeaderSizeLimit))
- return S_FALSE;
- }
- }
- database.StartPosition += inBuffer.GetProcessedSize() - kSignatureSize;
- }
+ RINOK(FindSignatureInStream(stream, NHeader::kMarker, NHeader::kMarkerSize,
+ searchHeaderSizeLimit, database.StartPosition));
+
+ RINOK(stream->Seek(database.StartPosition + NHeader::kMarkerSize, STREAM_SEEK_SET, NULL));
+ if (!inBuffer.Create(1 << 17))
+ return E_OUTOFMEMORY;
+ inBuffer.SetStream(stream);
+ inBuffer.Init();
CInArchiveInfo &archiveInfo = database.ArchiveInfo;
@@ -141,7 +120,9 @@ HRESULT CInArchive::Open2(IInStream *inStream,
archiveInfo.VersionMajor = ReadByte(); // cabinet file format version, major
archiveInfo.NumFolders = ReadUInt16(); // number of CFFOLDER entries in this cabinet
archiveInfo.NumFiles = ReadUInt16(); // number of CFFILE entries in this cabinet
- archiveInfo.Flags = ReadUInt16(); // number of CFFILE entries in this cabinet
+ archiveInfo.Flags = ReadUInt16();
+ if (archiveInfo.Flags > 7)
+ return S_FALSE;
archiveInfo.SetID = ReadUInt16(); // must be the same for all cabinets in a set
archiveInfo.CabinetNumber = ReadUInt16(); // number of this cabinet file in a set
@@ -175,9 +156,9 @@ HRESULT CInArchive::Open2(IInStream *inStream,
database.Folders.Add(folder);
}
- RINOK(inStream->Seek(database.StartPosition + archiveInfo.FileHeadersOffset, STREAM_SEEK_SET, NULL));
+ RINOK(stream->Seek(database.StartPosition + archiveInfo.FileHeadersOffset, STREAM_SEEK_SET, NULL));
- inBuffer.SetStream(inStream);
+ inBuffer.SetStream(stream);
inBuffer.Init();
for(i = 0; i < archiveInfo.NumFiles; i++)
{
@@ -221,8 +202,8 @@ static int CompareMvItems(const CMvItem *p1, const CMvItem *p2, void *param)
const CDatabaseEx &db2 = mvDb.Volumes[p2->VolumeIndex];
const CItem &item1 = db1.Items[p1->ItemIndex];
const CItem &item2 = db2.Items[p2->ItemIndex];;
- bool isDir1 = item1.IsDirectory();
- bool isDir2 = item2.IsDirectory();
+ bool isDir1 = item1.IsDir();
+ bool isDir2 = item2.IsDir();
if (isDir1 && !isDir2)
return -1;
if (isDir2 && !isDir1)
@@ -322,7 +303,7 @@ bool CMvDatabaseEx::Check()
if (fIndex >= FolderStartFileIndex.Size())
return false;
const CItem &item = Volumes[mvItem.VolumeIndex].Items[mvItem.ItemIndex];
- if (item.IsDirectory())
+ if (item.IsDir())
continue;
int folderIndex = GetFolderIndex(&mvItem);
if (folderIndex != prevFolder)
diff --git a/CPP/7zip/Archive/Cab/CabIn.h b/CPP/7zip/Archive/Cab/CabIn.h
index ebeead87..4975095f 100755
--- a/CPP/7zip/Archive/Cab/CabIn.h
+++ b/CPP/7zip/Archive/Cab/CabIn.h
@@ -93,7 +93,7 @@ public:
return true;
return false;
}
- int GetNumberOfNewFolders() const
+ int GetNumberOfNewFolders() const
{
int res = Folders.Size();
if (IsTherePrevFolder())
@@ -124,10 +124,10 @@ public:
CRecordVector<CMvItem> Items;
CRecordVector<int> StartFolderOfVol;
CRecordVector<int> FolderStartFileIndex;
- int GetFolderIndex(const CMvItem *mvi) const
+ int GetFolderIndex(const CMvItem *mvi) const
{
const CDatabaseEx &db = Volumes[mvi->VolumeIndex];
- return StartFolderOfVol[mvi->VolumeIndex] +
+ return StartFolderOfVol[mvi->VolumeIndex] +
db.Items[mvi->ItemIndex].GetFolderIndex(db.Folders.Size());
}
void Clear()
@@ -152,7 +152,7 @@ class CInArchive
void Skeep(size_t size);
void ReadOtherArchive(COtherArchive &oa);
- HRESULT Open2(IInStream *inStream,
+ HRESULT Open2(IInStream *inStream,
const UInt64 *searchHeaderSizeLimit,
CDatabase &database);
public:
diff --git a/CPP/7zip/Archive/Cab/CabItem.h b/CPP/7zip/Archive/Cab/CabItem.h
index 8b41fe69..63a1e856 100755
--- a/CPP/7zip/Archive/Cab/CabItem.h
+++ b/CPP/7zip/Archive/Cab/CabItem.h
@@ -19,9 +19,8 @@ struct CFolder
Byte GetCompressionMethod() const { return (Byte)(CompressionTypeMajor & 0xF); }
};
-class CItem
+struct CItem
{
-public:
AString Name;
UInt32 Offset;
UInt32 Size;
@@ -29,26 +28,28 @@ public:
UInt16 FolderIndex;
UInt16 Flags;
UInt16 Attributes;
+
UInt64 GetEndOffset() const { return (UInt64)Offset + Size; }
UInt32 GetWinAttributes() const { return (Attributes & ~NHeader::kFileNameIsUTFAttributeMask); }
bool IsNameUTF() const { return (Attributes & NHeader::kFileNameIsUTFAttributeMask) != 0; }
- bool IsDirectory() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0; }
+ bool IsDir() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0; }
- bool ContinuedFromPrev() const
- {
- return
+ bool ContinuedFromPrev() const
+ {
+ return
(FolderIndex == NHeader::NFolderIndex::kContinuedFromPrev) ||
(FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext);
}
- bool ContinuedToNext() const
- {
- return
+
+ bool ContinuedToNext() const
+ {
+ return
(FolderIndex == NHeader::NFolderIndex::kContinuedToNext) ||
(FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext);
}
- int GetFolderIndex(int numFolders) const
- {
+ int GetFolderIndex(int numFolders) const
+ {
if (ContinuedFromPrev())
return 0;
if (ContinuedToNext())
diff --git a/CPP/7zip/Archive/Cab/StdAfx.cpp b/CPP/7zip/Archive/Cab/StdAfx.cpp
deleted file mode 100755
index d0feea85..00000000
--- a/CPP/7zip/Archive/Cab/StdAfx.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-// StdAfx.cpp
-
-#include "StdAfx.h"
diff --git a/CPP/7zip/Archive/Cab/cab.ico b/CPP/7zip/Archive/Cab/cab.ico
deleted file mode 100755
index cc2007fc..00000000
--- a/CPP/7zip/Archive/Cab/cab.ico
+++ /dev/null
Binary files differ