Resolve remaining style issues

This commit is contained in:
Luke Page 2015-08-04 23:00:10 +01:00
parent bf5ae3c54e
commit 99eae1c711
12 changed files with 207 additions and 143 deletions

View file

@ -107,7 +107,7 @@
"arrow-spacing": 1,
"accessor-pairs": 1,
"block-scoped-var": 0,
"brace-style": [1, "1tbs"],
"brace-style": [1, "stroustrup"],
"callback-return": [2, ["callback", "cb", "next"]],
"camelcase": [2, {"properties": "always"}],
"comma-dangle": [2, "never"],
@ -129,7 +129,7 @@
"generator-star-spacing": 0,
"guard-for-in": 1,
"handle-callback-err": 2,
"id-length": [2, {"min": 3, "max": 20, "exceptions":["x", "y", "i", "j"]}],
"id-length": [2, {"min": 3, "max": 20, "exceptions":["x", "y", "i", "j", "ex", "up"]}],
"indent": [1, 2, {"SwitchCase": 1}],
"init-declarations": 0,
"key-spacing": [1, { "beforeColon": false, "afterColon": true }],

View file

@ -104,7 +104,8 @@ exports.dataToBitMap = function(data, width, height, bpp, depth, interlace) {
var pxData;
if (depth <= 8) {
pxData = new Buffer(width * height * 4);
} else {
}
else {
pxData = new Uint16Array(width * height * 4);
}
var maxBit = Math.pow(2, depth) - 1;
@ -116,7 +117,8 @@ exports.dataToBitMap = function(data, width, height, bpp, depth, interlace) {
if (interlace) {
images = interlaceUtils.getImagePasses(width, height);
getPxPos = interlaceUtils.getInterlaceIterator(width, height);
} else {
}
else {
var nonInterlacedPxPos = 0;
getPxPos = function() {
var returner = nonInterlacedPxPos;
@ -144,7 +146,8 @@ exports.dataToBitMap = function(data, width, height, bpp, depth, interlace) {
throw new Error('Ran out of data');
}
pxData[pxPos + i] = idx !== 0xff ? data[idx + rawPos] : maxBit;
} else {
}
else {
pxData[pxPos + i] = idx !== 0xff ? pixelData[idx] : maxBit;
}
}
@ -160,7 +163,8 @@ exports.dataToBitMap = function(data, width, height, bpp, depth, interlace) {
if (rawPos !== data.length) {
throw new Error('extra data found');
}
} else {
}
else {
bits.end();
}

View file

@ -70,7 +70,8 @@ ChunkStream.prototype.write = function(data, encoding) {
var dataBuffer;
if (Buffer.isBuffer(data)) {
dataBuffer = data;
} else {
}
else {
dataBuffer = new Buffer(data, encoding || this._encoding);
}
@ -80,7 +81,7 @@ ChunkStream.prototype.write = function(data, encoding) {
this._process();
// ok if there are no more read requests
if (this._reads && this._reads.length == 0) {
if (this._reads && this._reads.length === 0) {
this._paused = true;
}
@ -96,12 +97,15 @@ ChunkStream.prototype.end = function(data, encoding) {
this.writable = false;
// already destroyed
if (!this._buffers) return;
if (!this._buffers) {
return;
}
// enqueue or handle end
if (this._buffers.length == 0) {
if (this._buffers.length === 0) {
this._end();
} else {
}
else {
this._buffers.push(null);
this._process();
}
@ -157,7 +161,8 @@ ChunkStream.prototype._process = function() {
read.func.call(this, smallerBuf.slice(0, read.length));
} else {
}
else {
// ok this is less than maximum length so use it all
this._buffered -= smallerBuf.length;
this._buffers.shift(); // == smallerBuf
@ -165,7 +170,8 @@ ChunkStream.prototype._process = function() {
read.func.call(this, smallerBuf);
}
} else if (this._buffered >= read.length) {
}
else if (this._buffered >= read.length) {
// ok we can meet some expectations
this._reads.shift(); // == read
@ -184,19 +190,22 @@ ChunkStream.prototype._process = function() {
pos += len;
// last buffer wasn't used all so just slice it and leave
if (len != buf.length)
if (len !== buf.length) {
this._buffers[--count] = buf.slice(len);
}
}
// remove all used buffers
if (count > 0)
if (count > 0) {
this._buffers.splice(0, count);
}
this._buffered -= read.length;
read.func.call(this, data);
} else {
}
else {
// not enought data to satisfy first request in queue
// so we need to wait for more
break;

View file

@ -29,10 +29,8 @@ module.exports = {
TYPE_IEND: 0x49454e44,
TYPE_IDAT: 0x49444154,
TYPE_PLTE: 0x504c5445,
/*eslint camelcase: 0*/
TYPE_tRNS: 0x74524e53,
TYPE_gAMA: 0x67414d41,
/*eslint camelcase: 1*/
TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase
TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase
COLOR_PALETTE: 1,
COLOR_COLOR: 2,

View file

@ -28,7 +28,8 @@ var crcTable = [];
for (var j = 0; j < 8; j++) {
if (currentCrc & 1) {
currentCrc = 0xedb88320 ^ (currentCrc >>> 1);
} else {
}
else {
currentCrc = currentCrc >>> 1;
}
}

View file

@ -33,7 +33,7 @@ var FilterAsync = module.exports = function(width, height, Bpp, depth, interlace
this._filter = new Filter(width, height, Bpp, depth, interlace, options, {
read: this.read.bind(this),
complete: function() {
that.emit('complete', Buffer.concat(buffers), width, height)
that.emit('complete', Buffer.concat(buffers), width, height);
},
write: function(buffer) {
buffers.push(buffer);

View file

@ -30,12 +30,12 @@ function getByteWidth(width, bpp, depth) {
return byteWidth;
}
function PaethPredictor(left, above, upLeft) {
function paethPredictor(left, above, upLeft) {
var p = left + above - upLeft,
pLeft = Math.abs(p - left),
pAbove = Math.abs(p - above),
pUpLeft = Math.abs(p - upLeft);
var paeth = left + above - upLeft;
var pLeft = Math.abs(paeth - left);
var pAbove = Math.abs(paeth - above);
var pUpLeft = Math.abs(paeth - upLeft);
if (pLeft <= pAbove && pLeft <= pUpLeft) {
return left;
@ -51,13 +51,14 @@ var Filter = module.exports = function(width, height, Bpp, depth, interlace, opt
this._width = width;
this._height = height;
this._Bpp = Bpp;
this._Bpp = Bpp; //TODO rename
this._depth = depth;
this._options = options;
if (!('filterType' in options) || options.filterType == -1) {
if (!('filterType' in options) || options.filterType === -1) {
options.filterType = [0, 1, 2, 3, 4];
} else if (typeof options.filterType == 'number') {
}
else if (typeof options.filterType === 'number') {
options.filterType = [options.filterType];
}
@ -84,7 +85,8 @@ var Filter = module.exports = function(width, height, Bpp, depth, interlace, opt
lineIndex: 0
});
}
} else {
}
else {
this._images.push({
byteWidth: getByteWidth(width, Bpp, depth),
height: height,
@ -104,7 +106,20 @@ Filter.prototype._reverseFilterLine = function(rawData) {
var filter = rawData[0];
var xComparison = this._depth >= 8 ? ((this._depth === 16) ? this._Bpp * 2 : this._Bpp) : 1;
// when filtering the line we look at the pixel to the left
// the spec also says it is done on a byte level regardless of the number of pixels
// so if the depth is byte compatible (8 or 16) we subtract the bpp in order to compare back
// a pixel rather than just a different byte part. However if we are sub byte, we ignore.
var xComparison;
if (this._depth === 8) {
xComparison = this._Bpp;
}
else if (this._depth === 16) {
xComparison = this._Bpp * 2;
}
else {
xComparison = 1;
}
var xBiggerThan = xComparison - 1;
for (var x = 0; x < currentImage.byteWidth; x++) {
@ -114,27 +129,29 @@ Filter.prototype._reverseFilterLine = function(rawData) {
line[x] = rawByte;
break;
case 1:
var f1_left = x > xBiggerThan ? line[x - xComparison] : 0;
line[x] = rawByte + f1_left;
var f1Left = x > xBiggerThan ? line[x - xComparison] : 0;
line[x] = rawByte + f1Left;
break;
case 2:
var f2_up = this._lastLine ? this._lastLine[x] : 0;
line[x] = rawByte + f2_up;
var f2Up = this._lastLine ? this._lastLine[x] : 0;
line[x] = rawByte + f2Up;
break;
case 3:
var f3_up = this._lastLine ? this._lastLine[x] : 0;
var f3_left = x > xBiggerThan ? line[x - xComparison] : 0;
var f3_add = Math.floor((f3_left + f3_up) / 2);
line[x] = rawByte + f3_add;
var f3Up = this._lastLine ? this._lastLine[x] : 0;
var f3Left = x > xBiggerThan ? line[x - xComparison] : 0;
var f3Add = Math.floor((f3Left + f3Up) / 2);
line[x] = rawByte + f3Add;
break;
case 4:
var f4_up = this._lastLine ? this._lastLine[x] : 0;
var f4_left = x > xBiggerThan ? line[x - xComparison] : 0;
var f4_upLeft = x > xBiggerThan && this._lastLine
var f4Up = this._lastLine ? this._lastLine[x] : 0;
var f4Left = x > xBiggerThan ? line[x - xComparison] : 0;
var f4UpLeft = x > xBiggerThan && this._lastLine
? this._lastLine[x - xComparison] : 0;
var f4_add = PaethPredictor(f4_left, f4_up, f4_upLeft);
line[x] = rawByte + f4_add;
var f4Add = paethPredictor(f4Left, f4Up, f4UpLeft);
line[x] = rawByte + f4Add;
break;
default:
throw new Error('Unrecognised filter type - ' + filter);
}
//if (x === 5) {
@ -149,18 +166,20 @@ Filter.prototype._reverseFilterLine = function(rawData) {
this._lastLine = null;
this._imageIndex++;
currentImage = this._images[this._imageIndex];
} else {
}
else {
this._lastLine = line;
}
if (currentImage) {
this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this));
} else {
}
else {
this.complete(this._width, this._height);
}
};
//TODO pull out
Filter.prototype.filter = function(pxData) {
var rawData = new Buffer(((this._width << 2) + 1) * this._height);
@ -168,9 +187,9 @@ Filter.prototype.filter = function(pxData) {
for (var y = 0; y < this._height; y++) {
// find best filter for this line (with lowest sum of values)
var filterTypes = this._options.filterType,
min = Infinity,
sel = 0;
var filterTypes = this._options.filterType;
var min = Infinity;
var sel = 0;
for (var i = 0; i < filterTypes.length; i++) {
var sum = this._filters[filterTypes[i]](pxData, y, null);
@ -187,15 +206,17 @@ Filter.prototype.filter = function(pxData) {
Filter.prototype._filterNone = function(pxData, y, rawData) {
var pxRowLength = this._width << 2,
rawRowLength = pxRowLength + 1,
sum = 0;
var pxRowLength = this._width << 2;
var rawRowLength = pxRowLength + 1;
var sum = 0;
if (!rawData) {
for (var x = 0; x < pxRowLength; x++)
for (var x = 0; x < pxRowLength; x++) {
sum += Math.abs(pxData[y * pxRowLength + x]);
}
} else {
}
else {
rawData[y * rawRowLength] = 0;
pxData.copy(rawData, rawRowLength * y + 1, pxRowLength * y, pxRowLength * (y + 1));
}
@ -205,83 +226,103 @@ Filter.prototype._filterNone = function(pxData, y, rawData) {
Filter.prototype._filterSub = function(pxData, y, rawData) {
var pxRowLength = this._width << 2,
rawRowLength = pxRowLength + 1,
sum = 0;
var pxRowLength = this._width << 2;
var rawRowLength = pxRowLength + 1;
var sum = 0;
if (rawData)
if (rawData) {
rawData[y * rawRowLength] = 1;
}
for (var x = 0; x < pxRowLength; x++) {
var left = x >= 4 ? pxData[y * pxRowLength + x - 4] : 0,
val = pxData[y * pxRowLength + x] - left;
var left = x >= 4 ? pxData[y * pxRowLength + x - 4] : 0;
var val = pxData[y * pxRowLength + x] - left;
if (!rawData) sum += Math.abs(val);
else rawData[y * rawRowLength + 1 + x] = val;
if (!rawData) {
sum += Math.abs(val);
}
else {
rawData[y * rawRowLength + 1 + x] = val;
}
}
return sum;
};
Filter.prototype._filterUp = function(pxData, y, rawData) {
var pxRowLength = this._width << 2,
rawRowLength = pxRowLength + 1,
sum = 0;
var pxRowLength = this._width << 2;
var rawRowLength = pxRowLength + 1;
var sum = 0;
if (rawData)
if (rawData) {
rawData[y * rawRowLength] = 2;
}
for (var x = 0; x < pxRowLength; x++) {
var up = y > 0 ? pxData[(y - 1) * pxRowLength + x] : 0,
val = pxData[y * pxRowLength + x] - up;
var up = y > 0 ? pxData[(y - 1) * pxRowLength + x] : 0;
var val = pxData[y * pxRowLength + x] - up;
if (!rawData) sum += Math.abs(val);
else rawData[y * rawRowLength + 1 + x] = val;
if (!rawData) {
sum += Math.abs(val);
}
else {
rawData[y * rawRowLength + 1 + x] = val;
}
}
return sum;
};
Filter.prototype._filterAvg = function(pxData, y, rawData) {
var pxRowLength = this._width << 2,
rawRowLength = pxRowLength + 1,
sum = 0;
var pxRowLength = this._width << 2;
var rawRowLength = pxRowLength + 1;
var sum = 0;
if (rawData)
if (rawData) {
rawData[y * rawRowLength] = 3;
}
for (var x = 0; x < pxRowLength; x++) {
var left = x >= 4 ? pxData[y * pxRowLength + x - 4] : 0,
up = y > 0 ? pxData[(y - 1) * pxRowLength + x] : 0,
val = pxData[y * pxRowLength + x] - ((left + up) >> 1);
var left = x >= 4 ? pxData[y * pxRowLength + x - 4] : 0;
var up = y > 0 ? pxData[(y - 1) * pxRowLength + x] : 0;
var val = pxData[y * pxRowLength + x] - ((left + up) >> 1);
if (!rawData) sum += Math.abs(val);
else rawData[y * rawRowLength + 1 + x] = val;
if (!rawData) {
sum += Math.abs(val);
}
else {
rawData[y * rawRowLength + 1 + x] = val;
}
}
return sum;
};
Filter.prototype._filterPaeth = function(pxData, y, rawData) {
var pxRowLength = this._width << 2,
rawRowLength = pxRowLength + 1,
sum = 0;
var pxRowLength = this._width << 2;
var rawRowLength = pxRowLength + 1;
var sum = 0;
if (rawData)
if (rawData) {
rawData[y * rawRowLength] = 4;
}
for (var x = 0; x < pxRowLength; x++) {
var left = x >= 4 ? pxData[y * pxRowLength + x - 4] : 0,
up = y > 0 ? pxData[(y - 1) * pxRowLength + x] : 0,
upLeft = x >= 4 && y > 0 ? pxData[(y - 1) * pxRowLength + x - 4] : 0,
val = pxData[y * pxRowLength + x] - PaethPredictor(left, up, upLeft);
var left = x >= 4 ? pxData[y * pxRowLength + x - 4] : 0;
var up = y > 0 ? pxData[(y - 1) * pxRowLength + x] : 0;
var upLeft = x >= 4 && y > 0 ? pxData[(y - 1) * pxRowLength + x - 4] : 0;
var val = pxData[y * pxRowLength + x] - paethPredictor(left, up, upLeft);
if (!rawData) sum += Math.abs(val);
else rawData[y * rawRowLength + 1 + x] = val;
if (!rawData) {
sum += Math.abs(val);
}
else {
rawData[y * rawRowLength + 1 + x] = val;
}
}
return sum;
};

View file

@ -70,7 +70,7 @@ exports.getImagePasses = function(width, height) {
}
}
if (passWidth > 0 && passHeight > 0) {
images.push({width: passWidth, height: passHeight, index: i});
images.push({ width: passWidth, height: passHeight, index: i });
}
}
return images;

View file

@ -76,13 +76,15 @@ Packer.prototype.pack = function(data, width, height) {
Packer.prototype._packChunk = function(type, data) {
var len = (data ? data.length : 0),
buf = new Buffer(len + 12);
var len = (data ? data.length : 0);
var buf = new Buffer(len + 12);
buf.writeUInt32BE(len, 0);
buf.writeUInt32BE(type, 4);
if (data) data.copy(buf, 8);
if (data) {
data.copy(buf, 8);
}
buf.writeInt32BE(CrcStream.crc32(buf.slice(4, buf.length - 4)), buf.length - 4);
return buf;

View file

@ -35,8 +35,8 @@ var ParserAsync = module.exports = function(options) {
this._parser = new Parser(options, {
read: this.read.bind(this),
error: this._handleError.bind(this),
metadata: this.emit.bind(this, "metadata"),
gamma: this.emit.bind(this, "gamma"),
metadata: this.emit.bind(this, 'metadata'),
gamma: this.emit.bind(this, 'gamma'),
finished: this._finished.bind(this),
inflateData: this._inflateData.bind(this),
createData: this._createData.bind(this)
@ -98,31 +98,32 @@ ParserAsync.prototype._finished = function() {
if (!this._inflate) {
this.emit('error', 'No Inflate block');
} else {
}
else {
// no more data to inflate
this._inflate.end();
}
this.destroySoon();
};
ParserAsync.prototype._complete = function(data, width, height) {
ParserAsync.prototype._complete = function(filteredData, width, height) {
if (this.errord) {
return;
}
try {
data = bitmapper.dataToBitMap(data, width, height,
var bitmapData = bitmapper.dataToBitMap(filteredData, width, height,
this._bpp,
this._depth,
this._interlace);
data = this._parser.reverseFiltered(data, this._depth, width, height);
bitmapData = this._parser.reverseFiltered(bitmapData, this._depth, width, height);
}
catch (e) {
this._handleError();
catch (ex) {
this._handleError(ex);
return;
}
this.emit('parsed', data);
this.emit('parsed', bitmapData);
};

View file

@ -74,7 +74,7 @@ Parser.prototype._parseSignature = function(data) {
var signature = constants.PNG_SIGNATURE;
for (var i = 0; i < signature.length; i++) {
if (data[i] != signature[i]) {
if (data[i] !== signature[i]) {
this.error(new Error('Invalid file signature'));
return;
}
@ -88,8 +88,8 @@ Parser.prototype._parseChunkBegin = function(data) {
var length = data.readUInt32BE(0);
// chunk type
var type = data.readUInt32BE(4),
name = '';
var type = data.readUInt32BE(4);
var name = '';
for (var i = 4; i < 8; i++) {
name += String.fromCharCode(data[i]);
}
@ -97,11 +97,11 @@ Parser.prototype._parseChunkBegin = function(data) {
//console.log('chunk ', name, length);
// chunk flags
var ancillary = !!(data[4] & 0x20); // or critical
// priv = !!(data[5] & 0x20), // or public
// safeToCopy = !!(data[7] & 0x20); // or unsafe
var ancillary = Boolean(data[4] & 0x20); // or critical
// priv = Boolean(data[5] & 0x20), // or public
// safeToCopy = Boolean(data[7] & 0x20); // or unsafe
if (!this._hasIHDR && type != constants.TYPE_IHDR) {
if (!this._hasIHDR && type !== constants.TYPE_IHDR) {
this.error(new Error('Expected IHDR on beggining'));
return;
}
@ -131,12 +131,12 @@ Parser.prototype._handleChunkEnd = function() {
Parser.prototype._parseChunkEnd = function(data) {
var fileCrc = data.readInt32BE(0),
calcCrc = this._crc.crc32();
var fileCrc = data.readInt32BE(0);
var calcCrc = this._crc.crc32();
// check CRC
if (this._options.checkCRC && calcCrc != fileCrc) {
this.error(new Error('Crc error - ' + fileCrc + " - " + calcCrc));
if (this._options.checkCRC && calcCrc !== fileCrc) {
this.error(new Error('Crc error - ' + fileCrc + ' - ' + calcCrc));
return;
}
@ -152,13 +152,13 @@ Parser.prototype._parseIHDR = function(data) {
this._crc.write(data);
var width = data.readUInt32BE(0),
height = data.readUInt32BE(4),
depth = data[8],
colorType = data[9], // bits: 1 palette, 2 color, 4 alpha
compr = data[10],
filter = data[11],
interlace = data[12];
var width = data.readUInt32BE(0);
var height = data.readUInt32BE(4);
var depth = data[8];
var colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha
var compr = data[10];
var filter = data[11];
var interlace = data[12];
// console.log(' width', width, 'height', height,
// 'depth', depth, 'colorType', colorType,
@ -173,15 +173,15 @@ Parser.prototype._parseIHDR = function(data) {
this.error(new Error('Unsupported color type'));
return;
}
if (compr != 0) {
if (compr !== 0) {
this.error(new Error('Unsupported compression method'));
return;
}
if (filter != 0) {
if (filter !== 0) {
this.error(new Error('Unsupported filter method'));
return;
}
if (interlace != 0 && interlace !== 1) {
if (interlace !== 0 && interlace !== 1) {
this.error(new Error('Unsupported interlace method'));
return;
}
@ -197,10 +197,10 @@ Parser.prototype._parseIHDR = function(data) {
width: width,
height: height,
depth: depth,
interlace: interlace,
palette: !!(colorType & constants.COLOR_PALETTE),
color: !!(colorType & constants.COLOR_COLOR),
alpha: !!(colorType & constants.COLOR_ALPHA)
interlace: Boolean(interlace),
palette: Boolean(colorType & constants.COLOR_PALETTE),
color: Boolean(colorType & constants.COLOR_COLOR),
alpha: Boolean(colorType & constants.COLOR_ALPHA)
});
this._handleChunkEnd();
@ -237,8 +237,8 @@ Parser.prototype._parseTRNS = function(data) {
this._crc.write(data);
// palette
if (this._colorType == 3) {
if (this._palette.length == 0) {
if (this._colorType === 3) {
if (this._palette.length === 0) {
this.error(new Error('Transparency chunk must be after palette'));
return;
}
@ -282,16 +282,19 @@ Parser.prototype._parseIDAT = function(length, data) {
this._crc.write(data);
if (this._colorType == 3 && this._palette.length == 0)
if (this._colorType === 3 && this._palette.length === 0) {
throw new Error('Expected palette not found');
}
this.inflateData(data);
length -= data.length;
var leftOverLength = length - data.length;
if (length > 0)
this._handleIDAT(length);
else
if (leftOverLength > 0) {
this._handleIDAT(leftOverLength);
}
else {
this._handleChunkEnd();
}
};
@ -315,7 +318,7 @@ Parser.prototype.reverseFiltered = function(indata, depth, width, height) {
var pxLineLength = width << 2;
var x, y, i, pxPos, pxRowPos;
if (this._colorType == 3) { // paletted
if (this._colorType === 3) { // paletted
//TODO abstract loop?
// use values from palette
for (y = 0; y < height; y++) {
@ -326,14 +329,16 @@ Parser.prototype.reverseFiltered = function(indata, depth, width, height) {
var color = this._palette[indata[pxPos]];
if (!color) {
throw new Error("index " + indata[pxPos] + " not in palette");
throw new Error('index ' + indata[pxPos] + ' not in palette');
}
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++) {
indata[pxPos + i] = color[i];
}
}
}
} else {
}
else {
if (this._transColor) {
for (y = 0; y < height; y++) {
pxRowPos = y * pxLineLength;
@ -346,7 +351,8 @@ Parser.prototype.reverseFiltered = function(indata, depth, width, height) {
if (this._transColor[0] === indata[pxPos]) {
makeTrans = true;
}
} else if (this._transColor[0] === indata[pxPos] && this._transColor[1] === indata[pxPos + 1] && this._transColor[2] === indata[pxPos + 2]) {
}
else if (this._transColor[0] === indata[pxPos] && this._transColor[1] === indata[pxPos + 1] && this._transColor[2] === indata[pxPos + 2]) {
makeTrans = true;
}
if (makeTrans) {
@ -370,8 +376,9 @@ Parser.prototype.reverseFiltered = function(indata, depth, width, height) {
for (x = 0; x < width; x++) {
pxPos = pxRowPos + (x << 2);
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++) {
outdata[pxPos + i] = Math.floor((indata[pxPos + i] * maxOutSample) / maxInSample + 0.5);
}
}
}
}

View file

@ -53,7 +53,8 @@ SyncReader.prototype.process = function() {
read.func.call(this, buf.slice(0, read.length));
} else {
}
else {
break;
}