PhysicsFS 2.0.3 imported.

This commit is contained in:
King_DuckZ 2014-02-12 23:59:58 +01:00
parent bcc0937726
commit 993311d151
459 changed files with 87785 additions and 0 deletions

View file

@ -0,0 +1,62 @@
// Compress/CopyCoder.cpp
#include "StdAfx.h"
extern "C"
{
#include "../../../../C/Alloc.h"
}
#include "CopyCoder.h"
#include "../../Common/StreamUtils.h"
namespace NCompress {
static const UInt32 kBufferSize = 1 << 17;
CCopyCoder::~CCopyCoder()
{
::MidFree(_buffer);
}
STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
ISequentialOutStream *outStream,
const UInt64 * /* inSize */, const UInt64 *outSize,
ICompressProgressInfo *progress)
{
if (_buffer == 0)
{
_buffer = (Byte *)::MidAlloc(kBufferSize);
if (_buffer == 0)
return E_OUTOFMEMORY;
}
TotalSize = 0;
for (;;)
{
UInt32 realProcessedSize;
UInt32 size = kBufferSize;
if (outSize != 0)
if (size > *outSize - TotalSize)
size = (UInt32)(*outSize - TotalSize);
RINOK(inStream->Read(_buffer, size, &realProcessedSize));
if (realProcessedSize == 0)
break;
RINOK(WriteStream(outStream, _buffer, realProcessedSize, NULL));
TotalSize += realProcessedSize;
if (progress != NULL)
{
RINOK(progress->SetRatioInfo(&TotalSize, &TotalSize));
}
}
return S_OK;
}
STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value)
{
*value = TotalSize;
return S_OK;
}
}

View file

@ -0,0 +1,33 @@
// Compress/CopyCoder.h
#ifndef __COMPRESS_COPYCODER_H
#define __COMPRESS_COPYCODER_H
#include "../../ICoder.h"
#include "../../../Common/MyCom.h"
namespace NCompress {
class CCopyCoder:
public ICompressCoder,
public ICompressGetInStreamProcessedSize,
public CMyUnknownImp
{
Byte *_buffer;
public:
UInt64 TotalSize;
CCopyCoder(): TotalSize(0) , _buffer(0) {};
~CCopyCoder();
MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
STDMETHOD(Code)(ISequentialInStream *inStream,
ISequentialOutStream *outStream,
const UInt64 *inSize, const UInt64 *outSize,
ICompressProgressInfo *progress);
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
};
}
#endif

View file

@ -0,0 +1,13 @@
// LZMARegister.cpp
#include "StdAfx.h"
#include "../../Common/RegisterCodec.h"
#include "CopyCoder.h"
static void *CreateCodec() { return (void *)(ICompressCoder *)(new NCompress::CCopyCoder); }
static CCodecInfo g_CodecInfo =
{ CreateCodec, CreateCodec, 0x00, L"Copy", 1, false };
REGISTER_CODEC(Copy)

View file

@ -0,0 +1,3 @@
// StdAfx.cpp
#include "StdAfx.h"

View file

@ -0,0 +1,8 @@
// StdAfx.h
#ifndef __STDAFX_H
#define __STDAFX_H
#include "../../../Common/MyWindows.h"
#endif