Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '7zip/Common/StreamObjects.cpp')
-rwxr-xr-x7zip/Common/StreamObjects.cpp100
1 files changed, 1 insertions, 99 deletions
diff --git a/7zip/Common/StreamObjects.cpp b/7zip/Common/StreamObjects.cpp
index 8632cff4..c89f64e1 100755
--- a/7zip/Common/StreamObjects.cpp
+++ b/7zip/Common/StreamObjects.cpp
@@ -5,45 +5,6 @@
#include "StreamObjects.h"
#include "../../Common/Defs.h"
-/*
-STDMETHODIMP COutStreamImp::Read(void *data, ULONG size, ULONG *processedSize)
- { return E_NOTIMPL; }
-
-STDMETHODIMP COutStreamImp::Write(void const *data, ULONG size, ULONG *processedSize)
-{
- size_t newCapacity = _size + size;
- _buffer.EnsureCapacity(newCapacity);
- memmove(_buffer + _size, data, size);
- if(processedSize != NULL)
- *processedSize = size;
- _size += size;
- return S_OK;
-}
-
-void CInStreamImp::Init(Byte *dataPointer, size_t size)
-{
- _dataPointer = dataPointer;
- _size = size;
- _pos = 0;
-}
-
-STDMETHODIMP CInStreamImp::Read(void *data, ULONG size, ULONG *processedSize)
-{
- UInt32 numBytesToRead = MyMin(_pos + (UInt32)size, _size) - _pos;
- if(processedSize != NULL)
- *processedSize = numBytesToRead;
- memmove(data, _dataPointer + _pos, numBytesToRead);
- _pos += numBytesToRead;
- if(numBytesToRead == size)
- return S_OK;
- else
- return S_FALSE;
-}
-
-STDMETHODIMP CInStreamImp::Write(void const *data, ULONG size, ULONG *processedSize)
- { return E_NOTIMPL; }
-*/
-
STDMETHODIMP CSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
{
@@ -55,13 +16,6 @@ STDMETHODIMP CSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *proce
return S_OK;
}
-STDMETHODIMP CSequentialInStreamImp::ReadPart(void *data, UInt32 size, UInt32 *processedSize)
-{
- return Read(data, size, processedSize);
-}
-
-////////////////////
-
void CWriteBuffer::Write(const void *data, size_t size)
{
@@ -79,11 +33,6 @@ STDMETHODIMP CSequentialOutStreamImp::Write(const void *data, UInt32 size, UInt3
return S_OK;
}
-STDMETHODIMP CSequentialOutStreamImp::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
-{
- return Write(data, size, processedSize);
-}
-
STDMETHODIMP CSequentialOutStreamImp2::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 newSize = size;
@@ -98,13 +47,6 @@ STDMETHODIMP CSequentialOutStreamImp2::Write(const void *data, UInt32 size, UInt
return S_OK;
}
-STDMETHODIMP CSequentialOutStreamImp2::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
-{
- return Write(data, size, processedSize);
-}
-
-
-
STDMETHODIMP CSequentialInStreamSizeCount::Read(void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 realProcessedSize;
@@ -115,37 +57,8 @@ STDMETHODIMP CSequentialInStreamSizeCount::Read(void *data, UInt32 size, UInt32
return result;
}
-STDMETHODIMP CSequentialInStreamSizeCount::ReadPart(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->ReadPart(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}
-
STDMETHODIMP CSequentialInStreamRollback::Read(void *data, UInt32 size, UInt32 *processedSize)
{
- HRESULT result = S_OK;
- UInt32 realProcessedSizeTotal = 0;
- while (size > 0)
- {
- UInt32 realProcessedSize = 0;
- result = ReadPart(data, size, &realProcessedSize);
- size -= realProcessedSize;
- data = ((Byte *)data + realProcessedSize);
- realProcessedSizeTotal += realProcessedSize;
- if (realProcessedSize == 0 || result != S_OK)
- break;
- }
- if (processedSize != 0)
- *processedSize = realProcessedSizeTotal;
- return result;
-}
-
-STDMETHODIMP CSequentialInStreamRollback::ReadPart(void *data, UInt32 size, UInt32 *processedSize)
-{
if (_currentPos != _currentSize)
{
size_t curSize = _currentSize - _currentPos;
@@ -160,7 +73,7 @@ STDMETHODIMP CSequentialInStreamRollback::ReadPart(void *data, UInt32 size, UInt
UInt32 realProcessedSize;
if (size > _bufferSize)
size = (UInt32)_bufferSize;
- HRESULT result = _stream->ReadPart(_buffer, size, &realProcessedSize);
+ HRESULT result = _stream->Read(_buffer, size, &realProcessedSize);
memmove(data, _buffer, realProcessedSize);
_size += realProcessedSize;
_currentSize = realProcessedSize;
@@ -178,7 +91,6 @@ HRESULT CSequentialInStreamRollback::Rollback(size_t rollbackSize)
return S_OK;
}
-
STDMETHODIMP CSequentialOutStreamSizeCount::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 realProcessedSize;
@@ -188,13 +100,3 @@ STDMETHODIMP CSequentialOutStreamSizeCount::Write(const void *data, UInt32 size,
*processedSize = realProcessedSize;
return result;
}
-
-STDMETHODIMP CSequentialOutStreamSizeCount::WritePart(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->WritePart(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}