kopia lustrzana https://github.com/viljoviitanen/pako
				
				
				
			refactoring: rename input/output buffer indexes to next_in/next_out
							rodzic
							
								
									83859e524b
								
							
						
					
					
						commit
						8bea7480aa
					
				| 
						 | 
					@ -200,18 +200,18 @@ Deflate.prototype.push = function(data, mode) {
 | 
				
			||||||
  // Convert data if needed
 | 
					  // Convert data if needed
 | 
				
			||||||
  if (typeof data === 'string') {
 | 
					  if (typeof data === 'string') {
 | 
				
			||||||
    // If we need to compress text, change encoding to utf8.
 | 
					    // If we need to compress text, change encoding to utf8.
 | 
				
			||||||
    strm.next_in = strings.string2buf(data);
 | 
					    strm.input = strings.string2buf(data);
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    strm.next_in = data;
 | 
					    strm.input = data;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  strm.next_in_index = 0;
 | 
					  strm.next_in = 0;
 | 
				
			||||||
  strm.avail_in = strm.next_in.length;
 | 
					  strm.avail_in = strm.input.length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  do {
 | 
					  do {
 | 
				
			||||||
    if (strm.avail_out === 0) {
 | 
					    if (strm.avail_out === 0) {
 | 
				
			||||||
      strm.next_out = new utils.Buf8(chunkSize);
 | 
					      strm.output = new utils.Buf8(chunkSize);
 | 
				
			||||||
      strm.next_out_index = 0;
 | 
					      strm.next_out = 0;
 | 
				
			||||||
      strm.avail_out = chunkSize;
 | 
					      strm.avail_out = chunkSize;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    status = zlib_deflate.deflate(strm, _mode);    /* no bad return value */
 | 
					    status = zlib_deflate.deflate(strm, _mode);    /* no bad return value */
 | 
				
			||||||
| 
						 | 
					@ -223,9 +223,9 @@ Deflate.prototype.push = function(data, mode) {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
 | 
					    if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
 | 
				
			||||||
      if (this.options.to === 'string') {
 | 
					      if (this.options.to === 'string') {
 | 
				
			||||||
        this.onData(strings.buf2binstring(utils.shrinkBuf(strm.next_out, strm.next_out_index)));
 | 
					        this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        this.onData(utils.shrinkBuf(strm.next_out, strm.next_out_index));
 | 
					        this.onData(utils.shrinkBuf(strm.output, strm.next_out));
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);
 | 
					  } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,7 +175,7 @@ Inflate.prototype.push = function(data, mode) {
 | 
				
			||||||
  var strm = this.strm;
 | 
					  var strm = this.strm;
 | 
				
			||||||
  var chunkSize = this.options.chunkSize;
 | 
					  var chunkSize = this.options.chunkSize;
 | 
				
			||||||
  var status, _mode;
 | 
					  var status, _mode;
 | 
				
			||||||
  var next_out_utf8_index, tail, utf8str;
 | 
					  var next_out_utf8, tail, utf8str;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (this.ended) { return false; }
 | 
					  if (this.ended) { return false; }
 | 
				
			||||||
  _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
 | 
					  _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);
 | 
				
			||||||
| 
						 | 
					@ -183,18 +183,18 @@ Inflate.prototype.push = function(data, mode) {
 | 
				
			||||||
  // Convert data if needed
 | 
					  // Convert data if needed
 | 
				
			||||||
  if (typeof data === 'string') {
 | 
					  if (typeof data === 'string') {
 | 
				
			||||||
    // Only binary strings can be decompressed on practice
 | 
					    // Only binary strings can be decompressed on practice
 | 
				
			||||||
    strm.next_in = strings.binstring2buf(data);
 | 
					    strm.input = strings.binstring2buf(data);
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    strm.next_in = data;
 | 
					    strm.input = data;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  strm.next_in_index = 0;
 | 
					  strm.next_in = 0;
 | 
				
			||||||
  strm.avail_in = strm.next_in.length;
 | 
					  strm.avail_in = strm.input.length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  do {
 | 
					  do {
 | 
				
			||||||
    if (strm.avail_out === 0) {
 | 
					    if (strm.avail_out === 0) {
 | 
				
			||||||
      strm.next_out = new utils.Buf8(chunkSize);
 | 
					      strm.output = new utils.Buf8(chunkSize);
 | 
				
			||||||
      strm.next_out_index = 0;
 | 
					      strm.next_out = 0;
 | 
				
			||||||
      strm.avail_out = chunkSize;
 | 
					      strm.avail_out = chunkSize;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -206,25 +206,25 @@ Inflate.prototype.push = function(data, mode) {
 | 
				
			||||||
      return false;
 | 
					      return false;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (strm.next_out_index) {
 | 
					    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)) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (this.options.to === 'string') {
 | 
					        if (this.options.to === 'string') {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          next_out_utf8_index = strings.utf8border(strm.next_out, strm.next_out_index);
 | 
					          next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          tail = strm.next_out_index - next_out_utf8_index;
 | 
					          tail = strm.next_out - next_out_utf8;
 | 
				
			||||||
          utf8str = strings.buf2string(strm.next_out, next_out_utf8_index);
 | 
					          utf8str = strings.buf2string(strm.output, next_out_utf8);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          // move tail
 | 
					          // move tail
 | 
				
			||||||
          strm.next_out_index = tail;
 | 
					          strm.next_out = tail;
 | 
				
			||||||
          strm.avail_out = chunkSize - tail;
 | 
					          strm.avail_out = chunkSize - tail;
 | 
				
			||||||
          if (tail) { utils.arraySet(strm.next_out, strm.next_out, next_out_utf8_index, tail, 0); }
 | 
					          if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          this.onData(utf8str);
 | 
					          this.onData(utf8str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          this.onData(utils.shrinkBuf(strm.next_out, strm.next_out_index));
 | 
					          this.onData(utils.shrinkBuf(strm.output, strm.next_out));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; }
 | 
				
			||||||
/* =========================================================================
 | 
					/* =========================================================================
 | 
				
			||||||
 * Flush as much pending output as possible. All deflate() output goes
 | 
					 * Flush as much pending output as possible. All deflate() output goes
 | 
				
			||||||
 * through this function so some applications may wish to modify it
 | 
					 * through this function so some applications may wish to modify it
 | 
				
			||||||
 * to avoid allocating a large strm->next_out buffer and copying into it.
 | 
					 * to avoid allocating a large strm->output buffer and copying into it.
 | 
				
			||||||
 * (See also read_buf()).
 | 
					 * (See also read_buf()).
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function flush_pending(strm) {
 | 
					function flush_pending(strm) {
 | 
				
			||||||
| 
						 | 
					@ -131,8 +131,8 @@ function flush_pending(strm) {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (len === 0) { return; }
 | 
					  if (len === 0) { return; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  utils.arraySet(strm.next_out, s.pending_buf, s.pending_out, len, strm.next_out_index);
 | 
					  utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);
 | 
				
			||||||
  strm.next_out_index += len;
 | 
					  strm.next_out += len;
 | 
				
			||||||
  s.pending_out += len;
 | 
					  s.pending_out += len;
 | 
				
			||||||
  strm.total_out += len;
 | 
					  strm.total_out += len;
 | 
				
			||||||
  strm.avail_out -= len;
 | 
					  strm.avail_out -= len;
 | 
				
			||||||
| 
						 | 
					@ -172,7 +172,7 @@ function putShortMSB(s, b) {
 | 
				
			||||||
 * Read a new buffer from the current input stream, update the adler32
 | 
					 * Read a new buffer from the current input stream, update the adler32
 | 
				
			||||||
 * and total number of bytes read.  All deflate() input goes through
 | 
					 * and total number of bytes read.  All deflate() input goes through
 | 
				
			||||||
 * this function so some applications may wish to modify it to avoid
 | 
					 * this function so some applications may wish to modify it to avoid
 | 
				
			||||||
 * allocating a large strm->next_in buffer and copying from it.
 | 
					 * allocating a large strm->input buffer and copying from it.
 | 
				
			||||||
 * (See also flush_pending()).
 | 
					 * (See also flush_pending()).
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function read_buf(strm, buf, start, size) {
 | 
					function read_buf(strm, buf, start, size) {
 | 
				
			||||||
| 
						 | 
					@ -183,7 +183,7 @@ function read_buf(strm, buf, start, size) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  strm.avail_in -= len;
 | 
					  strm.avail_in -= len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  utils.arraySet(buf, strm.next_in, strm.next_in_index, len, start);
 | 
					  utils.arraySet(buf, strm.input, strm.next_in, len, start);
 | 
				
			||||||
  if (strm.state.wrap === 1) {
 | 
					  if (strm.state.wrap === 1) {
 | 
				
			||||||
    strm.adler = adler32(strm.adler, buf, len, start);
 | 
					    strm.adler = adler32(strm.adler, buf, len, start);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,7 @@ function read_buf(strm, buf, start, size) {
 | 
				
			||||||
    strm.adler = crc32(strm.adler, buf, len, start);
 | 
					    strm.adler = crc32(strm.adler, buf, len, start);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  strm.next_in_index += len;
 | 
					  strm.next_in += len;
 | 
				
			||||||
  strm.total_in += len;
 | 
					  strm.total_in += len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return len;
 | 
					  return len;
 | 
				
			||||||
| 
						 | 
					@ -1391,8 +1391,8 @@ function deflate(strm, flush) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  s = strm.state;
 | 
					  s = strm.state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!strm.next_out ||
 | 
					  if (!strm.output ||
 | 
				
			||||||
      (!strm.next_in && strm.avail_in !== 0) ||
 | 
					      (!strm.input && strm.avail_in !== 0) ||
 | 
				
			||||||
      (s.status === FINISH_STATE && flush !== Z_FINISH)) {
 | 
					      (s.status === FINISH_STATE && flush !== Z_FINISH)) {
 | 
				
			||||||
    return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
 | 
					    return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,10 +41,10 @@ var TYPE = 12;      /* i: waiting for type bits, including last-flag bit */
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
module.exports = function inflate_fast(strm, start) {
 | 
					module.exports = function inflate_fast(strm, start) {
 | 
				
			||||||
  var state;
 | 
					  var state;
 | 
				
			||||||
  var _in;                    /* local strm.next_in */
 | 
					  var _in;                    /* local strm.input */
 | 
				
			||||||
  var last;                   /* have enough input while in < last */
 | 
					  var last;                   /* have enough input while in < last */
 | 
				
			||||||
  var _out;                   /* local strm.next_out */
 | 
					  var _out;                   /* local strm.output */
 | 
				
			||||||
  var beg;                    /* inflate()'s initial strm.next_out */
 | 
					  var beg;                    /* inflate()'s initial strm.output */
 | 
				
			||||||
  var end;                    /* while out < end, enough space available */
 | 
					  var end;                    /* while out < end, enough space available */
 | 
				
			||||||
//#ifdef INFLATE_STRICT
 | 
					//#ifdef INFLATE_STRICT
 | 
				
			||||||
  var dmax;                   /* maximum distance from zlib header */
 | 
					  var dmax;                   /* maximum distance from zlib header */
 | 
				
			||||||
| 
						 | 
					@ -73,11 +73,11 @@ module.exports = function inflate_fast(strm, start) {
 | 
				
			||||||
  /* copy state to local variables */
 | 
					  /* copy state to local variables */
 | 
				
			||||||
  state = strm.state;
 | 
					  state = strm.state;
 | 
				
			||||||
  //here = state.here;
 | 
					  //here = state.here;
 | 
				
			||||||
  _in = strm.next_in_index;
 | 
					  _in = strm.next_in;
 | 
				
			||||||
  input = strm.next_in;
 | 
					  input = strm.input;
 | 
				
			||||||
  last = _in + (strm.avail_in - 5);
 | 
					  last = _in + (strm.avail_in - 5);
 | 
				
			||||||
  _out = strm.next_out_index;
 | 
					  _out = strm.next_out;
 | 
				
			||||||
  output = strm.next_out;
 | 
					  output = strm.output;
 | 
				
			||||||
  beg = _out - (start - strm.avail_out);
 | 
					  beg = _out - (start - strm.avail_out);
 | 
				
			||||||
  end = _out + (strm.avail_out - 257);
 | 
					  end = _out + (strm.avail_out - 257);
 | 
				
			||||||
//#ifdef INFLATE_STRICT
 | 
					//#ifdef INFLATE_STRICT
 | 
				
			||||||
| 
						 | 
					@ -315,8 +315,8 @@ module.exports = function inflate_fast(strm, start) {
 | 
				
			||||||
  hold &= (1 << bits) - 1;
 | 
					  hold &= (1 << bits) - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* update state and return */
 | 
					  /* update state and return */
 | 
				
			||||||
  strm.next_in_index = _in;
 | 
					  strm.next_in = _in;
 | 
				
			||||||
  strm.next_out_index = _out;
 | 
					  strm.next_out = _out;
 | 
				
			||||||
  strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
 | 
					  strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
 | 
				
			||||||
  strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
 | 
					  strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
 | 
				
			||||||
  state.hold = hold;
 | 
					  state.hold = hold;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -384,8 +384,8 @@ function inflate(strm, flush) {
 | 
				
			||||||
    [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
 | 
					    [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!strm || !strm.state || !strm.next_out ||
 | 
					  if (!strm || !strm.state || !strm.output ||
 | 
				
			||||||
      (!strm.next_in && strm.avail_in !== 0)) {
 | 
					      (!strm.input && strm.avail_in !== 0)) {
 | 
				
			||||||
    return Z_STREAM_ERROR;
 | 
					    return Z_STREAM_ERROR;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -394,11 +394,11 @@ function inflate(strm, flush) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //--- LOAD() ---
 | 
					  //--- LOAD() ---
 | 
				
			||||||
  put = strm.next_out_index;
 | 
					  put = strm.next_out;
 | 
				
			||||||
  output = strm.next_out;
 | 
					  output = strm.output;
 | 
				
			||||||
  left = strm.avail_out;
 | 
					  left = strm.avail_out;
 | 
				
			||||||
  next = strm.next_in_index;
 | 
					  next = strm.next_in;
 | 
				
			||||||
  input = strm.next_in;
 | 
					  input = strm.input;
 | 
				
			||||||
  have = strm.avail_in;
 | 
					  have = strm.avail_in;
 | 
				
			||||||
  hold = state.hold;
 | 
					  hold = state.hold;
 | 
				
			||||||
  bits = state.bits;
 | 
					  bits = state.bits;
 | 
				
			||||||
| 
						 | 
					@ -724,9 +724,9 @@ function inflate(strm, flush) {
 | 
				
			||||||
    case DICT:
 | 
					    case DICT:
 | 
				
			||||||
      if (state.havedict === 0) {
 | 
					      if (state.havedict === 0) {
 | 
				
			||||||
        //--- RESTORE() ---
 | 
					        //--- RESTORE() ---
 | 
				
			||||||
        strm.next_out_index = put;
 | 
					        strm.next_out = put;
 | 
				
			||||||
        strm.avail_out = left;
 | 
					        strm.avail_out = left;
 | 
				
			||||||
        strm.next_in_index = next;
 | 
					        strm.next_in = next;
 | 
				
			||||||
        strm.avail_in = have;
 | 
					        strm.avail_in = have;
 | 
				
			||||||
        state.hold = hold;
 | 
					        state.hold = hold;
 | 
				
			||||||
        state.bits = bits;
 | 
					        state.bits = bits;
 | 
				
			||||||
| 
						 | 
					@ -1076,20 +1076,20 @@ function inflate(strm, flush) {
 | 
				
			||||||
    case LEN:
 | 
					    case LEN:
 | 
				
			||||||
      if (have >= 6 && left >= 258) {
 | 
					      if (have >= 6 && left >= 258) {
 | 
				
			||||||
        //--- RESTORE() ---
 | 
					        //--- RESTORE() ---
 | 
				
			||||||
        strm.next_out_index = put;
 | 
					        strm.next_out = put;
 | 
				
			||||||
        strm.avail_out = left;
 | 
					        strm.avail_out = left;
 | 
				
			||||||
        strm.next_in_index = next;
 | 
					        strm.next_in = next;
 | 
				
			||||||
        strm.avail_in = have;
 | 
					        strm.avail_in = have;
 | 
				
			||||||
        state.hold = hold;
 | 
					        state.hold = hold;
 | 
				
			||||||
        state.bits = bits;
 | 
					        state.bits = bits;
 | 
				
			||||||
        //---
 | 
					        //---
 | 
				
			||||||
        inflate_fast(strm, _out);
 | 
					        inflate_fast(strm, _out);
 | 
				
			||||||
        //--- LOAD() ---
 | 
					        //--- LOAD() ---
 | 
				
			||||||
        put = strm.next_out_index;
 | 
					        put = strm.next_out;
 | 
				
			||||||
        output = strm.next_out;
 | 
					        output = strm.output;
 | 
				
			||||||
        left = strm.avail_out;
 | 
					        left = strm.avail_out;
 | 
				
			||||||
        next = strm.next_in_index;
 | 
					        next = strm.next_in;
 | 
				
			||||||
        input = strm.next_in;
 | 
					        input = strm.input;
 | 
				
			||||||
        have = strm.avail_in;
 | 
					        have = strm.avail_in;
 | 
				
			||||||
        hold = state.hold;
 | 
					        hold = state.hold;
 | 
				
			||||||
        bits = state.bits;
 | 
					        bits = state.bits;
 | 
				
			||||||
| 
						 | 
					@ -1410,9 +1410,9 @@ function inflate(strm, flush) {
 | 
				
			||||||
   */
 | 
					   */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //--- RESTORE() ---
 | 
					  //--- RESTORE() ---
 | 
				
			||||||
  strm.next_out_index = put;
 | 
					  strm.next_out = put;
 | 
				
			||||||
  strm.avail_out = left;
 | 
					  strm.avail_out = left;
 | 
				
			||||||
  strm.next_in_index = next;
 | 
					  strm.next_in = next;
 | 
				
			||||||
  strm.avail_in = have;
 | 
					  strm.avail_in = have;
 | 
				
			||||||
  state.hold = hold;
 | 
					  state.hold = hold;
 | 
				
			||||||
  state.bits = bits;
 | 
					  state.bits = bits;
 | 
				
			||||||
| 
						 | 
					@ -1420,7 +1420,7 @@ function inflate(strm, flush) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
 | 
					  if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
 | 
				
			||||||
                      (state.mode < CHECK || flush !== Z_FINISH))) {
 | 
					                      (state.mode < CHECK || flush !== Z_FINISH))) {
 | 
				
			||||||
    if (updatewindow(strm, strm.next_out, strm.next_out_index, _out - strm.avail_out)) {
 | 
					    if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
 | 
				
			||||||
      state.mode = MEM;
 | 
					      state.mode = MEM;
 | 
				
			||||||
      return Z_MEM_ERROR;
 | 
					      return Z_MEM_ERROR;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -1431,8 +1431,8 @@ function inflate(strm, flush) {
 | 
				
			||||||
  strm.total_out += _out;
 | 
					  strm.total_out += _out;
 | 
				
			||||||
  state.total += _out;
 | 
					  state.total += _out;
 | 
				
			||||||
  if (state.wrap && _out) {
 | 
					  if (state.wrap && _out) {
 | 
				
			||||||
    strm.adler = state.check = /*UPDATE(state.check, strm.next_out_index - _out, _out);*/
 | 
					    strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
 | 
				
			||||||
      (state.flags ? crc32(state.check, output, _out, strm.next_out_index - _out) : adler32(state.check, output, _out, strm.next_out_index - _out));
 | 
					      (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  strm.data_type = state.bits + (state.last ? 64 : 0) +
 | 
					  strm.data_type = state.bits + (state.last ? 64 : 0) +
 | 
				
			||||||
                    (state.mode === TYPE ? 128 : 0) +
 | 
					                    (state.mode === TYPE ? 128 : 0) +
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,16 +3,16 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function ZStream() {
 | 
					function ZStream() {
 | 
				
			||||||
  /* next input byte */
 | 
					  /* next input byte */
 | 
				
			||||||
  this.next_in = null;
 | 
					  this.input = null;
 | 
				
			||||||
  this.next_in_index = 0; // JS specific, offset in next_in
 | 
					  this.next_in = 0; // JS specific, offset in input
 | 
				
			||||||
  /* number of bytes available at next_in */
 | 
					  /* number of bytes available at input */
 | 
				
			||||||
  this.avail_in = 0;
 | 
					  this.avail_in = 0;
 | 
				
			||||||
  /* total number of input bytes read so far */
 | 
					  /* total number of input bytes read so far */
 | 
				
			||||||
  this.total_in = 0;
 | 
					  this.total_in = 0;
 | 
				
			||||||
  /* next output byte should be put there */
 | 
					  /* next output byte should be put there */
 | 
				
			||||||
  this.next_out = null;
 | 
					  this.output = null;
 | 
				
			||||||
  this.next_out_index = 0; // JS specific, offset in next_out
 | 
					  this.next_out = 0; // JS specific, offset in output
 | 
				
			||||||
  /* remaining free space at next_out */
 | 
					  /* remaining free space at output */
 | 
				
			||||||
  this.avail_out = 0;
 | 
					  this.avail_out = 0;
 | 
				
			||||||
  /* total number of bytes output so far */
 | 
					  /* total number of bytes output so far */
 | 
				
			||||||
  this.total_out = 0;
 | 
					  this.total_out = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,7 +75,7 @@ describe('Gzip special cases', function() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      assert(!inflator.err, inflator.msg);
 | 
					      assert(!inflator.err, inflator.msg);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      pos += strm.next_in_index;
 | 
					      pos += strm.next_in;
 | 
				
			||||||
      i++;
 | 
					      i++;
 | 
				
			||||||
    } while (strm.avail_in);
 | 
					    } while (strm.avail_in);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -210,7 +210,7 @@ describe('Inflate support', function() {
 | 
				
			||||||
    var ret;
 | 
					    var ret;
 | 
				
			||||||
    var strm = new zlib_stream();
 | 
					    var strm = new zlib_stream();
 | 
				
			||||||
    strm.avail_in = 0;
 | 
					    strm.avail_in = 0;
 | 
				
			||||||
    strm.next_in = null;
 | 
					    strm.input = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ret = zlib_inflate.inflateInit(strm);
 | 
					    ret = zlib_inflate.inflateInit(strm);
 | 
				
			||||||
    assert(ret === c.Z_OK);
 | 
					    assert(ret === c.Z_OK);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Ładowanie…
	
		Reference in New Issue