diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-05 20:01:10 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-05 20:01:10 +0200 |
commit | c3b63b831cd2c64700e875b28540212c7c881ac6 (patch) | |
tree | edd98fcbd2004d3b562904f822bf6c3322fc7f52 /other-licenses/7zstub/src/7zip/Common/InBuffer.cpp | |
parent | d432e068a21c815d5d5e7bcbc1cc8c6e77a7d1e0 (diff) | |
parent | cc07da9cb4d6e7a53f8d953427ffc2bca2e0c2df (diff) | |
download | UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.gz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.lz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.tar.xz UXP-c3b63b831cd2c64700e875b28540212c7c881ac6.zip |
Merge branch 'master' into 816
Diffstat (limited to 'other-licenses/7zstub/src/7zip/Common/InBuffer.cpp')
-rw-r--r-- | other-licenses/7zstub/src/7zip/Common/InBuffer.cpp | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/other-licenses/7zstub/src/7zip/Common/InBuffer.cpp b/other-licenses/7zstub/src/7zip/Common/InBuffer.cpp deleted file mode 100644 index 17280b5b6..000000000 --- a/other-licenses/7zstub/src/7zip/Common/InBuffer.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// InBuffer.cpp
-
-#include "StdAfx.h"
-
-#include "InBuffer.h"
-
-#include "../../Common/Alloc.h"
-
-CInBuffer::CInBuffer():
- _buffer(0),
- _bufferLimit(0),
- _bufferBase(0),
- _stream(0),
- _bufferSize(0)
-{}
-
-bool CInBuffer::Create(UInt32 bufferSize)
-{
- const UInt32 kMinBlockSize = 1;
- if (bufferSize < kMinBlockSize)
- bufferSize = kMinBlockSize;
- if (_bufferBase != 0 && _bufferSize == bufferSize)
- return true;
- Free();
- _bufferSize = bufferSize;
- _bufferBase = (Byte *)::MidAlloc(bufferSize);
- return (_bufferBase != 0);
-}
-
-void CInBuffer::Free()
-{
- ::MidFree(_bufferBase);
- _bufferBase = 0;
-}
-
-void CInBuffer::SetStream(ISequentialInStream *stream)
-{
- _stream = stream;
-}
-
-void CInBuffer::Init()
-{
- _processedSize = 0;
- _buffer = _bufferBase;
- _bufferLimit = _buffer;
- _wasFinished = false;
- #ifdef _NO_EXCEPTIONS
- ErrorCode = S_OK;
- #endif
-}
-
-bool CInBuffer::ReadBlock()
-{
- #ifdef _NO_EXCEPTIONS
- if (ErrorCode != S_OK)
- return false;
- #endif
- if (_wasFinished)
- return false;
- _processedSize += (_buffer - _bufferBase);
- UInt32 numProcessedBytes;
- HRESULT result = _stream->Read(_bufferBase, _bufferSize, &numProcessedBytes);
- #ifdef _NO_EXCEPTIONS
- ErrorCode = result;
- #else
- if (result != S_OK)
- throw CInBufferException(result);
- #endif
- _buffer = _bufferBase;
- _bufferLimit = _buffer + numProcessedBytes;
- _wasFinished = (numProcessedBytes == 0);
- return (!_wasFinished);
-}
-
-Byte CInBuffer::ReadBlock2()
-{
- if(!ReadBlock())
- return 0xFF;
- return *_buffer++;
-}
|