This commit is contained in:
Igor Pavlov
2005-05-30 00:00:00 +00:00
committed by Kornel Lesiński
parent 8c1b5c7b7e
commit 3c510ba80b
926 changed files with 40559 additions and 23519 deletions

View File

@@ -1,7 +1,5 @@
// Archive/ZipIn.h
#pragma once
#ifndef __ZIP_IN_H
#define __ZIP_IN_H
@@ -17,7 +15,7 @@ namespace NZip {
class CInArchiveException
{
public:
enum CCauseType
enum ECauseType
{
kUnexpectedEndOfArchive = 0,
kArchiceHeaderCRCError,
@@ -29,53 +27,58 @@ public:
kSeekStreamError
}
Cause;
CInArchiveException(CCauseType cause): Cause(cause) {}
CInArchiveException(ECauseType cause): Cause(cause) {}
};
class CInArchiveInfo
{
public:
UINT64 StartPosition;
UINT64 CommentPosition;
UINT16 CommentSize;
bool IsCommented() const { return (CommentSize != 0); };
UInt64 StartPosition;
CByteBuffer Comment;
void Clear() { Comment.SetCapacity(0); }
};
class CProgressVirt
{
public:
STDMETHOD(SetCompleted)(const UINT64 *numFiles) PURE;
STDMETHOD(SetCompleted)(const UInt64 *numFiles) PURE;
};
class CInArchive
{
CMyComPtr<IInStream> m_Stream;
UINT32 m_Signature;
UINT64 m_StreamStartPosition;
UINT64 m_Position;
UInt32 m_Signature;
UInt64 m_StreamStartPosition;
UInt64 m_Position;
CInArchiveInfo m_ArchiveInfo;
AString m_NameBuffer;
bool FindAndReadMarker(const UINT64 *searchHeaderSizeLimit);
bool ReadSignature(UINT32 &signature);
AString ReadFileName(UINT32 nameSize);
bool FindAndReadMarker(const UInt64 *searchHeaderSizeLimit);
bool ReadUInt32(UInt32 &signature);
AString ReadFileName(UInt32 nameSize);
HRESULT ReadBytes(void *data, UINT32 size, UINT32 *processedSize);
bool ReadBytesAndTestSize(void *data, UINT32 size);
void SafeReadBytes(void *data, UINT32 size);
HRESULT ReadBytes(void *data, UInt32 size, UInt32 *processedSize);
bool ReadBytesAndTestSize(void *data, UInt32 size);
void SafeReadBytes(void *data, UInt32 size);
void ReadBuffer(CByteBuffer &buffer, UInt32 size);
Byte ReadByte();
UInt16 ReadUInt16();
UInt32 ReadUInt32();
UInt64 ReadUInt64();
void IncreasePositionValue(UINT64 addValue);
void IncreaseRealPosition(UINT64 addValue);
void IncreaseRealPosition(UInt64 addValue);
void ThrowIncorrectArchiveException();
void ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock,
UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber);
public:
HRESULT ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress);
bool Open(IInStream *inStream, const UINT64 *searchHeaderSizeLimit);
bool Open(IInStream *inStream, const UInt64 *searchHeaderSizeLimit);
void Close();
void GetArchiveInfo(CInArchiveInfo &archiveInfo) const;
void DirectGetBytes(void *data, UINT32 num);
bool SeekInArchive(UINT64 position);
ISequentialInStream *CreateLimitedStream(UINT64 position, UINT64 size);
void DirectGetBytes(void *data, UInt32 num);
bool SeekInArchive(UInt64 position);
ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size);
IInStream* CreateStream();
};