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

Lint: correct code style violations

Manual observations and working with other linting tools found these.
This commit is contained in:
Tim van der Meij 2016-11-01 15:04:21 +01:00
parent 978b214c92
commit 5194e68134
13 changed files with 27 additions and 34 deletions

View file

@ -1000,7 +1000,7 @@ var CalRGBCS = (function CalRGBCSClosure() {
function sRGBTransferFunction(color) {
// See http://en.wikipedia.org/wiki/SRGB.
if (color <= 0.0031308){
if (color <= 0.0031308) {
return adjustToRange(0, 1, 12.92 * color);
}

View file

@ -498,8 +498,7 @@ var calculateSHA512 = (function calculateSHA512Closure() {
h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
h7 = new Word64(0x5be0cd19, 0x137e2179);
}
else {
} else {
// SHA384 is exactly the same
// except with different starting values and a trimmed result
h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
@ -618,8 +617,7 @@ var calculateSHA512 = (function calculateSHA512Closure() {
h5.copyTo(result,40);
h6.copyTo(result,48);
h7.copyTo(result,56);
}
else {
} else {
result = new Uint8Array(48);
h0.copyTo(result,0);
h1.copyTo(result,8);
@ -1651,11 +1649,9 @@ var PDF20 = (function PDF20Closure() {
}
if (remainder === 0) {
k = calculateSHA256(e, 0, e.length);
}
else if (remainder === 1) {
} else if (remainder === 1) {
k = calculateSHA384(e, 0, e.length);
}
else if (remainder === 2) {
} else if (remainder === 2) {
k = calculateSHA512(e, 0, e.length);
}
i++;
@ -1977,8 +1973,7 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
encryptionKey = prepareKeyData(fileIdBytes, passwordBytes,
ownerPassword, userPassword, flags,
revision, keyLength, encryptMetadata);
}
else {
} else {
var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40);
var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48);
var uBytes = stringToBytes(dict.get('U')).subarray(0, 48);

View file

@ -296,7 +296,7 @@ var FontRendererFactory = (function FontRendererFactoryClosure() {
for (j = 1, jj = contour.length; j < jj; j++) {
if ((contour[j].flags & 1)) {
lineTo(contour[j].x, contour[j].y);
} else if ((contour[j + 1].flags & 1)){
} else if ((contour[j + 1].flags & 1)) {
quadraticCurveTo(contour[j].x, contour[j].y,
contour[j + 1].x, contour[j + 1].y);
j++;

View file

@ -226,7 +226,7 @@ var PDFFunction = (function PDFFunctionClosure() {
// x_i' = min(max(x_i, Domain_2i), Domain_2i+1)
var domain_2i = domain[i][0];
var domain_2i_1 = domain[i][1];
var xi = Math.min(Math.max(src[srcOffset +i], domain_2i),
var xi = Math.min(Math.max(src[srcOffset + i], domain_2i),
domain_2i_1);
// e_i = Interpolate(x_i', Domain_2i, Domain_2i+1,
@ -467,7 +467,7 @@ var PDFFunction = (function PDFFunctionClosure() {
if (value < bound) {
value = bound;
} else {
bound = range[i * 2 +1];
bound = range[i * 2 + 1];
if (value > bound) {
value = bound;
}
@ -1052,7 +1052,7 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
return null;
}
n = num1.number;
if (n < 0 || (n|0) !== n || stack.length < n) {
if (n < 0 || (n | 0) !== n || stack.length < n) {
return null;
}
ast1 = stack[stack.length - n - 1];
@ -1102,7 +1102,7 @@ var PostScriptCompiler = (function PostScriptCompilerClosure() {
}
j = num2.number;
n = num1.number;
if (n <= 0 || (n|0) !== n || (j|0) !== j || stack.length < n) {
if (n <= 0 || (n | 0) !== n || (j | 0) !== j || stack.length < n) {
// ... and integers
return null;
}

View file

@ -645,7 +645,7 @@ var JpegImage = (function JpegImageClosure() {
fileMarker = readUint16();
while (fileMarker !== 0xFFD9) { // EOI (End of image)
var i, j, l;
switch(fileMarker) {
switch (fileMarker) {
case 0xFFE0: // APP0 (Application Specific)
case 0xFFE1: // APP1
case 0xFFE2: // APP2

View file

@ -2135,7 +2135,7 @@ var JpxImage = (function JpxImageClosure() {
// step 1 & 3
j = offset - 2;
current = delta * x[j -1];
current = delta * x[j - 1];
for (n = len + 3; n--; j += 2) {
next = delta * x[j + 1];
x[j] = K * x[j] - current - next;

View file

@ -65,8 +65,7 @@ var MurmurHash3_64 = (function MurmurHash3_64Closure (seed) {
var code = input.charCodeAt(i);
if (code <= 0xff) {
data[length++] = code;
}
else {
} else {
data[length++] = code >>> 8;
data[length++] = code & 0xff;
}

View file

@ -1230,7 +1230,7 @@ var XRef = (function XRefClosure() {
} else {
xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
}
if (isDict(xrefEntry)){
if (isDict(xrefEntry)) {
xrefEntry.objId = ref.toString();
} else if (isStream(xrefEntry)) {
xrefEntry.dict.objId = ref.toString();