summaryrefslogtreecommitdiffstats
path: root/other-licenses/7zstub/src/7zip/Common
diff options
context:
space:
mode:
Diffstat (limited to 'other-licenses/7zstub/src/7zip/Common')
-rw-r--r--other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.cpp57
-rw-r--r--other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.h10
-rw-r--r--other-licenses/7zstub/src/7zip/Common/FileStreams.cpp251
-rw-r--r--other-licenses/7zstub/src/7zip/Common/FileStreams.h98
-rw-r--r--other-licenses/7zstub/src/7zip/Common/InBuffer.cpp80
-rw-r--r--other-licenses/7zstub/src/7zip/Common/InBuffer.h76
-rw-r--r--other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.cpp122
-rw-r--r--other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.h55
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LSBFDecoder.cpp34
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LSBFDecoder.h127
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LSBFEncoder.cpp29
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LSBFEncoder.h51
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LimitedStreams.cpp24
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LimitedStreams.h23
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LockedStream.cpp23
-rw-r--r--other-licenses/7zstub/src/7zip/Common/LockedStream.h38
-rw-r--r--other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h69
-rw-r--r--other-licenses/7zstub/src/7zip/Common/MSBFEncoder.h59
-rw-r--r--other-licenses/7zstub/src/7zip/Common/OffsetStream.cpp35
-rw-r--r--other-licenses/7zstub/src/7zip/Common/OffsetStream.h25
-rw-r--r--other-licenses/7zstub/src/7zip/Common/OutBuffer.cpp116
-rw-r--r--other-licenses/7zstub/src/7zip/Common/OutBuffer.h64
-rw-r--r--other-licenses/7zstub/src/7zip/Common/ProgressUtils.cpp58
-rw-r--r--other-licenses/7zstub/src/7zip/Common/ProgressUtils.h43
-rw-r--r--other-licenses/7zstub/src/7zip/Common/StdAfx.h9
-rw-r--r--other-licenses/7zstub/src/7zip/Common/StreamBinder.cpp162
-rw-r--r--other-licenses/7zstub/src/7zip/Common/StreamBinder.h37
-rw-r--r--other-licenses/7zstub/src/7zip/Common/StreamObjects.cpp102
-rw-r--r--other-licenses/7zstub/src/7zip/Common/StreamObjects.h156
-rw-r--r--other-licenses/7zstub/src/7zip/Common/StreamUtils.cpp44
-rw-r--r--other-licenses/7zstub/src/7zip/Common/StreamUtils.h11
31 files changed, 0 insertions, 2088 deletions
diff --git a/other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.cpp b/other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.cpp
deleted file mode 100644
index 9dae03d12..000000000
--- a/other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-// FilePathAutoRename.cpp
-
-#include "StdAfx.h"
-#include "FilePathAutoRename.h"
-
-#include "Common/Defs.h"
-#include "Common/IntToString.h"
-
-#include "Windows/FileName.h"
-#include "Windows/FileFind.h"
-
-using namespace NWindows;
-
-static bool MakeAutoName(const UString &name,
- const UString &extension, int value, UString &path)
-{
- wchar_t number[32];
- ConvertUInt64ToString(value, number);
- path = name;
- path += number;
- path += extension;
- return NFile::NFind::DoesFileExist(path);
-}
-
-bool AutoRenamePath(UString &fullProcessedPath)
-{
- UString path;
- int dotPos = fullProcessedPath.ReverseFind(L'.');
-
- int slashPos = fullProcessedPath.ReverseFind(L'/');
- #ifdef _WIN32
- int slash1Pos = fullProcessedPath.ReverseFind(L'\\');
- slashPos = MyMax(slashPos, slash1Pos);
- #endif
-
- UString name, extension;
- if (dotPos > slashPos && dotPos > 0)
- {
- name = fullProcessedPath.Left(dotPos);
- extension = fullProcessedPath.Mid(dotPos);
- }
- else
- name = fullProcessedPath;
- name += L'_';
- int indexLeft = 1, indexRight = (1 << 30);
- while (indexLeft != indexRight)
- {
- int indexMid = (indexLeft + indexRight) / 2;
- if (MakeAutoName(name, extension, indexMid, path))
- indexLeft = indexMid + 1;
- else
- indexRight = indexMid;
- }
- if (MakeAutoName(name, extension, indexRight, fullProcessedPath))
- return false;
- return true;
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.h b/other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.h
deleted file mode 100644
index 10197428d..000000000
--- a/other-licenses/7zstub/src/7zip/Common/FilePathAutoRename.h
+++ /dev/null
@@ -1,10 +0,0 @@
-// Util/FilePathAutoRename.h
-
-#ifndef __FILEPATHAUTORENAME_H
-#define __FILEPATHAUTORENAME_H
-
-#include "Common/String.h"
-
-bool AutoRenamePath(UString &fullProcessedPath);
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/FileStreams.cpp b/other-licenses/7zstub/src/7zip/Common/FileStreams.cpp
deleted file mode 100644
index 7a32c6e70..000000000
--- a/other-licenses/7zstub/src/7zip/Common/FileStreams.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-// FileStreams.cpp
-
-#include "StdAfx.h"
-
-#ifndef _WIN32
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#endif
-
-#include "FileStreams.h"
-
-static inline HRESULT ConvertBoolToHRESULT(bool result)
-{
- // return result ? S_OK: E_FAIL;
- #ifdef _WIN32
- return result ? S_OK: (::GetLastError());
- #else
- return result ? S_OK: E_FAIL;
- #endif
-}
-
-bool CInFileStream::Open(LPCTSTR fileName)
-{
- return File.Open(fileName);
-}
-
-#ifdef _WIN32
-#ifndef _UNICODE
-bool CInFileStream::Open(LPCWSTR fileName)
-{
- return File.Open(fileName);
-}
-#endif
-#endif
-
-STDMETHODIMP CInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- #ifdef _WIN32
-
- UInt32 realProcessedSize;
- bool result = File.ReadPart(data, size, realProcessedSize);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- if(processedSize != NULL)
- *processedSize = 0;
- ssize_t res = File.Read(data, (size_t)size);
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- return S_OK;
-
- #endif
-}
-
-#ifndef _WIN32_WCE
-STDMETHODIMP CStdInFileStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- #ifdef _WIN32
- UInt32 realProcessedSize;
- BOOL res = ::ReadFile(GetStdHandle(STD_INPUT_HANDLE),
- data, size, (DWORD *)&realProcessedSize, NULL);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- if (res == FALSE && GetLastError() == ERROR_BROKEN_PIPE)
- return S_OK;
- return ConvertBoolToHRESULT(res != FALSE);
-
- #else
-
- if(processedSize != NULL)
- *processedSize = 0;
- ssize_t res;
- do
- {
- res = read(0, data, (size_t)size);
- }
- while (res < 0 && (errno == EINTR));
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- return S_OK;
-
- #endif
-}
-
-#endif
-
-STDMETHODIMP CInFileStream::Seek(Int64 offset, UInt32 seekOrigin,
- UInt64 *newPosition)
-{
- if(seekOrigin >= 3)
- return STG_E_INVALIDFUNCTION;
-
- #ifdef _WIN32
-
- UInt64 realNewPosition;
- bool result = File.Seek(offset, seekOrigin, realNewPosition);
- if(newPosition != NULL)
- *newPosition = realNewPosition;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- off_t res = File.Seek(offset, seekOrigin);
- if (res == -1)
- return E_FAIL;
- if(newPosition != NULL)
- *newPosition = (UInt64)res;
- return S_OK;
-
- #endif
-}
-
-STDMETHODIMP CInFileStream::GetSize(UInt64 *size)
-{
- return ConvertBoolToHRESULT(File.GetLength(*size));
-}
-
-
-//////////////////////////
-// COutFileStream
-
-bool COutFileStream::Create(LPCTSTR fileName, bool createAlways)
-{
- return File.Create(fileName, createAlways);
-}
-
-#ifdef _WIN32
-#ifndef _UNICODE
-bool COutFileStream::Create(LPCWSTR fileName, bool createAlways)
-{
- return File.Create(fileName, createAlways);
-}
-#endif
-#endif
-
-STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- #ifdef _WIN32
-
- UInt32 realProcessedSize;
- bool result = File.WritePart(data, size, realProcessedSize);
- if(processedSize != NULL)
- *processedSize = realProcessedSize;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- if(processedSize != NULL)
- *processedSize = 0;
- ssize_t res = File.Write(data, (size_t)size);
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- return S_OK;
-
- #endif
-}
-
-STDMETHODIMP COutFileStream::Seek(Int64 offset, UInt32 seekOrigin,
- UInt64 *newPosition)
-{
- if(seekOrigin >= 3)
- return STG_E_INVALIDFUNCTION;
- #ifdef _WIN32
-
- UInt64 realNewPosition;
- bool result = File.Seek(offset, seekOrigin, realNewPosition);
- if(newPosition != NULL)
- *newPosition = realNewPosition;
- return ConvertBoolToHRESULT(result);
-
- #else
-
- off_t res = File.Seek(offset, seekOrigin);
- if (res == -1)
- return E_FAIL;
- if(newPosition != NULL)
- *newPosition = (UInt64)res;
- return S_OK;
-
- #endif
-}
-
-STDMETHODIMP COutFileStream::SetSize(Int64 newSize)
-{
- #ifdef _WIN32
- UInt64 currentPos;
- if(!File.Seek(0, FILE_CURRENT, currentPos))
- return E_FAIL;
- bool result = File.SetLength(newSize);
- UInt64 currentPos2;
- result = result && File.Seek(currentPos, currentPos2);
- return result ? S_OK : E_FAIL;
- #else
- return E_FAIL;
- #endif
-}
-
-#ifndef _WIN32_WCE
-STDMETHODIMP CStdOutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if(processedSize != NULL)
- *processedSize = 0;
-
- #ifdef _WIN32
- UInt32 realProcessedSize;
- BOOL res = TRUE;
- if (size > 0)
- {
- // Seems that Windows doesn't like big amounts writing to stdout.
- // So we limit portions by 32KB.
- UInt32 sizeTemp = (1 << 15);
- if (sizeTemp > size)
- sizeTemp = size;
- res = ::WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),
- data, sizeTemp, (DWORD *)&realProcessedSize, NULL);
- size -= realProcessedSize;
- data = (const void *)((const Byte *)data + realProcessedSize);
- if(processedSize != NULL)
- *processedSize += realProcessedSize;
- }
- return ConvertBoolToHRESULT(res != FALSE);
-
- #else
-
- ssize_t res;
- do
- {
- res = write(1, data, (size_t)size);
- }
- while (res < 0 && (errno == EINTR));
- if (res == -1)
- return E_FAIL;
- if(processedSize != NULL)
- *processedSize = (UInt32)res;
- return S_OK;
-
- return S_OK;
- #endif
-}
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/FileStreams.h b/other-licenses/7zstub/src/7zip/Common/FileStreams.h
deleted file mode 100644
index e6494f679..000000000
--- a/other-licenses/7zstub/src/7zip/Common/FileStreams.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// FileStreams.h
-
-#ifndef __FILESTREAMS_H
-#define __FILESTREAMS_H
-
-#ifdef _WIN32
-#include "../../Windows/FileIO.h"
-#else
-#include "../../Common/C_FileIO.h"
-#endif
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-
-class CInFileStream:
- public IInStream,
- public IStreamGetSize,
- public CMyUnknownImp
-{
-public:
- #ifdef _WIN32
- NWindows::NFile::NIO::CInFile File;
- #else
- NC::NFile::NIO::CInFile File;
- #endif
- CInFileStream() {}
- virtual ~CInFileStream() {}
-
- bool Open(LPCTSTR fileName);
- #ifdef _WIN32
- #ifndef _UNICODE
- bool Open(LPCWSTR fileName);
- #endif
- #endif
-
- MY_UNKNOWN_IMP2(IInStream, IStreamGetSize)
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
-
- STDMETHOD(GetSize)(UInt64 *size);
-};
-
-#ifndef _WIN32_WCE
-class CStdInFileStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
-public:
- // HANDLE File;
- // CStdInFileStream() File(INVALID_HANDLE_VALUE): {}
- // void Open() { File = GetStdHandle(STD_INPUT_HANDLE); };
- MY_UNKNOWN_IMP
-
- virtual ~CStdInFileStream() {}
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-#endif
-
-class COutFileStream:
- public IOutStream,
- public CMyUnknownImp
-{
-public:
- #ifdef _WIN32
- NWindows::NFile::NIO::COutFile File;
- #else
- NC::NFile::NIO::COutFile File;
- #endif
- virtual ~COutFileStream() {}
- bool Create(LPCTSTR fileName, bool createAlways);
- #ifdef _WIN32
- #ifndef _UNICODE
- bool Create(LPCWSTR fileName, bool createAlways);
- #endif
- #endif
-
- MY_UNKNOWN_IMP1(IOutStream)
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
- STDMETHOD(SetSize)(Int64 newSize);
-};
-
-#ifndef _WIN32_WCE
-class CStdOutFileStream:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- virtual ~CStdOutFileStream() {}
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-#endif
-
-#endif
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++;
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/InBuffer.h b/other-licenses/7zstub/src/7zip/Common/InBuffer.h
deleted file mode 100644
index a59ecefac..000000000
--- a/other-licenses/7zstub/src/7zip/Common/InBuffer.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// InBuffer.h
-
-#ifndef __INBUFFER_H
-#define __INBUFFER_H
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-
-#ifndef _NO_EXCEPTIONS
-class CInBufferException
-{
-public:
- HRESULT ErrorCode;
- CInBufferException(HRESULT errorCode): ErrorCode(errorCode) {}
-};
-#endif
-
-class CInBuffer
-{
- Byte *_buffer;
- Byte *_bufferLimit;
- Byte *_bufferBase;
- CMyComPtr<ISequentialInStream> _stream;
- UInt64 _processedSize;
- UInt32 _bufferSize;
- bool _wasFinished;
-
- bool ReadBlock();
- Byte ReadBlock2();
-
-public:
- #ifdef _NO_EXCEPTIONS
- HRESULT ErrorCode;
- #endif
-
- CInBuffer();
- ~CInBuffer() { Free(); }
-
- bool Create(UInt32 bufferSize);
- void Free();
-
- void SetStream(ISequentialInStream *stream);
- void Init();
- void ReleaseStream() { _stream.Release(); }
-
- bool ReadByte(Byte &b)
- {
- if(_buffer >= _bufferLimit)
- if(!ReadBlock())
- return false;
- b = *_buffer++;
- return true;
- }
- Byte ReadByte()
- {
- if(_buffer >= _bufferLimit)
- return ReadBlock2();
- return *_buffer++;
- }
- void ReadBytes(void *data, UInt32 size, UInt32 &processedSize)
- {
- for(processedSize = 0; processedSize < size; processedSize++)
- if (!ReadByte(((Byte *)data)[processedSize]))
- return;
- }
- bool ReadBytes(void *data, UInt32 size)
- {
- UInt32 processedSize;
- ReadBytes(data, size, processedSize);
- return (processedSize == size);
- }
- UInt64 GetProcessedSize() const { return _processedSize + (_buffer - _bufferBase); }
- bool WasFinished() const { return _wasFinished; }
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.cpp b/other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.cpp
deleted file mode 100644
index 06fde8ff3..000000000
--- a/other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// InOutTempBuffer.cpp
-
-#include "StdAfx.h"
-
-#include "InOutTempBuffer.h"
-#include "../../Common/Defs.h"
-// #include "Windows/Defs.h"
-
-#include "StreamUtils.h"
-
-using namespace NWindows;
-using namespace NFile;
-using namespace NDirectory;
-
-static UInt32 kTmpBufferMemorySize = (1 << 20);
-
-static LPCTSTR kTempFilePrefixString = TEXT("iot");
-
-CInOutTempBuffer::CInOutTempBuffer():
- _buffer(NULL)
-{
-}
-
-void CInOutTempBuffer::Create()
-{
- _buffer = new Byte[kTmpBufferMemorySize];
-}
-
-CInOutTempBuffer::~CInOutTempBuffer()
-{
- delete []_buffer;
-}
-void CInOutTempBuffer::InitWriting()
-{
- _bufferPosition = 0;
- _tmpFileCreated = false;
- _fileSize = 0;
-}
-
-bool CInOutTempBuffer::WriteToFile(const void *data, UInt32 size)
-{
- if (size == 0)
- return true;
- if(!_tmpFileCreated)
- {
- CSysString tempDirPath;
- if(!MyGetTempPath(tempDirPath))
- return false;
- if (_tempFile.Create(tempDirPath, kTempFilePrefixString, _tmpFileName) == 0)
- return false;
- // _outFile.SetOpenCreationDispositionCreateAlways();
- if(!_outFile.Create(_tmpFileName, true))
- return false;
- _tmpFileCreated = true;
- }
- UInt32 processedSize;
- if(!_outFile.Write(data, size, processedSize))
- return false;
- _fileSize += processedSize;
- return (processedSize == size);
-}
-
-bool CInOutTempBuffer::FlushWrite()
-{
- return _outFile.Close();
-}
-
-bool CInOutTempBuffer::Write(const void *data, UInt32 size)
-{
- if(_bufferPosition < kTmpBufferMemorySize)
- {
- UInt32 curSize = MyMin(kTmpBufferMemorySize - _bufferPosition, size);
- memmove(_buffer + _bufferPosition, (const Byte *)data, curSize);
- _bufferPosition += curSize;
- size -= curSize;
- data = ((const Byte *)data) + curSize;
- _fileSize += curSize;
- }
- return WriteToFile(data, size);
-}
-
-bool CInOutTempBuffer::InitReading()
-{
- _currentPositionInBuffer = 0;
- if(_tmpFileCreated)
- return _inFile.Open(_tmpFileName);
- return true;
-}
-
-HRESULT CInOutTempBuffer::WriteToStream(ISequentialOutStream *stream)
-{
- if (_currentPositionInBuffer < _bufferPosition)
- {
- UInt32 sizeToWrite = _bufferPosition - _currentPositionInBuffer;
- RINOK(WriteStream(stream, _buffer + _currentPositionInBuffer, sizeToWrite, NULL));
- _currentPositionInBuffer += sizeToWrite;
- }
- if (!_tmpFileCreated)
- return true;
- while(true)
- {
- UInt32 localProcessedSize;
- if (!_inFile.ReadPart(_buffer, kTmpBufferMemorySize, localProcessedSize))
- return E_FAIL;
- if (localProcessedSize == 0)
- return S_OK;
- RINOK(WriteStream(stream, _buffer, localProcessedSize, NULL));
- }
-}
-
-STDMETHODIMP CSequentialOutTempBufferImp::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (!_buffer->Write(data, size))
- {
- if (processedSize != NULL)
- *processedSize = 0;
- return E_FAIL;
- }
- if (processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.h b/other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.h
deleted file mode 100644
index 17f3e8826..000000000
--- a/other-licenses/7zstub/src/7zip/Common/InOutTempBuffer.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Util/InOutTempBuffer.h
-
-#ifndef __IN_OUT_TEMP_BUFFER_H
-#define __IN_OUT_TEMP_BUFFER_H
-
-#include "../../Windows/FileIO.h"
-#include "../../Windows/FileDir.h"
-#include "../../Common/MyCom.h"
-
-#include "../IStream.h"
-
-class CInOutTempBuffer
-{
- NWindows::NFile::NDirectory::CTempFile _tempFile;
- NWindows::NFile::NIO::COutFile _outFile;
- NWindows::NFile::NIO::CInFile _inFile;
- Byte *_buffer;
- UInt32 _bufferPosition;
- UInt32 _currentPositionInBuffer;
- CSysString _tmpFileName;
- bool _tmpFileCreated;
-
- UInt64 _fileSize;
-
- bool WriteToFile(const void *data, UInt32 size);
-public:
- CInOutTempBuffer();
- ~CInOutTempBuffer();
- void Create();
-
- void InitWriting();
- bool Write(const void *data, UInt32 size);
- UInt64 GetDataSize() const { return _fileSize; }
- bool FlushWrite();
- bool InitReading();
- HRESULT WriteToStream(ISequentialOutStream *stream);
-};
-
-class CSequentialOutTempBufferImp:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CInOutTempBuffer *_buffer;
-public:
- // CSequentialOutStreamImp(): _size(0) {}
- // UInt32 _size;
- void Init(CInOutTempBuffer *buffer) { _buffer = buffer; }
- // UInt32 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/LSBFDecoder.cpp b/other-licenses/7zstub/src/7zip/Common/LSBFDecoder.cpp
deleted file mode 100644
index ada5890be..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LSBFDecoder.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Stream/LSBFDecoder.cpp
-
-#include "StdAfx.h"
-
-#include "LSBFDecoder.h"
-
-namespace NStream {
-namespace NLSBF {
-
-Byte kInvertTable[256];
-
-class CInverterTableInitializer
-{
-public:
- CInverterTableInitializer()
- {
- for(int i = 0; i < 256; i++)
- {
- Byte b = Byte(i);
- Byte bInvert = 0;
- for(int j = 0; j < 8; j++)
- {
- bInvert <<= 1;
- if (b & 1)
- bInvert |= 1;
- b >>= 1;
- }
- kInvertTable[i] = bInvert;
- }
- }
-} g_InverterTableInitializer;
-
-
-}}
diff --git a/other-licenses/7zstub/src/7zip/Common/LSBFDecoder.h b/other-licenses/7zstub/src/7zip/Common/LSBFDecoder.h
deleted file mode 100644
index 6e506859c..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LSBFDecoder.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// LSBFDecoder.h
-
-#ifndef __STREAM_LSBFDECODER_H
-#define __STREAM_LSBFDECODER_H
-
-#include "../IStream.h"
-
-namespace NStream {
-namespace NLSBF {
-
-const int kNumBigValueBits = 8 * 4;
-
-const int kNumValueBytes = 3;
-const int kNumValueBits = 8 * kNumValueBytes;
-
-const UInt32 kMask = (1 << kNumValueBits) - 1;
-
-extern Byte kInvertTable[256];
-// the Least Significant Bit of byte is First
-
-template<class TInByte>
-class CBaseDecoder
-{
-protected:
- int m_BitPos;
- UInt32 m_Value;
- TInByte m_Stream;
-public:
- UInt32 NumExtraBytes;
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream); }
- void ReleaseStream() { m_Stream.ReleaseStream(); }
- void Init()
- {
- m_Stream.Init();
- m_BitPos = kNumBigValueBits;
- m_Value = 0;
- NumExtraBytes = 0;
- }
- UInt64 GetProcessedSize() const
- { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
- UInt64 GetProcessedBitsSize() const
- { return (m_Stream.GetProcessedSize() << 3) - (kNumBigValueBits - m_BitPos); }
- int GetBitPosition() const { return (m_BitPos & 7); }
-
- void Normalize()
- {
- for (;m_BitPos >= 8; m_BitPos -= 8)
- {
- Byte b;
- if (!m_Stream.ReadByte(b))
- {
- b = 0xFF; // check it
- NumExtraBytes++;
- }
- m_Value = (b << (kNumBigValueBits - m_BitPos)) | m_Value;
- }
- }
-
- UInt32 ReadBits(int numBits)
- {
- Normalize();
- UInt32 res = m_Value & ((1 << numBits) - 1);
- m_BitPos += numBits;
- m_Value >>= numBits;
- return res;
- }
-
- bool ExtraBitsWereRead() const
- {
- if (NumExtraBytes == 0)
- return false;
- return ((UInt32)(kNumBigValueBits - m_BitPos) < (NumExtraBytes << 3));
- }
-};
-
-template<class TInByte>
-class CDecoder: public CBaseDecoder<TInByte>
-{
- UInt32 m_NormalValue;
-
-public:
- void Init()
- {
- CBaseDecoder<TInByte>::Init();
- m_NormalValue = 0;
- }
-
- void Normalize()
- {
- for (;this->m_BitPos >= 8; this->m_BitPos -= 8)
- {
- Byte b;
- if (!this->m_Stream.ReadByte(b))
- {
- b = 0xFF; // check it
- this->NumExtraBytes++;
- }
- m_NormalValue = (b << (kNumBigValueBits - this->m_BitPos)) | m_NormalValue;
- this->m_Value = (this->m_Value << 8) | kInvertTable[b];
- }
- }
-
- UInt32 GetValue(int numBits)
- {
- Normalize();
- return ((this->m_Value >> (8 - this->m_BitPos)) & kMask) >> (kNumValueBits - numBits);
- }
-
- void MovePos(int numBits)
- {
- this->m_BitPos += numBits;
- m_NormalValue >>= numBits;
- }
-
- UInt32 ReadBits(int numBits)
- {
- Normalize();
- UInt32 res = m_NormalValue & ( (1 << numBits) - 1);
- MovePos(numBits);
- return res;
- }
-};
-
-}}
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/LSBFEncoder.cpp b/other-licenses/7zstub/src/7zip/Common/LSBFEncoder.cpp
deleted file mode 100644
index a0ed300c6..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LSBFEncoder.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// LSBFEncoder.cpp
-
-#include "StdAfx.h"
-
-#include "LSBFEncoder.h"
-#include "Common/Defs.h"
-
-namespace NStream {
-namespace NLSBF {
-
-void CEncoder::WriteBits(UInt32 value, int numBits)
-{
- while(numBits > 0)
- {
- if (numBits < m_BitPos)
- {
- m_CurByte |= (value & ((1 << numBits) - 1)) << (8 - m_BitPos);
- m_BitPos -= numBits;
- return;
- }
- numBits -= m_BitPos;
- m_Stream.WriteByte((Byte)(m_CurByte | (value << (8 - m_BitPos))));
- value >>= m_BitPos;
- m_BitPos = 8;
- m_CurByte = 0;
- }
-}
-
-}}
diff --git a/other-licenses/7zstub/src/7zip/Common/LSBFEncoder.h b/other-licenses/7zstub/src/7zip/Common/LSBFEncoder.h
deleted file mode 100644
index 1c50b8e76..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LSBFEncoder.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Stream/LSBFEncoder.h
-
-#ifndef __STREAM_LSBFENCODER_H
-#define __STREAM_LSBFENCODER_H
-
-#include "../IStream.h"
-#include "OutBuffer.h"
-
-namespace NStream {
-namespace NLSBF {
-
-class CEncoder
-{
- COutBuffer m_Stream;
- int m_BitPos;
- Byte m_CurByte;
-public:
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream); }
- void ReleaseStream() { m_Stream.ReleaseStream(); }
- void Init()
- {
- m_Stream.Init();
- m_BitPos = 8;
- m_CurByte = 0;
- }
- HRESULT Flush()
- {
- FlushByte();
- return m_Stream.Flush();
- }
-
- void FlushByte()
- {
- if(m_BitPos < 8)
- m_Stream.WriteByte(m_CurByte);
- m_BitPos = 8;
- m_CurByte = 0;
- }
-
- void WriteBits(UInt32 value, int numBits);
- UInt32 GetBitPosition() const { return (8 - m_BitPos); }
- UInt64 GetProcessedSize() const {
- return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) /8; }
- void WriteByte(Byte b) { m_Stream.WriteByte(b);}
-};
-
-
-}}
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/LimitedStreams.cpp b/other-licenses/7zstub/src/7zip/Common/LimitedStreams.cpp
deleted file mode 100644
index c210c9560..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LimitedStreams.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// LimitedStreams.cpp
-
-#include "StdAfx.h"
-
-#include "LimitedStreams.h"
-#include "../../Common/Defs.h"
-
-void CLimitedSequentialInStream::Init(ISequentialInStream *stream, UInt64 streamSize)
-{
- _stream = stream;
- _size = streamSize;
-}
-
-STDMETHODIMP CLimitedSequentialInStream::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 processedSizeReal;
- UInt32 sizeToRead = UInt32(MyMin(_size, UInt64(size)));
- HRESULT result = _stream->Read(data, sizeToRead, &processedSizeReal);
- _size -= processedSizeReal;
- if(processedSize != NULL)
- *processedSize = processedSizeReal;
- return result;
-}
-
diff --git a/other-licenses/7zstub/src/7zip/Common/LimitedStreams.h b/other-licenses/7zstub/src/7zip/Common/LimitedStreams.h
deleted file mode 100644
index 7658b620d..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LimitedStreams.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// LimitedStreams.h
-
-#ifndef __LIMITEDSTREAMS_H
-#define __LIMITEDSTREAMS_H
-
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CLimitedSequentialInStream:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- UInt64 _size;
- CMyComPtr<ISequentialInStream> _stream;
-public:
- void Init(ISequentialInStream *stream, UInt64 streamSize);
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/LockedStream.cpp b/other-licenses/7zstub/src/7zip/Common/LockedStream.cpp
deleted file mode 100644
index 637c8980c..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LockedStream.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// LockedStream.cpp
-
-#include "StdAfx.h"
-
-#include "LockedStream.h"
-
-HRESULT CLockedInStream::Read(UInt64 startPos, void *data, UInt32 size,
- UInt32 *processedSize)
-{
- NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection);
- RINOK(_stream->Seek(startPos, STREAM_SEEK_SET, NULL));
- return _stream->Read(data, size, processedSize);
-}
-
-STDMETHODIMP CLockedSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize = 0;
- HRESULT result = _lockedInStream->Read(_pos, data, size, &realProcessedSize);
- _pos += realProcessedSize;
- if (processedSize != NULL)
- *processedSize = realProcessedSize;
- return result;
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/LockedStream.h b/other-licenses/7zstub/src/7zip/Common/LockedStream.h
deleted file mode 100644
index d61f6a372..000000000
--- a/other-licenses/7zstub/src/7zip/Common/LockedStream.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// LockedStream.h
-
-#ifndef __LOCKEDSTREAM_H
-#define __LOCKEDSTREAM_H
-
-#include "../../Windows/Synchronization.h"
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CLockedInStream
-{
- CMyComPtr<IInStream> _stream;
- NWindows::NSynchronization::CCriticalSection _criticalSection;
-public:
- void Init(IInStream *stream)
- { _stream = stream; }
- HRESULT Read(UInt64 startPos, void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CLockedSequentialInStreamImp:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- CLockedInStream *_lockedInStream;
- UInt64 _pos;
-public:
- void Init(CLockedInStream *lockedInStream, UInt64 startPos)
- {
- _lockedInStream = lockedInStream;
- _pos = startPos;
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h b/other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h
deleted file mode 100644
index dad00ecab..000000000
--- a/other-licenses/7zstub/src/7zip/Common/MSBFDecoder.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// MSBFDecoder.h
-// the Most Significant Bit of byte is First
-
-#ifndef __STREAM_MSBFDECODER_H
-#define __STREAM_MSBFDECODER_H
-
-#include "../../Common/Types.h"
-#include "../IStream.h"
-
-namespace NStream {
-namespace NMSBF {
-
-const int kNumBigValueBits = 8 * 4;
-const int kNumValueBytes = 3;
-const int kNumValueBits = 8 * kNumValueBytes;
-
-const UInt32 kMask = (1 << kNumValueBits) - 1;
-
-template<class TInByte>
-class CDecoder
-{
- UInt32 m_BitPos;
- UInt32 m_Value;
-public:
- TInByte m_Stream;
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialInStream *inStream) { m_Stream.SetStream(inStream);}
- void ReleaseStream() { m_Stream.ReleaseStream();}
-
- void Init()
- {
- m_Stream.Init();
- m_BitPos = kNumBigValueBits;
- Normalize();
- }
-
- UInt64 GetProcessedSize() const
- { return m_Stream.GetProcessedSize() - (kNumBigValueBits - m_BitPos) / 8; }
- UInt32 GetBitPosition() const { return (m_BitPos & 7); }
-
- void Normalize()
- {
- for (;m_BitPos >= 8; m_BitPos -= 8)
- m_Value = (m_Value << 8) | m_Stream.ReadByte();
- }
-
- UInt32 GetValue(UInt32 numBits) const
- {
- // return (m_Value << m_BitPos) >> (kNumBigValueBits - numBits);
- return ((m_Value >> (8 - m_BitPos)) & kMask) >> (kNumValueBits - numBits);
- }
-
- void MovePos(UInt32 numBits)
- {
- m_BitPos += numBits;
- Normalize();
- }
-
- UInt32 ReadBits(UInt32 numBits)
- {
- UInt32 res = GetValue(numBits);
- MovePos(numBits);
- return res;
- }
-};
-
-}}
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/MSBFEncoder.h b/other-licenses/7zstub/src/7zip/Common/MSBFEncoder.h
deleted file mode 100644
index b141e5545..000000000
--- a/other-licenses/7zstub/src/7zip/Common/MSBFEncoder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Stream/MSBFEncoder.h
-
-#ifndef __STREAM_MSBFENCODER_H
-#define __STREAM_MSBFENCODER_H
-
-#include "Common/Defs.h"
-#include "../IStream.h"
-#include "OutBuffer.h"
-
-namespace NStream {
-namespace NMSBF {
-
-template<class TOutByte>
-class CEncoder
-{
- TOutByte m_Stream;
- int m_BitPos;
- Byte m_CurByte;
-public:
- bool Create(UInt32 bufferSize) { return m_Stream.Create(bufferSize); }
- void SetStream(ISequentialOutStream *outStream) { m_Stream.SetStream(outStream);}
- void ReleaseStream() { m_Stream.ReleaseStream(); }
- void Init()
- {
- m_Stream.Init();
- m_BitPos = 8;
- m_CurByte = 0;
- }
- HRESULT Flush()
- {
- if(m_BitPos < 8)
- WriteBits(0, m_BitPos);
- return m_Stream.Flush();
- }
-
- void WriteBits(UInt32 value, int numBits)
- {
- while(numBits > 0)
- {
- if (numBits < m_BitPos)
- {
- m_CurByte |= ((Byte)value << (m_BitPos -= numBits));
- return;
- }
- numBits -= m_BitPos;
- UInt32 newBits = (value >> numBits);
- value -= (newBits << numBits);
- m_Stream.WriteByte(m_CurByte | (Byte)newBits);
- m_BitPos = 8;
- m_CurByte = 0;
- }
- }
- UInt64 GetProcessedSize() const {
- return m_Stream.GetProcessedSize() + (8 - m_BitPos + 7) / 8; }
-};
-
-}}
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/OffsetStream.cpp b/other-licenses/7zstub/src/7zip/Common/OffsetStream.cpp
deleted file mode 100644
index 177401f38..000000000
--- a/other-licenses/7zstub/src/7zip/Common/OffsetStream.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-// OffsetStream.cpp
-
-#include "StdAfx.h"
-
-#include "Common/Defs.h"
-#include "OffsetStream.h"
-
-HRESULT COffsetOutStream::Init(IOutStream *stream, UInt64 offset)
-{
- _offset = offset;
- _stream = stream;
- return _stream->Seek(offset, STREAM_SEEK_SET, NULL);
-}
-
-STDMETHODIMP COffsetOutStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- return _stream->Write(data, size, processedSize);
-}
-
-STDMETHODIMP COffsetOutStream::Seek(Int64 offset, UInt32 seekOrigin,
- UInt64 *newPosition)
-{
- UInt64 absoluteNewPosition;
- if (seekOrigin == STREAM_SEEK_SET)
- offset += _offset;
- HRESULT result = _stream->Seek(offset, seekOrigin, &absoluteNewPosition);
- if (newPosition != NULL)
- *newPosition = absoluteNewPosition - _offset;
- return result;
-}
-
-STDMETHODIMP COffsetOutStream::SetSize(Int64 newSize)
-{
- return _stream->SetSize(_offset + newSize);
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/OffsetStream.h b/other-licenses/7zstub/src/7zip/Common/OffsetStream.h
deleted file mode 100644
index 6eaa25928..000000000
--- a/other-licenses/7zstub/src/7zip/Common/OffsetStream.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// OffsetStream.h
-
-#ifndef __OFFSETSTREAM_H
-#define __OFFSETSTREAM_H
-
-#include "Common/MyCom.h"
-#include "../IStream.h"
-
-class COffsetOutStream:
- public IOutStream,
- public CMyUnknownImp
-{
- UInt64 _offset;
- CMyComPtr<IOutStream> _stream;
-public:
- HRESULT Init(IOutStream *stream, UInt64 offset);
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
- STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
- STDMETHOD(SetSize)(Int64 newSize);
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/OutBuffer.cpp b/other-licenses/7zstub/src/7zip/Common/OutBuffer.cpp
deleted file mode 100644
index 45da6d7f0..000000000
--- a/other-licenses/7zstub/src/7zip/Common/OutBuffer.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// OutByte.cpp
-
-#include "StdAfx.h"
-
-#include "OutBuffer.h"
-
-#include "../../Common/Alloc.h"
-
-bool COutBuffer::Create(UInt32 bufferSize)
-{
- const UInt32 kMinBlockSize = 1;
- if (bufferSize < kMinBlockSize)
- bufferSize = kMinBlockSize;
- if (_buffer != 0 && _bufferSize == bufferSize)
- return true;
- Free();
- _bufferSize = bufferSize;
- _buffer = (Byte *)::MidAlloc(bufferSize);
- return (_buffer != 0);
-}
-
-void COutBuffer::Free()
-{
- ::MidFree(_buffer);
- _buffer = 0;
-}
-
-void COutBuffer::SetStream(ISequentialOutStream *stream)
-{
- _stream = stream;
-}
-
-void COutBuffer::Init()
-{
- _streamPos = 0;
- _limitPos = _bufferSize;
- _pos = 0;
- _processedSize = 0;
- _overDict = false;
- #ifdef _NO_EXCEPTIONS
- ErrorCode = S_OK;
- #endif
-}
-
-UInt64 COutBuffer::GetProcessedSize() const
-{
- UInt64 res = _processedSize + _pos - _streamPos;
- if (_streamPos > _pos)
- res += _bufferSize;
- return res;
-}
-
-
-HRESULT COutBuffer::FlushPart()
-{
- // _streamPos < _bufferSize
- UInt32 size = (_streamPos >= _pos) ? (_bufferSize - _streamPos) : (_pos - _streamPos);
- HRESULT result = S_OK;
- #ifdef _NO_EXCEPTIONS
- result = ErrorCode;
- #endif
- if (_buffer2 != 0)
- {
- memmove(_buffer2, _buffer + _streamPos, size);
- _buffer2 += size;
- }
-
- if (_stream != 0
- #ifdef _NO_EXCEPTIONS
- && (ErrorCode == S_OK)
- #endif
- )
- {
- UInt32 processedSize = 0;
- result = _stream->Write(_buffer + _streamPos, size, &processedSize);
- size = processedSize;
- }
- _streamPos += size;
- if (_streamPos == _bufferSize)
- _streamPos = 0;
- if (_pos == _bufferSize)
- {
- _overDict = true;
- _pos = 0;
- }
- _limitPos = (_streamPos > _pos) ? _streamPos : _bufferSize;
- _processedSize += size;
- return result;
-}
-
-HRESULT COutBuffer::Flush()
-{
- #ifdef _NO_EXCEPTIONS
- if (ErrorCode != S_OK)
- return ErrorCode;
- #endif
-
- while(_streamPos != _pos)
- {
- HRESULT result = FlushPart();
- if (result != S_OK)
- return result;
- }
- return S_OK;
-}
-
-void COutBuffer::FlushWithCheck()
-{
- HRESULT result = FlushPart();
- #ifdef _NO_EXCEPTIONS
- ErrorCode = result;
- #else
- if (result != S_OK)
- throw COutBufferException(result);
- #endif
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/OutBuffer.h b/other-licenses/7zstub/src/7zip/Common/OutBuffer.h
deleted file mode 100644
index 37eefbdfc..000000000
--- a/other-licenses/7zstub/src/7zip/Common/OutBuffer.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// OutBuffer.h
-
-#ifndef __OUTBUFFER_H
-#define __OUTBUFFER_H
-
-#include "../IStream.h"
-#include "../../Common/MyCom.h"
-
-#ifndef _NO_EXCEPTIONS
-struct COutBufferException
-{
- HRESULT ErrorCode;
- COutBufferException(HRESULT errorCode): ErrorCode(errorCode) {}
-};
-#endif
-
-class COutBuffer
-{
-protected:
- Byte *_buffer;
- UInt32 _pos;
- UInt32 _limitPos;
- UInt32 _streamPos;
- UInt32 _bufferSize;
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _processedSize;
- Byte *_buffer2;
- bool _overDict;
-
- HRESULT FlushPart();
- void FlushWithCheck();
-public:
- #ifdef _NO_EXCEPTIONS
- HRESULT ErrorCode;
- #endif
-
- 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 WriteByte(Byte b)
- {
- _buffer[_pos++] = b;
- if(_pos == _limitPos)
- FlushWithCheck();
- }
- void WriteBytes(const void *data, size_t size)
- {
- for (size_t i = 0; i < size; i++)
- WriteByte(((const Byte *)data)[i]);
- }
-
- UInt64 GetProcessedSize() const;
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/ProgressUtils.cpp b/other-licenses/7zstub/src/7zip/Common/ProgressUtils.cpp
deleted file mode 100644
index ac598cd54..000000000
--- a/other-licenses/7zstub/src/7zip/Common/ProgressUtils.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// ProgressUtils.h
-
-#include "StdAfx.h"
-
-#include "ProgressUtils.h"
-
-void CLocalCompressProgressInfo::Init(ICompressProgressInfo *progress,
- const UInt64 *inStartValue, const UInt64 *outStartValue)
-{
- _progress = progress;
- _inStartValueIsAssigned = (inStartValue != NULL);
- if (_inStartValueIsAssigned)
- _inStartValue = *inStartValue;
- _outStartValueIsAssigned = (outStartValue != NULL);
- if (_outStartValueIsAssigned)
- _outStartValue = *outStartValue;
-}
-
-STDMETHODIMP CLocalCompressProgressInfo::SetRatioInfo(
- const UInt64 *inSize, const UInt64 *outSize)
-{
- UInt64 inSizeNew, outSizeNew;
- const UInt64 *inSizeNewPointer;
- const UInt64 *outSizeNewPointer;
- if (_inStartValueIsAssigned && inSize != NULL)
- {
- inSizeNew = _inStartValue + (*inSize);
- inSizeNewPointer = &inSizeNew;
- }
- else
- inSizeNewPointer = NULL;
-
- if (_outStartValueIsAssigned && outSize != NULL)
- {
- outSizeNew = _outStartValue + (*outSize);
- outSizeNewPointer = &outSizeNew;
- }
- else
- outSizeNewPointer = NULL;
- return _progress->SetRatioInfo(inSizeNewPointer, outSizeNewPointer);
-}
-
-
-///////////////////////////////////
-//
-
-void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain)
-{
- _progress = progress;
- _inSizeIsMain = inSizeIsMain;
-}
-
-STDMETHODIMP CLocalProgress::SetRatioInfo(
- const UInt64 *inSize, const UInt64 *outSize)
-{
- return _progress->SetCompleted(_inSizeIsMain ? inSize : outSize);
-}
-
diff --git a/other-licenses/7zstub/src/7zip/Common/ProgressUtils.h b/other-licenses/7zstub/src/7zip/Common/ProgressUtils.h
deleted file mode 100644
index 92e628528..000000000
--- a/other-licenses/7zstub/src/7zip/Common/ProgressUtils.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// ProgressUtils.h
-
-#ifndef __PROGRESSUTILS_H
-#define __PROGRESSUTILS_H
-
-#include "../../Common/MyCom.h"
-
-#include "../ICoder.h"
-#include "../IProgress.h"
-
-class CLocalCompressProgressInfo:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- CMyComPtr<ICompressProgressInfo> _progress;
- bool _inStartValueIsAssigned;
- bool _outStartValueIsAssigned;
- UInt64 _inStartValue;
- UInt64 _outStartValue;
-public:
- void Init(ICompressProgressInfo *progress,
- const UInt64 *inStartValue, const UInt64 *outStartValue);
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-class CLocalProgress:
- public ICompressProgressInfo,
- public CMyUnknownImp
-{
- CMyComPtr<IProgress> _progress;
- bool _inSizeIsMain;
-public:
- void Init(IProgress *progress, bool inSizeIsMain);
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/StdAfx.h b/other-licenses/7zstub/src/7zip/Common/StdAfx.h
deleted file mode 100644
index d7d9211b0..000000000
--- a/other-licenses/7zstub/src/7zip/Common/StdAfx.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// StdAfx.h
-
-#ifndef __STDAFX_H
-#define __STDAFX_H
-
-#include "../../Common/MyWindows.h"
-#include "../../Common/NewHandler.h"
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/StreamBinder.cpp b/other-licenses/7zstub/src/7zip/Common/StreamBinder.cpp
deleted file mode 100644
index dc11de8e5..000000000
--- a/other-licenses/7zstub/src/7zip/Common/StreamBinder.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-// StreamBinder.cpp
-
-#include "StdAfx.h"
-
-#include "StreamBinder.h"
-#include "../../Common/Defs.h"
-#include "../../Common/MyCom.h"
-
-using namespace NWindows;
-using namespace NSynchronization;
-
-class CSequentialInStreamForBinder:
- public ISequentialInStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-private:
- CStreamBinder *m_StreamBinder;
-public:
- ~CSequentialInStreamForBinder() { m_StreamBinder->CloseRead(); }
- void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; }
-};
-
-STDMETHODIMP CSequentialInStreamForBinder::Read(void *data, UInt32 size, UInt32 *processedSize)
- { return m_StreamBinder->Read(data, size, processedSize); }
-
-class CSequentialOutStreamForBinder:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
-public:
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-
-private:
- CStreamBinder *m_StreamBinder;
-public:
- ~CSequentialOutStreamForBinder() { m_StreamBinder->CloseWrite(); }
- void SetBinder(CStreamBinder *streamBinder) { m_StreamBinder = streamBinder; }
-};
-
-STDMETHODIMP CSequentialOutStreamForBinder::Write(const void *data, UInt32 size, UInt32 *processedSize)
- { return m_StreamBinder->Write(data, size, processedSize); }
-
-
-//////////////////////////
-// CStreamBinder
-// (_thereAreBytesToReadEvent && _bufferSize == 0) means that stream is finished.
-
-void CStreamBinder::CreateEvents()
-{
- _allBytesAreWritenEvent = new CManualResetEvent(true);
- _thereAreBytesToReadEvent = new CManualResetEvent(false);
- _readStreamIsClosedEvent = new CManualResetEvent(false);
-}
-
-void CStreamBinder::ReInit()
-{
- _thereAreBytesToReadEvent->Reset();
- _readStreamIsClosedEvent->Reset();
- ProcessedSize = 0;
-}
-
-CStreamBinder::~CStreamBinder()
-{
- if (_allBytesAreWritenEvent != NULL)
- delete _allBytesAreWritenEvent;
- if (_thereAreBytesToReadEvent != NULL)
- delete _thereAreBytesToReadEvent;
- if (_readStreamIsClosedEvent != NULL)
- delete _readStreamIsClosedEvent;
-}
-
-
-
-
-void CStreamBinder::CreateStreams(ISequentialInStream **inStream,
- ISequentialOutStream **outStream)
-{
- CSequentialInStreamForBinder *inStreamSpec = new
- CSequentialInStreamForBinder;
- CMyComPtr<ISequentialInStream> inStreamLoc(inStreamSpec);
- inStreamSpec->SetBinder(this);
- *inStream = inStreamLoc.Detach();
-
- CSequentialOutStreamForBinder *outStreamSpec = new
- CSequentialOutStreamForBinder;
- CMyComPtr<ISequentialOutStream> outStreamLoc(outStreamSpec);
- outStreamSpec->SetBinder(this);
- *outStream = outStreamLoc.Detach();
-
- _buffer = NULL;
- _bufferSize= 0;
- ProcessedSize = 0;
-}
-
-HRESULT CStreamBinder::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 sizeToRead = size;
- if (size > 0)
- {
- if(!_thereAreBytesToReadEvent->Lock())
- return E_FAIL;
- sizeToRead = MyMin(_bufferSize, size);
- if (_bufferSize > 0)
- {
- MoveMemory(data, _buffer, sizeToRead);
- _buffer = ((const Byte *)_buffer) + sizeToRead;
- _bufferSize -= sizeToRead;
- if (_bufferSize == 0)
- {
- _thereAreBytesToReadEvent->Reset();
- _allBytesAreWritenEvent->Set();
- }
- }
- }
- if (processedSize != NULL)
- *processedSize = sizeToRead;
- ProcessedSize += sizeToRead;
- return S_OK;
-}
-
-void CStreamBinder::CloseRead()
-{
- _readStreamIsClosedEvent->Set();
-}
-
-HRESULT CStreamBinder::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (size > 0)
- {
- _buffer = data;
- _bufferSize = size;
- _allBytesAreWritenEvent->Reset();
- _thereAreBytesToReadEvent->Set();
-
- HANDLE events[2];
- events[0] = *_allBytesAreWritenEvent;
- events[1] = *_readStreamIsClosedEvent;
- DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);
- if (waitResult != WAIT_OBJECT_0 + 0)
- {
- // ReadingWasClosed = true;
- return E_FAIL;
- }
- // if(!_allBytesAreWritenEvent.Lock())
- // return E_FAIL;
- }
- if (processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-void CStreamBinder::CloseWrite()
-{
- // _bufferSize must be = 0
- _thereAreBytesToReadEvent->Set();
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/StreamBinder.h b/other-licenses/7zstub/src/7zip/Common/StreamBinder.h
deleted file mode 100644
index 7899f0ff0..000000000
--- a/other-licenses/7zstub/src/7zip/Common/StreamBinder.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// StreamBinder.h
-
-#ifndef __STREAMBINDER_H
-#define __STREAMBINDER_H
-
-#include "../IStream.h"
-#include "../../Windows/Synchronization.h"
-
-class CStreamBinder
-{
- NWindows::NSynchronization::CManualResetEvent *_allBytesAreWritenEvent;
- NWindows::NSynchronization::CManualResetEvent *_thereAreBytesToReadEvent;
- NWindows::NSynchronization::CManualResetEvent *_readStreamIsClosedEvent;
- UInt32 _bufferSize;
- const void *_buffer;
-public:
- // bool ReadingWasClosed;
- UInt64 ProcessedSize;
- CStreamBinder():
- _allBytesAreWritenEvent(NULL),
- _thereAreBytesToReadEvent(NULL),
- _readStreamIsClosedEvent(NULL)
- {}
- ~CStreamBinder();
- void CreateEvents();
-
- void CreateStreams(ISequentialInStream **inStream,
- ISequentialOutStream **outStream);
- HRESULT Read(void *data, UInt32 size, UInt32 *processedSize);
- void CloseRead();
-
- HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize);
- void CloseWrite();
- void ReInit();
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/StreamObjects.cpp b/other-licenses/7zstub/src/7zip/Common/StreamObjects.cpp
deleted file mode 100644
index 459df66cf..000000000
--- a/other-licenses/7zstub/src/7zip/Common/StreamObjects.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-// StreamObjects.cpp
-
-#include "StdAfx.h"
-
-#include "StreamObjects.h"
-#include "../../Common/Defs.h"
-
-
-STDMETHODIMP CSequentialInStreamImp::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 numBytesToRead = (UInt32)(MyMin(_pos + size, _size) - _pos);
- memmove(data, _dataPointer + _pos, numBytesToRead);
- _pos += numBytesToRead;
- if(processedSize != NULL)
- *processedSize = numBytesToRead;
- return S_OK;
-}
-
-
-void CWriteBuffer::Write(const void *data, size_t size)
-{
- size_t newCapacity = _size + size;
- _buffer.EnsureCapacity(newCapacity);
- memmove(_buffer + _size, data, size);
- _size += size;
-}
-
-STDMETHODIMP CSequentialOutStreamImp::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- _writeBuffer.Write(data, size);
- if(processedSize != NULL)
- *processedSize = size;
- return S_OK;
-}
-
-STDMETHODIMP CSequentialOutStreamImp2::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 newSize = size;
- if (_pos + size > _size)
- newSize = (UInt32)(_size - _pos);
- memmove(_buffer + _pos, data, newSize);
- if(processedSize != NULL)
- *processedSize = newSize;
- _pos += newSize;
- if (newSize != size)
- return E_FAIL;
- return S_OK;
-}
-
-STDMETHODIMP CSequentialInStreamSizeCount::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->Read(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}
-
-STDMETHODIMP CSequentialInStreamRollback::Read(void *data, UInt32 size, UInt32 *processedSize)
-{
- if (_currentPos != _currentSize)
- {
- size_t curSize = _currentSize - _currentPos;
- if (size > curSize)
- size = (UInt32)curSize;
- memmove(data, _buffer + _currentPos, size);
- _currentPos += size;
- if (processedSize != 0)
- *processedSize = size;
- return S_OK;
- }
- UInt32 realProcessedSize;
- if (size > _bufferSize)
- size = (UInt32)_bufferSize;
- HRESULT result = _stream->Read(_buffer, size, &realProcessedSize);
- memmove(data, _buffer, realProcessedSize);
- _size += realProcessedSize;
- _currentSize = realProcessedSize;
- _currentPos = realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}
-
-HRESULT CSequentialInStreamRollback::Rollback(size_t rollbackSize)
-{
- if (rollbackSize > _currentPos)
- return E_INVALIDARG;
- _currentPos -= rollbackSize;
- return S_OK;
-}
-
-STDMETHODIMP CSequentialOutStreamSizeCount::Write(const void *data, UInt32 size, UInt32 *processedSize)
-{
- UInt32 realProcessedSize;
- HRESULT result = _stream->Write(data, size, &realProcessedSize);
- _size += realProcessedSize;
- if (processedSize != 0)
- *processedSize = realProcessedSize;
- return result;
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/StreamObjects.h b/other-licenses/7zstub/src/7zip/Common/StreamObjects.h
deleted file mode 100644
index b028a2114..000000000
--- a/other-licenses/7zstub/src/7zip/Common/StreamObjects.h
+++ /dev/null
@@ -1,156 +0,0 @@
-// StreamObjects.h
-
-#ifndef __STREAMOBJECTS_H
-#define __STREAMOBJECTS_H
-
-#include "../../Common/DynamicBuffer.h"
-#include "../../Common/MyCom.h"
-#include "../IStream.h"
-
-class CSequentialInStreamImp:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- const Byte *_dataPointer;
- size_t _size;
- size_t _pos;
-
-public:
- void Init(const Byte *dataPointer, size_t size)
- {
- _dataPointer = dataPointer;
- _size = size;
- _pos = 0;
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-
-class CWriteBuffer
-{
- CByteDynamicBuffer _buffer;
- size_t _size;
-public:
- CWriteBuffer(): _size(0) {}
- void Init() { _size = 0; }
- void Write(const void *data, size_t size);
- size_t GetSize() const { return _size; }
- const CByteDynamicBuffer& GetBuffer() const { return _buffer; }
-};
-
-class CSequentialOutStreamImp:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CWriteBuffer _writeBuffer;
-public:
- void Init() { _writeBuffer.Init(); }
- size_t GetSize() const { return _writeBuffer.GetSize(); }
- const CByteDynamicBuffer& GetBuffer() const { return _writeBuffer.GetBuffer(); }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialOutStreamImp2:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- Byte *_buffer;
-public:
- size_t _size;
- size_t _pos;
-
- void Init(Byte *buffer, size_t size)
- {
- _buffer = buffer;
- _pos = 0;
- _size = size;
- }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialInStreamSizeCount:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _stream;
- UInt64 _size;
-public:
- void Init(ISequentialInStream *stream)
- {
- _stream = stream;
- _size = 0;
- }
- UInt64 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
-};
-
-class CSequentialInStreamRollback:
- public ISequentialInStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialInStream> _stream;
- Byte *_buffer;
- size_t _bufferSize;
- UInt64 _size;
-
- size_t _currentSize;
- size_t _currentPos;
-public:
- CSequentialInStreamRollback(size_t bufferSize):
- _bufferSize(bufferSize),
- _buffer(0)
- {
- _buffer = new Byte[bufferSize];
- }
- ~CSequentialInStreamRollback()
- {
- delete _buffer;
- }
-
- void Init(ISequentialInStream *stream)
- {
- _stream = stream;
- _size = 0;
- _currentSize = 0;
- _currentPos = 0;
- }
- UInt64 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
- HRESULT Rollback(size_t rollbackSize);
-};
-
-class CSequentialOutStreamSizeCount:
- public ISequentialOutStream,
- public CMyUnknownImp
-{
- CMyComPtr<ISequentialOutStream> _stream;
- UInt64 _size;
-public:
- void Init(ISequentialOutStream *stream)
- {
- _stream = stream;
- _size = 0;
- }
- UInt64 GetSize() const { return _size; }
-
- MY_UNKNOWN_IMP
-
- STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
-};
-
-#endif
diff --git a/other-licenses/7zstub/src/7zip/Common/StreamUtils.cpp b/other-licenses/7zstub/src/7zip/Common/StreamUtils.cpp
deleted file mode 100644
index 712a78585..000000000
--- a/other-licenses/7zstub/src/7zip/Common/StreamUtils.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// StreamUtils.cpp
-
-#include "StdAfx.h"
-
-#include "../../Common/MyCom.h"
-#include "StreamUtils.h"
-
-HRESULT ReadStream(ISequentialInStream *stream, void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != 0)
- *processedSize = 0;
- while(size != 0)
- {
- UInt32 processedSizeLoc;
- HRESULT res = stream->Read(data, size, &processedSizeLoc);
- if (processedSize != 0)
- *processedSize += processedSizeLoc;
- data = (Byte *)((Byte *)data + processedSizeLoc);
- size -= processedSizeLoc;
- RINOK(res);
- if (processedSizeLoc == 0)
- return S_OK;
- }
- return S_OK;
-}
-
-HRESULT WriteStream(ISequentialOutStream *stream, const void *data, UInt32 size, UInt32 *processedSize)
-{
- if (processedSize != 0)
- *processedSize = 0;
- while(size != 0)
- {
- UInt32 processedSizeLoc;
- HRESULT res = stream->Write(data, size, &processedSizeLoc);
- if (processedSize != 0)
- *processedSize += processedSizeLoc;
- data = (const void *)((const Byte *)data + processedSizeLoc);
- size -= processedSizeLoc;
- RINOK(res);
- if (processedSizeLoc == 0)
- break;
- }
- return S_OK;
-}
diff --git a/other-licenses/7zstub/src/7zip/Common/StreamUtils.h b/other-licenses/7zstub/src/7zip/Common/StreamUtils.h
deleted file mode 100644
index c8cd8cef1..000000000
--- a/other-licenses/7zstub/src/7zip/Common/StreamUtils.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// StreamUtils.h
-
-#ifndef __STREAMUTILS_H
-#define __STREAMUTILS_H
-
-#include "../IStream.h"
-
-HRESULT ReadStream(ISequentialInStream *stream, void *data, UInt32 size, UInt32 *processedSize);
-HRESULT WriteStream(ISequentialOutStream *stream, const void *data, UInt32 size, UInt32 *processedSize);
-
-#endif