Skip to content

Commit

Permalink
src: use ZCtxt as a source for v8::Isolates
Browse files Browse the repository at this point in the history
Other methods like `After` already use ZCtxt as the source for
Enviroment/ v8::Isolate objects, this commit applies the same style
to the other missing methods (`After sync` and `Write`)

PR-URL: #2547
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
  • Loading branch information
romankl authored and Fishrock123 committed Sep 14, 2015
1 parent 999d25b commit 414e407
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/node_zlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class ZCtx : public AsyncWrap {
Bytef *in;
Bytef *out;
size_t in_off, in_len, out_off, out_len;
Environment* env = ctx->env();

if (args[1]->IsNull()) {
// just a flush
Expand All @@ -151,7 +152,7 @@ class ZCtx : public AsyncWrap {
} else {
CHECK(Buffer::HasInstance(args[1]));
Local<Object> in_buf;
in_buf = args[1]->ToObject(args.GetIsolate());
in_buf = args[1]->ToObject(env->isolate());
in_off = args[2]->Uint32Value();
in_len = args[3]->Uint32Value();

Expand All @@ -160,7 +161,7 @@ class ZCtx : public AsyncWrap {
}

CHECK(Buffer::HasInstance(args[4]));
Local<Object> out_buf = args[4]->ToObject(args.GetIsolate());
Local<Object> out_buf = args[4]->ToObject(env->isolate());
out_off = args[5]->Uint32Value();
out_len = args[6]->Uint32Value();
CHECK(Buffer::IsWithinBounds(out_off, out_len, Buffer::Length(out_buf)));
Expand Down Expand Up @@ -198,7 +199,7 @@ class ZCtx : public AsyncWrap {


static void AfterSync(ZCtx* ctx, const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
Environment* env = ctx->env();
Local<Integer> avail_out = Integer::New(env->isolate(),
ctx->strm_.avail_out);
Local<Integer> avail_in = Integer::New(env->isolate(),
Expand Down

0 comments on commit 414e407

Please sign in to comment.