]> git.parisson.com Git - pdf.js.git/commitdiff
fix other cases of reading this.buffer before ensureBuffer, too
authorAndreas Gal <andreas.gal@gmail.com>
Wed, 22 Jun 2011 06:35:42 +0000 (02:35 -0400)
committerAndreas Gal <andreas.gal@gmail.com>
Wed, 22 Jun 2011 06:35:42 +0000 (02:35 -0400)
pdf.js

diff --git a/pdf.js b/pdf.js
index b53829abb46e3eda13a1cf95dd3eb4b226c8a60e..abe58ce5a2ff55b082cca8810b6b4b4f91cb1046 100644 (file)
--- a/pdf.js
+++ b/pdf.js
@@ -603,10 +603,8 @@ var PredictorStream = (function() {
         var rowBytes = this.rowBytes;
         var pixBytes = this.pixBytes;
 
-
-        var buffer = this.buffer;
         var bufferLength = this.bufferLength;
-        this.ensureBuffer(bufferLength + rowBytes);
+        var buffer this.ensureBuffer(bufferLength + rowBytes);
         var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
 
         var bits = this.bits;
@@ -672,8 +670,7 @@ var PredictorStream = (function() {
         var rawBytes = this.stream.getBytes(rowBytes);
 
         var bufferLength = this.bufferLength;
-        this.ensureBuffer(bufferLength + pixBytes);
-        var buffer = this.buffer;
+        var buffer = this.ensureBuffer(bufferLength + pixBytes);
 
         var currentRow = buffer.subarray(bufferLength, bufferLength + rowBytes);
         var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
@@ -802,8 +799,7 @@ var Ascii85Stream = (function() {
 
         // special code for z
         if (c == zCode) {
-            this.ensureBuffer(bufferLength + 4);
-            var buffer = this.buffer;
+            var buffer = this.ensureBuffer(bufferLength + 4);
             for (var i = 0; i < 4; ++i)
                 buffer[bufferLength + i] = 0;
             this.bufferLength += 4;
@@ -820,8 +816,7 @@ var Ascii85Stream = (function() {
                 if (!c || c == tildaCode)
                     break;
             }
-            this.ensureBuffer(bufferLength + i - 1);
-            var buffer = this.buffer;
+            var buffer = this.ensureBuffer(bufferLength + i - 1);
             this.bufferLength += i - 1;
 
             // partial ending;