Skip to content

Commit

Permalink
src: fix windows build error
Browse files Browse the repository at this point in the history
Fix a Windows-only build error that was introduced in
commit 1183ba4 ("zlib: support concatenated gzip files").

Rename the NO_ERROR and FAILED enumerations, they conflict
with macros of the same name in <winerror.h>.

PR-URL: node-forward/node#57
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
bnoordhuis committed Nov 11, 2014
1 parent 355b96b commit be413ac
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/node_zlib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ enum node_zlib_mode {
};

enum node_zlib_error {
NO_ERROR,
FAILED,
WRITE_PENDING
kNoError,
kFailed,
kWritePending
};

void InitZlib(v8::Handle<v8::Object> target);
Expand Down Expand Up @@ -208,7 +208,7 @@ class ZCtx : public AsyncWrap {
if (!async) {
// sync version
Process(work_req);
if (CheckError(ctx) == NO_ERROR)
if (CheckError(ctx) == kNoError)
AfterSync(ctx, args);
return;
}
Expand Down Expand Up @@ -305,18 +305,18 @@ class ZCtx : public AsyncWrap {
ZCtx::Error(ctx, "Missing dictionary");
else
ZCtx::Error(ctx, "Bad dictionary");
return FAILED;
return kFailed;
default:
// something else.
if (ctx->strm_.total_out == 0) {
ZCtx::Error(ctx, "Zlib error");
return FAILED;
return kFailed;
} else {
return WRITE_PENDING;
return kWritePending;
}
}

return NO_ERROR;
return kNoError;
}


Expand All @@ -331,7 +331,7 @@ class ZCtx : public AsyncWrap {
Context::Scope context_scope(env->context());

node_zlib_error error = CheckError(ctx);
if (error == FAILED)
if (error == kFailed)
return;

Local<Integer> avail_out = Integer::New(env->isolate(),
Expand All @@ -345,7 +345,7 @@ class ZCtx : public AsyncWrap {
Local<Value> args[2] = { avail_in, avail_out };
ctx->MakeCallback(env->callback_string(), ARRAY_SIZE(args), args);

if (error == WRITE_PENDING) {
if (error == kWritePending) {
ZCtx::Error(ctx, "Zlib error");
return;
}
Expand Down

0 comments on commit be413ac

Please sign in to comment.