Fix LZ4FEncoder constructor

This commit is contained in:
topjohnwu 2019-03-07 19:58:59 -05:00
parent 7f08c06943
commit bbe4b69c8d

View File

@ -366,7 +366,7 @@ void LZ4FDecoder::read_header(const uint8_t *&in, size_t &size) {
size -= read; size -= read;
} }
LZ4FEncoder::LZ4FEncoder() : outbuf(nullptr), outCapacity(0) { LZ4FEncoder::LZ4FEncoder() : outbuf(nullptr), outCapacity(0), total(0) {
LZ4F_createCompressionContext(&ctx, LZ4F_VERSION); LZ4F_createCompressionContext(&ctx, LZ4F_VERSION);
} }
@ -422,10 +422,8 @@ void LZ4FEncoder::write_header() {
FilterOutStream::write(outbuf, write); FilterOutStream::write(outbuf, write);
} }
LZ4Decoder::LZ4Decoder() : init(false), buf_off(0), total(0), block_sz(0) { LZ4Decoder::LZ4Decoder() : init(false), buf_off(0), total(0), block_sz(0),
outbuf = new char[LZ4_UNCOMPRESSED]; outbuf(new char[LZ4_UNCOMPRESSED]), buf(new char[LZ4_COMPRESSED]) {}
buf = new char[LZ4_COMPRESSED];
}
LZ4Decoder::~LZ4Decoder() { LZ4Decoder::~LZ4Decoder() {
delete[] outbuf; delete[] outbuf;
@ -478,10 +476,8 @@ uint64_t LZ4Decoder::finalize() {
return total; return total;
} }
LZ4Encoder::LZ4Encoder() : init(false), buf_off(0), out_total(0), in_total(0) { LZ4Encoder::LZ4Encoder() : init(false), buf_off(0), out_total(0), in_total(0),
outbuf = new char[LZ4_COMPRESSED]; outbuf(new char[LZ4_COMPRESSED]), buf(new char[LZ4_UNCOMPRESSED]) {}
buf = new char[LZ4_UNCOMPRESSED];
}
LZ4Encoder::~LZ4Encoder() { LZ4Encoder::~LZ4Encoder() {
delete[] outbuf; delete[] outbuf;