Merge pull request #1382 from kkujala/master

Use [] instead of new Array(...).
This commit is contained in:
notmasteryet 2012-03-24 10:00:46 -07:00
commit 32eb64389e
4 changed files with 9 additions and 13 deletions

View File

@ -132,9 +132,9 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
// get types, fill arrays // get types, fill arrays
var chars = new Array(strLength); var chars = [];
var types = new Array(strLength); var types = [];
var oldtypes = new Array(strLength); var oldtypes = [];
var numBidi = 0; var numBidi = 0;
for (var i = 0; i < strLength; ++i) { 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) { for (var i = 0; i < strLength; ++i) {
levels[i] = startLevel; 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. X1-X10: skip most of this, since we are NOT doing the embeddings.
*/ */

View File

@ -220,7 +220,7 @@ var AlternateCS = (function AlternateCSClosure() {
var baseNumComps = base.numComps; var baseNumComps = base.numComps;
var baseBuf = new Uint8Array(baseNumComps * length); var baseBuf = new Uint8Array(baseNumComps * length);
var numComps = this.numComps; var numComps = this.numComps;
var scaled = new Array(numComps); var scaled = [];
for (var i = 0; i < length; i += numComps) { for (var i = 0; i < length; i += numComps) {
for (var z = 0; z < numComps; ++z) for (var z = 0; z < numComps; ++z)

View File

@ -3703,7 +3703,7 @@ var CFFParser = (function CFFParserClosure() {
var name = index.get(i); var name = index.get(i);
// OTS doesn't allow names to be over 127 characters. // OTS doesn't allow names to be over 127 characters.
var length = Math.min(name.length, 127); var length = Math.min(name.length, 127);
var data = new Array(length); var data = [];
// OTS also only permits certain characters in the name. // OTS also only permits certain characters in the name.
for (var j = 0; j < length; ++j) { for (var j = 0; j < length; ++j) {
var c = name[j]; var c = name[j];
@ -4553,7 +4553,7 @@ var CFFCompiler = (function CFFCompilerClosure() {
return this.compileTypedArray(fdSelect); return this.compileTypedArray(fdSelect);
}, },
compileTypedArray: function compileTypedArray(data) { compileTypedArray: function compileTypedArray(data) {
var out = new Array(data.length); var out = [];
for (var i = 0, ii = data.length; i < ii; ++i) for (var i = 0, ii = data.length; i < ii; ++i)
out[i] = data[i]; out[i] = data[i];
return out; return out;

View File

@ -81,7 +81,7 @@ var PDFFunction = (function PDFFunctionClosure() {
function toMultiArray(arr) { function toMultiArray(arr) {
var inputLength = arr.length; var inputLength = arr.length;
var outputLength = arr.length / 2; var outputLength = arr.length / 2;
var out = new Array(outputLength); var out = [];
var index = 0; var index = 0;
for (var i = 0; i < inputLength; i += 2) { for (var i = 0; i < inputLength; i += 2) {
out[index] = [arr[i], arr[i + 1]]; out[index] = [arr[i], arr[i + 1]];
@ -364,7 +364,7 @@ var PDFFunction = (function PDFFunctionClosure() {
return cache.get(key); return cache.get(key);
var stack = evaluator.execute(initialStack); var stack = evaluator.execute(initialStack);
var transformed = new Array(numOutputs); var transformed = [];
for (i = numOutputs - 1; i >= 0; --i) { for (i = numOutputs - 1; i >= 0; --i) {
var out = stack.pop(); var out = stack.pop();
var rangeIndex = 2 * i; var rangeIndex = 2 * i;