
- Added SetCompressorDictSize (only works for LZMA) - Added SetCompressionLevel (only "works" for zlib and bzip2) - doesn't work for now - Section is only supposed to get 4 parameters if /o is specified - Updated version numbers git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3190 212acab6-be3b-0410-9dea-997c60f758d6
53 lines
836 B
C++
53 lines
836 B
C++
// Stream/OutByte.cpp
|
|
|
|
#include "StdAfx.h"
|
|
|
|
#include "OutBuffer.h"
|
|
|
|
COutBuffer::COutBuffer(UINT32 bufferSize):
|
|
_bufferSize(bufferSize)
|
|
{
|
|
_buffer = new BYTE[_bufferSize];
|
|
}
|
|
|
|
COutBuffer::~COutBuffer()
|
|
{
|
|
delete []_buffer;
|
|
}
|
|
|
|
void COutBuffer::Init(ISequentialOutStream *stream)
|
|
{
|
|
_stream = stream;
|
|
_processedSize = 0;
|
|
_pos = 0;
|
|
}
|
|
|
|
/*
|
|
void COutBuffer::ReleaseStream()
|
|
{
|
|
_stream.Release();
|
|
}
|
|
*/
|
|
|
|
|
|
HRESULT COutBuffer::Flush()
|
|
{
|
|
if (_pos == 0)
|
|
return S_OK;
|
|
UINT32 processedSize;
|
|
HRESULT result = _stream->Write(_buffer, _pos, &processedSize);
|
|
if (result != S_OK)
|
|
return result;
|
|
if (_pos != processedSize)
|
|
return E_FAIL;
|
|
_processedSize += processedSize;
|
|
_pos = 0;
|
|
return S_OK;
|
|
}
|
|
|
|
void COutBuffer::WriteBlock()
|
|
{
|
|
HRESULT result = Flush();
|
|
if (result != S_OK)
|
|
throw COutBufferException(result);
|
|
}
|