Browse Source

Merge pull request #335 from notmasteryet/lzw-mem

Reducing memory usage in LZWStream
Chris Jones 14 years ago
parent
commit
8f4967d0b8
  1. 6
      pdf.js

6
pdf.js

@ -1990,7 +1990,7 @@ var LZWStream = (function() {
this.cachedData = 0; this.cachedData = 0;
this.bitsCached = 0; this.bitsCached = 0;
var maxLzwDictionarySize = 4097; var maxLzwDictionarySize = 4096;
var lzwState = { var lzwState = {
earlyChange: earlyChange, earlyChange: earlyChange,
codeLength: 9, codeLength: 9,
@ -2036,6 +2036,9 @@ var LZWStream = (function() {
var i, j, q; var i, j, q;
var lzwState = this.lzwState; var lzwState = this.lzwState;
if (!lzwState)
return; // eof was found
var earlyChange = lzwState.earlyChange; var earlyChange = lzwState.earlyChange;
var nextCode = lzwState.nextCode; var nextCode = lzwState.nextCode;
var dictionaryValues = lzwState.dictionaryValues; var dictionaryValues = lzwState.dictionaryValues;
@ -2073,6 +2076,7 @@ var LZWStream = (function() {
continue; continue;
} else { } else {
this.eof = true; this.eof = true;
delete this.lzwState;
break; break;
} }

Loading…
Cancel
Save