Skip to content

Commit e19d3c3

Browse files
committed
Finish updating bitjs to 1.2.4
1 parent bcd054c commit e19d3c3

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

code/bitjs/archive/unrar.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
import { BitStream } from '../io/bitstream.js';
1515
import { ByteStream } from '../io/bytestream.js';
1616
import { ByteBuffer } from '../io/bytebuffer.js';
17-
import { RarVM, UnpackFilter, VM_GLOBALMEMADDR, VM_GLOBALMEMSIZE, VM_FIXEDGLOBALSIZE, MAXWINMASK } from './rarvm.js';
17+
import { RarVM, UnpackFilter, VM_GLOBALMEMADDR, VM_GLOBALMEMSIZE,
18+
VM_FIXEDGLOBALSIZE, MAXWINMASK } from './rarvm.js';
1819

1920
const UnarchiveState = {
2021
NOT_STARTED: 0,
@@ -509,6 +510,7 @@ function Unpack15(bstream, Solid) {
509510
function Unpack20(bstream, Solid) {
510511
const destUnpSize = rBuffer.data.length;
511512
let oldDistPtr = 0;
513+
let Bits;
512514

513515
if (!Solid) {
514516
RarReadTables20(bstream);
@@ -1343,19 +1345,20 @@ class RarLocalFile {
13431345
function unrar_start() {
13441346
let bstream = bytestream.tee();
13451347
const header = new RarVolumeHeader(bstream);
1346-
if (header.crc == 0x6152 &&
1347-
header.headType == 0x72 &&
1348-
header.flags.value == 0x1A21 &&
1349-
header.headSize == 7) {
1350-
if (logToConsole) {
1351-
info('Found RAR signature');
1352-
}
1348+
if (header.crc == 0x6152 && header.headType == 0x72 && header.flags.value == 0x1A21) {
1349+
if (header.headSize == 7) {
1350+
if (logToConsole) {
1351+
info('Found RAR signature');
1352+
}
13531353

1354-
const mhead = new RarVolumeHeader(bstream);
1355-
if (mhead.headType != MAIN_HEAD) {
1356-
info('Error! RAR did not include a MAIN_HEAD header');
1357-
} else {
1358-
bytestream = bstream.tee();
1354+
const mhead = new RarVolumeHeader(bstream);
1355+
if (mhead.headType != MAIN_HEAD) {
1356+
info('Error! RAR did not include a MAIN_HEAD header');
1357+
} else {
1358+
bytestream = bstream.tee();
1359+
}
1360+
} else if (header.headSize === 0x107) {
1361+
throw 'Error! RAR5 files not supported yet. See https://github.com/codedread/bitjs/issues/25';
13591362
}
13601363
}
13611364
}

0 commit comments

Comments
 (0)