From 3b3922764edbc7e2d0c929c5e51302bb038fd26e Mon Sep 17 00:00:00 2001 From: Jon Buckley Date: Thu, 31 Jan 2013 18:33:38 -0500 Subject: [PATCH] Issue #2008 - Fix lint errors for src/util.js --- src/util.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/util.js b/src/util.js index f30a42032..1d0cf1003 100644 --- a/src/util.js +++ b/src/util.js @@ -1,5 +1,6 @@ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ +/* globals Cmd, DeviceCmykCS, Dict, globalScope, INFOS, MozBlobBuilder, Name, PDFJS, Ref, WARNINGS, verbosity */ /* Copyright 2012 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -253,7 +254,7 @@ var Util = PDFJS.Util = (function UtilClosure() { m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2] ]; - } + }; // Normalize rectangle rect=[x1, y1, x2, y2] so that (x1,y1) < (x2,y2) // For coordinate systems whose origin lies in the bottom-left, this @@ -270,7 +271,7 @@ var Util = PDFJS.Util = (function UtilClosure() { r[3] = rect[1]; } return r; - } + }; // Returns a rectangle [x1, y1, x2, y2] corresponding to the // intersection of rect1 and rect2. If no intersection, returns 'false' @@ -278,7 +279,7 @@ var Util = PDFJS.Util = (function UtilClosure() { Util.intersect = function Util_intersect(rect1, rect2) { function compare(a, b) { return a - b; - }; + } // Order points along the axes var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare), @@ -338,15 +339,15 @@ var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() { case 270: rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; break; - case 360: - case 0: + //case 360: + //case 0: default: rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; break; } var offsetCanvasX, offsetCanvasY; var width, height; - if (rotateA == 0) { + if (rotateA === 0) { offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; width = Math.abs(viewBox[3] - viewBox[1]) * scale; @@ -468,11 +469,11 @@ function isArray(v) { } function isStream(v) { - return typeof v == 'object' && v != null && ('getChar' in v); + return typeof v == 'object' && v !== null && v !== undefined && ('getChar' in v); } function isArrayBuffer(v) { - return typeof v == 'object' && v != null && ('byteLength' in v); + return typeof v == 'object' && v !== null && v !== undefined && ('byteLength' in v); } function isRef(v) { @@ -517,7 +518,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() { this.error = null; this.exception = null; // If you build a promise and pass in some data it's already resolved. - if (data != null) { + if (data !== null && data !== undefined) { this.isResolved = true; this._data = data; this.hasData = true; @@ -528,7 +529,7 @@ var Promise = PDFJS.Promise = (function PromiseClosure() { this.callbacks = []; this.errbacks = []; this.progressbacks = []; - }; + } /** * Builds a promise that is resolved when all the passed in promises are * resolved.