Porównaj commity

...

16 Commity

Autor SHA1 Wiadomość Data
Vitaly Puzrin 08c5cfb4fe 0.2.8 released 2015-09-14 15:16:43 +03:00
Vitaly Puzrin 26ebc2d048 Browser files rebuild 2015-09-14 15:16:17 +03:00
Vitaly Puzrin 5f728b177d code/comments cleanup 2015-09-14 15:01:53 +03:00
nik 2c504a0865 fix inflate wrapper check condition, issue #65 2015-09-14 14:46:53 +03:00
Vitaly Puzrin 2bef4935c7 rename window -> s_window, close #60 2015-09-13 14:23:40 +03:00
Vitaly Puzrin 3d02fb105c Added IE6 testing 2015-09-13 03:23:03 +03:00
Vitaly Puzrin 705b072edf Increased timeouts to pass IE 7/8 tests 2015-09-13 03:06:04 +03:00
Vitaly Puzrin 6fa3101b48 Pinned mocha version for compatibility with old IEs 2015-09-13 02:57:37 +03:00
Vitaly Puzrin 8070869d8c 0.2.7 released 2015-06-09 22:57:26 +03:00
Vitaly Puzrin 54a8b34cd9 Browser files rebuild 2015-06-09 22:56:43 +03:00
Vitaly Puzrin e77b84ea95 Merge pull request #57 from TinoLange/flushfix
Patch: pako and Z_SYNC_FLUSH
2015-06-09 22:53:23 +03:00
Tino Lange 0d64e15c82 - high-level wrapper: add documentation for recently introduced Z_SYNC_FLUSH 2015-06-09 21:07:48 +02:00
Tino Lange a75010e2cc - high-level wrapper: make {in,de}flate.push(data, Z_SYNC_FLUSH) working
(will fix issue #34)
2015-06-09 20:38:12 +02:00
Vitaly Puzrin ddaf928aec Typo fix, closes #52 2015-04-13 17:39:20 +03:00
Vitaly Puzrin cf7da48212 Use docker container for travis tests 2015-03-24 05:31:47 +03:00
Vitaly Puzrin cff11fc91b Replaced jshint with eslint & updated CS 2015-03-24 05:28:20 +03:00
43 zmienionych plików z 527 dodań i 291 usunięć

7
.eslintignore 100644
Wyświetl plik

@ -0,0 +1,7 @@
coverage/
demo/
dist/
node_modules
support/demo_template/sample.js
benchmark/implementations/
test/browser

118
.eslintrc 100644
Wyświetl plik

@ -0,0 +1,118 @@
env:
node: true
browser: false
plugins:
- nodeca
rules:
# block-scoped-var: 2
# brace-style: [ 2, '1tbs', { allowSingleLine: true } ]
# comma-spacing: 2
comma-style: 2
consistent-this: [ 2, self ]
consistent-return: 2
curly: 2
# default-case: 2
dot-notation: 2
eol-last: 2
eqeqeq: 2
# guard-for-in: 2
handle-callback-err: 2
# max-depth: [ 1, 6 ]
max-nested-callbacks: [ 1, 4 ]
# string can exceed 80 chars, but should not overflow github website :)
# max-len: [ 2, 120, 1000 ]
# new-cap: 2
new-parens: 2
no-alert: 2
no-array-constructor: 2
# no-bitwise: 2
no-caller: 2
no-catch-shadow: 2
no-comma-dangle: 2
no-cond-assign: 2
# no-console: 1
no-constant-condition: 2
no-control-regex: 2
no-debugger: 2
no-delete-var: 2
no-dupe-keys: 2
no-div-regex: 2
# no-empty: 2
no-empty-class: 2
no-empty-label: 2
no-else-return: 2
no-eq-null: 2
no-ex-assign: 2
no-extend-native: 2
no-extra-bind: 2
no-extra-boolean-cast: 2
no-extra-semi: 2
no-extra-strict: 2
no-eval: 2
no-floating-decimal: 2
no-func-assign: 2
no-implied-eval: 2
no-inner-declarations: 2
no-invalid-regexp: 2
no-irregular-whitespace: 2
no-label-var: 2
# no-labels: 2
no-lone-blocks: 2
no-lonely-if: 2
no-loop-func: 2
no-mixed-requires: 2
no-mixed-spaces-and-tabs: 2
no-multi-str: 2
no-native-reassign: 2
no-negated-in-lhs: 2
no-new: 2
no-new-func: 2
no-new-object: 2
no-new-require: 2
no-new-wrappers: 2
no-obj-calls: 2
no-octal: 2
no-octal-escape: 2
no-path-concat: 2
no-redeclare: 2
no-regex-spaces: 2
no-reserved-keys: 2
no-return-assign: 2
no-script-url: 2
no-sequences: 2
no-shadow: 2
no-shadow-restricted-names: 2
# no-space-before-semi: 2
no-sparse-arrays: 2
no-trailing-spaces: 2
no-undef: 2
no-undef-init: 2
no-undefined: 2
no-unreachable: 2
no-unused-expressions: 2
no-unused-vars: 2
no-use-before-define: 2
no-with: 2
no-wrap-func: 2
quotes: [ 2, single, avoid-escape ]
radix: 2
semi: 2
space-after-keywords: [ 2, always, , { "checkFunctionKeyword": true } ]
space-before-blocks: 2
# space-in-brackets: [ 2, always, { propertyName: false } ]
space-in-parens: [ 2, never ]
# space-infix-ops: 2
space-return-throw-case: 2
space-unary-ops: 2
# spaced-line-comment: [ 2, always, { exceptions: [ '/' ] } ]
strict: 2
use-isnan: 2
yoda: 2
valid-typeof: 2
#
# Our custom rules
#
nodeca/indent: [ 2, spaces, 2 ]

Wyświetl plik

@ -1,6 +0,0 @@
.git/
node_modules/
benchmark/implementations
coverage/
dist/
test/browser/pako.js

Wyświetl plik

@ -1,78 +0,0 @@
{
// Enforcing Options /////////////////////////////////////////////////////////
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"indent" : 2, // Specify indentation spacing
"latedef" : true, // Prohibit hariable use before definition.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"plusplus" : false, // Prohibit use of `++` & `--`.
"quotmark" : "single", // Quotation mark consistency:
// false : do nothing (default)
// true : ensure whatever is used is consistent
// "single" : require single quotes
// "double" : require double quotes
"undef" : true, // Require all non-global variables be declared before they are used.
"unused" : true, // Warns when you define and never use your variables
"strict" : true, // Require `use strict` pragma in every file.
"trailing" : true, // Prohibit trailing whitespaces.
// Relaxing Options //////////////////////////////////////////////////////////
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"eqnull" : false, // Tolerate use of `== null`.
//"es5" : true, // Allow ECMAScript 5 syntax.
"esnext" : false, // Allow ES.next specific features such as const and let
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"funcscope" : false, // Tolerate declaring variables inside of control structures while accessing them later
"globalstrict" : true, // Allow global "use strict" (also enables 'strict').
"iterator" : false, // Allow usage of __iterator__ property.
"lastsemic" : false, // Tolerate semicolon omited for the last statement.
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"laxcomma" : true, // This option suppresses warnings about comma-first coding style
"loopfunc" : false, // Allow functions to be defined within loops.
"multistr" : false, // Tolerate multi-line strings.
"proto" : false, // Allow usage of __proto__ property.
"scripturl" : false, // Tolerate script-targeted URLs.
"smarttabs" : false, // Allow mixed tabs and spaces when the latter are used for alignmnent only.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"validthis" : false, // true: Tolerate using this in a non-constructor function
// Environments //////////////////////////////////////////////////////////////
"browser" : false, // Defines globals exposed by modern browsers
"couch" : false, // Defines globals exposed by CouchDB
"devel" : false, // Allow developments statements e.g. `console.log();`.
"dojo" : false, // Defines globals exposed by the Dojo Toolkit
"jquery" : false, // Defines globals exposed by the jQuery
"mootools" : false, // Defines globals exposed by the MooTools
"node" : true, // Defines globals exposed when running under Node.JS
"nonstandard" : false, // Defines non-standard but widely adopted globals such as escape and unescape
"prototypejs" : false, // Defines globals exposed by the Prototype
"rhino" : false, // Defines globals exposed when running under Rhino
"wsh" : false, // Defines globals exposed when running under WSH
"yui" : false, // Yahoo User Interface
// Legacy ////////////////////////////////////////////////////////////////////
"nomen" : false, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"passfail" : false, // Stop on first error.
"white" : false, // Check against strict whitespace and indentation rules.
// Custom globals ///////////////////////////////////////////////////////////
"globals" : { }
}

Wyświetl plik

@ -1,7 +1,6 @@
language: node_js
node_js:
- "0.10"
before_script: "npm install"
script: make $COMMAND
env:
matrix:
@ -10,3 +9,4 @@ env:
global:
- secure: FsU9623CV4X1G3WHvq2H0XHjDYxvfSMdWdKrAuTSZB9TsJlQ0UAIKbHNBzxSBo6/1xv1ZYyuPZvJnrkHAqNOVGYr0MiIINPt0jDmM3anl03lbaVwwpWcwxgslFGbfVufKKKrYAPF0UDS6uNeZtYP4fs2xlao7F9BaanpARiK5TY=
- secure: PZeRlTvq67EBo1yXthMK2bKeCn5fVA3qCtFZ0m38XZDi8cj6wfXaLGoELrrtSNGFhZt2xU0DLQ+w0y2vC+gTOzWqbAw1Cedri97c514oX+QFvDqRKCbrKkGR9DHW6jUxOL1YrSfto21+CEsZEcQsYBTYFwnAKxmT3UIXCCgU+JI=
sudo: false

Wyświetl plik

@ -30,7 +30,7 @@ module.exports = function(grunt) {
browserName: 'internet explorer',
platform: 'WIN7',
version: '9'
}, {/*
}, {
browserName: 'internet explorer',
platform: 'WIN7',
version: '8'
@ -38,7 +38,11 @@ module.exports = function(grunt) {
browserName: 'internet explorer',
platform: 'XP',
version: '7'
}, {*/
}, {
browserName: 'internet explorer',
platform: 'XP',
version: '6'
}, {
browserName: 'safari',
platform: 'OS X 10.8',
version: '6'

Wyświetl plik

@ -1,3 +1,16 @@
0.2.8 / 2015-09-14
------------------
- Fixed regression after 0.2.4 for edge conditions in inflate wrapper (#65).
Added more tests to cover possible cases.
0.2.7 / 2015-06-09
------------------
- Added Z_SYNC_FLUSH support. Thanks to @TinoLange.
0.2.6 / 2015-03-24
------------------

Wyświetl plik

@ -1,6 +1,6 @@
(The MIT License)
Copyright (C) 2014 by Vitaly Puzrin
Copyright (C) 2014-2015 by Vitaly Puzrin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

Wyświetl plik

@ -23,7 +23,7 @@ help:
lint:
jshint . --show-non-errors
eslint --reset .
test: lint

Wyświetl plik

@ -100,7 +100,7 @@ var compressed = new Uint8Array();
//... fill data to uncompress here
try {
var result = pako.inflate(compressed);
catch (err) {
} catch (err) {
console.log(err);
}
@ -160,9 +160,13 @@ Authors
- Andrey Tupitsin [@anrd83](https://github.com/andr83)
- Vitaly Puzrin [@puzrin](https://github.com/puzrin)
Personal thanks to Vyacheslav Egorov ([@mraleph](https://github.com/mraleph))
for his awesome tutoruals about optimising JS code for v8,
[IRHydra](http://mrale.ph/irhydra/) tool and his advices.
Personal thanks to:
- Vyacheslav Egorov ([@mraleph](https://github.com/mraleph)) for his awesome
tutoruals about optimising JS code for v8, [IRHydra](http://mrale.ph/irhydra/)
tool and his advices.
- David Duponchel ([@dduponchel](https://github.com/dduponchel)) for help with
testing.
License

Wyświetl plik

@ -20,8 +20,8 @@ var IMPLS = [];
fs.readdirSync(IMPLS_DIRECTORY).sort().forEach(function (name) {
var file = path.join(IMPLS_DIRECTORY, name),
code = require(file);
var file = path.join(IMPLS_DIRECTORY, name);
var code = require(file);
IMPLS_PATHS[name] = file;
IMPLS.push({
@ -85,7 +85,7 @@ fs.readdirSync(SAMPLES_DIRECTORY).sort().forEach(function (sample) {
defer: !!impl.code.async,
fn: function (deferred) {
if (!!impl.code.async) {
if (impl.code.async) {
impl.code.run(content, LEVEL, function() {
deferred.resolve();
return;

Wyświetl plik

@ -1,9 +1,10 @@
'use strict';
var fs = require('fs');
var path = require('path');
var pako = require('../index.js');
var data = new Uint8Array(fs.readFileSync(__dirname +'/samples/lorem_1mb.txt'));
var data = new Uint8Array(fs.readFileSync(path.join(__dirname, '/samples/lorem_1mb.txt')));
var deflated = pako.deflate(data, { level: 6/*, to: 'string'*/ });

158
dist/pako.js vendored
Wyświetl plik

@ -1,4 +1,4 @@
/* pako 0.2.6 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
/* pako 0.2.8 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
'use strict';
@ -18,6 +18,7 @@ var Z_FINISH = 4;
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_SYNC_FLUSH = 2;
var Z_DEFAULT_COMPRESSION = -1;
@ -47,7 +48,9 @@ var Z_DEFLATED = 8;
*
* Compressed result, generated by default [[Deflate#onData]]
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Deflate#push]] with `Z_FINISH` / `true` param).
* (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Deflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -171,8 +174,9 @@ var Deflate = function(options) {
*
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
* new compressed chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Deflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the compression context.
*
* On fail call [[Deflate#onEnd]] with error code and return false.
*
@ -225,7 +229,7 @@ Deflate.prototype.push = function(data, mode) {
this.ended = true;
return false;
}
if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
} else {
@ -242,6 +246,13 @@ Deflate.prototype.push = function(data, mode) {
return status === Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === Z_SYNC_FLUSH) {
this.onEnd(Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -265,8 +276,9 @@ Deflate.prototype.onData = function(chunk) {
* - status (Number): deflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell deflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called once after you tell deflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Deflate.prototype.onEnd = function(status) {
@ -363,6 +375,7 @@ exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;
},{"./utils/common":3,"./utils/strings":4,"./zlib/deflate.js":8,"./zlib/messages":13,"./zlib/zstream":15}],2:[function(require,module,exports){
'use strict';
@ -396,7 +409,9 @@ var toString = Object.prototype.toString;
*
* Uncompressed result, generated by default [[Inflate#onData]]
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Inflate#push]] with `Z_FINISH` / `true` param).
* (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Inflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -516,8 +531,9 @@ var Inflate = function(options) {
*
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
* new output chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Inflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the decompression context.
*
* On fail call [[Inflate#onEnd]] with error code and return false.
*
@ -541,6 +557,10 @@ Inflate.prototype.push = function(data, mode) {
var status, _mode;
var next_out_utf8, tail, utf8str;
// Flag to properly process Z_BUF_ERROR on testing inflate call
// when we check that all output data was flushed.
var allowBufError = false;
if (this.ended) { return false; }
_mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
@ -566,6 +586,11 @@ Inflate.prototype.push = function(data, mode) {
status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */
if (status === c.Z_BUF_ERROR && allowBufError === true) {
status = c.Z_OK;
allowBufError = false;
}
if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
this.onEnd(status);
this.ended = true;
@ -573,7 +598,7 @@ Inflate.prototype.push = function(data, mode) {
}
if (strm.next_out) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && _mode === c.Z_FINISH)) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
@ -594,11 +619,24 @@ Inflate.prototype.push = function(data, mode) {
}
}
}
} while ((strm.avail_in > 0) && status !== c.Z_STREAM_END);
// When no more input data, we should check that internal inflate buffers
// are flushed. The only way to do it when avail_out = 0 - run one more
// inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
// Here we set flag to process this error properly.
//
// NOTE. Deflate does not return error in this case and does not needs such
// logic.
if (strm.avail_in === 0 && strm.avail_out === 0) {
allowBufError = true;
}
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
if (status === c.Z_STREAM_END) {
_mode = c.Z_FINISH;
}
// Finalize on the last chunk.
if (_mode === c.Z_FINISH) {
status = zlib_inflate.inflateEnd(this.strm);
@ -607,6 +645,13 @@ Inflate.prototype.push = function(data, mode) {
return status === c.Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === c.Z_SYNC_FLUSH) {
this.onEnd(c.Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -630,8 +675,9 @@ Inflate.prototype.onData = function(chunk) {
* - status (Number): inflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell inflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called either after you tell inflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Inflate.prototype.onEnd = function(status) {
@ -747,7 +793,7 @@ exports.assign = function (obj /*from1, from2, from3, ...*/) {
var source = sources.shift();
if (!source) { continue; }
if (typeof(source) !== 'object') {
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
@ -778,7 +824,7 @@ var fnTyped = {
return;
}
// Fallback to ordinary array
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -807,7 +853,7 @@ var fnTyped = {
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -835,6 +881,7 @@ exports.setTyped = function (on) {
};
exports.setTyped(TYPED_OK);
},{}],4:[function(require,module,exports){
// String encode/decode helpers
'use strict';
@ -859,8 +906,8 @@ try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPL
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var i=0; i<256; i++) {
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
for (var q=0; q<256; q++) {
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
}
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
@ -929,7 +976,7 @@ function buf2binstring(buf, len) {
}
var result = '';
for(var i=0; i < len; i++) {
for (var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
@ -945,7 +992,7 @@ exports.buf2binstring = function(buf) {
// Convert binary string (typed, when possible)
exports.binstring2buf = function(str) {
var buf = new utils.Buf8(str.length);
for(var i=0, len=buf.length; i < len; i++) {
for (var i=0, len=buf.length; i < len; i++) {
buf[i] = str.charCodeAt(i);
}
return buf;
@ -1030,9 +1077,9 @@ exports.utf8border = function(buf, max) {
// Small size is preferable.
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0
, s2 = ((adler >>> 16) & 0xffff) |0
, n = 0;
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
// Set limit ~ twice less than 5552, to keep
@ -1055,6 +1102,7 @@ function adler32(adler, buf, len, pos) {
module.exports = adler32;
},{}],6:[function(require,module,exports){
module.exports = {
@ -1103,6 +1151,7 @@ module.exports = {
Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type
};
},{}],7:[function(require,module,exports){
'use strict';
@ -1115,9 +1164,9 @@ module.exports = {
function makeTable() {
var c, table = [];
for(var n =0; n < 256; n++){
for (var n =0; n < 256; n++) {
c = n;
for(var k =0; k < 8; k++){
for (var k =0; k < 8; k++) {
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
@ -1131,12 +1180,12 @@ var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable
, end = pos + len;
var t = crcTable,
end = pos + len;
crc = crc ^ (-1);
for (var i = pos; i < end; i++ ) {
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
@ -1145,6 +1194,7 @@ function crc32(crc, buf, len, pos) {
module.exports = crc32;
},{}],8:[function(require,module,exports){
'use strict';
@ -2682,7 +2732,7 @@ function deflate(strm, flush) {
put_byte(s, val);
} while (val !== 0);
if (s.gzhead.hcrc && s.pending > beg){
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (val === 0) {
@ -2911,6 +2961,7 @@ exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/
},{"../utils/common":3,"./adler32":5,"./crc32":7,"./messages":13,"./trees":14}],9:[function(require,module,exports){
'use strict';
@ -2931,7 +2982,7 @@ function GZheader() {
// but leave for few code modifications
//
// Setup limits is not necessary because in js we should not preallocate memory
// Setup limits is not necessary because in js we should not preallocate memory
// for inflate use constant limit in 65536 bytes
//
@ -2952,6 +3003,7 @@ function GZheader() {
}
module.exports = GZheader;
},{}],10:[function(require,module,exports){
'use strict';
@ -3007,7 +3059,8 @@ module.exports = function inflate_fast(strm, start) {
var wsize; /* window size or zero if not using window */
var whave; /* valid bytes in the window */
var wnext; /* window write index */
var window; /* allocated sliding window, if wsize != 0 */
// Use `s_window` instead `window`, avoid conflict with instrumentation tools
var s_window; /* allocated sliding window, if wsize != 0 */
var hold; /* local strm.hold */
var bits; /* local strm.bits */
var lcode; /* local strm.lencode */
@ -3041,7 +3094,7 @@ module.exports = function inflate_fast(strm, start) {
wsize = state.wsize;
whave = state.whave;
wnext = state.wnext;
window = state.window;
s_window = state.window;
hold = state.hold;
bits = state.bits;
lcode = state.lencode;
@ -3159,13 +3212,13 @@ module.exports = function inflate_fast(strm, start) {
//#endif
}
from = 0; // window index
from_source = window;
from_source = s_window;
if (wnext === 0) { /* very common case */
from += wsize - op;
if (op < len) { /* some from window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -3177,14 +3230,14 @@ module.exports = function inflate_fast(strm, start) {
if (op < len) { /* some from end of window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = 0;
if (wnext < len) { /* some from start of window */
op = wnext;
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -3196,7 +3249,7 @@ module.exports = function inflate_fast(strm, start) {
if (op < len) { /* some from window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -4783,6 +4836,7 @@ exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/
},{"../utils/common":3,"./adler32":5,"./crc32":7,"./inffast":10,"./inftrees":12}],12:[function(require,module,exports){
'use strict';
@ -4980,18 +5034,20 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
// 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;
base = extra = work; /* dummy value--not used */
end = 19;
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
base = dbase;
extra = dext;
end = -1;
}
/* initialize opts for loop */
@ -5124,6 +5180,7 @@ module.exports = {
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
},{}],14:[function(require,module,exports){
'use strict';
@ -5558,7 +5615,7 @@ function tr_static_init() {
}
//Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
for (; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
_dist_code[256 + dist++] = code;
@ -6324,6 +6381,7 @@ exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
},{"../utils/common":3}],15:[function(require,module,exports){
'use strict';
@ -6354,6 +6412,7 @@ function ZStream() {
}
module.exports = ZStream;
},{}],"/":[function(require,module,exports){
// Top level file is just a mixin of submodules & constants
'use strict';
@ -6369,5 +6428,6 @@ var pako = {};
assign(pako, deflate, inflate, constants);
module.exports = pako;
},{"./lib/deflate":1,"./lib/inflate":2,"./lib/utils/common":3,"./lib/zlib/constants":6}]},{},[])("/")
});

6
dist/pako.min.js vendored

File diff suppressed because one or more lines are too long

68
dist/pako_deflate.js vendored
Wyświetl plik

@ -1,4 +1,4 @@
/* pako 0.2.6 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
/* pako 0.2.8 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
'use strict';
@ -13,7 +13,7 @@ exports.assign = function (obj /*from1, from2, from3, ...*/) {
var source = sources.shift();
if (!source) { continue; }
if (typeof(source) !== 'object') {
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
@ -44,7 +44,7 @@ var fnTyped = {
return;
}
// Fallback to ordinary array
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -73,7 +73,7 @@ var fnTyped = {
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -101,6 +101,7 @@ exports.setTyped = function (on) {
};
exports.setTyped(TYPED_OK);
},{}],2:[function(require,module,exports){
// String encode/decode helpers
'use strict';
@ -125,8 +126,8 @@ try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPL
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var i=0; i<256; i++) {
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
for (var q=0; q<256; q++) {
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
}
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
@ -195,7 +196,7 @@ function buf2binstring(buf, len) {
}
var result = '';
for(var i=0; i < len; i++) {
for (var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
@ -211,7 +212,7 @@ exports.buf2binstring = function(buf) {
// Convert binary string (typed, when possible)
exports.binstring2buf = function(str) {
var buf = new utils.Buf8(str.length);
for(var i=0, len=buf.length; i < len; i++) {
for (var i=0, len=buf.length; i < len; i++) {
buf[i] = str.charCodeAt(i);
}
return buf;
@ -296,9 +297,9 @@ exports.utf8border = function(buf, max) {
// Small size is preferable.
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0
, s2 = ((adler >>> 16) & 0xffff) |0
, n = 0;
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
// Set limit ~ twice less than 5552, to keep
@ -321,6 +322,7 @@ function adler32(adler, buf, len, pos) {
module.exports = adler32;
},{}],4:[function(require,module,exports){
'use strict';
@ -333,9 +335,9 @@ module.exports = adler32;
function makeTable() {
var c, table = [];
for(var n =0; n < 256; n++){
for (var n =0; n < 256; n++) {
c = n;
for(var k =0; k < 8; k++){
for (var k =0; k < 8; k++) {
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
@ -349,12 +351,12 @@ var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable
, end = pos + len;
var t = crcTable,
end = pos + len;
crc = crc ^ (-1);
for (var i = pos; i < end; i++ ) {
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
@ -363,6 +365,7 @@ function crc32(crc, buf, len, pos) {
module.exports = crc32;
},{}],5:[function(require,module,exports){
'use strict';
@ -1900,7 +1903,7 @@ function deflate(strm, flush) {
put_byte(s, val);
} while (val !== 0);
if (s.gzhead.hcrc && s.pending > beg){
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (val === 0) {
@ -2129,6 +2132,7 @@ exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/
},{"../utils/common":1,"./adler32":3,"./crc32":4,"./messages":6,"./trees":7}],6:[function(require,module,exports){
'use strict';
@ -2143,6 +2147,7 @@ module.exports = {
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
},{}],7:[function(require,module,exports){
'use strict';
@ -2577,7 +2582,7 @@ function tr_static_init() {
}
//Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
for (; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
_dist_code[256 + dist++] = code;
@ -3343,6 +3348,7 @@ exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
},{"../utils/common":1}],8:[function(require,module,exports){
'use strict';
@ -3373,6 +3379,7 @@ function ZStream() {
}
module.exports = ZStream;
},{}],"/lib/deflate.js":[function(require,module,exports){
'use strict';
@ -3393,6 +3400,7 @@ var Z_FINISH = 4;
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_SYNC_FLUSH = 2;
var Z_DEFAULT_COMPRESSION = -1;
@ -3422,7 +3430,9 @@ var Z_DEFLATED = 8;
*
* Compressed result, generated by default [[Deflate#onData]]
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Deflate#push]] with `Z_FINISH` / `true` param).
* (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Deflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -3546,8 +3556,9 @@ var Deflate = function(options) {
*
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
* new compressed chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Deflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the compression context.
*
* On fail call [[Deflate#onEnd]] with error code and return false.
*
@ -3600,7 +3611,7 @@ Deflate.prototype.push = function(data, mode) {
this.ended = true;
return false;
}
if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
} else {
@ -3617,6 +3628,13 @@ Deflate.prototype.push = function(data, mode) {
return status === Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === Z_SYNC_FLUSH) {
this.onEnd(Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -3640,8 +3658,9 @@ Deflate.prototype.onData = function(chunk) {
* - status (Number): deflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell deflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called once after you tell deflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Deflate.prototype.onEnd = function(status) {
@ -3738,5 +3757,6 @@ exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;
},{"./utils/common":1,"./utils/strings":2,"./zlib/deflate.js":5,"./zlib/messages":6,"./zlib/zstream":8}]},{},[])("/lib/deflate.js")
});

File diff suppressed because one or more lines are too long

126
dist/pako_inflate.js vendored
Wyświetl plik

@ -1,4 +1,4 @@
/* pako 0.2.6 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
/* pako 0.2.8 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(require,module,exports){
'use strict';
@ -13,7 +13,7 @@ exports.assign = function (obj /*from1, from2, from3, ...*/) {
var source = sources.shift();
if (!source) { continue; }
if (typeof(source) !== 'object') {
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
@ -44,7 +44,7 @@ var fnTyped = {
return;
}
// Fallback to ordinary array
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -73,7 +73,7 @@ var fnTyped = {
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -101,6 +101,7 @@ exports.setTyped = function (on) {
};
exports.setTyped(TYPED_OK);
},{}],2:[function(require,module,exports){
// String encode/decode helpers
'use strict';
@ -125,8 +126,8 @@ try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPL
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var i=0; i<256; i++) {
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
for (var q=0; q<256; q++) {
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
}
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
@ -195,7 +196,7 @@ function buf2binstring(buf, len) {
}
var result = '';
for(var i=0; i < len; i++) {
for (var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
@ -211,7 +212,7 @@ exports.buf2binstring = function(buf) {
// Convert binary string (typed, when possible)
exports.binstring2buf = function(str) {
var buf = new utils.Buf8(str.length);
for(var i=0, len=buf.length; i < len; i++) {
for (var i=0, len=buf.length; i < len; i++) {
buf[i] = str.charCodeAt(i);
}
return buf;
@ -296,9 +297,9 @@ exports.utf8border = function(buf, max) {
// Small size is preferable.
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0
, s2 = ((adler >>> 16) & 0xffff) |0
, n = 0;
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
// Set limit ~ twice less than 5552, to keep
@ -321,6 +322,7 @@ function adler32(adler, buf, len, pos) {
module.exports = adler32;
},{}],4:[function(require,module,exports){
module.exports = {
@ -369,6 +371,7 @@ module.exports = {
Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type
};
},{}],5:[function(require,module,exports){
'use strict';
@ -381,9 +384,9 @@ module.exports = {
function makeTable() {
var c, table = [];
for(var n =0; n < 256; n++){
for (var n =0; n < 256; n++) {
c = n;
for(var k =0; k < 8; k++){
for (var k =0; k < 8; k++) {
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
@ -397,12 +400,12 @@ var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable
, end = pos + len;
var t = crcTable,
end = pos + len;
crc = crc ^ (-1);
for (var i = pos; i < end; i++ ) {
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
@ -411,6 +414,7 @@ function crc32(crc, buf, len, pos) {
module.exports = crc32;
},{}],6:[function(require,module,exports){
'use strict';
@ -431,7 +435,7 @@ function GZheader() {
// but leave for few code modifications
//
// Setup limits is not necessary because in js we should not preallocate memory
// Setup limits is not necessary because in js we should not preallocate memory
// for inflate use constant limit in 65536 bytes
//
@ -452,6 +456,7 @@ function GZheader() {
}
module.exports = GZheader;
},{}],7:[function(require,module,exports){
'use strict';
@ -507,7 +512,8 @@ module.exports = function inflate_fast(strm, start) {
var wsize; /* window size or zero if not using window */
var whave; /* valid bytes in the window */
var wnext; /* window write index */
var window; /* allocated sliding window, if wsize != 0 */
// Use `s_window` instead `window`, avoid conflict with instrumentation tools
var s_window; /* allocated sliding window, if wsize != 0 */
var hold; /* local strm.hold */
var bits; /* local strm.bits */
var lcode; /* local strm.lencode */
@ -541,7 +547,7 @@ module.exports = function inflate_fast(strm, start) {
wsize = state.wsize;
whave = state.whave;
wnext = state.wnext;
window = state.window;
s_window = state.window;
hold = state.hold;
bits = state.bits;
lcode = state.lencode;
@ -659,13 +665,13 @@ module.exports = function inflate_fast(strm, start) {
//#endif
}
from = 0; // window index
from_source = window;
from_source = s_window;
if (wnext === 0) { /* very common case */
from += wsize - op;
if (op < len) { /* some from window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -677,14 +683,14 @@ module.exports = function inflate_fast(strm, start) {
if (op < len) { /* some from end of window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = 0;
if (wnext < len) { /* some from start of window */
op = wnext;
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -696,7 +702,7 @@ module.exports = function inflate_fast(strm, start) {
if (op < len) { /* some from window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -2283,6 +2289,7 @@ exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/
},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){
'use strict';
@ -2480,18 +2487,20 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
// 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;
base = extra = work; /* dummy value--not used */
end = 19;
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
base = dbase;
extra = dext;
end = -1;
}
/* initialize opts for loop */
@ -2624,6 +2633,7 @@ module.exports = {
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
},{}],11:[function(require,module,exports){
'use strict';
@ -2654,6 +2664,7 @@ function ZStream() {
}
module.exports = ZStream;
},{}],"/lib/inflate.js":[function(require,module,exports){
'use strict';
@ -2687,7 +2698,9 @@ var toString = Object.prototype.toString;
*
* Uncompressed result, generated by default [[Inflate#onData]]
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Inflate#push]] with `Z_FINISH` / `true` param).
* (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Inflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -2807,8 +2820,9 @@ var Inflate = function(options) {
*
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
* new output chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Inflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the decompression context.
*
* On fail call [[Inflate#onEnd]] with error code and return false.
*
@ -2832,6 +2846,10 @@ Inflate.prototype.push = function(data, mode) {
var status, _mode;
var next_out_utf8, tail, utf8str;
// Flag to properly process Z_BUF_ERROR on testing inflate call
// when we check that all output data was flushed.
var allowBufError = false;
if (this.ended) { return false; }
_mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
@ -2857,6 +2875,11 @@ Inflate.prototype.push = function(data, mode) {
status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */
if (status === c.Z_BUF_ERROR && allowBufError === true) {
status = c.Z_OK;
allowBufError = false;
}
if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
this.onEnd(status);
this.ended = true;
@ -2864,7 +2887,7 @@ Inflate.prototype.push = function(data, mode) {
}
if (strm.next_out) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && _mode === c.Z_FINISH)) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
@ -2885,11 +2908,24 @@ Inflate.prototype.push = function(data, mode) {
}
}
}
} while ((strm.avail_in > 0) && status !== c.Z_STREAM_END);
// When no more input data, we should check that internal inflate buffers
// are flushed. The only way to do it when avail_out = 0 - run one more
// inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
// Here we set flag to process this error properly.
//
// NOTE. Deflate does not return error in this case and does not needs such
// logic.
if (strm.avail_in === 0 && strm.avail_out === 0) {
allowBufError = true;
}
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
if (status === c.Z_STREAM_END) {
_mode = c.Z_FINISH;
}
// Finalize on the last chunk.
if (_mode === c.Z_FINISH) {
status = zlib_inflate.inflateEnd(this.strm);
@ -2898,6 +2934,13 @@ Inflate.prototype.push = function(data, mode) {
return status === c.Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === c.Z_SYNC_FLUSH) {
this.onEnd(c.Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -2921,8 +2964,9 @@ Inflate.prototype.onData = function(chunk) {
* - status (Number): inflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell inflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called either after you tell inflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Inflate.prototype.onEnd = function(status) {

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -11,4 +11,4 @@ var pako = {};
assign(pako, deflate, inflate, constants);
module.exports = pako;
module.exports = pako;

Wyświetl plik

@ -17,6 +17,7 @@ var Z_FINISH = 4;
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_SYNC_FLUSH = 2;
var Z_DEFAULT_COMPRESSION = -1;
@ -46,7 +47,9 @@ var Z_DEFLATED = 8;
*
* Compressed result, generated by default [[Deflate#onData]]
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Deflate#push]] with `Z_FINISH` / `true` param).
* (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Deflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -170,8 +173,9 @@ var Deflate = function(options) {
*
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
* new compressed chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Deflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the compression context.
*
* On fail call [[Deflate#onEnd]] with error code and return false.
*
@ -224,7 +228,7 @@ Deflate.prototype.push = function(data, mode) {
this.ended = true;
return false;
}
if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
} else {
@ -241,6 +245,13 @@ Deflate.prototype.push = function(data, mode) {
return status === Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === Z_SYNC_FLUSH) {
this.onEnd(Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -264,8 +275,9 @@ Deflate.prototype.onData = function(chunk) {
* - status (Number): deflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell deflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called once after you tell deflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Deflate.prototype.onEnd = function(status) {
@ -361,4 +373,4 @@ function gzip(input, options) {
exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;
exports.gzip = gzip;

Wyświetl plik

@ -30,7 +30,9 @@ var toString = Object.prototype.toString;
*
* Uncompressed result, generated by default [[Inflate#onData]]
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Inflate#push]] with `Z_FINISH` / `true` param).
* (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Inflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -150,8 +152,9 @@ var Inflate = function(options) {
*
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
* new output chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Inflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the decompression context.
*
* On fail call [[Inflate#onEnd]] with error code and return false.
*
@ -175,6 +178,10 @@ Inflate.prototype.push = function(data, mode) {
var status, _mode;
var next_out_utf8, tail, utf8str;
// Flag to properly process Z_BUF_ERROR on testing inflate call
// when we check that all output data was flushed.
var allowBufError = false;
if (this.ended) { return false; }
_mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
@ -200,6 +207,11 @@ Inflate.prototype.push = function(data, mode) {
status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */
if (status === c.Z_BUF_ERROR && allowBufError === true) {
status = c.Z_OK;
allowBufError = false;
}
if (status !== c.Z_STREAM_END && status !== c.Z_OK) {
this.onEnd(status);
this.ended = true;
@ -207,7 +219,7 @@ Inflate.prototype.push = function(data, mode) {
}
if (strm.next_out) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && _mode === c.Z_FINISH)) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
@ -228,11 +240,24 @@ Inflate.prototype.push = function(data, mode) {
}
}
}
} while ((strm.avail_in > 0) && status !== c.Z_STREAM_END);
// When no more input data, we should check that internal inflate buffers
// are flushed. The only way to do it when avail_out = 0 - run one more
// inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
// Here we set flag to process this error properly.
//
// NOTE. Deflate does not return error in this case and does not needs such
// logic.
if (strm.avail_in === 0 && strm.avail_out === 0) {
allowBufError = true;
}
} while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);
if (status === c.Z_STREAM_END) {
_mode = c.Z_FINISH;
}
// Finalize on the last chunk.
if (_mode === c.Z_FINISH) {
status = zlib_inflate.inflateEnd(this.strm);
@ -241,6 +266,13 @@ Inflate.prototype.push = function(data, mode) {
return status === c.Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === c.Z_SYNC_FLUSH) {
this.onEnd(c.Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -264,8 +296,9 @@ Inflate.prototype.onData = function(chunk) {
* - status (Number): inflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell inflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called either after you tell inflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Inflate.prototype.onEnd = function(status) {

Wyświetl plik

@ -12,7 +12,7 @@ exports.assign = function (obj /*from1, from2, from3, ...*/) {
var source = sources.shift();
if (!source) { continue; }
if (typeof(source) !== 'object') {
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
@ -43,7 +43,7 @@ var fnTyped = {
return;
}
// Fallback to ordinary array
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -72,7 +72,7 @@ var fnTyped = {
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -99,4 +99,4 @@ exports.setTyped = function (on) {
}
};
exports.setTyped(TYPED_OK);
exports.setTyped(TYPED_OK);

Wyświetl plik

@ -21,8 +21,8 @@ try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPL
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var i=0; i<256; i++) {
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
for (var q=0; q<256; q++) {
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
}
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
@ -91,7 +91,7 @@ function buf2binstring(buf, len) {
}
var result = '';
for(var i=0; i < len; i++) {
for (var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
@ -107,7 +107,7 @@ exports.buf2binstring = function(buf) {
// Convert binary string (typed, when possible)
exports.binstring2buf = function(str) {
var buf = new utils.Buf8(str.length);
for(var i=0, len=buf.length; i < len; i++) {
for (var i=0, len=buf.length; i < len; i++) {
buf[i] = str.charCodeAt(i);
}
return buf;

Wyświetl plik

@ -5,9 +5,9 @@
// Small size is preferable.
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0
, s2 = ((adler >>> 16) & 0xffff) |0
, n = 0;
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
// Set limit ~ twice less than 5552, to keep
@ -29,4 +29,4 @@ function adler32(adler, buf, len, pos) {
}
module.exports = adler32;
module.exports = adler32;

Wyświetl plik

@ -44,4 +44,4 @@ module.exports = {
/* The deflate compression method */
Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type
};
};

Wyświetl plik

@ -9,9 +9,9 @@
function makeTable() {
var c, table = [];
for(var n =0; n < 256; n++){
for (var n =0; n < 256; n++) {
c = n;
for(var k =0; k < 8; k++){
for (var k =0; k < 8; k++) {
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
@ -25,12 +25,12 @@ var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable
, end = pos + len;
var t = crcTable,
end = pos + len;
crc = crc ^ (-1);
for (var i = pos; i < end; i++ ) {
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
@ -38,4 +38,4 @@ function crc32(crc, buf, len, pos) {
}
module.exports = crc32;
module.exports = crc32;

Wyświetl plik

@ -1534,7 +1534,7 @@ function deflate(strm, flush) {
put_byte(s, val);
} while (val !== 0);
if (s.gzhead.hcrc && s.pending > beg){
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (val === 0) {
@ -1762,4 +1762,4 @@ exports.deflateParams = deflateParams;
exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/
*/

Wyświetl plik

@ -17,7 +17,7 @@ function GZheader() {
// but leave for few code modifications
//
// Setup limits is not necessary because in js we should not preallocate memory
// Setup limits is not necessary because in js we should not preallocate memory
// for inflate use constant limit in 65536 bytes
//
@ -37,4 +37,4 @@ function GZheader() {
this.done = false;
}
module.exports = GZheader;
module.exports = GZheader;

Wyświetl plik

@ -52,7 +52,8 @@ module.exports = function inflate_fast(strm, start) {
var wsize; /* window size or zero if not using window */
var whave; /* valid bytes in the window */
var wnext; /* window write index */
var window; /* allocated sliding window, if wsize != 0 */
// Use `s_window` instead `window`, avoid conflict with instrumentation tools
var s_window; /* allocated sliding window, if wsize != 0 */
var hold; /* local strm.hold */
var bits; /* local strm.bits */
var lcode; /* local strm.lencode */
@ -86,7 +87,7 @@ module.exports = function inflate_fast(strm, start) {
wsize = state.wsize;
whave = state.whave;
wnext = state.wnext;
window = state.window;
s_window = state.window;
hold = state.hold;
bits = state.bits;
lcode = state.lencode;
@ -204,13 +205,13 @@ module.exports = function inflate_fast(strm, start) {
//#endif
}
from = 0; // window index
from_source = window;
from_source = s_window;
if (wnext === 0) { /* very common case */
from += wsize - op;
if (op < len) { /* some from window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -222,14 +223,14 @@ module.exports = function inflate_fast(strm, start) {
if (op < len) { /* some from end of window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = 0;
if (wnext < len) { /* some from start of window */
op = wnext;
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;
@ -241,7 +242,7 @@ module.exports = function inflate_fast(strm, start) {
if (op < len) { /* some from window */
len -= op;
do {
output[_out++] = window[from++];
output[_out++] = s_window[from++];
} while (--op);
from = _out - dist; /* rest from output */
from_source = output;

Wyświetl plik

@ -1500,4 +1500,4 @@ exports.inflateSetDictionary = inflateSetDictionary;
exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/
*/

Wyświetl plik

@ -194,18 +194,20 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
// 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;
base = extra = work; /* dummy value--not used */
end = 19;
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
base = dbase;
extra = dext;
end = -1;
}
/* initialize opts for loop */

Wyświetl plik

@ -10,4 +10,4 @@ module.exports = {
'-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
};

Wyświetl plik

@ -431,7 +431,7 @@ function tr_static_init() {
}
//Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
for (; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
_dist_code[256 + dist++] = code;
@ -1196,4 +1196,4 @@ exports._tr_init = _tr_init;
exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
exports._tr_align = _tr_align;

Wyświetl plik

@ -26,4 +26,4 @@ function ZStream() {
this.adler = 0;
}
module.exports = ZStream;
module.exports = ZStream;

Wyświetl plik

@ -1,7 +1,7 @@
{
"name" : "pako",
"description" : "zlib port to javascript - fast, modularized, with browser support",
"version" : "0.2.6",
"version" : "0.2.8",
"keywords" : [ "zlib", "deflate", "inflate", "gzip" ],
"homepage" : "https://github.com/nodeca/pako",
@ -15,12 +15,13 @@
"main" : "./index.js",
"devDependencies" : {
"mocha": "*",
"mocha": "1.21.5",
"benchmark": "*",
"ansi": "*",
"browserify":"*",
"eslint": "0.17.1",
"eslint-plugin-nodeca": "~1.0.3",
"uglify-js": "*",
"jshint": "*",
"istanbul": "*",
"ndoc": "*",
"lodash": "*",

Wyświetl plik

@ -7,6 +7,7 @@
<script src="../../node_modules/mocha/mocha.js"></script>
<script>
mocha.setup('bdd');
mocha.suite.timeout(30000);
</script>
<script>
function assert(expr, msg) {

Wyświetl plik

@ -93,4 +93,4 @@ describe('Deflate states', function() {
ret = zlib_deflate.deflateEnd(strm);
assert(ret === c.Z_STREAM_ERROR);
});
});
});

Plik binarny nie jest wyświetlany.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -82,4 +82,4 @@ describe('Gzip special cases', function() {
assert(i === 2, 'invalid blobs count');
});
});
});

Wyświetl plik

@ -168,4 +168,4 @@ function testInflate(samples, inflateOptions, deflateOptions, callback) {
exports.cmpBuf = cmpBuf;
exports.testSamples = testSamples;
exports.testInflate = testInflate;
exports.loadSamples = loadSamples;
exports.loadSamples = loadSamples;

Wyświetl plik

@ -18,7 +18,7 @@ var pako = require('../index');
function h2b(hex) {
return hex.split(' ').map(function(hex) { return parseInt(hex, 16); });
return hex.split(' ').map(function(hx) { return parseInt(hx, 16); });
}
@ -243,4 +243,4 @@ describe('Inflate support', function() {
it('bad window size', function() {
testInflate('', -15, c.Z_OK);
});
});
});

Wyświetl plik

@ -18,13 +18,12 @@ function fixedFromCharCode(code) {
if (code > 0xffff) {
code -= 0x10000;
var surrogate1 = 0xd800 + (code >> 10)
, surrogate2 = 0xdc00 + (code & 0x3ff);
var surrogate1 = 0xd800 + (code >> 10),
surrogate2 = 0xdc00 + (code & 0x3ff);
return String.fromCharCode(surrogate1, surrogate2);
} else {
return String.fromCharCode(code);
}
return String.fromCharCode(code);
}
// Converts array of codes / chars / strings to utf16 string
@ -123,4 +122,4 @@ describe('Deflate/Inflate strings', function () {
assert.equal(data, sampleString);
});
});
});