Fixes some static analysis warnings and recommendations

* Useless conditional
* Superfluous trailing arguments
* Useless assignment to local variable
* Misspelled identifier
* JSDoc tag for non-existent parameter
This commit is contained in:
Yury Delendik 2016-05-02 17:34:58 -05:00
parent d20002b6b1
commit 32ce369d88
9 changed files with 32 additions and 43 deletions

View File

@ -331,7 +331,7 @@ var CFFParser = (function CFFParserClosure() {
function parseOperand() {
var value = dict[pos++];
if (value === 30) {
return parseFloatOperand(pos);
return parseFloatOperand();
} else if (value === 28) {
value = dict[pos++];
value = ((value << 24) | (dict[pos++] << 16)) >> 16;

View File

@ -1779,7 +1779,6 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
pdfAlgorithm = new PDF17();
}
if (pdfAlgorithm) {
if (pdfAlgorithm.checkUserPassword(password, userValidationSalt,
userPassword)) {
return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
@ -1790,7 +1789,6 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes,
ownerEncryption);
}
}
return null;
}

View File

@ -19,33 +19,30 @@
if (typeof define === 'function' && define.amd) {
define('pdfjs/core/fonts', ['exports', 'pdfjs/shared/util',
'pdfjs/core/primitives', 'pdfjs/core/stream', 'pdfjs/core/parser',
'pdfjs/core/glyphlist', 'pdfjs/core/charsets',
'pdfjs/core/font_renderer', 'pdfjs/core/encodings',
'pdfjs/core/standard_fonts', 'pdfjs/core/unicode',
'pdfjs/core/glyphlist', 'pdfjs/core/font_renderer',
'pdfjs/core/encodings', 'pdfjs/core/standard_fonts', 'pdfjs/core/unicode',
'pdfjs/core/type1_parser', 'pdfjs/core/cff_parser'], factory);
} else if (typeof exports !== 'undefined') {
factory(exports, require('../shared/util.js'), require('./primitives.js'),
require('./stream.js'), require('./parser.js'),
require('./glyphlist.js'), require('./charsets.js'),
require('./stream.js'), require('./parser.js'), require('./glyphlist.js'),
require('./font_renderer.js'), require('./encodings.js'),
require('./standard_fonts.js'), require('./unicode.js'),
require('./type1_parser.js'), require('./cff_parser.js'));
} else {
factory((root.pdfjsCoreFonts = {}), root.pdfjsSharedUtil,
root.pdfjsCorePrimitives, root.pdfjsCoreStream, root.pdfjsCoreParser,
root.pdfjsCoreGlyphList, root.pdfjsCoreCharsets,
root.pdfjsCoreFontRenderer, root.pdfjsCoreEncodings,
root.pdfjsCoreStandardFonts, root.pdfjsCoreUnicode,
root.pdfjsCoreType1Parser, root.pdfjsCoreCFFParser);
root.pdfjsCoreGlyphList, root.pdfjsCoreFontRenderer,
root.pdfjsCoreEncodings, root.pdfjsCoreStandardFonts,
root.pdfjsCoreUnicode, root.pdfjsCoreType1Parser,
root.pdfjsCoreCFFParser);
}
}(this, function (exports, sharedUtil, corePrimitives, coreStream, coreParser,
coreGlyphList, coreCharsets, coreFontRenderer,
coreEncodings, coreStandardFonts, coreUnicode,
coreType1Parser, coreCFFParser) {
coreGlyphList, coreFontRenderer, coreEncodings,
coreStandardFonts, coreUnicode, coreType1Parser,
coreCFFParser) {
var FONT_IDENTITY_MATRIX = sharedUtil.FONT_IDENTITY_MATRIX;
var FontType = sharedUtil.FontType;
var Util = sharedUtil.Util;
var assert = sharedUtil.assert;
var bytesToString = sharedUtil.bytesToString;
var error = sharedUtil.error;
@ -55,7 +52,6 @@ var isInt = sharedUtil.isInt;
var isNum = sharedUtil.isNum;
var readUint32 = sharedUtil.readUint32;
var shadow = sharedUtil.shadow;
var stringToBytes = sharedUtil.stringToBytes;
var string32 = sharedUtil.string32;
var warn = sharedUtil.warn;
var MissingDataException = sharedUtil.MissingDataException;
@ -63,16 +59,11 @@ var Stream = coreStream.Stream;
var Lexer = coreParser.Lexer;
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
var getDingbatsGlyphsUnicode = coreGlyphList.getDingbatsGlyphsUnicode;
var ISOAdobeCharset = coreCharsets.ISOAdobeCharset;
var ExpertCharset = coreCharsets.ExpertCharset;
var ExpertSubsetCharset = coreCharsets.ExpertSubsetCharset;
var FontRendererFactory = coreFontRenderer.FontRendererFactory;
var WinAnsiEncoding = coreEncodings.WinAnsiEncoding;
var StandardEncoding = coreEncodings.StandardEncoding;
var MacRomanEncoding = coreEncodings.MacRomanEncoding;
var SymbolSetEncoding = coreEncodings.SymbolSetEncoding;
var ZapfDingbatsEncoding = coreEncodings.ZapfDingbatsEncoding;
var ExpertEncoding = coreEncodings.ExpertEncoding;
var getEncoding = coreEncodings.getEncoding;
var getStdFontMap = coreStandardFonts.getStdFontMap;
var getNonStdFontMap = coreStandardFonts.getNonStdFontMap;
@ -2070,7 +2061,7 @@ var Font = (function FontClosure() {
}
}
function sanitizeTTPrograms(fpgm, prep, cvt) {
function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
var ttContext = {
functionsDefined: [],
functionsUsed: [],
@ -2827,7 +2818,8 @@ var ErrorFont = (function ErrorFontClosure() {
* @param {Object} properties Font properties object.
* @param {Object} builtInEncoding The encoding contained within the actual font
* data.
* @param {Array} Array of glyph names where the index is the glyph ID.
* @param {Array} glyphNames Array of glyph names where the index is the
* glyph ID.
* @returns {Object} A char code to glyph ID map.
*/
function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {

View File

@ -1259,7 +1259,7 @@ var JpxImage = (function JpxImageClosure() {
for (j = 0; j < codingpasses; j++) {
switch (currentCodingpassType) {
case 0:
bitModel.runSignificancePropogationPass();
bitModel.runSignificancePropagationPass();
break;
case 1:
bitModel.runMagnitudeRefinementPass();
@ -1738,8 +1738,8 @@ var JpxImage = (function JpxImageClosure() {
}
neighborsSignificance[index] |= 0x80;
},
runSignificancePropogationPass:
function BitModel_runSignificancePropogationPass() {
runSignificancePropagationPass:
function BitModel_runSignificancePropagationPass() {
var decoder = this.decoder;
var width = this.width, height = this.height;
var coefficentsMagnitude = this.coefficentsMagnitude;

View File

@ -810,7 +810,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
return;
}
stats.time('Rendering');
internalRenderTask.initalizeGraphics(transparency);
internalRenderTask.initializeGraphics(transparency);
internalRenderTask.operatorListChanged();
},
function pageDisplayReadPromiseError(reason) {
@ -1937,8 +1937,8 @@ var InternalRenderTask = (function InternalRenderTaskClosure() {
InternalRenderTask.prototype = {
initalizeGraphics:
function InternalRenderTask_initalizeGraphics(transparency) {
initializeGraphics:
function InternalRenderTask_initializeGraphics(transparency) {
if (this.cancelled) {
return;

View File

@ -1302,7 +1302,7 @@ function createPromiseCapability() {
/**
* Builds a promise that is resolved when all the passed in promises are
* resolved.
* @param {array} array of data and/or promises to wait for.
* @param {array} promises array of data and/or promises to wait for.
* @return {Promise} New dependant promise.
*/
Promise.all = function Promise_all(promises) {

View File

@ -38,7 +38,6 @@
PDFHistory.prototype = {
/**
* @param {string} fingerprint
* @param {IPDFLinkService} linkService
*/
initialize: function pdfHistoryInitialize(fingerprint) {
this.initialized = true;

View File

@ -135,7 +135,7 @@ var PDFOutlineViewer = (function PDFOutlineViewerClosure() {
* Toggle the visibility of the subtree of an outline item.
*
* @param {Element} root - the root of the outline (sub)tree.
* @param {boolean} state - whether to show the outline (sub)tree. If false,
* @param {boolean} show - whether to show the outline (sub)tree. If false,
* the outline subtree rooted at |root| will be collapsed.
*
* @private

View File

@ -170,7 +170,7 @@ var PDFThumbnailViewer = (function PDFThumbnailViewerClosure() {
},
/**
* @param {PDFPageView} pageView
* @param {PDFThumbnailView} thumbView
* @returns {PDFPage}
* @private
*/