This commit is contained in:
Igor Pavlov
2014-11-23 00:00:00 +00:00
committed by Kornel Lesiński
parent 83f8ddcc5b
commit f08f4dcc3c
1158 changed files with 76451 additions and 35082 deletions

29
CPP/7zip/Archive/Cab/CabItem.h Executable file → Normal file
View File

@@ -3,20 +3,23 @@
#ifndef __ARCHIVE_CAB_ITEM_H
#define __ARCHIVE_CAB_ITEM_H
#include "Common/Types.h"
#include "Common/MyString.h"
#include "../../../Common/MyString.h"
#include "CabHeader.h"
namespace NArchive {
namespace NCab {
const unsigned kNumMethodsMax = 16;
struct CFolder
{
UInt32 DataStart; // offset of the first CFDATA block in this folder
UInt16 NumDataBlocks; // number of CFDATA blocks in this folder
Byte CompressionTypeMajor;
Byte CompressionTypeMinor;
Byte GetCompressionMethod() const { return (Byte)(CompressionTypeMajor & 0xF); }
Byte MethodMajor;
Byte MethodMinor;
Byte GetMethod() const { return (Byte)(MethodMajor & 0xF); }
};
struct CItem
@@ -25,27 +28,27 @@ struct CItem
UInt32 Offset;
UInt32 Size;
UInt32 Time;
UInt16 FolderIndex;
UInt32 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; }
UInt32 GetWinAttrib() const { return (UInt32)Attributes & ~(UInt32)NHeader::kFileNameIsUtf8_Mask; }
bool IsNameUTF() const { return (Attributes & NHeader::kFileNameIsUtf8_Mask) != 0; }
bool IsDir() const { return (Attributes & FILE_ATTRIBUTE_DIRECTORY) != 0; }
bool ContinuedFromPrev() const
{
return
(FolderIndex == NHeader::NFolderIndex::kContinuedFromPrev) ||
(FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext);
FolderIndex == NHeader::NFolderIndex::kContinuedFromPrev ||
FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext;
}
bool ContinuedToNext() const
{
return
(FolderIndex == NHeader::NFolderIndex::kContinuedToNext) ||
(FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext);
FolderIndex == NHeader::NFolderIndex::kContinuedToNext ||
FolderIndex == NHeader::NFolderIndex::kContinuedPrevAndNext;
}
int GetFolderIndex(int numFolders) const
@@ -53,7 +56,7 @@ struct CItem
if (ContinuedFromPrev())
return 0;
if (ContinuedToNext())
return (numFolders - 1);
return numFolders - 1;
return FolderIndex;
}
};