diff --git a/src/node_constants.cc b/src/node_constants.cc index b6c7bf37a3ad86..753b8f8fe16602 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -1241,69 +1241,6 @@ void DefineCryptoConstants(Local target) { NODE_DEFINE_CONSTANT(target, INT_MAX); } -void DefineZlibConstants(Local target) { - NODE_DEFINE_CONSTANT(target, Z_NO_FLUSH); - NODE_DEFINE_CONSTANT(target, Z_PARTIAL_FLUSH); - NODE_DEFINE_CONSTANT(target, Z_SYNC_FLUSH); - NODE_DEFINE_CONSTANT(target, Z_FULL_FLUSH); - NODE_DEFINE_CONSTANT(target, Z_FINISH); - NODE_DEFINE_CONSTANT(target, Z_BLOCK); - - // return/error codes - NODE_DEFINE_CONSTANT(target, Z_OK); - NODE_DEFINE_CONSTANT(target, Z_STREAM_END); - NODE_DEFINE_CONSTANT(target, Z_NEED_DICT); - NODE_DEFINE_CONSTANT(target, Z_ERRNO); - NODE_DEFINE_CONSTANT(target, Z_STREAM_ERROR); - NODE_DEFINE_CONSTANT(target, Z_DATA_ERROR); - NODE_DEFINE_CONSTANT(target, Z_MEM_ERROR); - NODE_DEFINE_CONSTANT(target, Z_BUF_ERROR); - NODE_DEFINE_CONSTANT(target, Z_VERSION_ERROR); - - NODE_DEFINE_CONSTANT(target, Z_NO_COMPRESSION); - NODE_DEFINE_CONSTANT(target, Z_BEST_SPEED); - NODE_DEFINE_CONSTANT(target, Z_BEST_COMPRESSION); - NODE_DEFINE_CONSTANT(target, Z_DEFAULT_COMPRESSION); - NODE_DEFINE_CONSTANT(target, Z_FILTERED); - NODE_DEFINE_CONSTANT(target, Z_HUFFMAN_ONLY); - NODE_DEFINE_CONSTANT(target, Z_RLE); - NODE_DEFINE_CONSTANT(target, Z_FIXED); - NODE_DEFINE_CONSTANT(target, Z_DEFAULT_STRATEGY); - NODE_DEFINE_CONSTANT(target, ZLIB_VERNUM); - - enum node_zlib_mode { - NONE, - DEFLATE, - INFLATE, - GZIP, - GUNZIP, - DEFLATERAW, - INFLATERAW, - UNZIP - }; - - NODE_DEFINE_CONSTANT(target, DEFLATE); - NODE_DEFINE_CONSTANT(target, INFLATE); - NODE_DEFINE_CONSTANT(target, GZIP); - NODE_DEFINE_CONSTANT(target, GUNZIP); - NODE_DEFINE_CONSTANT(target, DEFLATERAW); - NODE_DEFINE_CONSTANT(target, INFLATERAW); - NODE_DEFINE_CONSTANT(target, UNZIP); - - NODE_DEFINE_CONSTANT(target, Z_MIN_WINDOWBITS); - NODE_DEFINE_CONSTANT(target, Z_MAX_WINDOWBITS); - NODE_DEFINE_CONSTANT(target, Z_DEFAULT_WINDOWBITS); - NODE_DEFINE_CONSTANT(target, Z_MIN_CHUNK); - NODE_DEFINE_CONSTANT(target, Z_MAX_CHUNK); - NODE_DEFINE_CONSTANT(target, Z_DEFAULT_CHUNK); - NODE_DEFINE_CONSTANT(target, Z_MIN_MEMLEVEL); - NODE_DEFINE_CONSTANT(target, Z_MAX_MEMLEVEL); - NODE_DEFINE_CONSTANT(target, Z_DEFAULT_MEMLEVEL); - NODE_DEFINE_CONSTANT(target, Z_MIN_LEVEL); - NODE_DEFINE_CONSTANT(target, Z_MAX_LEVEL); - NODE_DEFINE_CONSTANT(target, Z_DEFAULT_LEVEL); -} - void DefineDLOpenConstants(Local target) { #ifdef RTLD_LAZY NODE_DEFINE_CONSTANT(target, RTLD_LAZY); diff --git a/src/node_internals.h b/src/node_internals.h index 9a34825b1e6df0..0c0b2e317620ce 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -936,6 +936,8 @@ void GetEGid(const v8::FunctionCallbackInfo& args); void GetGroups(const v8::FunctionCallbackInfo& args); #endif // __POSIX__ && !defined(__ANDROID__) && !defined(__CloudABI__) +void DefineZlibConstants(v8::Local target); + } // namespace node void napi_module_register_by_symbol(v8::Local exports, diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 288fbd7bcc9bcf..d0cc54c9436582 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -773,6 +773,59 @@ void Initialize(Local target, } } // anonymous namespace + +void DefineZlibConstants(Local target) { + NODE_DEFINE_CONSTANT(target, Z_NO_FLUSH); + NODE_DEFINE_CONSTANT(target, Z_PARTIAL_FLUSH); + NODE_DEFINE_CONSTANT(target, Z_SYNC_FLUSH); + NODE_DEFINE_CONSTANT(target, Z_FULL_FLUSH); + NODE_DEFINE_CONSTANT(target, Z_FINISH); + NODE_DEFINE_CONSTANT(target, Z_BLOCK); + + // return/error codes + NODE_DEFINE_CONSTANT(target, Z_OK); + NODE_DEFINE_CONSTANT(target, Z_STREAM_END); + NODE_DEFINE_CONSTANT(target, Z_NEED_DICT); + NODE_DEFINE_CONSTANT(target, Z_ERRNO); + NODE_DEFINE_CONSTANT(target, Z_STREAM_ERROR); + NODE_DEFINE_CONSTANT(target, Z_DATA_ERROR); + NODE_DEFINE_CONSTANT(target, Z_MEM_ERROR); + NODE_DEFINE_CONSTANT(target, Z_BUF_ERROR); + NODE_DEFINE_CONSTANT(target, Z_VERSION_ERROR); + + NODE_DEFINE_CONSTANT(target, Z_NO_COMPRESSION); + NODE_DEFINE_CONSTANT(target, Z_BEST_SPEED); + NODE_DEFINE_CONSTANT(target, Z_BEST_COMPRESSION); + NODE_DEFINE_CONSTANT(target, Z_DEFAULT_COMPRESSION); + NODE_DEFINE_CONSTANT(target, Z_FILTERED); + NODE_DEFINE_CONSTANT(target, Z_HUFFMAN_ONLY); + NODE_DEFINE_CONSTANT(target, Z_RLE); + NODE_DEFINE_CONSTANT(target, Z_FIXED); + NODE_DEFINE_CONSTANT(target, Z_DEFAULT_STRATEGY); + NODE_DEFINE_CONSTANT(target, ZLIB_VERNUM); + + NODE_DEFINE_CONSTANT(target, DEFLATE); + NODE_DEFINE_CONSTANT(target, INFLATE); + NODE_DEFINE_CONSTANT(target, GZIP); + NODE_DEFINE_CONSTANT(target, GUNZIP); + NODE_DEFINE_CONSTANT(target, DEFLATERAW); + NODE_DEFINE_CONSTANT(target, INFLATERAW); + NODE_DEFINE_CONSTANT(target, UNZIP); + + NODE_DEFINE_CONSTANT(target, Z_MIN_WINDOWBITS); + NODE_DEFINE_CONSTANT(target, Z_MAX_WINDOWBITS); + NODE_DEFINE_CONSTANT(target, Z_DEFAULT_WINDOWBITS); + NODE_DEFINE_CONSTANT(target, Z_MIN_CHUNK); + NODE_DEFINE_CONSTANT(target, Z_MAX_CHUNK); + NODE_DEFINE_CONSTANT(target, Z_DEFAULT_CHUNK); + NODE_DEFINE_CONSTANT(target, Z_MIN_MEMLEVEL); + NODE_DEFINE_CONSTANT(target, Z_MAX_MEMLEVEL); + NODE_DEFINE_CONSTANT(target, Z_DEFAULT_MEMLEVEL); + NODE_DEFINE_CONSTANT(target, Z_MIN_LEVEL); + NODE_DEFINE_CONSTANT(target, Z_MAX_LEVEL); + NODE_DEFINE_CONSTANT(target, Z_DEFAULT_LEVEL); +} + } // namespace node NODE_BUILTIN_MODULE_CONTEXT_AWARE(zlib, node::Initialize)