Resolving new lint issues

This commit is contained in:
Tim van der Meij 2014-04-09 19:47:42 +02:00
parent 1d066b768f
commit f463f96f35
5 changed files with 22 additions and 17 deletions

View File

@ -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') {

View File

@ -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);

View File

@ -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});

View File

@ -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);

View File

@ -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++) {