]> git.parisson.com Git - pdf.js.git/commitdiff
changed skip in FlateStream to not call getChar
authorsbarman <sbarman@L3CWZ5T.(none)>
Fri, 17 Jun 2011 20:13:25 +0000 (13:13 -0700)
committersbarman <sbarman@L3CWZ5T.(none)>
Fri, 17 Jun 2011 20:13:25 +0000 (13:13 -0700)
pdf.js

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