LZ4: flip in buffers

This commit is contained in:
Reece Wilson 2021-07-11 18:38:16 +01:00
parent 7579d70bc1
commit 95a04e0984

View File

@ -434,13 +434,18 @@ namespace Aurora::Compression
int size = info.lz4BlockSize ? info.lz4BlockSize : 64 * 1024;
std::shared_ptr<char> inBuf(new char[size], std::default_delete<char[]>());
std::shared_ptr<char> in1Buf(new char[size], std::default_delete<char[]>());
std::shared_ptr<char> in2Buf(new char[size], std::default_delete<char[]>());
std::shared_ptr<char> outBuf(new char[size], std::default_delete<char[]>());
std::shared_ptr<char> inBuffers[2] = {in1Buf, in2Buf};
bool inBufState = false;
AuUInt32 inputStat = 0, outputStat = 0;
while (true)
{
auto &inBuf = inBuffers[inBufState = !inBufState];
auto read = stream.inPipe(inBuf.get() , 64 * 1024);
if (!read) break;