1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #7972 from Snuffleupagus/eslint_no-unused-vars

Enable the `no-unused-vars` ESLint rule
This commit is contained in:
Tim van der Meij 2017-02-01 23:50:23 +01:00 committed by GitHub
commit 6f0cf8c4cb
23 changed files with 37 additions and 85 deletions

View file

@ -38,7 +38,6 @@ var AnnotationFlag = sharedUtil.AnnotationFlag;
var AnnotationType = sharedUtil.AnnotationType;
var OPS = sharedUtil.OPS;
var Util = sharedUtil.Util;
var isString = sharedUtil.isString;
var isArray = sharedUtil.isArray;
var isInt = sharedUtil.isInt;
var stringToBytes = sharedUtil.stringToBytes;

View file

@ -785,7 +785,6 @@ var CFFParser = (function CFFParserClosure() {
var encoding = Object.create(null);
var bytes = this.bytes;
var predefined = false;
var hasSupplement = false;
var format, i, ii;
var raw = null;
@ -836,7 +835,7 @@ var CFFParser = (function CFFParserClosure() {
break;
}
var dataEnd = pos;
if (format & 0x80) {
if (format & 0x80) { // hasSupplement
// The font sanitizer does not support CFF encoding with a
// supplement, since the encoding is not really used to map
// between gid to glyph, let's overwrite what is declared in
@ -844,7 +843,6 @@ var CFFParser = (function CFFParserClosure() {
// StandardEncoding, that's a lie but that's ok.
bytes[dataStart] &= 0x7f;
readSupplement();
hasSupplement = true;
}
raw = bytes.subarray(dataStart, dataEnd);
}

View file

@ -1084,30 +1084,6 @@ var AES128Cipher = (function AES128CipherClosure() {
})();
var AES256Cipher = (function AES256CipherClosure() {
var rcon = new Uint8Array([
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0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,
0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
0x74, 0xe8, 0xcb, 0x8d]);
var s = new Uint8Array([
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b,
0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,

View file

@ -1296,22 +1296,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var width = 0;
var height = 0;
var glyphs = font.charsToGlyphs(chars);
var defaultVMetrics = font.defaultVMetrics;
for (var i = 0; i < glyphs.length; i++) {
var glyph = glyphs[i];
var vMetricX = null;
var vMetricY = null;
var glyphWidth = null;
if (font.vertical) {
if (glyph.vmetric) {
glyphWidth = glyph.vmetric[0];
vMetricX = glyph.vmetric[1];
vMetricY = glyph.vmetric[2];
} else {
glyphWidth = glyph.width;
vMetricX = glyph.width * 0.5;
vMetricY = defaultVMetrics[2];
}
if (font.vertical && glyph.vmetric) {
glyphWidth = glyph.vmetric[0];
} else {
glyphWidth = glyph.width;
}
@ -1323,18 +1312,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
}
glyphUnicode = reverseIfRtl(glyphUnicode);
// The following will calculate the x and y of the individual glyphs.
// if (font.vertical) {
// tsm[4] -= vMetricX * Math.abs(textState.fontSize) *
// textState.fontMatrix[0];
// tsm[5] -= vMetricY * textState.fontSize *
// textState.fontMatrix[0];
// }
// var trm = Util.transform(textState.textMatrix, tsm);
// var pt = Util.applyTransform([trm[4], trm[5]], textState.ctm);
// var x = pt[0];
// var y = pt[1];
var charSpacing = textState.charSpacing;
if (glyph.isSpace) {
var wordSpacing = textState.wordSpacing;

View file

@ -53,9 +53,9 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
var offset = (getUshort(data, start + 2) === 1 ?
getLong(data, start + 8) : getLong(data, start + 16));
var format = getUshort(data, start + offset);
var length, ranges, p, i;
var ranges, p, i;
if (format === 4) {
length = getUshort(data, start + offset + 2);
getUshort(data, start + offset + 2); // length
var segCount = getUshort(data, start + offset + 6) >> 1;
p = start + offset + 14;
ranges = [];
@ -82,7 +82,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
}
return ranges;
} else if (format === 12) {
length = getLong(data, start + offset + 4);
getLong(data, start + offset + 4); // length
var groups = getLong(data, start + offset + 12);
p = start + offset + 16;
ranges = [];

View file

@ -594,9 +594,6 @@ var Font = (function FontClosure() {
this.glyphCache = Object.create(null);
var names = name.split('+');
names = names.length > 1 ? names[1] : names[0];
names = names.split(/[-,_]/g)[0];
this.isSerifFont = !!(properties.flags & FontFlags.Serif);
this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
@ -1409,7 +1406,7 @@ var Font = (function FontClosure() {
var start = (font.start ? font.start : 0) + cmap.offset;
font.pos = start;
var version = font.getUint16();
font.getUint16(); // version
var numTables = font.getUint16();
var potentialTable;
@ -1471,8 +1468,8 @@ var Font = (function FontClosure() {
}
var format = font.getUint16();
var length = font.getUint16();
var language = font.getUint16();
font.getUint16(); // length
font.getUint16(); // language
var hasShortCmap = false;
var mappings = [];

View file

@ -432,14 +432,12 @@ var Jbig2Image = (function Jbig2ImageClosure() {
var deltaHeight = decodeInteger(contextCache, 'IADH', decoder); // 6.5.6
currentHeight += deltaHeight;
var currentWidth = 0;
var totalWidth = 0;
while (true) {
var deltaWidth = decodeInteger(contextCache, 'IADW', decoder); // 6.5.7
if (deltaWidth === null) {
break; // OOB
}
currentWidth += deltaWidth;
totalWidth += currentWidth;
var bitmap;
if (refinement) {
// 6.5.8.2 Refinement/aggregate-coded symbol bitmap
@ -889,7 +887,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
delete pageInfo.height;
}
var pageSegmentFlags = data[position + 16];
var pageStripingInformation = readUint16(data, position + 17);
readUint16(data, position + 17); // pageStripingInformation
pageInfo.lossless = !!(pageSegmentFlags & 1);
pageInfo.refinement = !!(pageSegmentFlags & 2);
pageInfo.defaultPixelValue = (pageSegmentFlags >> 2) & 1;
@ -923,7 +921,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
}
}
function parseJbig2(data, start, end) {
function parseJbig2(data, start, end) { // eslint-disable-line no-unused-vars
var position = start;
if (data[position] !== 0x97 || data[position + 1] !== 0x4A ||
data[position + 2] !== 0x42 || data[position + 3] !== 0x32 ||
@ -939,7 +937,7 @@ var Jbig2Image = (function Jbig2ImageClosure() {
header.numberOfPages = readUint32(data, position);
position += 4;
}
var segments = readSegments(header, data, position, end);
readSegments(header, data, position, end); // segments
error('Not implemented');
// processSegments(segments, new SimpleSegmentVisitor());
}

View file

@ -790,7 +790,7 @@ var JpegImage = (function JpegImageClosure() {
break;
case 0xFFDA: // SOS (Start of Scan)
var scanLength = readUint16();
readUint16(); // scanLength
var selectorsCount = data[offset++];
var components = [], component;
for (i = 0; i < selectorsCount; i++) {

View file

@ -38,7 +38,6 @@ var isInt = sharedUtil.isInt;
var isArray = sharedUtil.isArray;
var createObjectURL = sharedUtil.createObjectURL;
var shadow = sharedUtil.shadow;
var warn = sharedUtil.warn;
var isSpace = sharedUtil.isSpace;
var Dict = corePrimitives.Dict;
var isDict = corePrimitives.isDict;

View file

@ -251,7 +251,7 @@ var Type1CharString = (function Type1CharStringClosure() {
// first part of the charstring and then use rmoveto with
// (dx, dy). The height argument will not be used for vmtx and
// vhea tables reconstruction -- ignoring it.
var wy = this.stack.pop();
this.stack.pop(); // wy
wx = this.stack.pop();
var sby = this.stack.pop();
sbx = this.stack.pop();
@ -579,7 +579,7 @@ var Type1Parser = (function Type1ParserClosure() {
}
break;
case 'Subrs':
var num = this.readInt();
this.readInt(); // num
this.getToken(); // read in 'array'
while ((token = this.getToken()) === 'dup') {
var index = this.readInt();

View file

@ -36,7 +36,6 @@ var MessageHandler = sharedUtil.MessageHandler;
var MissingPDFException = sharedUtil.MissingPDFException;
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;
var PasswordException = sharedUtil.PasswordException;
var PasswordResponses = sharedUtil.PasswordResponses;
var UnknownErrorException = sharedUtil.UnknownErrorException;
var XRefParseException = sharedUtil.XRefParseException;
var arrayByteLength = sharedUtil.arrayByteLength;
@ -448,7 +447,7 @@ var WorkerMessageHandler = {
var responseExists = 'response' in xhr;
// check if the property is actually implemented
try {
var dummy = xhr.responseType;
xhr.responseType; // eslint-disable-line no-unused-expressions
} catch (e) {
responseExists = false;
}

View file

@ -39,7 +39,6 @@ var InvalidPDFException = sharedUtil.InvalidPDFException;
var MessageHandler = sharedUtil.MessageHandler;
var MissingPDFException = sharedUtil.MissingPDFException;
var PageViewport = sharedUtil.PageViewport;
var PasswordResponses = sharedUtil.PasswordResponses;
var PasswordException = sharedUtil.PasswordException;
var StatTimer = sharedUtil.StatTimer;
var UnexpectedResponseException = sharedUtil.UnexpectedResponseException;

View file

@ -13,6 +13,7 @@
* limitations under the License.
*/
/* eslint strict: ["error", "function"] */
/* eslint-disable no-unused-vars */
/* umdutils ignore */
(function (root, factory) {