Fix array initializations.

And refactor one loop.
This commit is contained in:
Kalervo Kujala 2011-09-07 22:11:30 +03:00
parent 909284df7b
commit fb5807721e

10
pdf.js
View File

@ -592,17 +592,17 @@ var FlateStream = (function() {
var numCodeLenCodes = this.getBits(4) + 4; var numCodeLenCodes = this.getBits(4) + 4;
// build the code lengths code table // build the code lengths code table
var codeLenCodeLengths = Array(codeLenCodeMap.length); var codeLenCodeLengths = [];
var i = 0;
while (i < numCodeLenCodes) for (var i = 0; i < numCodeLenCodes; ++i)
codeLenCodeLengths[codeLenCodeMap[i++]] = this.getBits(3); codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths); var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
// build the literal and distance code tables // build the literal and distance code tables
var len = 0; var len = 0;
var i = 0; var i = 0;
var codes = numLitCodes + numDistCodes; var codes = numLitCodes + numDistCodes;
var codeLengths = new Array(codes); var codeLengths = [];
while (i < codes) { while (i < codes) {
var code = this.getCode(codeLenCodeTab); var code = this.getCode(codeLenCodeTab);
if (code == 16) { if (code == 16) {