Merge pull request #5125 from Snuffleupagus/strict-equalities-src-core-3

Add strict equalities in src/core/* (part 3)
This commit is contained in:
Tim van der Meij 2014-08-02 21:18:58 +02:00
commit 10daf0489f
2 changed files with 39 additions and 39 deletions

View File

@ -152,7 +152,7 @@ var Parser = (function ParserClosure() {
// searching for the /EI\s/
var state = 0, ch, i, ii;
while (state != 4 && (ch = stream.getByte()) !== -1) {
while (state !== 4 && (ch = stream.getByte()) !== -1) {
switch (ch | 0) {
case 0x20:
case 0x0D:
@ -346,7 +346,7 @@ var Parser = (function ParserClosure() {
}
try {
var xrefStreamStats = this.xref.stats.streamTypes;
if (name == 'FlateDecode' || name == 'Fl') {
if (name === 'FlateDecode' || name === 'Fl') {
xrefStreamStats[StreamType.FLATE] = true;
if (params) {
return new PredictorStream(new FlateStream(stream, maybeLength),
@ -354,7 +354,7 @@ var Parser = (function ParserClosure() {
}
return new FlateStream(stream, maybeLength);
}
if (name == 'LZWDecode' || name == 'LZW') {
if (name === 'LZWDecode' || name === 'LZW') {
xrefStreamStats[StreamType.LZW] = true;
var earlyChange = 1;
if (params) {
@ -367,31 +367,31 @@ var Parser = (function ParserClosure() {
}
return new LZWStream(stream, maybeLength, earlyChange);
}
if (name == 'DCTDecode' || name == 'DCT') {
if (name === 'DCTDecode' || name === 'DCT') {
xrefStreamStats[StreamType.DCT] = true;
return new JpegStream(stream, maybeLength, stream.dict, this.xref);
}
if (name == 'JPXDecode' || name == 'JPX') {
if (name === 'JPXDecode' || name === 'JPX') {
xrefStreamStats[StreamType.JPX] = true;
return new JpxStream(stream, maybeLength, stream.dict);
}
if (name == 'ASCII85Decode' || name == 'A85') {
if (name === 'ASCII85Decode' || name === 'A85') {
xrefStreamStats[StreamType.A85] = true;
return new Ascii85Stream(stream, maybeLength);
}
if (name == 'ASCIIHexDecode' || name == 'AHx') {
if (name === 'ASCIIHexDecode' || name === 'AHx') {
xrefStreamStats[StreamType.AHX] = true;
return new AsciiHexStream(stream, maybeLength);
}
if (name == 'CCITTFaxDecode' || name == 'CCF') {
if (name === 'CCITTFaxDecode' || name === 'CCF') {
xrefStreamStats[StreamType.CCF] = true;
return new CCITTFaxStream(stream, maybeLength, params);
}
if (name == 'RunLengthDecode' || name == 'RL') {
if (name === 'RunLengthDecode' || name === 'RL') {
xrefStreamStats[StreamType.RL] = true;
return new RunLengthStream(stream, maybeLength);
}
if (name == 'JBIG2Decode') {
if (name === 'JBIG2Decode') {
xrefStreamStats[StreamType.JBIG] = true;
return new Jbig2Stream(stream, maybeLength, stream.dict);
}
@ -650,7 +650,7 @@ var Lexer = (function LexerClosure() {
if (ch === 0x23) { // '#'
ch = this.nextChar();
var x = toHexDigit(ch);
if (x != -1) {
if (x !== -1) {
var x2 = toHexDigit(this.nextChar());
if (x2 === -1) {
error('Illegal digit in hex char in name: ' + x2);

View File

@ -374,10 +374,10 @@ var FlateStream = (function FlateStreamClosure() {
var cmf = str.getByte();
var flg = str.getByte();
if (cmf == -1 || flg == -1) {
if (cmf === -1 || flg === -1) {
error('Invalid header in flate stream: ' + cmf + ', ' + flg);
}
if ((cmf & 0x0f) != 0x08) {
if ((cmf & 0x0f) !== 0x08) {
error('Unknown compression method in flate stream: ' + cmf + ', ' + flg);
}
if ((((cmf << 8) + flg) % 31) !== 0) {
@ -463,7 +463,7 @@ var FlateStream = (function FlateStreamClosure() {
len <= maxLen;
++len, code <<= 1, skip <<= 1) {
for (var val = 0; val < n; ++val) {
if (lengths[val] == len) {
if (lengths[val] === len) {
// bit-reverse the code
var code2 = 0;
var t = code;
@ -513,7 +513,7 @@ var FlateStream = (function FlateStreamClosure() {
error('Bad block header in flate stream');
}
check |= (b << 8);
if (check != (~blockLen & 0xffff) &&
if (check !== (~blockLen & 0xffff) &&
(blockLen !== 0 || check !== 0)) {
// Ignoring error for bad "empty" block (see issue 1277)
error('Bad uncompressed block length in flate stream');
@ -544,10 +544,10 @@ var FlateStream = (function FlateStreamClosure() {
var litCodeTable;
var distCodeTable;
if (hdr == 1) { // compressed block, fixed codes
if (hdr === 1) { // compressed block, fixed codes
litCodeTable = fixedLitCodeTab;
distCodeTable = fixedDistCodeTab;
} else if (hdr == 2) { // compressed block, dynamic codes
} else if (hdr === 2) { // compressed block, dynamic codes
var numLitCodes = this.getBits(5) + 257;
var numDistCodes = this.getBits(5) + 1;
var numCodeLenCodes = this.getBits(4) + 4;
@ -569,11 +569,11 @@ var FlateStream = (function FlateStreamClosure() {
var bitsLength, bitsOffset, what;
while (i < codes) {
var code = this.getCode(codeLenCodeTab);
if (code == 16) {
if (code === 16) {
bitsLength = 2; bitsOffset = 3; what = len;
} else if (code == 17) {
} else if (code === 17) {
bitsLength = 3; bitsOffset = 3; what = (len = 0);
} else if (code == 18) {
} else if (code === 18) {
bitsLength = 7; bitsOffset = 11; what = (len = 0);
} else {
codeLengths[i++] = len = code;
@ -607,7 +607,7 @@ var FlateStream = (function FlateStreamClosure() {
buffer[pos++] = code1;
continue;
}
if (code1 == 256) {
if (code1 === 256) {
this.bufferLength = pos;
return;
}
@ -928,7 +928,7 @@ var JpegStream = (function JpegStreamClosure() {
function JpegStream_isNativelyDecodable(xref, res) {
var cs = ColorSpace.parse(this.dict.get('ColorSpace', 'CS'), xref, res);
var numComps = cs.numComps;
return numComps == 1 || numComps == 3;
return numComps === 1 || numComps === 3;
};
return JpegStream;
@ -1148,7 +1148,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
var i;
// special code for z
if (c == Z_LOWER_CHAR) {
if (c === Z_LOWER_CHAR) {
buffer = this.ensureBuffer(bufferLength + 4);
for (i = 0; i < 4; ++i) {
buffer[bufferLength + i] = 0;
@ -1165,7 +1165,7 @@ var Ascii85Stream = (function Ascii85StreamClosure() {
input[i] = c;
if (c === EOF || c == TILDA_CHAR) {
if (c === EOF || c === TILDA_CHAR) {
break;
}
}
@ -1272,7 +1272,7 @@ var RunLengthStream = (function RunLengthStreamClosure() {
// (in addition to the second byte from the header), n = 129 through 255 -
// duplicate the second byte from the header (257 - n) times, n = 128 - end.
var repeatHeader = this.str.getBytes(2);
if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] == 128) {
if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
this.eof = true;
return;
}
@ -1765,7 +1765,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
while ((code1 = this.lookBits(12)) === 0) {
this.eatBits(1);
}
if (code1 == 1) {
if (code1 === 1) {
this.eatBits(12);
}
if (this.encoding > 0) {
@ -2024,7 +2024,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
var gotEOL = false;
if (!this.eoblock && this.row == this.rows - 1) {
if (!this.eoblock && this.row === this.rows - 1) {
this.eof = true;
} else {
code1 = this.lookBits(12);
@ -2032,10 +2032,10 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
this.eatBits(1);
code1 = this.lookBits(12);
}
if (code1 == 1) {
if (code1 === 1) {
this.eatBits(12);
gotEOL = true;
} else if (code1 == EOF) {
} else if (code1 === EOF) {
this.eof = true;
}
}
@ -2047,7 +2047,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
if (this.eoblock && gotEOL) {
code1 = this.lookBits(12);
if (code1 == 1) {
if (code1 === 1) {
this.eatBits(12);
if (this.encoding > 0) {
this.lookBits(1);
@ -2056,7 +2056,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
if (this.encoding >= 0) {
for (i = 0; i < 4; ++i) {
code1 = this.lookBits(12);
if (code1 != 1) {
if (code1 !== 1) {
info('bad rtc code: ' + code1);
}
this.eatBits(12);
@ -2071,11 +2071,11 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
} else if (this.err && this.eoline) {
while (true) {
code1 = this.lookBits(13);
if (code1 == EOF) {
if (code1 === EOF) {
this.eof = true;
return null;
}
if ((code1 >> 1) == 1) {
if ((code1 >> 1) === 1) {
break;
}
this.eatBits(1);
@ -2151,7 +2151,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
var limitValue = limit || 0;
for (var i = start; i <= end; ++i) {
var code = this.lookBits(i);
if (code == EOF) {
if (code === EOF) {
return [true, 1, false];
}
if (i < end) {
@ -2159,7 +2159,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
}
if (!limitValue || code >= limitValue) {
var p = table[code - limitValue];
if (p[0] == i) {
if (p[0] === i) {
this.eatBits(i);
return [true, p[1], true];
}
@ -2197,7 +2197,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
var p;
if (this.eoblock) {
code = this.lookBits(12);
if (code == EOF) {
if (code === EOF) {
return 1;
}
@ -2233,7 +2233,7 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
var code, p;
if (this.eoblock) {
code = this.lookBits(13);
if (code == EOF) {
if (code === EOF) {
return 1;
}
if ((code >> 7) === 0) {
@ -2381,7 +2381,7 @@ var LZWStream = (function LZWStreamClosure() {
} else {
currentSequence[currentSequenceLength++] = currentSequence[0];
}
} else if (code == 256) {
} else if (code === 256) {
codeLength = 9;
nextCode = 258;
currentSequenceLength = 0;