[Pkg-javascript-commits] [pdf.js] 165/207: Faster chunkedStream_getByte()

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 9a41659ae7eddb92eaa09626db84b672947a6a43
Author: fkaelberer <o_0_o at gmx.de>
Date:   Wed Jun 25 20:11:49 2014 +0200

    Faster chunkedStream_getByte()
---
 src/core/chunked_stream.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/core/chunked_stream.js b/src/core/chunked_stream.js
index cf0e6b7..5eeb3f0 100644
--- a/src/core/chunked_stream.js
+++ b/src/core/chunked_stream.js
@@ -155,8 +155,15 @@ var ChunkedStream = (function ChunkedStreamClosure() {
       if (pos >= this.end) {
         return -1;
       }
-      this.ensureByte(pos);
-      return this.bytes[this.pos++];
+      var byte = this.bytes[pos];
+      if (byte === 0) {
+        // |byte| might be zero, because the corresponding chunk has not been
+        // loaded yet. In this case, this.ensureByte(pos) will throw an
+        // exception and nothing is returned.
+        this.ensureByte(pos);
+      }
+      this.pos++;
+      return byte;
     },
 
     getUint16: function ChunkedStream_getUint16() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list