From 4b8274348ba86c85cc3ca1879619e3bce6a4a183 Mon Sep 17 00:00:00 2001 From: Kalervo Kujala Date: Wed, 31 Aug 2011 04:46:59 +0300 Subject: [PATCH] Fix a small bug in getBlackCode. And refactor the code a litlle bit. --- pdf.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pdf.js b/pdf.js index a0295860f..aa5978b39 100644 --- a/pdf.js +++ b/pdf.js @@ -1972,7 +1972,7 @@ var CCITTFaxStream = (function() { }; constructor.prototype.getBlackCode = function() { - var code, p, n; + var code, p; if (this.eoblock) { code = this.lookBits(13); if (code == EOF) @@ -1989,20 +1989,20 @@ var CCITTFaxStream = (function() { return p[1]; } } else { - for (var n = 2; n <= 6; ++n) { + var n; + for (n = 2; n <= 6; ++n) { code = this.lookBits(n); if (code == EOF) return 1; if (n < 6) code <<= 6 - n; - p = blackTable3[code]; if (p[0] == n) { this.eatBits(n); return p[1]; } } - for (var n = 7; n <= 12; ++n) { + for (n = 7; n <= 12; ++n) { code = this.lookBits(n); if (code == EOF) return 1; @@ -2021,7 +2021,7 @@ var CCITTFaxStream = (function() { if (code == EOF) return 1; if (n < 13) - code << 13 - n; + code <<= 13 - n; p = blackTable1[code]; if (p[0] == n) { this.eatBits(n);