[*] Actually compiles now :(
This commit is contained in:
parent
3be51018c9
commit
7579d70bc1
@ -291,10 +291,12 @@ namespace Aurora::Async
|
||||
((GetThreadWorkersCount(unlocker.first) < 2) || // is there anyone besides us who might deal with this? unlikely fast path
|
||||
(workerIdMatches))) // well, crap
|
||||
{
|
||||
if (workerIdMatches)
|
||||
if ((workerIdMatches) &&
|
||||
(unlocker.first != 0)) // UI code is always hacky. dont judge people for nesting tasks within tasks.
|
||||
// if theres a stack overflow problem, the native dev responsable for the sysloop and ui would already know about it
|
||||
{
|
||||
LogWarn("Nested Task: {}:{}", unlocker.first, unlocker.second);
|
||||
SysPushErrorLogicError("Nested Task: {}:{}", unlocker.first, unlocker.second);
|
||||
LogWarn("Nested Task: {}:{}. This is not an error, it's just bad practice.", unlocker.first, unlocker.second.value_or(0));
|
||||
SysPushErrorLogicError("[telemetry] Nested Task: {}:{}", unlocker.first, unlocker.second.value_or(0));
|
||||
}
|
||||
|
||||
// TODO: timeout isn't respected here as well
|
||||
|
@ -41,7 +41,7 @@ namespace Aurora::Compression
|
||||
public:
|
||||
~ZSTDInflate()
|
||||
{
|
||||
if (auto dctx = std::exchange(_dctx, {}))
|
||||
if (auto dctx = std::exchange(dctx_, {}))
|
||||
{
|
||||
ZSTD_freeDCtx(dctx);
|
||||
}
|
||||
@ -49,10 +49,10 @@ namespace Aurora::Compression
|
||||
|
||||
bool Init(Aurora::IO::IStreamReader *reader)
|
||||
{
|
||||
this->_reader = reader;
|
||||
this->_dctx = ZSTD_createDCtx();
|
||||
this->reader_ = reader;
|
||||
this->dctx_ = ZSTD_createDCtx();
|
||||
|
||||
if (!this->_dctx)
|
||||
if (!this->dctx_)
|
||||
{
|
||||
SysPushErrorGen("Couldn't create decompressor");
|
||||
return false;
|
||||
@ -74,7 +74,7 @@ namespace Aurora::Compression
|
||||
while (read != input)
|
||||
{
|
||||
AuUInt32 request = std::min(input, length);
|
||||
if (this->_reader->Read(din, request) != IO::EStreamError::eErrorNone)
|
||||
if (this->reader_->Read(din, request) != IO::EStreamError::eErrorNone)
|
||||
{
|
||||
return std::make_pair(read, done);
|
||||
}
|
||||
@ -85,7 +85,7 @@ namespace Aurora::Compression
|
||||
{
|
||||
ZSTD_outBuffer output = { dout, outFrameLength, 0 };
|
||||
|
||||
auto ret = ZSTD_decompressStream(this->_dctx, &output, &input);
|
||||
auto ret = ZSTD_decompressStream(this->dctx_, &output, &input);
|
||||
if (ZSTD_isError(ret))
|
||||
{
|
||||
SysPushErrorIO("Compression error: {}", ret);
|
||||
@ -103,9 +103,9 @@ namespace Aurora::Compression
|
||||
}
|
||||
|
||||
private:
|
||||
Aurora::IO::IStreamReader *_reader;
|
||||
ZSTD_DCtx *_dctx;
|
||||
|
||||
|
||||
Aurora::IO::IStreamReader *reader_;
|
||||
ZSTD_DCtx *dctx_;
|
||||
};
|
||||
|
||||
class ZIPInflate : public BaseStream
|
||||
@ -113,17 +113,17 @@ namespace Aurora::Compression
|
||||
public:
|
||||
~ZIPInflate()
|
||||
{
|
||||
if (auto ctx = std::exchange(this->_init, {}))
|
||||
if (auto ctx = std::exchange(this->init_, {}))
|
||||
{
|
||||
inflateEnd(&this->_ctx);
|
||||
inflateEnd(&this->ctx_);
|
||||
}
|
||||
}
|
||||
|
||||
bool Init(Aurora::IO::IStreamReader *reader)
|
||||
{
|
||||
this->_reader = reader;
|
||||
this->reader_ = reader;
|
||||
|
||||
auto ret = inflateInit(&this->_ctx);
|
||||
auto ret = inflateInit(&this->ctx_);
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
SysPushErrorMem("Error: {}", ret);
|
||||
@ -131,7 +131,7 @@ namespace Aurora::Compression
|
||||
}
|
||||
|
||||
this->_outbuffer.reserve(10 * 1024);
|
||||
this->_init = true;
|
||||
this->init_ = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -144,55 +144,54 @@ namespace Aurora::Compression
|
||||
while (read != input)
|
||||
{
|
||||
AuUInt32 request = std::min(input, AuUInt32(ArraySize(din_)));
|
||||
if (this->_reader->Read(din_, request) != IO::EStreamError::eErrorNone)
|
||||
if (this->reader_->Read(din_, request) != IO::EStreamError::eErrorNone)
|
||||
{
|
||||
return std::make_pair(read, done);
|
||||
}
|
||||
|
||||
read += request;
|
||||
|
||||
this->_ctx.avail_in = request;
|
||||
this->_ctx.next_in = reinterpret_cast<unsigned char *>(din_);
|
||||
this->ctx_.avail_in = request;
|
||||
this->ctx_.next_in = reinterpret_cast<unsigned char *>(din_);
|
||||
|
||||
do
|
||||
{
|
||||
this->_ctx.avail_out = ArraySize(dout_);
|
||||
this->_ctx.next_out = dout_;
|
||||
this->ctx_.avail_out = ArraySize(dout_);
|
||||
this->ctx_.next_out = dout_;
|
||||
|
||||
if (!this->_ctx.avail_out)
|
||||
if (!this->ctx_.avail_out)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ret = inflate(&this->_ctx, Z_NO_FLUSH);
|
||||
ret = inflate(&this->ctx_, Z_NO_FLUSH);
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
SysPushErrorIO("Error: {}", ret);
|
||||
return std::make_pair(read, 0);
|
||||
}
|
||||
|
||||
auto have = ArraySize(dout_) - this->_ctx.avail_out;
|
||||
auto have = ArraySize(dout_) - this->ctx_.avail_out;
|
||||
done += have;
|
||||
|
||||
this->_outbuffer.insert(this->_outbuffer.end(),
|
||||
reinterpret_cast<const AuUInt8 *>(dout_),
|
||||
reinterpret_cast<const AuUInt8 *>(dout_) + have);
|
||||
|
||||
} while (this->_ctx.avail_out == 0);
|
||||
SysAssert(this->_ctx.avail_in == 0);
|
||||
} while (this->ctx_.avail_out == 0);
|
||||
SysAssert(this->ctx_.avail_in == 0);
|
||||
}
|
||||
|
||||
return std::make_pair(read, done);
|
||||
}
|
||||
|
||||
private:
|
||||
AuList<AuUInt8> _outbuffer;
|
||||
Aurora::IO::IStreamReader *_reader;
|
||||
z_stream _ctx {};
|
||||
bool _init {};
|
||||
|
||||
Aurora::IO::IStreamReader *reader_;
|
||||
z_stream ctx_ {};
|
||||
bool init_ {};
|
||||
unsigned char din_[4096];
|
||||
unsigned char dout_[4096];
|
||||
|
||||
};
|
||||
|
||||
class BZIPInflate : public BaseStream
|
||||
@ -200,17 +199,17 @@ namespace Aurora::Compression
|
||||
public:
|
||||
~BZIPInflate()
|
||||
{
|
||||
if (auto ctx = std::exchange(this->_init, {}))
|
||||
if (auto ctx = std::exchange(this->init_, {}))
|
||||
{
|
||||
BZ2_bzDecompressEnd(&this->_ctx);
|
||||
BZ2_bzDecompressEnd(&this->ctx_);
|
||||
}
|
||||
}
|
||||
|
||||
bool Init(Aurora::IO::IStreamReader *reader)
|
||||
{
|
||||
this->_reader = reader;
|
||||
this->reader_ = reader;
|
||||
|
||||
auto ret = BZ2_bzDecompressInit(&this->_ctx, 0, 0);
|
||||
auto ret = BZ2_bzDecompressInit(&this->ctx_, 0, 0);
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
SysPushErrorMem("Error: {}", ret);
|
||||
@ -218,7 +217,7 @@ namespace Aurora::Compression
|
||||
}
|
||||
|
||||
this->_outbuffer.reserve(10 * 1024);
|
||||
this->_init = true;
|
||||
this->init_ = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -230,28 +229,28 @@ namespace Aurora::Compression
|
||||
while (read != input)
|
||||
{
|
||||
AuUInt32 request = std::min(input, AuUInt32(ArraySize(din_)));
|
||||
if (this->_reader->Read(din_, request) != IO::EStreamError::eErrorNone)
|
||||
if (this->reader_->Read(din_, request) != IO::EStreamError::eErrorNone)
|
||||
{
|
||||
return std::make_pair(read, done);
|
||||
}
|
||||
read += request;
|
||||
|
||||
this->_ctx.avail_in = request;
|
||||
this->_ctx.next_in = reinterpret_cast<char *>(din_);
|
||||
this->ctx_.avail_in = request;
|
||||
this->ctx_.next_in = reinterpret_cast<char *>(din_);
|
||||
|
||||
do
|
||||
{
|
||||
this->_ctx.avail_out = ArraySize(dout_);
|
||||
this->_ctx.next_out = dout_;
|
||||
this->ctx_.avail_out = ArraySize(dout_);
|
||||
this->ctx_.next_out = dout_;
|
||||
|
||||
ret = BZ2_bzDecompress(&this->_ctx);
|
||||
ret = BZ2_bzDecompress(&this->ctx_);
|
||||
if (ret != Z_OK)
|
||||
{
|
||||
SysPushErrorIO("Error: {}", ret);
|
||||
return std::make_pair(read, 0);
|
||||
}
|
||||
|
||||
auto have = ArraySize(dout_) - this->_ctx.avail_out;
|
||||
auto have = ArraySize(dout_) - this->ctx_.avail_out;
|
||||
done += have;
|
||||
|
||||
this->_outbuffer.insert(this->_outbuffer.end(),
|
||||
@ -259,21 +258,20 @@ namespace Aurora::Compression
|
||||
reinterpret_cast<const AuUInt8 *>(dout_) + have);
|
||||
|
||||
|
||||
} while (this->_ctx.avail_out == 0);
|
||||
SysAssert(this->_ctx.avail_in == 0);
|
||||
} while (this->ctx_.avail_out == 0);
|
||||
SysAssert(this->ctx_.avail_in == 0);
|
||||
}
|
||||
|
||||
return std::make_pair(read, done);
|
||||
}
|
||||
|
||||
private:
|
||||
AuList<AuUInt8> _outbuffer;
|
||||
Aurora::IO::IStreamReader *_reader;
|
||||
bz_stream _ctx {};
|
||||
bool _init {};
|
||||
|
||||
Aurora::IO::IStreamReader *reader_;
|
||||
bz_stream ctx_ {};
|
||||
bool init_ {};
|
||||
char dout_[4096];
|
||||
char din_[4096];
|
||||
|
||||
};
|
||||
|
||||
class LZ4Inflate : public BaseStream
|
||||
@ -281,18 +279,18 @@ namespace Aurora::Compression
|
||||
public:
|
||||
~LZ4Inflate()
|
||||
{
|
||||
if (auto ctx = std::exchange(this->_lz4Stream, {}))
|
||||
if (auto ctx = std::exchange(this->lz4Stream_, {}))
|
||||
{
|
||||
LZ4_freeStreamDecode(this->_lz4Stream);
|
||||
LZ4_freeStreamDecode(this->lz4Stream_);
|
||||
}
|
||||
}
|
||||
|
||||
bool Init(Aurora::IO::IStreamReader *reader)
|
||||
{
|
||||
this->_reader = reader;
|
||||
this->reader_ = reader;
|
||||
|
||||
this->_lz4Stream = LZ4_createStreamDecode();
|
||||
if (!this->_lz4Stream)
|
||||
this->lz4Stream_ = LZ4_createStreamDecode();
|
||||
if (!this->lz4Stream_)
|
||||
{
|
||||
SysPushErrorMem();
|
||||
return false;
|
||||
@ -314,7 +312,7 @@ namespace Aurora::Compression
|
||||
AuUInt16 frameSize;
|
||||
AuUInt32 request = sizeof(frameSize);
|
||||
|
||||
if (this->_reader->Read(&frameSize, request) != IO::EStreamError::eErrorNone)
|
||||
if (this->reader_->Read(&frameSize, request) != IO::EStreamError::eErrorNone)
|
||||
{
|
||||
return std::make_pair(read, done);
|
||||
}
|
||||
@ -328,7 +326,7 @@ namespace Aurora::Compression
|
||||
}
|
||||
|
||||
request = frameSize;
|
||||
if (this->_reader->Read(inFrame.get(), request) != IO::EStreamError::eErrorNone)
|
||||
if (this->reader_->Read(inFrame.get(), request) != IO::EStreamError::eErrorNone)
|
||||
{
|
||||
return std::make_pair(read, done);
|
||||
}
|
||||
@ -336,7 +334,7 @@ namespace Aurora::Compression
|
||||
|
||||
auto outPtr = outFrames[outFrame].get();
|
||||
|
||||
auto bytes = LZ4_decompress_safe_continue(_lz4Stream, inFrame.get(), outPtr, frameSize, frameSize);
|
||||
auto bytes = LZ4_decompress_safe_continue(lz4Stream_, inFrame.get(), outPtr, frameSize, frameSize);
|
||||
if (bytes <= 0)
|
||||
{
|
||||
return std::make_pair(read, 0);
|
||||
@ -356,10 +354,9 @@ namespace Aurora::Compression
|
||||
}
|
||||
|
||||
private:
|
||||
AuList<AuUInt8> _outbuffer;
|
||||
Aurora::IO::IStreamReader *_reader;
|
||||
LZ4_streamDecode_t* _lz4Stream {};
|
||||
|
||||
Aurora::IO::IStreamReader *reader_;
|
||||
LZ4_streamDecode_t* lz4Stream_ {};
|
||||
};
|
||||
|
||||
AUKN_SYM ICompressionStream *DecompressorNew(IO::IStreamReader *reader, ECompresionType type)
|
||||
|
@ -524,7 +524,6 @@ namespace Aurora::Compression
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
LZ4_freeStreamDecode(lz4Stream);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user