remove null checks that always evaluate to false
This commit is contained in:
parent
5f32f80e34
commit
ea719ae805
@ -130,9 +130,8 @@ var JpegImage = (function jpegImage() {
|
|||||||
|
|
||||||
function decodeHuffman(tree) {
|
function decodeHuffman(tree) {
|
||||||
var node = tree;
|
var node = tree;
|
||||||
var bit;
|
while (true) {
|
||||||
while ((bit = readBit()) !== null) {
|
node = node[readBit()];
|
||||||
node = node[bit];
|
|
||||||
if (typeof node === 'number') {
|
if (typeof node === 'number') {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@ -140,17 +139,12 @@ var JpegImage = (function jpegImage() {
|
|||||||
throw 'invalid huffman sequence';
|
throw 'invalid huffman sequence';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function receive(length) {
|
function receive(length) {
|
||||||
var n = 0;
|
var n = 0;
|
||||||
while (length > 0) {
|
while (length > 0) {
|
||||||
var bit = readBit();
|
n = (n << 1) | readBit();
|
||||||
if (bit === null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
n = (n << 1) | bit;
|
|
||||||
length--;
|
length--;
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
@ -866,8 +860,7 @@ var JpegImage = (function jpegImage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// decodeTransform will contains pairs of multiplier (-256..256) and
|
// decodeTransform contains pairs of multiplier (-256..256) and additive
|
||||||
// additive
|
|
||||||
var transform = this.decodeTransform;
|
var transform = this.decodeTransform;
|
||||||
if (transform) {
|
if (transform) {
|
||||||
for (i = 0; i < dataLength;) {
|
for (i = 0; i < dataLength;) {
|
||||||
|
Loading…
Reference in New Issue
Block a user