From 8e060bdbca7fab0d7f65d4a247b63d24a825fd58 Mon Sep 17 00:00:00 2001 From: Kalervo Kujala Date: Thu, 22 Mar 2012 15:15:27 +0200 Subject: [PATCH] Use [] instead of new Array(...). --- src/bidi.js | 12 ++++-------- src/colorspace.js | 2 +- src/fonts.js | 4 ++-- src/function.js | 4 ++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/bidi.js b/src/bidi.js index aab477dbc..5f18e5303 100644 --- a/src/bidi.js +++ b/src/bidi.js @@ -132,9 +132,9 @@ var bidi = PDFJS.bidi = (function bidiClosure() { // get types, fill arrays - var chars = new Array(strLength); - var types = new Array(strLength); - var oldtypes = new Array(strLength); + var chars = []; + var types = []; + var oldtypes = []; var numBidi = 0; for (var i = 0; i < strLength; ++i) { @@ -176,16 +176,12 @@ var bidi = PDFJS.bidi = (function bidiClosure() { } } - var levels = new Array(strLength); + var levels = []; for (var i = 0; i < strLength; ++i) { levels[i] = startLevel; } - var diffChars = new Array(strLength); - var diffLevels = new Array(strLength); - var diffTypes = new Array(strLength); - /* X1-X10: skip most of this, since we are NOT doing the embeddings. */ diff --git a/src/colorspace.js b/src/colorspace.js index d3d392361..e1df7c725 100644 --- a/src/colorspace.js +++ b/src/colorspace.js @@ -220,7 +220,7 @@ var AlternateCS = (function AlternateCSClosure() { var baseNumComps = base.numComps; var baseBuf = new Uint8Array(baseNumComps * length); var numComps = this.numComps; - var scaled = new Array(numComps); + var scaled = []; for (var i = 0; i < length; i += numComps) { for (var z = 0; z < numComps; ++z) diff --git a/src/fonts.js b/src/fonts.js index 8473196a0..43efea34d 100644 --- a/src/fonts.js +++ b/src/fonts.js @@ -3652,7 +3652,7 @@ var CFFParser = (function CFFParserClosure() { var name = index.get(i); // OTS doesn't allow names to be over 127 characters. var length = Math.min(name.length, 127); - var data = new Array(length); + var data = []; // OTS also only permits certain characters in the name. for (var j = 0; j < length; ++j) { var c = name[j]; @@ -4502,7 +4502,7 @@ var CFFCompiler = (function CFFCompilerClosure() { return this.compileTypedArray(fdSelect); }, compileTypedArray: function compileTypedArray(data) { - var out = new Array(data.length); + var out = []; for (var i = 0, ii = data.length; i < ii; ++i) out[i] = data[i]; return out; diff --git a/src/function.js b/src/function.js index 4f81158f0..5ff5840c5 100644 --- a/src/function.js +++ b/src/function.js @@ -81,7 +81,7 @@ var PDFFunction = (function PDFFunctionClosure() { function toMultiArray(arr) { var inputLength = arr.length; var outputLength = arr.length / 2; - var out = new Array(outputLength); + var out = []; var index = 0; for (var i = 0; i < inputLength; i += 2) { out[index] = [arr[i], arr[i + 1]]; @@ -364,7 +364,7 @@ var PDFFunction = (function PDFFunctionClosure() { return cache.get(key); var stack = evaluator.execute(initialStack); - var transformed = new Array(numOutputs); + var transformed = []; for (i = numOutputs - 1; i >= 0; --i) { var out = stack.pop(); var rangeIndex = 2 * i;