mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-14 10:11:38 -06:00
4.27 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
31e7b924e8
commit
d66cf2fcf3
@@ -16,48 +16,40 @@ struct COutBufferException
|
||||
|
||||
class COutBuffer
|
||||
{
|
||||
protected:
|
||||
Byte *_buffer;
|
||||
UInt32 _pos;
|
||||
UInt32 _limitPos;
|
||||
UInt32 _streamPos;
|
||||
UInt32 _bufferSize;
|
||||
CMyComPtr<ISequentialOutStream> _stream;
|
||||
UInt64 _processedSize;
|
||||
Byte *_buffer2;
|
||||
|
||||
void WriteBlock();
|
||||
HRESULT FlushPart();
|
||||
void FlushWithCheck();
|
||||
public:
|
||||
#ifdef _NO_EXCEPTIONS
|
||||
HRESULT ErrorCode;
|
||||
#endif
|
||||
|
||||
COutBuffer(): _buffer(0), _pos(0), _stream(0) {}
|
||||
COutBuffer(): _buffer(0), _pos(0), _stream(0), _buffer2(0) {}
|
||||
~COutBuffer() { Free(); }
|
||||
|
||||
bool Create(UInt32 bufferSize);
|
||||
void Free();
|
||||
|
||||
void SetMemStream(Byte *buffer) { _buffer2 = buffer; }
|
||||
void SetStream(ISequentialOutStream *stream);
|
||||
void Init();
|
||||
HRESULT Flush();
|
||||
void ReleaseStream() { _stream.Release(); }
|
||||
|
||||
/*
|
||||
void *GetBuffer(UInt32 &sizeAvail)
|
||||
{
|
||||
sizeAvail = _bufferSize - _pos;
|
||||
return _buffer + _pos;
|
||||
}
|
||||
void MovePos(UInt32 num)
|
||||
{
|
||||
_pos += num;
|
||||
if(_pos >= _bufferSize)
|
||||
WriteBlock();
|
||||
}
|
||||
*/
|
||||
|
||||
void WriteByte(Byte b)
|
||||
{
|
||||
_buffer[_pos++] = b;
|
||||
if(_pos >= _bufferSize)
|
||||
WriteBlock();
|
||||
if(_pos == _limitPos)
|
||||
FlushWithCheck();
|
||||
}
|
||||
void WriteBytes(const void *data, size_t size)
|
||||
{
|
||||
@@ -65,7 +57,7 @@ public:
|
||||
WriteByte(((const Byte *)data)[i]);
|
||||
}
|
||||
|
||||
UInt64 GetProcessedSize() const { return _processedSize + _pos; }
|
||||
UInt64 GetProcessedSize() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user