1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

Fix whitespace and style

This commit is contained in:
codedread 2018-01-19 07:47:49 -08:00
parent ccf755e3db
commit e7ef46fb78
3 changed files with 77 additions and 77 deletions

View file

@ -187,8 +187,9 @@ class RarVolumeHeader {
if ((rmode & 8) == 0) { if ((rmode & 8) == 0) {
continue; continue;
} }
if (I != 0) if (I != 0) {
bstream.readBits(16); bstream.readBits(16);
}
const count = (rmode & 3); const count = (rmode & 3);
for (let J = 0; J < count; ++J) { for (let J = 0; J < count; ++J) {
bstream.readBits(8); bstream.readBits(8);
@ -330,15 +331,14 @@ function RarReadTables(bstream) {
let ZeroCount = bstream.readBits(4); let ZeroCount = bstream.readBits(4);
if (ZeroCount == 0) { if (ZeroCount == 0) {
BitLength[I] = 15; BitLength[I] = 15;
} } else {
else {
ZeroCount += 2; ZeroCount += 2;
while (ZeroCount-- > 0 && I < rBC) while (ZeroCount-- > 0 && I < rBC) {
BitLength[I++] = 0; BitLength[I++] = 0;
}
--I; --I;
} }
} } else {
else {
BitLength[I] = Length; BitLength[I] = Length;
} }
} }

View file

@ -25,8 +25,8 @@ bitjs.io.BitStream = class {
* @param {Number} opt_length The length of this BitStream * @param {Number} opt_length The length of this BitStream
*/ */
constructor(ab, rtl, opt_offset, opt_length) { constructor(ab, rtl, opt_offset, opt_length) {
if (!ab || !ab.toString || ab.toString() !== "[object ArrayBuffer]") { if (!ab || !ab.toString || ab.toString() !== '[object ArrayBuffer]') {
throw "Error! BitArray constructed with an invalid ArrayBuffer object"; throw 'Error! BitArray constructed with an invalid ArrayBuffer object';
} }
const offset = opt_offset || 0; const offset = opt_offset || 0;
@ -65,8 +65,8 @@ bitjs.io.BitStream = class {
// This could be considerably faster when reading more than 3 or 4 bits at a time. // This could be considerably faster when reading more than 3 or 4 bits at a time.
while (n > 0) { while (n > 0) {
if (bytePtr >= bytes.length) { if (bytePtr >= bytes.length) {
throw "Error! Overflowed the bit stream! n=" + n + ", bytePtr=" + bytePtr + ", bytes.length=" + throw 'Error! Overflowed the bit stream! n=' + n + ', bytePtr=' + bytePtr + ', bytes.length=' +
bytes.length + ", bitPtr=" + bitPtr; bytes.length + ', bitPtr=' + bitPtr;
return -1; return -1;
} }
@ -125,8 +125,8 @@ bitjs.io.BitStream = class {
// This could be considerably faster when reading more than 3 or 4 bits at a time. // This could be considerably faster when reading more than 3 or 4 bits at a time.
while (n > 0) { while (n > 0) {
if (bytePtr >= bytes.length) { if (bytePtr >= bytes.length) {
throw "Error! Overflowed the bit stream! n=" + n + ", bytePtr=" + bytePtr + ", bytes.length=" + throw 'Error! Overflowed the bit stream! n=' + n + ', bytePtr=' + bytePtr + ', bytes.length=' +
bytes.length + ", bitPtr=" + bitPtr; bytes.length + ', bitPtr=' + bitPtr;
return -1; return -1;
} }