4.43 beta

This commit is contained in:
Igor Pavlov
2006-09-15 00:00:00 +00:00
committed by Kornel Lesiński
parent 0ec42ff829
commit 804edc5756
391 changed files with 9725 additions and 3168 deletions

View File

@@ -127,7 +127,7 @@ struct CBindInfo
class CBindReverseConverter
{
UInt32 _numSrcOutStreams;
const NCoderMixer2::CBindInfo _srcBindInfo;
NCoderMixer2::CBindInfo _srcBindInfo;
CRecordVector<UInt32> _srcInToDestOutMap;
CRecordVector<UInt32> _srcOutToDestInMap;
CRecordVector<UInt32> _destInToSrcOutMap;

View File

@@ -125,7 +125,7 @@ void CThreadCoderInfo::SetCoderInfo(const UInt64 **inSizes,
static DWORD WINAPI CoderThread(void *threadCoderInfo)
{
while(true)
for (;;)
{
if (!((CThreadCoderInfo *)threadCoderInfo)->WaitAndCode())
return 0;
@@ -137,7 +137,7 @@ static DWORD WINAPI CoderThread(void *threadCoderInfo)
static DWORD WINAPI MainCoderThread(void *threadCoderInfo)
{
while(true)
for (;;)
{
if (!((CCoderMixer2MT *)threadCoderInfo)->MyCode())
return 0;
@@ -282,7 +282,7 @@ bool CCoderMixer2MT::MyCode()
for(int i = 0; i < _coderInfoVector.Size(); i++)
_coderInfoVector[i].CompressEvent->Set();
DWORD result = ::WaitForMultipleObjects(_compressingCompletedEvents.Size(),
/* DWORD result = */ ::WaitForMultipleObjects(_compressingCompletedEvents.Size(),
&_compressingCompletedEvents.Front(), TRUE, INFINITE);
_compressingFinishedEvent.Set();
@@ -292,10 +292,10 @@ bool CCoderMixer2MT::MyCode()
STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
const UInt64 **inSizes,
const UInt64 ** /* inSizes */,
UInt32 numInStreams,
ISequentialOutStream **outStreams,
const UInt64 **outSizes,
const UInt64 ** /* outSizes */,
UInt32 numOutStreams,
ICompressProgressInfo *progress)
{
@@ -315,7 +315,7 @@ STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
_startCompressingEvent.Set();
while (true)
for (;;)
{
HANDLE events[2] = {_compressingFinishedEvent, progressSpec->ProgressEvent };
DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);

View File

@@ -66,7 +66,8 @@ public:
{
{ _coders[coderIndex].SetCoderInfo(inSizes, outSizes); }
}
void SetProgressCoderIndex(UInt32 coderIndex)
void SetProgressCoderIndex(UInt32 /*coderIndex*/)
{
// _progressCoderIndex = coderIndex;
}

View File

@@ -37,12 +37,13 @@ HRESULT CFilterCoder::WriteWithLimit(ISequentialOutStream *outStream, UInt32 siz
STDMETHODIMP CFilterCoder::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
ISequentialOutStream *outStream, const UInt64 * /* inSize */, const UInt64 *outSize,
ICompressProgressInfo *progress)
{
RINOK(Init());
UInt32 bufferPos = 0;
if (_outSizeIsDefined = (outSize != 0))
_outSizeIsDefined = (outSize != 0);
if (_outSizeIsDefined)
_outSize = *outSize;
while(NeedMore())

View File

@@ -4,23 +4,25 @@
#include "InStreamWithCRC.h"
STDMETHODIMP CSequentialInStreamWithCRC::Read(void *data,
UInt32 size, UInt32 *processedSize)
STDMETHODIMP CSequentialInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 realProcessedSize;
HRESULT result = _stream->Read(data, size, &realProcessedSize);
_size += realProcessedSize;
if (size > 0 && realProcessedSize == 0)
_wasFinished = true;
_crc.Update(data, realProcessedSize);
if(processedSize != NULL)
*processedSize = realProcessedSize;
return result;
}
STDMETHODIMP CInStreamWithCRC::Read(void *data,
UInt32 size, UInt32 *processedSize)
STDMETHODIMP CInStreamWithCRC::Read(void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 realProcessedSize;
HRESULT result = _stream->Read(data, size, &realProcessedSize);
if (size > 0 && realProcessedSize == 0)
_wasFinished = true;
_size += realProcessedSize;
_crc.Update(data, realProcessedSize);
if(processedSize != NULL)

View File

@@ -19,16 +19,19 @@ private:
CMyComPtr<ISequentialInStream> _stream;
UInt64 _size;
CCRC _crc;
bool _wasFinished;
public:
void Init(ISequentialInStream *stream)
void SetStream(ISequentialInStream *stream) { _stream = stream; }
void Init()
{
_stream = stream;
_size = 0;
_wasFinished = false;
_crc.Init();
}
void ReleaseStream() { _stream.Release(); }
UInt32 GetCRC() const { return _crc.GetDigest(); }
UInt64 GetSize() const { return _size; }
bool WasFinished() const { return _wasFinished; }
};
class CInStreamWithCRC:
@@ -44,16 +47,19 @@ private:
CMyComPtr<IInStream> _stream;
UInt64 _size;
CCRC _crc;
bool _wasFinished;
public:
void Init(IInStream *stream)
void SetStream(IInStream *stream) { _stream = stream; }
void Init()
{
_stream = stream;
_size = 0;
_wasFinished = false;
_crc.Init();
}
void ReleaseStream() { _stream.Release(); }
UInt32 GetCRC() const { return _crc.GetDigest(); }
UInt64 GetSize() const { return _size; }
bool WasFinished() const { return _wasFinished; }
};
#endif

View File

@@ -40,7 +40,7 @@ bool HasTailSlash(const AString &name, UINT codePage)
return false;
LPCSTR prev =
#ifdef _WIN32
CharPrevExA(codePage, name, &name[name.Length()], 0);
CharPrevExA((WORD)codePage, name, &name[name.Length()], 0);
#else
(LPCSTR)(name) + (name.Length() - 1);
#endif

View File

@@ -37,8 +37,6 @@ STDMETHODIMP CMultiStream::Seek(Int64 offset, UInt32 seekOrigin,
UInt64 *newPosition)
{
UInt64 newPos;
if(seekOrigin >= 3)
return STG_E_INVALIDFUNCTION;
switch(seekOrigin)
{
case STREAM_SEEK_SET:
@@ -50,6 +48,8 @@ STDMETHODIMP CMultiStream::Seek(Int64 offset, UInt32 seekOrigin,
case STREAM_SEEK_END:
newPos = _totalLength + offset;
break;
default:
return STG_E_INVALIDFUNCTION;
}
_seekPos = 0;
for (_streamIndex = 0; _streamIndex < Streams.Size(); _streamIndex++)

View File

@@ -4,8 +4,7 @@
#include "OutStreamWithCRC.h"
STDMETHODIMP COutStreamWithCRC::Write(const void *data,
UInt32 size, UInt32 *processedSize)
STDMETHODIMP COutStreamWithCRC::Write(const void *data, UInt32 size, UInt32 *processedSize)
{
UInt32 realProcessedSize;
HRESULT result;
@@ -16,7 +15,9 @@ STDMETHODIMP COutStreamWithCRC::Write(const void *data,
}
else
result = _stream->Write(data, size, &realProcessedSize);
_crc.Update(data, realProcessedSize);
if (_calculateCrc)
_crc.Update(data, realProcessedSize);
_size += realProcessedSize;
if(processedSize != NULL)
*processedSize = realProcessedSize;
return result;

View File

@@ -16,18 +16,22 @@ public:
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
private:
CCRC _crc;
CMyComPtr<ISequentialOutStream> _stream;
UInt64 _size;
CCRC _crc;
bool _calculateCrc;
public:
void Init(ISequentialOutStream *stream)
void SetStream(ISequentialOutStream *stream) { _stream = stream; }
void Init(bool calculateCrc = true)
{
_stream = stream;
_size = 0;
_calculateCrc = calculateCrc;
_crc.Init();
}
void ReleaseStream() { _stream.Release(); }
UInt64 GetSize() const { return _size; }
UInt32 GetCRC() const { return _crc.GetDigest(); }
void InitCRC() { _crc.Init(); }
};
#endif