Skip to content

Commit

Permalink
Merge pull request #9098 from xiemaisi/fix-lgtm-alerts
Browse files Browse the repository at this point in the history
Fix issues found by lgtm
  • Loading branch information
Snuffleupagus committed Nov 4, 2017
2 parents 6521d2f + 3ae37d1 commit 99b62fe
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/core/cmap.js
Expand Up @@ -588,15 +588,15 @@ var BinaryCMapReader = (function BinaryCMapReaderClosure() {
stream.readHex(start, dataSize);
stream.readHexNumber(end, dataSize);
addHex(end, start, dataSize);
code = stream.readNumber();
stream.readNumber(); // code
// undefined range, skipping
for (i = 1; i < subitemsCount; i++) {
incHex(end, dataSize);
stream.readHexNumber(start, dataSize);
addHex(start, end, dataSize);
stream.readHexNumber(end, dataSize);
addHex(end, start, dataSize);
code = stream.readNumber();
stream.readNumber(); // code
// nop
}
break;
Expand Down
15 changes: 9 additions & 6 deletions src/core/crypto.js
Expand Up @@ -860,7 +860,7 @@ var AES128Cipher = (function AES128CipherClosure() {
}

function encrypt128(input, key) {
var t, u, v, k;
var t, u, v, j, k;
var state = new Uint8Array(16);
state.set(input);
for (j = 0; j < 16; ++j) {
Expand Down Expand Up @@ -893,7 +893,7 @@ var AES128Cipher = (function AES128CipherClosure() {
state[11] = u;
state[15] = t;
// MixColumns
for (var j = 0; j < 16; j += 4) {
for (j = 0; j < 16; j += 4) {
var s0 = state[j + 0], s1 = state[j + 1];
var s2 = state[j + 2], s3 = state[j + 3];
t = s0 ^ s1 ^ s2 ^ s3;
Expand Down Expand Up @@ -1169,15 +1169,18 @@ var AES256Cipher = (function AES256CipherClosure() {

result.set(cipherKey);
for (var j = 32, i = 1; j < b; ++i) {
var t1, t2, t3, t4;
if (j % 32 === 16) {
t1 = s[t1];
t2 = s[t2];
t3 = s[t3];
t4 = s[t4];
} else if (j % 32 === 0) {
// RotWord
var t1 = result[j - 3], t2 = result[j - 2],
t3 = result[j - 1], t4 = result[j - 4];
t1 = result[j - 3];
t2 = result[j - 2];
t3 = result[j - 1];
t4 = result[j - 4];
// SubWord
t1 = s[t1];
t2 = s[t2];
Expand Down Expand Up @@ -1282,7 +1285,7 @@ var AES256Cipher = (function AES256CipherClosure() {
}

function encrypt256(input, key) {
var t, u, v, k;
var t, u, v, i, j, k;
var state = new Uint8Array(16);
state.set(input);
for (j = 0; j < 16; ++j) {
Expand Down Expand Up @@ -1315,7 +1318,7 @@ var AES256Cipher = (function AES256CipherClosure() {
state[11] = u;
state[15] = t;
// MixColumns
for (var j = 0; j < 16; j += 4) {
for (j = 0; j < 16; j += 4) {
var s0 = state[j + 0], s1 = state[j + 1];
var s2 = state[j + 2], s3 = state[j + 3];
t = s0 ^ s1 ^ s2 ^ s3;
Expand Down
3 changes: 0 additions & 3 deletions src/core/fonts.js
Expand Up @@ -2447,7 +2447,6 @@ var Font = (function FontClosure() {
}
if (glyphId > 0 && hasGlyph(glyphId)) {
charCodeToGlyphId[charCode] = glyphId;
found = true;
}
}
}
Expand Down Expand Up @@ -3084,7 +3083,6 @@ var Type1Font = (function Type1FontClosure() {

// Get the data block containing glyphs and subrs information
var headerBlock = getHeaderBlock(file, headerBlockLength);
headerBlockLength = headerBlock.length;
var headerBlockParser = new Type1Parser(headerBlock.stream, false,
SEAC_ANALYSIS_ENABLED);
headerBlockParser.extractFontHeader(properties);
Expand All @@ -3097,7 +3095,6 @@ var Type1Font = (function Type1FontClosure() {

// Decrypt the data blocks and retrieve it's content
var eexecBlock = getEexecBlock(file, eexecBlockLength);
eexecBlockLength = eexecBlock.length;
var eexecBlockParser = new Type1Parser(eexecBlock.stream, true,
SEAC_ANALYSIS_ENABLED);
var data = eexecBlockParser.extractFontProgram();
Expand Down
4 changes: 2 additions & 2 deletions src/core/parser.js
Expand Up @@ -563,7 +563,7 @@ var Parser = (function ParserClosure() {
// when we can be absolutely certain that it actually is empty.
if (maybeLength === 0) {
warn('Empty "' + name + '" stream.');
return new NullStream(stream);
return new NullStream();
}
try {
var xrefStreamStats = this.xref.stats.streamTypes;
Expand Down Expand Up @@ -623,7 +623,7 @@ var Parser = (function ParserClosure() {
throw ex;
}
warn('Invalid stream: \"' + ex + '\"');
return new NullStream(stream);
return new NullStream();
}
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/type1_parser.js
Expand Up @@ -578,7 +578,7 @@ var Type1Parser = (function Type1ParserClosure() {
case 'Subrs':
this.readInt(); // num
this.getToken(); // read in 'array'
while ((token = this.getToken()) === 'dup') {
while (this.getToken() === 'dup') {
var index = this.readInt();
length = this.readInt();
this.getToken(); // read in 'RD' or '-|'
Expand Down

0 comments on commit 99b62fe

Please sign in to comment.