feature(zip) pako v0.2.5

This commit is contained in:
coderaiser 2014-10-28 12:12:21 -04:00
parent 4c9637ddc4
commit cc494e486f
12 changed files with 166 additions and 117 deletions

View file

@ -1,7 +1,6 @@
{
"name": "pako",
"main": "dist/pako.js",
"version": "0.2.0",
"homepage": "https://github.com/nodeca/pako",
"authors": [
"Andrei Tuputcyn <Andrew.Tupitsin@gmail.com>",
@ -26,14 +25,15 @@
"benchmark",
"coverage"
],
"_release": "0.2.0",
"version": "0.2.5",
"_release": "0.2.5",
"_resolution": {
"type": "version",
"tag": "0.2.0",
"commit": "e93c614f7ab3db2f9d39be66fa54e4b2c6fc08e0"
"tag": "0.2.5",
"commit": "eda5a97b543decd7e712534fa4cfcc88b85dc4ff"
},
"_source": "git://github.com/nodeca/pako.git",
"_target": "~0.2.0",
"_target": "~0.2.5",
"_originalSource": "pako",
"_direct": true
}

View file

@ -58,9 +58,9 @@ module.exports = function(grunt) {
all: {
options: {
urls: ['http://127.0.0.1:9999/test/browser/test.html'],
build: process.env.TRAVIS_JOB_ID || ('local' + ~~(Math.random()*1000)),
build: process.env.TRAVIS_JOB_NUMBER || ('local' + ~~(Math.random()*1000)),
browsers: browsers,
concurrency: 3,
throttled: 3,
testname: process.env.SAUCE_PROJ || 'mocha tests'
}
}

View file

@ -1,3 +1,33 @@
0.2.5 / 2014-07-19
------------------
- Workaround for Chrome 38.0.2096.0 script parser bug, #30
0.2.4 / 2014-07-07
------------------
- Fixed bug in inflate wrapper, #29
0.2.3 / 2014-06-09
------------------
- Maintenance release, dependencies update.
0.2.2 / 2014-06-04
------------------
- Fixed iOS 5.1 Safary issue with `apply(typed_array)`, #26.
0.2.1 / 2014-05-01
------------------
- Fixed collision on switch dynamic/fixed tables.
0.2.0 / 2014-04-18
------------------

View file

@ -1,7 +1,8 @@
pako - zlib port to javascript, very fast!
==========================================
[![Build Status](https://travis-ci.org/nodeca/pako.png?branch=master)](https://travis-ci.org/nodeca/pako)
[![Build Status](https://travis-ci.org/nodeca/pako.svg?branch=master)](https://travis-ci.org/nodeca/pako)
[![NPM version](https://img.shields.io/npm/v/pako.svg)](https://www.npmjs.org/package/pako)
__Why pako is cool:__
@ -19,7 +20,11 @@ __Famous projects, using pako:__
- [browserify](http://browserify.org/) (via [browserify-zlib](https://github.com/devongovett/browserify-zlib))
- [JSZip](http://stuk.github.io/jszip/)
- [mincer](https://github.com/nodeca/mincer)
- [JS-Git](https://github.com/creationix/js-git) and
[Tedit](https://chrome.google.com/webstore/detail/tedit-development-environ/ooekdijbnbbjdfjocaiflnjgoohnblgf)
by [@creatronix](https://github.com/creationix)
__Benchmarks:__

View file

@ -1,7 +1,6 @@
{
"name": "pako",
"main": "dist/pako.js",
"version": "0.2.0",
"homepage": "https://github.com/nodeca/pako",
"authors": [
"Andrei Tuputcyn <Andrew.Tupitsin@gmail.com>",

View file

@ -1,4 +1,4 @@
/* pako 0.2.0 nodeca/pako */!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.pako=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/* pako 0.2.5 nodeca/pako */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.pako=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
// Top level file is just a mixin of submodules & constants
'use strict';
@ -603,7 +603,7 @@ Inflate.prototype.push = function(data, mode) {
}
}
}
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
} while ((strm.avail_in > 0) && status !== c.Z_STREAM_END);
if (status === c.Z_STREAM_END) {
_mode = c.Z_FINISH;
@ -662,7 +662,7 @@ Inflate.prototype.onEnd = function(status) {
/**
* inflate(data[, options]) -> Uint8Array|Array|String
* - data (Uint8Array|Array|String): input data to compress.
* - data (Uint8Array|Array|String): input data to decompress.
* - options (Object): zlib inflate options.
*
* Decompress `data` with inflate/ungzip and `options`. Autodetect
@ -713,7 +713,7 @@ function inflate(input, options) {
/**
* inflateRaw(data[, options]) -> Uint8Array|Array|String
* - data (Uint8Array|Array|String): input data to compress.
* - data (Uint8Array|Array|String): input data to decompress.
* - options (Object): zlib inflate options.
*
* The same as [[inflate]], but creates raw data, without wrapper
@ -728,7 +728,7 @@ function inflateRaw(input, options) {
/**
* ungzip(data[, options]) -> Uint8Array|Array|String
* - data (Uint8Array|Array|String): input data to compress.
* - data (Uint8Array|Array|String): input data to decompress.
* - options (Object): zlib inflate options.
*
* Just shortcut to [[inflate]], because it autodetects format
@ -853,8 +853,15 @@ var utils = _dereq_('./common');
// Quick check if we can use fast array to bin string conversion
//
// - apply(Array) can fail on Android 2.2
// - apply(Uint8Array) can fail on iOS 5.1 Safary
//
var STR_APPLY_OK = true;
var STR_APPLY_UIA_OK = true;
try { String.fromCharCode.apply(null, [0]); } catch(__) { STR_APPLY_OK = false; }
try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPLY_UIA_OK = false; }
// Table with utf8 lengths (calculated by first byte of sequence)
@ -921,19 +928,26 @@ exports.string2buf = function (str) {
return buf;
};
// Convert byte array to binary string
exports.buf2binstring = function(buf) {
// Helper (used in 2 places)
function buf2binstring(buf, len) {
// use fallback for big arrays to avoid stack overflow
if (STR_APPLY_OK && buf.length < 65537) {
return String.fromCharCode.apply(null, buf);
if (len < 65537) {
if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
}
}
var result = '';
for(var i=0, len=buf.length; i < len; i++) {
for(var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
}
// Convert byte array to binary string
exports.buf2binstring = function(buf) {
return buf2binstring(buf, buf.length);
};
@ -949,7 +963,7 @@ exports.binstring2buf = function(str) {
// convert array to string
exports.buf2string = function (buf, max) {
var str, i, out, c, c_len;
var i, out, c, c_len;
var len = max || buf.length;
// Reserve max possible length (2 words per char)
@ -986,16 +1000,7 @@ exports.buf2string = function (buf, max) {
}
}
if (STR_APPLY_OK) {
return String.fromCharCode.apply(null, utils.shrinkBuf(utf16buf, out));
}
// Fallback, when String.fromCharCode.apply not available
str = '';
for (i=0, len=out; i<len; i++) {
str += String.fromCharCode(utf16buf[i]);
}
return str;
return buf2binstring(utf16buf, out);
};
@ -3371,7 +3376,7 @@ var SYNC = 32; /* looking for synchronization bytes to restart inflate()
var ENOUGH_LENS = 852;
var ENOUGH_DISTS = 592;
var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
var MAX_WBITS = 15;
/* 32K LZ77 window */
@ -3429,12 +3434,16 @@ function InflateState() {
this.have = 0; /* number of code lengths in lens[] */
this.next = null; /* next available space in codes[] */
//unsigned short array
//todo: test later with Uint16Array
this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
this.work = new utils.Buf16(288); /* work area for code table building */
this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
/*
because we don't have pointers in js, we use lencode and distcode directly
as buffers so we don't need codes
*/
//this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
this.distdyn = null; /* dynamic table for distance codes (JS specific) */
this.sane = 0; /* if false, allow invalid distance too far */
this.back = 0; /* bits back of last unprocessed length/lit */
this.was = 0; /* initial length of match */
@ -3458,8 +3467,8 @@ function inflateResetKeep(strm) {
state.hold = 0;
state.bits = 0;
//state.lencode = state.distcode = state.next = state.codes;
state.lencode = new utils.Buf32(ENOUGH);
state.distcode = new utils.Buf32(ENOUGH);
state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
state.sane = 1;
state.back = -1;
@ -4193,7 +4202,8 @@ function inflate(strm, flush) {
// We have separate tables & no pointers. 2 commented lines below not needed.
//state.next = state.codes;
//state.lencode = state.next;
utils.arraySet(state.lencode, state.codes, 0, state.codes.length, 0);
// Switch to use dynamic table
state.lencode = state.lendyn;
state.lenbits = 7;
opts = {bits: state.lenbits};
@ -4325,8 +4335,6 @@ function inflate(strm, flush) {
/* build code tables -- note: do not change the lenbits or distbits
values here (9 and 6) without reading the comments in inftrees.h
concerning the ENOUGH constants, which depend on those values */
//state.lencode.copy(state.codes);
utils.arraySet(state.lencode, state.codes, 0, state.codes.length, 0);
state.lenbits = 9;
opts = {bits: state.lenbits};
@ -4344,7 +4352,8 @@ function inflate(strm, flush) {
state.distbits = 6;
//state.distcode.copy(state.codes);
utils.arraySet(state.distcode, state.codes, 0, state.codes.length, 0);
// Switch to use dynamic table
state.distcode = state.distdyn;
opts = {bits: state.distbits};
ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
// We have separate tables & no pointers. 2 commented lines below not needed.
@ -4977,19 +4986,18 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
*/
/* set up for code type */
switch (type) {
case CODES:
// poor man optimization - use if-else instead of switch,
// to avoid deopts in old v8
if (type === CODES) {
base = extra = work; /* dummy value--not used */
end = 19;
break;
case LENS:
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
break;
default: /* DISTS */
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
@ -5054,7 +5062,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
/* go to next symbol, update count, len */
sym++;
if (--(count[len]) === 0) {
if (--count[len] === 0) {
if (len === max) { break; }
len = lens[lens_index + work[sym]];
}
@ -5110,6 +5118,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
opts.bits = root;
return 0;
};
},{"../utils/common":4}],14:[function(_dereq_,module,exports){
'use strict';

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
/* pako 0.2.0 nodeca/pako */!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.pako=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/* pako 0.2.5 nodeca/pako */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.pako=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
'use strict';
@ -472,8 +472,15 @@ var utils = _dereq_('./common');
// Quick check if we can use fast array to bin string conversion
//
// - apply(Array) can fail on Android 2.2
// - apply(Uint8Array) can fail on iOS 5.1 Safary
//
var STR_APPLY_OK = true;
var STR_APPLY_UIA_OK = true;
try { String.fromCharCode.apply(null, [0]); } catch(__) { STR_APPLY_OK = false; }
try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPLY_UIA_OK = false; }
// Table with utf8 lengths (calculated by first byte of sequence)
@ -540,19 +547,26 @@ exports.string2buf = function (str) {
return buf;
};
// Convert byte array to binary string
exports.buf2binstring = function(buf) {
// Helper (used in 2 places)
function buf2binstring(buf, len) {
// use fallback for big arrays to avoid stack overflow
if (STR_APPLY_OK && buf.length < 65537) {
return String.fromCharCode.apply(null, buf);
if (len < 65537) {
if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
}
}
var result = '';
for(var i=0, len=buf.length; i < len; i++) {
for(var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
}
// Convert byte array to binary string
exports.buf2binstring = function(buf) {
return buf2binstring(buf, buf.length);
};
@ -568,7 +582,7 @@ exports.binstring2buf = function(str) {
// convert array to string
exports.buf2string = function (buf, max) {
var str, i, out, c, c_len;
var i, out, c, c_len;
var len = max || buf.length;
// Reserve max possible length (2 words per char)
@ -605,16 +619,7 @@ exports.buf2string = function (buf, max) {
}
}
if (STR_APPLY_OK) {
return String.fromCharCode.apply(null, utils.shrinkBuf(utf16buf, out));
}
// Fallback, when String.fromCharCode.apply not available
str = '';
for (i=0, len=out; i<len; i++) {
str += String.fromCharCode(utf16buf[i]);
}
return str;
return buf2binstring(utf16buf, out);
};

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
/* pako 0.2.0 nodeca/pako */!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.pako=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/* pako 0.2.5 nodeca/pako */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.pako=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
'use strict';
@ -226,7 +226,7 @@ Inflate.prototype.push = function(data, mode) {
}
}
}
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
} while ((strm.avail_in > 0) && status !== c.Z_STREAM_END);
if (status === c.Z_STREAM_END) {
_mode = c.Z_FINISH;
@ -285,7 +285,7 @@ Inflate.prototype.onEnd = function(status) {
/**
* inflate(data[, options]) -> Uint8Array|Array|String
* - data (Uint8Array|Array|String): input data to compress.
* - data (Uint8Array|Array|String): input data to decompress.
* - options (Object): zlib inflate options.
*
* Decompress `data` with inflate/ungzip and `options`. Autodetect
@ -336,7 +336,7 @@ function inflate(input, options) {
/**
* inflateRaw(data[, options]) -> Uint8Array|Array|String
* - data (Uint8Array|Array|String): input data to compress.
* - data (Uint8Array|Array|String): input data to decompress.
* - options (Object): zlib inflate options.
*
* The same as [[inflate]], but creates raw data, without wrapper
@ -351,7 +351,7 @@ function inflateRaw(input, options) {
/**
* ungzip(data[, options]) -> Uint8Array|Array|String
* - data (Uint8Array|Array|String): input data to compress.
* - data (Uint8Array|Array|String): input data to decompress.
* - options (Object): zlib inflate options.
*
* Just shortcut to [[inflate]], because it autodetects format
@ -476,8 +476,15 @@ var utils = _dereq_('./common');
// Quick check if we can use fast array to bin string conversion
//
// - apply(Array) can fail on Android 2.2
// - apply(Uint8Array) can fail on iOS 5.1 Safary
//
var STR_APPLY_OK = true;
var STR_APPLY_UIA_OK = true;
try { String.fromCharCode.apply(null, [0]); } catch(__) { STR_APPLY_OK = false; }
try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPLY_UIA_OK = false; }
// Table with utf8 lengths (calculated by first byte of sequence)
@ -544,19 +551,26 @@ exports.string2buf = function (str) {
return buf;
};
// Convert byte array to binary string
exports.buf2binstring = function(buf) {
// Helper (used in 2 places)
function buf2binstring(buf, len) {
// use fallback for big arrays to avoid stack overflow
if (STR_APPLY_OK && buf.length < 65537) {
return String.fromCharCode.apply(null, buf);
if (len < 65537) {
if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {
return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
}
}
var result = '';
for(var i=0, len=buf.length; i < len; i++) {
for(var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
}
// Convert byte array to binary string
exports.buf2binstring = function(buf) {
return buf2binstring(buf, buf.length);
};
@ -572,7 +586,7 @@ exports.binstring2buf = function(str) {
// convert array to string
exports.buf2string = function (buf, max) {
var str, i, out, c, c_len;
var i, out, c, c_len;
var len = max || buf.length;
// Reserve max possible length (2 words per char)
@ -609,16 +623,7 @@ exports.buf2string = function (buf, max) {
}
}
if (STR_APPLY_OK) {
return String.fromCharCode.apply(null, utils.shrinkBuf(utf16buf, out));
}
// Fallback, when String.fromCharCode.apply not available
str = '';
for (i=0, len=out; i<len; i++) {
str += String.fromCharCode(utf16buf[i]);
}
return str;
return buf2binstring(utf16buf, out);
};
@ -1228,7 +1233,7 @@ var SYNC = 32; /* looking for synchronization bytes to restart inflate()
var ENOUGH_LENS = 852;
var ENOUGH_DISTS = 592;
var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
var MAX_WBITS = 15;
/* 32K LZ77 window */
@ -1286,12 +1291,16 @@ function InflateState() {
this.have = 0; /* number of code lengths in lens[] */
this.next = null; /* next available space in codes[] */
//unsigned short array
//todo: test later with Uint16Array
this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
this.work = new utils.Buf16(288); /* work area for code table building */
this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
/*
because we don't have pointers in js, we use lencode and distcode directly
as buffers so we don't need codes
*/
//this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
this.distdyn = null; /* dynamic table for distance codes (JS specific) */
this.sane = 0; /* if false, allow invalid distance too far */
this.back = 0; /* bits back of last unprocessed length/lit */
this.was = 0; /* initial length of match */
@ -1315,8 +1324,8 @@ function inflateResetKeep(strm) {
state.hold = 0;
state.bits = 0;
//state.lencode = state.distcode = state.next = state.codes;
state.lencode = new utils.Buf32(ENOUGH);
state.distcode = new utils.Buf32(ENOUGH);
state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
state.sane = 1;
state.back = -1;
@ -2050,7 +2059,8 @@ function inflate(strm, flush) {
// We have separate tables & no pointers. 2 commented lines below not needed.
//state.next = state.codes;
//state.lencode = state.next;
utils.arraySet(state.lencode, state.codes, 0, state.codes.length, 0);
// Switch to use dynamic table
state.lencode = state.lendyn;
state.lenbits = 7;
opts = {bits: state.lenbits};
@ -2182,8 +2192,6 @@ function inflate(strm, flush) {
/* build code tables -- note: do not change the lenbits or distbits
values here (9 and 6) without reading the comments in inftrees.h
concerning the ENOUGH constants, which depend on those values */
//state.lencode.copy(state.codes);
utils.arraySet(state.lencode, state.codes, 0, state.codes.length, 0);
state.lenbits = 9;
opts = {bits: state.lenbits};
@ -2201,7 +2209,8 @@ function inflate(strm, flush) {
state.distbits = 6;
//state.distcode.copy(state.codes);
utils.arraySet(state.distcode, state.codes, 0, state.codes.length, 0);
// Switch to use dynamic table
state.distcode = state.distdyn;
opts = {bits: state.distbits};
ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
// We have separate tables & no pointers. 2 commented lines below not needed.
@ -2834,19 +2843,18 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
*/
/* set up for code type */
switch (type) {
case CODES:
// poor man optimization - use if-else instead of switch,
// to avoid deopts in old v8
if (type === CODES) {
base = extra = work; /* dummy value--not used */
end = 19;
break;
case LENS:
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
break;
default: /* DISTS */
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
@ -2911,7 +2919,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
/* go to next symbol, update count, len */
sym++;
if (--(count[len]) === 0) {
if (--count[len] === 0) {
if (len === max) { break; }
len = lens[lens_index + work[sym]];
}
@ -2967,6 +2975,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
opts.bits = root;
return 0;
};
},{"../utils/common":2}],11:[function(_dereq_,module,exports){
'use strict';

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
{
"name" : "pako",
"description" : "zlib port to javascript - fast, modularized, with browser support",
"version" : "0.2.0",
"version" : "0.2.5",
"keywords" : [ "zlib", "deflate", "inflate", "gzip" ],
"homepage" : "https://github.com/nodeca/pako",
@ -16,7 +16,6 @@
"devDependencies" : {
"mocha": "*",
"chai": "*",
"benchmark": "*",
"ansi": "*",
"browserify":"*",
@ -24,12 +23,12 @@
"jshint": "*",
"istanbul": "*",
"ndoc": "*",
"lodash": "2.4.1",
"async": "0.2.10",
"lodash": "*",
"async": "*",
"grunt": "~0.4.4",
"grunt-cli": "~0.1.13",
"grunt-saucelabs": "~5.1.1",
"grunt-saucelabs": "~8.0.2",
"grunt-contrib-connect": "~0.7.1"
}
}