zlib: lint

v0.7.4-release
isaacs 2011-09-17 23:03:36 -07:00
parent d104bfd5a6
commit f90264d246
1 changed files with 35 additions and 15 deletions

View File

@ -59,13 +59,33 @@ exports.DeflateRaw = DeflateRaw;
exports.InflateRaw = InflateRaw;
exports.Unzip = Unzip;
exports.createDeflate = function (o) { return new Deflate(o); };
exports.createInflate = function (o) { return new Inflate(o); };
exports.createDeflateRaw = function (o) { return new DeflateRaw(o); };
exports.createInflateRaw = function (o) { return new InflateRaw(o); };
exports.createGzip = function (o) { return new Gzip(o); };
exports.createGunzip = function (o) { return new Gunzip(o); };
exports.createUnzip = function (o) { return new Unzip(o); };
exports.createDeflate = function(o) {
return new Deflate(o);
};
exports.createInflate = function(o) {
return new Inflate(o);
};
exports.createDeflateRaw = function(o) {
return new DeflateRaw(o);
};
exports.createInflateRaw = function(o) {
return new InflateRaw(o);
};
exports.createGzip = function(o) {
return new Gzip(o);
};
exports.createGunzip = function(o) {
return new Gunzip(o);
};
exports.createUnzip = function(o) {
return new Unzip(o);
};
@ -132,28 +152,28 @@ function Zlib(opts, Binding) {
if (opts.chunkSize) {
if (opts.chunkSize < exports.Z_MIN_CHUNK ||
opts.chunkSize > exports.Z_MAX_CHUNK) {
throw new Error("Invalid chunk size: "+opts.chunkSize);
throw new Error('Invalid chunk size: ' + opts.chunkSize);
}
}
if (opts.windowBits) {
if (opts.windowBits < exports.Z_MIN_WINDOWBITS ||
opts.windowBits > exports.Z_MAX_WINDOWBITS) {
throw new Error("Invalid windowBits: "+opts.windowBits);
throw new Error('Invalid windowBits: ' + opts.windowBits);
}
}
if (opts.level) {
if (opts.level < exports.Z_MIN_LEVEL ||
opts.level > exports.Z_MAX_LEVEL) {
throw new Error("Invalid compression level: "+opts.level);
throw new Error('Invalid compression level: ' + opts.level);
}
}
if (opts.memLevel) {
if (opts.memLevel < exports.Z_MIN_MEMLEVEL ||
opts.memLevel > exports.Z_MAX_MEMLEVEL) {
throw new Error("Invalid memLevel: "+opts.memLevel);
throw new Error('Invalid memLevel: ' + opts.memLevel);
}
}
@ -163,15 +183,15 @@ function Zlib(opts, Binding) {
opts.strategy != exports.Z_RLE &&
opts.strategy != exports.Z_FIXED &&
opts.strategy != exports.Z_DEFAULT_STRATEGY) {
throw new Error("Invalid strategy: "+opts.strategy);
throw new Error('Invalid strategy: ' + opts.strategy);
}
}
this._binding = new Binding();
this._binding.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS,
opts.level || exports.Z_DEFAULT_COMPRESSION,
opts.memLevel || exports.Z_DEFAULT_MEMLEVEL,
opts.strategy || exports.Z_DEFAULT_STRATEGY);
opts.level || exports.Z_DEFAULT_COMPRESSION,
opts.memLevel || exports.Z_DEFAULT_MEMLEVEL,
opts.strategy || exports.Z_DEFAULT_STRATEGY);
this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK;
this._buffer = new Buffer(this._chunkSize);