Issue #2008 - Fix lint errors for src/jbig2.js

This commit is contained in:
Jon Buckley 2013-01-31 18:32:24 -05:00
parent f883a1f40f
commit bc94a4d353

View File

@ -1,5 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* globals error, shadow */
/* Copyright 2012 Mozilla Foundation /* Copyright 2012 Mozilla Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -123,7 +124,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
return d; return d;
} else { } else {
this.chigh -= qeIcx; this.chigh -= qeIcx;
if ((this.a & 0x8000) == 0) { if ((this.a & 0x8000) === 0) {
var d = this.exchangeMps(cx); var d = this.exchangeMps(cx);
this.renormD(); this.renormD();
return d; return d;
@ -134,14 +135,14 @@ var Jbig2Image = (function Jbig2ImageClosure() {
}, },
renormD: function ArithmeticDecoder_renormD() { renormD: function ArithmeticDecoder_renormD() {
do { do {
if (this.ct == 0) if (this.ct === 0)
this.byteIn(); this.byteIn();
this.a <<= 1; this.a <<= 1;
this.chigh = ((this.chigh << 1) & 0xFFFF) | ((this.clow >> 15) & 1); this.chigh = ((this.chigh << 1) & 0xFFFF) | ((this.clow >> 15) & 1);
this.clow = (this.clow << 1) & 0xFFFF; this.clow = (this.clow << 1) & 0xFFFF;
this.ct--; this.ct--;
} while ((this.a & 0x8000) == 0); } while ((this.a & 0x8000) === 0);
}, },
exchangeMps: function ArithmeticDecoder_exchangeMps(cx) { exchangeMps: function ArithmeticDecoder_exchangeMps(cx) {
var d; var d;
@ -261,7 +262,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
break; break;
default: default:
v = v * 2 + bit; v = v * 2 + bit;
if (--toRead == 0) if (--toRead === 0)
state = 0; state = 0;
continue; continue;
} }
@ -437,7 +438,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
offsetX, offsetY, prediction, at, offsetX, offsetY, prediction, at,
decodingContext) { decodingContext) {
var codingTemplate = RefinementTemplates[templateIndex].coding; var codingTemplate = RefinementTemplates[templateIndex].coding;
if (templateIndex == 0) if (templateIndex === 0)
codingTemplate = codingTemplate.concat([at[0]]); codingTemplate = codingTemplate.concat([at[0]]);
var codingTemplateLength = codingTemplate.length; var codingTemplateLength = codingTemplate.length;
var codingTemplateX = new Int32Array(codingTemplateLength); var codingTemplateX = new Int32Array(codingTemplateLength);
@ -447,7 +448,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
codingTemplateY[k] = codingTemplate[k].y; codingTemplateY[k] = codingTemplate[k].y;
} }
var referenceTemplate = RefinementTemplates[templateIndex].reference; var referenceTemplate = RefinementTemplates[templateIndex].reference;
if (templateIndex == 0) if (templateIndex === 0)
referenceTemplate = referenceTemplate.concat([at[1]]); referenceTemplate = referenceTemplate.concat([at[1]]);
var referenceTemplateLength = referenceTemplate.length; var referenceTemplateLength = referenceTemplate.length;
var referenceTemplateX = new Int32Array(referenceTemplateLength); var referenceTemplateX = new Int32Array(referenceTemplateLength);
@ -530,7 +531,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
var totalWidth = 0; var totalWidth = 0;
while (true) { while (true) {
var deltaWidth = decodeInteger(contextCache, 'IADW', decoder); // 6.5.7 var deltaWidth = decodeInteger(contextCache, 'IADW', decoder); // 6.5.7
if (deltaWidth == null) if (deltaWidth === null)
break; // OOB break; // OOB
currentWidth += deltaWidth; currentWidth += deltaWidth;
totalWidth += currentWidth; totalWidth += currentWidth;
@ -657,7 +658,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
i++; i++;
var deltaS = decodeInteger(contextCache, 'IADS', decoder); // 6.4.8 var deltaS = decodeInteger(contextCache, 'IADS', decoder); // 6.4.8
if (deltaS == null) if (deltaS === null)
break; // OOB break; // OOB
currentS += deltaS + dsOffset; currentS += deltaS + dsOffset;
} while (true); } while (true);
@ -779,7 +780,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
dictionary.refinementTemplate = (dictionaryFlags >> 12) & 1; dictionary.refinementTemplate = (dictionaryFlags >> 12) & 1;
position += 2; position += 2;
if (!dictionary.huffman) { if (!dictionary.huffman) {
var atLength = dictionary.template == 0 ? 4 : 1; var atLength = dictionary.template === 0 ? 4 : 1;
var at = []; var at = [];
for (var i = 0; i < atLength; i++) { for (var i = 0; i < atLength; i++) {
at.push({ at.push({
@ -865,7 +866,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
genericRegion.template = (genericRegionSegmentFlags >> 1) & 3; genericRegion.template = (genericRegionSegmentFlags >> 1) & 3;
genericRegion.prediction = !!(genericRegionSegmentFlags & 8); genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
if (!genericRegion.mmr) { if (!genericRegion.mmr) {
var atLength = genericRegion.template == 0 ? 4 : 1; var atLength = genericRegion.template === 0 ? 4 : 1;
var at = []; var at = [];
for (var i = 0; i < atLength; i++) { for (var i = 0; i < atLength; i++) {
at.push({ at.push({