1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Fix remaining linting errors, from enabling the prefer-const ESLint rule globally

This covers cases that the `--fix` command couldn't deal with, and in a few cases (notably `src/core/jbig2.js`) the code was changed to use block-scoped variables instead.
This commit is contained in:
Jonas Jenwald 2020-01-24 13:21:16 +01:00
parent 9e262ae7fa
commit 83bdb525a4
10 changed files with 76 additions and 109 deletions

View file

@ -207,8 +207,8 @@ class Parser {
CR = 0xd;
const n = 10,
NUL = 0x0;
let startPos = stream.pos,
state = 0,
const startPos = stream.pos;
let state = 0,
ch,
maybeEIPos;
while ((ch = stream.getByte()) !== -1) {
@ -282,11 +282,10 @@ class Parser {
* @returns {number} The inline stream length.
*/
findDCTDecodeInlineStreamEnd(stream) {
let startPos = stream.pos,
foundEOI = false,
const startPos = stream.pos;
let foundEOI = false,
b,
markerLength,
length;
markerLength;
while ((b = stream.getByte()) !== -1) {
if (b !== 0xff) {
// Not a valid marker.
@ -367,7 +366,7 @@ class Parser {
break;
}
}
length = stream.pos - startPos;
const length = stream.pos - startPos;
if (b === -1) {
warn(
"Inline DCTDecode image stream: " +
@ -387,9 +386,8 @@ class Parser {
findASCII85DecodeInlineStreamEnd(stream) {
const TILDE = 0x7e,
GT = 0x3e;
let startPos = stream.pos,
ch,
length;
const startPos = stream.pos;
let ch;
while ((ch = stream.getByte()) !== -1) {
if (ch === TILDE) {
const tildePos = stream.pos;
@ -415,7 +413,7 @@ class Parser {
}
}
}
length = stream.pos - startPos;
const length = stream.pos - startPos;
if (ch === -1) {
warn(
"Inline ASCII85Decode image stream: " +
@ -434,15 +432,14 @@ class Parser {
*/
findASCIIHexDecodeInlineStreamEnd(stream) {
const GT = 0x3e;
let startPos = stream.pos,
ch,
length;
const startPos = stream.pos;
let ch;
while ((ch = stream.getByte()) !== -1) {
if (ch === GT) {
break;
}
}
length = stream.pos - startPos;
const length = stream.pos - startPos;
if (ch === -1) {
warn(
"Inline ASCIIHexDecode image stream: " +