[Pkg-javascript-commits] [pdf.js] 09/56: Remove some unused variables from src/
David Prévot
taffit at moszumanska.debian.org
Thu May 15 15:17:43 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 2e97c0d085d708959c632338ac37a50ddedaad38
Author: Rob Wu <rob at robwu.nl>
Date: Fri Apr 11 23:01:08 2014 +0200
Remove some unused variables from src/
Only obviously useless, local variables have been removed.
---
src/core/bidi.js | 40 ----------------------------------------
src/core/chunked_stream.js | 1 -
src/core/evaluator.js | 4 ----
src/core/font_renderer.js | 4 ----
src/core/fonts.js | 23 -----------------------
src/core/image.js | 1 -
src/core/jpx.js | 15 ++++-----------
src/core/obj.js | 2 --
src/core/parser.js | 2 --
src/core/pattern.js | 1 -
src/core/ps_parser.js | 1 -
src/core/stream.js | 1 -
src/display/canvas.js | 6 ------
src/display/pattern_helper.js | 5 ++---
src/shared/annotation.js | 8 +-------
src/shared/fonts_utils.js | 3 +--
src/shared/function.js | 3 +--
17 files changed, 9 insertions(+), 111 deletions(-)
diff --git a/src/core/bidi.js b/src/core/bidi.js
index a5aee27..16219ce 100644
--- a/src/core/bidi.js
+++ b/src/core/bidi.js
@@ -99,46 +99,6 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
}
}
- function mirrorGlyphs(c) {
- /*
- # BidiMirroring-1.txt
- 0028; 0029 # LEFT PARENTHESIS
- 0029; 0028 # RIGHT PARENTHESIS
- 003C; 003E # LESS-THAN SIGN
- 003E; 003C # GREATER-THAN SIGN
- 005B; 005D # LEFT SQUARE BRACKET
- 005D; 005B # RIGHT SQUARE BRACKET
- 007B; 007D # LEFT CURLY BRACKET
- 007D; 007B # RIGHT CURLY BRACKET
- 00AB; 00BB # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
- 00BB; 00AB # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
- */
- switch (c) {
- case '(':
- return ')';
- case ')':
- return '(';
- case '<':
- return '>';
- case '>':
- return '<';
- case ']':
- return '[';
- case '[':
- return ']';
- case '}':
- return '{';
- case '{':
- return '}';
- case '\u00AB':
- return '\u00BB';
- case '\u00BB':
- return '\u00AB';
- default:
- return c;
- }
- }
-
function createBidiText(str, isLTR, vertical) {
return {
str: str,
diff --git a/src/core/chunked_stream.js b/src/core/chunked_stream.js
index b82f26d..3dd9875 100644
--- a/src/core/chunked_stream.js
+++ b/src/core/chunked_stream.js
@@ -237,7 +237,6 @@ var ChunkedStream = (function ChunkedStreamClosure() {
var ChunkedStreamManager = (function ChunkedStreamManagerClosure() {
function ChunkedStreamManager(length, chunkSize, url, args) {
- var self = this;
this.stream = new ChunkedStream(length, chunkSize, this);
this.length = length;
this.chunkSize = chunkSize;
diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index 86106aa..afebf4b 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -509,7 +509,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var self = this;
var xref = this.xref;
- var handler = this.handler;
var imageCache = {};
operatorList = (operatorList || new OperatorList());
@@ -520,7 +519,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var stateManager = new StateManager(initialState || new EvalState());
var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
- var promise = new LegacyPromise();
var operation, i, ii;
while ((operation = preprocessor.read())) {
var args = operation.args;
@@ -706,7 +704,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
var xobjsCache = {};
var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
- var res = resources;
var operation;
var textState;
@@ -1091,7 +1088,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
readToUnicode: function PartialEvaluator_readToUnicode(toUnicode) {
var cmapObj = toUnicode;
- var charToUnicode = [];
if (isName(cmapObj)) {
return CMapFactory.create(cmapObj).map;
} else if (isStream(cmapObj)) {
diff --git a/src/core/font_renderer.js b/src/core/font_renderer.js
index ebaacc3..f02771c 100644
--- a/src/core/font_renderer.js
+++ b/src/core/font_renderer.js
@@ -148,10 +148,6 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
var i = 0;
var numberOfContours = ((code[i] << 24) | (code[i + 1] << 16)) >> 16;
- var xMin = ((code[i + 2] << 24) | (code[i + 3] << 16)) >> 16;
- var yMin = ((code[i + 4] << 24) | (code[i + 5] << 16)) >> 16;
- var xMax = ((code[i + 6] << 24) | (code[i + 7] << 16)) >> 16;
- var yMax = ((code[i + 8] << 24) | (code[i + 9] << 16)) >> 16;
var flags;
var x = 0, y = 0;
i += 10;
diff --git a/src/core/fonts.js b/src/core/fonts.js
index de0129d..36c02e9 100644
--- a/src/core/fonts.js
+++ b/src/core/fonts.js
@@ -2423,7 +2423,6 @@ var Font = (function FontClosure() {
var isIdentityUnicode = properties.isIdentityUnicode;
var newMap = Object.create(null);
var toFontChar = [];
- var usedCharCodes = [];
var usedFontCharCodes = [];
var nextAvailableFontCharCode = PRIVATE_USE_OFFSET_START;
for (var originalCharCode in charCodeToGlyphId) {
@@ -3049,8 +3048,6 @@ var Font = (function FontClosure() {
var firstCode = font.getUint16();
var entryCount = font.getUint16();
- var glyphs = [];
- var ids = [];
for (j = 0; j < entryCount; j++) {
glyphId = font.getUint16();
var charCode = firstCode + j;
@@ -3438,7 +3435,6 @@ var Font = (function FontClosure() {
}
font.pos = pos;
var nameIndex = record.name;
- var encoding = record.encoding ? 1 : 0;
if (record.encoding) {
// unicode
var str = '';
@@ -4030,8 +4026,6 @@ var Font = (function FontClosure() {
// to write the table entry information about a table and another offset
// representing the offset where to draw the actual data of a particular
// table
- var REQ_TABLES_CNT = 9;
-
var otf = {
file: '',
virtualOffset: 9 * (4 * 4)
@@ -5812,7 +5806,6 @@ var CFFParser = (function CFFParserClosure() {
var bytes = this.bytes;
var count = (bytes[pos++] << 8) | bytes[pos++];
var offsets = [];
- var start = pos;
var end = pos;
var i, ii;
@@ -5875,8 +5868,6 @@ var CFFParser = (function CFFParserClosure() {
},
createDict: function CFFParser_createDict(Type, dict, strings) {
var cffDict = new Type(strings);
- var types = cffDict.types;
-
for (var i = 0, ii = dict.length; i < ii; ++i) {
var pair = dict[i];
var key = pair[0];
@@ -6444,11 +6435,6 @@ var CFFCharsetPredefinedTypes = {
EXPERT: 1,
EXPERT_SUBSET: 2
};
-var CFFCharsetEmbeddedTypes = {
- FORMAT0: 0,
- FORMAT1: 1,
- FORMAT2: 2
-};
var CFFCharset = (function CFFCharsetClosure() {
function CFFCharset(predefined, format, charset, raw) {
this.predefined = predefined;
@@ -6459,14 +6445,6 @@ var CFFCharset = (function CFFCharsetClosure() {
return CFFCharset;
})();
-var CFFEncodingPredefinedTypes = {
- STANDARD: 0,
- EXPERT: 1
-};
-var CFFCharsetEmbeddedTypes = {
- FORMAT0: 0,
- FORMAT1: 1
-};
var CFFEncoding = (function CFFEncodingClosure() {
function CFFEncoding(predefined, format, encoding, raw) {
this.predefined = predefined;
@@ -6930,7 +6908,6 @@ var CFFCompiler = (function CFFCompilerClosure() {
relativeOffset += objects[i].length;
}
}
- var offset = data.length;
for (i = 0; i < count; i++) {
// Notify the tracker where the object will be offset in the data.
diff --git a/src/core/image.js b/src/core/image.js
index 14f93f3..5b913f6 100644
--- a/src/core/image.js
+++ b/src/core/image.js
@@ -265,7 +265,6 @@ var PDFImage = (function PDFImageClosure() {
},
decodeBuffer: function PDFImage_decodeBuffer(buffer) {
var bpc = this.bpc;
- var decodeMap = this.decode;
var numComps = this.numComps;
var decodeAddends = this.decodeAddends;
diff --git a/src/core/jpx.js b/src/core/jpx.js
index 392f9a6..66815b0 100644
--- a/src/core/jpx.js
+++ b/src/core/jpx.js
@@ -428,7 +428,6 @@ var JpxImage = (function JpxImageClosure() {
var componentsCount = siz.Csiz;
for (var i = 0, ii = componentsCount; i < ii; i++) {
var component = components[i];
- var tileComponents = [];
for (var j = 0, jj = tiles.length; j < jj; j++) {
var tileComponent = {};
tile = tiles[j];
@@ -497,7 +496,7 @@ var JpxImage = (function JpxImageClosure() {
var precinctParameters = subband.resolution.precinctParameters;
var codeblocks = [];
var precincts = [];
- var i, ii, j, codeblock, precinctNumber;
+ var i, j, codeblock, precinctNumber;
for (j = cby0; j < cby1; j++) {
for (i = cbx0; i < cbx1; i++) {
codeblock = {
@@ -522,8 +521,6 @@ var JpxImage = (function JpxImageClosure() {
codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
codeblock.precinctNumber = precinctNumber;
codeblock.subbandType = subband.type;
- var coefficientsLength = (codeblock.tbx1_ - codeblock.tbx0_) *
- (codeblock.tby1_ - codeblock.tby0_);
codeblock.Lblock = 3;
codeblocks.push(codeblock);
// building precinct for the sub-band
@@ -742,7 +739,6 @@ var JpxImage = (function JpxImageClosure() {
}
// Generate the packets sequence
var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
- var packetsIterator;
switch (progressionOrder) {
case 0:
tile.packetsIterator =
@@ -966,7 +962,7 @@ var JpxImage = (function JpxImageClosure() {
}
var offset = (codeblock.tbx0_ - x0) + (codeblock.tby0_ - y0) * width;
- var n, nb, correction, position = 0;
+ var n, nb, position = 0;
var irreversible = !reversible;
var sign = bitModel.coefficentsSign;
var magnitude = bitModel.coefficentsMagnitude;
@@ -1077,7 +1073,7 @@ var JpxImage = (function JpxImageClosure() {
// Section G.2.2 Inverse multi component transform
var y0items, y1items, y2items, j, jj, y0, y1, y2;
- var component, offset, tileImage, items;
+ var component, tileImage, items;
if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
var component0 = tile.components[0];
if (!component0.codingStyleParameters.reversibleTransformation) {
@@ -1130,7 +1126,6 @@ var JpxImage = (function JpxImageClosure() {
var siz = context.SIZ;
var componentsCount = siz.Csiz;
var tile = context.tiles[tileIndex];
- var resultTiles = [];
for (var c = 0; c < componentsCount; c++) {
var component = tile.components[c];
var qcdOrQcc = (c in context.currentTile.QCC ?
@@ -1393,7 +1388,6 @@ var JpxImage = (function JpxImageClosure() {
var width = this.width, height = this.height;
var coefficentsMagnitude = this.coefficentsMagnitude;
var coefficentsSign = this.coefficentsSign;
- var contextLabels = this.contextLabels;
var neighborsSignificance = this.neighborsSignificance;
var processingFlags = this.processingFlags;
var contexts = this.contexts;
@@ -1531,7 +1525,6 @@ var JpxImage = (function JpxImageClosure() {
var decoder = this.decoder;
var width = this.width, height = this.height;
var neighborsSignificance = this.neighborsSignificance;
- var significanceState = this.significanceState;
var coefficentsMagnitude = this.coefficentsMagnitude;
var coefficentsSign = this.coefficentsSign;
var contexts = this.contexts;
@@ -1795,7 +1788,7 @@ var JpxImage = (function JpxImageClosure() {
var delta = 0.443506852043971;
var K = 1.230174104914001;
var K_ = 1 / K;
- var j, n, nn;
+ var j, n;
// step 1 is combined with step 3
diff --git a/src/core/obj.js b/src/core/obj.js
index 86a6da5..cd1cf70 100644
--- a/src/core/obj.js
+++ b/src/core/obj.js
@@ -940,8 +940,6 @@ var XRef = (function XRefClosure() {
var buffer = stream.getBytes();
var position = stream.start, length = buffer.length;
var trailers = [], xrefStms = [];
- var state = 0;
- var currentToken;
while (position < length) {
var ch = buffer[position];
if (ch === 32 || ch === 9 || ch === 13 || ch === 10) {
diff --git a/src/core/parser.js b/src/core/parser.js
index fb5e20f..887d37b 100644
--- a/src/core/parser.js
+++ b/src/core/parser.js
@@ -503,7 +503,6 @@ var Lexer = (function LexerClosure() {
} else if (ch === 0x45 || ch === 0x65) { // 'E', 'e'
// 'E' can be either a scientific notation or the beginning of a new
// operator
- var hasE = true;
ch = this.peekChar();
if (ch === 0x2B || ch === 0x2D) { // '+', '-'
powerValueSign = (ch === 0x2D) ? -1 : 1;
@@ -781,7 +780,6 @@ var Lexer = (function LexerClosure() {
return Cmd.get(str);
},
skipToNextLine: function Lexer_skipToNextLine() {
- var stream = this.stream;
var ch = this.currentChar;
while (ch >= 0) {
if (ch === 0x0D) { // CR
diff --git a/src/core/pattern.js b/src/core/pattern.js
index f84567e..7295754 100644
--- a/src/core/pattern.js
+++ b/src/core/pattern.js
@@ -361,7 +361,6 @@ Shadings.Mesh = (function MeshClosure() {
function decodeType5Shading(mesh, reader, verticesPerRow) {
var coords = mesh.coords;
var colors = mesh.colors;
- var operators = [];
var ps = []; // not maintaining cs since that will match ps
while (reader.hasData) {
var coord = reader.readCoordinate();
diff --git a/src/core/ps_parser.js b/src/core/ps_parser.js
index f036251..9aa6f09 100644
--- a/src/core/ps_parser.js
+++ b/src/core/ps_parser.js
@@ -143,7 +143,6 @@ var PostScriptLexer = (function PostScriptLexerClosure() {
return (this.currentChar = this.stream.getByte());
},
getToken: function PostScriptLexer_getToken() {
- var s = '';
var comment = false;
var ch = this.currentChar;
diff --git a/src/core/stream.js b/src/core/stream.js
index 0faa56b..02235bc 100644
--- a/src/core/stream.js
+++ b/src/core/stream.js
@@ -2212,7 +2212,6 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
var code = 0;
var p;
- var n;
if (this.eoblock) {
code = this.lookBits(12);
if (code == EOF) {
diff --git a/src/display/canvas.js b/src/display/canvas.js
index 9e77e22..355f7a3 100644
--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -462,7 +462,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
// imgData.kind tells us which one this is.
if (imgData.kind === ImageKind.GRAYSCALE_1BPP) {
// Grayscale, 1 bit per pixel (i.e. black-and-white).
- var destDataLength = dest.length;
var srcLength = src.byteLength;
var dest32 = PDFJS.hasCanvasTypedArrays ? new Uint32Array(dest.buffer) :
new Uint32ArrayView(dest);
@@ -733,7 +732,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
return i;
}
- var executionEndIdx;
var endTime = Date.now() + EXECUTION_TIME;
var commonObjs = this.commonObjs;
@@ -1309,7 +1307,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var vertical = font.vertical;
var defaultVMetrics = font.defaultVMetrics;
var i, glyph, width;
- var VERTICAL_TEXT_ROTATION = Math.PI / 2;
if (fontSize === 0) {
return;
@@ -1437,7 +1434,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
}
},
showSpacedText: function CanvasGraphics_showSpacedText(arr) {
- var ctx = this.ctx;
var current = this.current;
var font = current.font;
var fontSize = current.fontSize;
@@ -1513,8 +1509,6 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
var base = cs.base;
var color;
if (base) {
- var baseComps = base.numComps;
-
color = base.getRgb(args, 0);
}
pattern = new TilingPattern(IR, color, this.ctx, this.objs,
diff --git a/src/display/pattern_helper.js b/src/display/pattern_helper.js
index 8359d67..d2a8c79 100644
--- a/src/display/pattern_helper.js
+++ b/src/display/pattern_helper.js
@@ -215,13 +215,13 @@ var createMeshCanvas = (function createMeshCanvasClosure() {
ShadingIRs.Mesh = {
fromIR: function Mesh_fromIR(raw) {
- var type = raw[1];
+ //var type = raw[1];
var coords = raw[2];
var colors = raw[3];
var figures = raw[4];
var bounds = raw[5];
var matrix = raw[6];
- var bbox = raw[7];
+ //var bbox = raw[7];
var background = raw[8];
return {
type: 'Pattern',
@@ -318,7 +318,6 @@ var TilingPattern = (function TilingPatternClosure() {
var color = this.color;
var objs = this.objs;
var commonObjs = this.commonObjs;
- var ctx = this.ctx;
info('TilingType: ' + tilingType);
diff --git a/src/shared/annotation.js b/src/shared/annotation.js
index 31bbf1a..6c740a6 100644
--- a/src/shared/annotation.js
+++ b/src/shared/annotation.js
@@ -237,8 +237,6 @@ var Annotation = (function AnnotationClosure() {
var matrix = appearanceDict.get('Matrix') || [1, 0, 0, 1, 0 ,0];
var transform = getTransformMatrix(data.rect, bbox, matrix);
- var border = data.border;
-
resourcesPromise.then(function(resources) {
var opList = new OperatorList();
opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]);
@@ -464,7 +462,6 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
}
- var parent = WidgetAnnotation.prototype;
Util.inherit(TextWidgetAnnotation, WidgetAnnotation, {
hasHtml: function TextWidgetAnnotation_hasHtml() {
return !this.data.hasAppearance && !!this.data.fieldValue;
@@ -487,7 +484,7 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
var fontObj = item.fontRefName ?
commonObjs.getData(item.fontRefName) : null;
- var cssRules = setTextStyles(content, item, fontObj);
+ setTextStyles(content, item, fontObj);
element.appendChild(content);
@@ -519,7 +516,6 @@ var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
var appearanceFnArray = opList.fnArray;
var appearanceArgsArray = opList.argsArray;
var fnArray = [];
- var argsArray = [];
// TODO(mack): Add support for stroke color
data.rgb = [0, 0, 0];
@@ -735,7 +731,6 @@ var TextAnnotation = (function TextAnnotationClosure() {
}
};
- var self = this;
image.addEventListener('click', function image_clickHandler() {
toggleAnnotation();
}, false);
@@ -840,7 +835,6 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
container.className = 'annotLink';
var item = this.data;
- var rect = item.rect;
container.style.borderColor = item.colorCssRgb;
container.style.borderStyle = 'solid';
diff --git a/src/shared/fonts_utils.js b/src/shared/fonts_utils.js
index a2dc4dc..57b8e19 100644
--- a/src/shared/fonts_utils.js
+++ b/src/shared/fonts_utils.js
@@ -88,7 +88,7 @@ function readCharstringEncoding(aString) {
} else if (value <= 18) {
token = CFFEncodingMap[value];
} else if (value <= 20) {
- var mask = aString[i++];
+ ++i; // var mask = aString[i++];
token = CFFEncodingMap[value];
} else if (value <= 27) {
token = CFFEncodingMap[value];
@@ -340,7 +340,6 @@ var Type2Parser = function type2Parser(aFilePath) {
}
// Parse the TopDict operator
- var objects = [];
var count = topDict.length;
for (i = 0; i < count; i++) {
parseAsToken(topDict[i], CFFDictDataMap);
diff --git a/src/shared/function.js b/src/shared/function.js
index 1ed30ad..1ece43f 100644
--- a/src/shared/function.js
+++ b/src/shared/function.js
@@ -99,7 +99,6 @@ var PDFFunction = (function PDFFunctionClosure() {
constructSampled: function PDFFunction_constructSampled(str, dict) {
function toMultiArray(arr) {
var inputLength = arr.length;
- var outputLength = arr.length / 2;
var out = [];
var index = 0;
for (var i = 0; i < inputLength; i += 2) {
@@ -170,7 +169,7 @@ var PDFFunction = (function PDFFunctionClosure() {
var samples = IR[5];
var size = IR[6];
var n = IR[7];
- var mask = IR[8];
+ //var mask = IR[8];
var range = IR[9];
if (m != args.length) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list