]> git.parisson.com Git - pdf.js.git/commitdiff
don't use array buffes to implement moveStart, that won't work for filtered streams
authorAndreas Gal <andreas.gal@gmail.com>
Sun, 8 May 2011 18:35:32 +0000 (11:35 -0700)
committerAndreas Gal <andreas.gal@gmail.com>
Sun, 8 May 2011 18:35:32 +0000 (11:35 -0700)
pdf.js

diff --git a/pdf.js b/pdf.js
index 138261f0ccda256c0f05dd285e9c4c4ed0ddfa11..b836a4b09772e241d699fbbf27ff4c55cf59af0d 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -5,6 +5,7 @@ var Stream = (function() {
     function constructor(arrayBuffer) {
         this.bytes = Uint8Array(arrayBuffer);
         this.pos = 0;
+        this.start = 0;
     }
 
     constructor.prototype = {
@@ -12,7 +13,7 @@ var Stream = (function() {
             return this.bytes.length;
         },
         reset: function() {
-            this.pos = 0;
+            this.pos = this.start;
         },
         lookChar: function() {
             var bytes = this.bytes;
@@ -37,8 +38,7 @@ var Stream = (function() {
             this.pos += n;
         },
         moveStart: function() {
-            this.bytes = Uint8Array(this.bytes, this.pos);
-            this.pos = 0;
+            this.start = this.pos;
         },
         find: function(needle, limit, backwards) {
             var length = this.bytes.length;