[Pkg-javascript-commits] [pdf.js] 82/141: Resolving new lint issues

David Prévot taffit at moszumanska.debian.org
Sat Apr 19 22:40:32 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 f463f96f35ae49e10e55e99228c1e8f6789b96b9
Author: Tim van der Meij <timvandermeij at gmail.com>
Date:   Wed Apr 9 19:47:42 2014 +0200

    Resolving new lint issues
---
 src/core/evaluator.js         |  6 ++++--
 src/core/murmurhash3.js       |  5 +++--
 src/core/obj.js               |  9 +++++----
 src/display/pattern_helper.js | 10 +++++-----
 src/display/webgl.js          |  9 +++++----
 5 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 88e7881..e189a6a 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -1290,6 +1290,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
       assertWellFormed(isName(type), 'invalid font Subtype');
 
       var composite = false;
+      var uint8array;
       if (type.name == 'Type0') {
         // If font is a composite
         //  - get the descendant font
@@ -1319,7 +1320,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
         var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
         if (isStream(toUnicode)) {
           var stream = toUnicode.str || toUnicode;
-          var uint8array = stream.buffer ?
+          uint8array = stream.buffer ?
             new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) :
             new Uint8Array(stream.bytes.buffer,
                            stream.start, stream.end - stream.start);
@@ -1331,7 +1332,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 
         var widths = dict.get('Widths') || baseDict.get('Widths');
         if (widths) {
-          var uint8array = new Uint8Array(new Uint32Array(widths).buffer);
+          uint8array = new Uint8Array(new Uint32Array(widths).buffer);
           hash.update(uint8array);
         }
       }
@@ -1353,6 +1354,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
       var descriptor = preEvaluatedFont.descriptor;
       var type = dict.get('Subtype');
       var maxCharIndex = (composite ? 0xFFFF : 0xFF);
+      var properties;
 
       if (!descriptor) {
         if (type.name == 'Type3') {
diff --git a/src/core/murmurhash3.js b/src/core/murmurhash3.js
index 929dd3a..aa7421f 100644
--- a/src/core/murmurhash3.js
+++ b/src/core/murmurhash3.js
@@ -37,10 +37,11 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
   MurmurHash3_64.prototype = {
     update: function MurmurHash3_64_update(input) {
       var useUint32ArrayView = false;
+      var i;
       if (typeof input == 'string') {
         var data = new Uint8Array(input.length * 2);
         var length = 0;
-        for (var i = 0; i < input.length; i++) {
+        for (i = 0; i < input.length; i++) {
           var code = input.charCodeAt(i);
           if (code <= 0xff) {
             data[length++] = code;
@@ -78,7 +79,7 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
       var C1_LOW = C1 & MASK_LOW;
       var C2_LOW = C2 & MASK_LOW;
 
-      for (var i = 0; i < blockCounts; i++) {
+      for (i = 0; i < blockCounts; i++) {
         if (i & 1) {
           k1 = dataUint32[i];
           k1 = (k1 * C1 & MASK_HIGH) | (k1 * C1_LOW & MASK_LOW);
diff --git a/src/core/obj.js b/src/core/obj.js
index d604535..bf88bf2 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -151,8 +151,9 @@ var Dict = (function DictClosure() {
     getAll: function Dict_getAll() {
       var all = Object.create(null);
       var queue = null;
-      for (var key in this.map) {
-        var obj = this.get(key);
+      var key, obj;
+      for (key in this.map) {
+        obj = this.get(key);
         if (obj instanceof Dict) {
           if (isRecursionAllowedFor(obj)) {
             (queue || (queue = [])).push({target: all, key: key, obj: obj});
@@ -178,8 +179,8 @@ var Dict = (function DictClosure() {
           continue;
         }
         var dereferenced = Object.create(null);
-        for (var key in itemObj.map) {
-          var obj = itemObj.get(key);
+        for (key in itemObj.map) {
+          obj = itemObj.get(key);
           if (obj instanceof Dict) {
             if (isRecursionAllowedFor(obj)) {
               queue.push({target: dereferenced, key: key, obj: obj});
diff --git a/src/display/pattern_helper.js b/src/display/pattern_helper.js
index d471865..8359d67 100644
--- a/src/display/pattern_helper.js
+++ b/src/display/pattern_helper.js
@@ -177,30 +177,30 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
       scaleY: 1 / scaleY
     };
 
-    var canvas;
+    var canvas, tmpCanvas, i, ii;
     if (WebGLUtils.isEnabled) {
       canvas = WebGLUtils.drawFigures(width, height, backgroundColor,
                                       figures, context);
 
       // https://bugzilla.mozilla.org/show_bug.cgi?id=972126
-      var tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
+      tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
       tmpCanvas.context.drawImage(canvas, 0, 0);
       canvas = tmpCanvas.canvas;
     } else {
-      var tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
+      tmpCanvas = CachedCanvases.getCanvas('mesh', width, height, false);
       var tmpCtx = tmpCanvas.context;
 
       var data = tmpCtx.createImageData(width, height);
       if (backgroundColor) {
         var bytes = data.data;
-        for (var i = 0, ii = bytes.length; i < ii; i += 4) {
+        for (i = 0, ii = bytes.length; i < ii; i += 4) {
           bytes[i] = backgroundColor[0];
           bytes[i + 1] = backgroundColor[1];
           bytes[i + 2] = backgroundColor[2];
           bytes[i + 3] = 255;
         }
       }
-      for (var i = 0; i < figures.length; i++) {
+      for (i = 0; i < figures.length; i++) {
         drawFigure(data, figures[i], context);
       }
       tmpCtx.putImageData(data, 0, 0);
diff --git a/src/display/webgl.js b/src/display/webgl.js
index 13d68bc..cfef4c8 100644
--- a/src/display/webgl.js
+++ b/src/display/webgl.js
@@ -294,10 +294,11 @@ var WebGLUtils = (function WebGLUtilsClosure() {
 
     // count triangle points
     var count = 0;
-    for (var i = 0, ii = figures.length; i < ii; i++) {
+    var i, ii, rows;
+    for (i = 0, ii = figures.length; i < ii; i++) {
       switch (figures[i].type) {
         case 'lattice':
-          var rows = (figures[i].coords.length / figures[i].verticesPerRow) | 0;
+          rows = (figures[i].coords.length / figures[i].verticesPerRow) | 0;
           count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6;
           break;
         case 'triangles':
@@ -310,12 +311,12 @@ var WebGLUtils = (function WebGLUtilsClosure() {
     var colors = new Uint8Array(count * 3);
     var coordsMap = context.coords, colorsMap = context.colors;
     var pIndex = 0, cIndex = 0;
-    for (var i = 0, ii = figures.length; i < ii; i++) {
+    for (i = 0, ii = figures.length; i < ii; i++) {
       var figure = figures[i], ps = figure.coords, cs = figure.colors;
       switch (figure.type) {
         case 'lattice':
           var cols = figure.verticesPerRow;
-          var rows = (ps.length / cols) | 0;
+          rows = (ps.length / cols) | 0;
           for (var row = 1; row < rows; row++) {
             var offset = row * cols + 1;
             for (var col = 1; col < cols; col++, offset++) {

-- 
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