Commit e57066ca authored by Ingvar Stepanyan's avatar Ingvar Stepanyan

Simplify z_stream initialisation

parent 441e079f
......@@ -29,12 +29,6 @@ namespace kj {
namespace _ { // private
GzipOutputContext::GzipOutputContext(kj::Maybe<int> compressionLevel) {
memset(&ctx, 0, sizeof(ctx));
ctx.next_in = nullptr;
ctx.avail_in = 0;
ctx.next_out = nullptr;
ctx.avail_out = 0;
int initResult;
KJ_IF_MAYBE(level, compressionLevel) {
......@@ -91,12 +85,6 @@ void GzipOutputContext::fail(int result) {
GzipInputStream::GzipInputStream(InputStream& inner)
: inner(inner) {
memset(&ctx, 0, sizeof(ctx));
ctx.next_in = nullptr;
ctx.avail_in = 0;
ctx.next_out = nullptr;
ctx.avail_out = 0;
// windowBits = 15 (maximum) + magic value 16 to ask for gzip.
KJ_ASSERT(inflateInit2(&ctx, 15 + 16) == Z_OK);
}
......@@ -180,12 +168,6 @@ void GzipOutputStream::pump(int flush) {
GzipAsyncInputStream::GzipAsyncInputStream(AsyncInputStream& inner)
: inner(inner) {
memset(&ctx, 0, sizeof(ctx));
ctx.next_in = nullptr;
ctx.avail_in = 0;
ctx.next_out = nullptr;
ctx.avail_out = 0;
// windowBits = 15 (maximum) + magic value 16 to ask for gzip.
KJ_ASSERT(inflateInit2(&ctx, 15 + 16) == Z_OK);
}
......
......@@ -41,7 +41,7 @@ public:
private:
bool compressing;
z_stream ctx;
z_stream ctx = {};
byte buffer[4096];
void fail(int result);
......@@ -59,7 +59,7 @@ public:
private:
InputStream& inner;
z_stream ctx;
z_stream ctx = {};
bool atValidEndpoint = false;
byte buffer[4096];
......@@ -102,7 +102,7 @@ public:
private:
AsyncInputStream& inner;
z_stream ctx;
z_stream ctx = {};
bool atValidEndpoint = false;
byte buffer[4096];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment