This commit is contained in:
Igor Pavlov
2022-06-23 11:43:16 +01:00
committed by Kornel
parent c3529a41f5
commit ec44a8a070
1248 changed files with 15242 additions and 2443 deletions

21
CPP/7zip/Common/LimitedStreams.h Normal file → Executable file
View File

@@ -101,21 +101,26 @@ public:
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
};
const UInt64 k_SeekExtent_Phy_Type_ZeroFill = (UInt64)(Int64)-1;
struct CSeekExtent
{
UInt64 Phy;
UInt64 Virt;
UInt64 Phy;
void SetAs_ZeroFill() { Phy = k_SeekExtent_Phy_Type_ZeroFill; }
bool Is_ZeroFill() const { return Phy == k_SeekExtent_Phy_Type_ZeroFill; }
};
class CExtentsStream:
public IInStream,
public CMyUnknownImp
{
UInt64 _phyPos;
UInt64 _virtPos;
bool _needStartSeek;
HRESULT SeekToPhys() { return Stream->Seek((Int64)_phyPos, STREAM_SEEK_SET, NULL); }
UInt64 _phyPos;
unsigned _prevExtentIndex;
public:
CMyComPtr<IInStream> Stream;
@@ -129,11 +134,13 @@ public:
void Init()
{
_virtPos = 0;
_phyPos = 0;
_needStartSeek = true;
_phyPos = (UInt64)0 - 1; // we need Seek() for Stream
_prevExtentIndex = 0;
}
};
class CLimitedSequentialOutStream:
public ISequentialOutStream,
public CMyUnknownImp