changed skip in FlateStream to not call getChar

This commit is contained in:
sbarman 2011-06-17 13:13:25 -07:00
parent 35aacef28c
commit 558ac50d72

13
pdf.js
View File

@ -316,9 +316,8 @@ var FlateStream = (function() {
return this.buffer = buffer2; return this.buffer = buffer2;
}, },
getByte: function() { getByte: function() {
var bufferLength = this.bufferLength;
var pos = this.pos; var pos = this.pos;
if (bufferLength == pos) { while (this.bufferLength <= pos) {
if (this.eof) if (this.eof)
return; return;
this.readBlock(); this.readBlock();
@ -341,9 +340,8 @@ var FlateStream = (function() {
return this.buffer.subarray(pos, end) return this.buffer.subarray(pos, end)
}, },
lookChar: function() { lookChar: function() {
var bufferLength = this.bufferLength;
var pos = this.pos; var pos = this.pos;
if (bufferLength == pos) { while (this.bufferLength <= pos) {
if (this.eof) if (this.eof)
return; return;
this.readBlock(); this.readBlock();
@ -352,16 +350,15 @@ var FlateStream = (function() {
}, },
getChar: function() { getChar: function() {
var ch = this.lookChar(); var ch = this.lookChar();
if (!ch) // shouldnt matter what the position is if we get past the eof
return; // so no need to check if ch is undefined
this.pos++; this.pos++;
return ch; return ch;
}, },
skip: function(n) { skip: function(n) {
if (!n) if (!n)
n = 1; n = 1;
while (n-- > 0) this.pos += n;
this.getChar();
}, },
generateHuffmanTable: function(lengths) { generateHuffmanTable: function(lengths) {
var n = lengths.length; var n = lengths.length;