|
|
|
@ -113,12 +113,12 @@ var RarVolumeHeader = function(bstream) {
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
bstream.readBits(16);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// byte 6,7
|
|
|
|
|
this.headSize = bstream.readBits(16);
|
|
|
|
|
info(" headSize=" + this.headSize);
|
|
|
|
|
switch (this.headType) {
|
|
|
|
|
// byte 6,7
|
|
|
|
|
this.headSize = bstream.readBits(16);
|
|
|
|
|
info(" headSize=" + this.headSize);
|
|
|
|
|
switch (this.headType) {
|
|
|
|
|
case MAIN_HEAD:
|
|
|
|
|
this.highPosAv = bstream.readBits(16);
|
|
|
|
|
this.posAv = bstream.readBits(32);
|
|
|
|
@ -367,7 +367,6 @@ function RarDecodeNumber(bstream, dec) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function RarMakeDecodeTables(BitLength, offset, dec, size) {
|
|
|
|
|
var DecodeLen = dec.DecodeLen, DecodePos = dec.DecodePos, DecodeNum = dec.DecodeNum;
|
|
|
|
|
var LenCount = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
|
|
|
|
@ -394,7 +393,6 @@ function RarMakeDecodeTables(BitLength, offset, dec, size) {
|
|
|
|
|
for (I = 0; I < size; ++I)
|
|
|
|
|
if (BitLength[I + offset] != 0)
|
|
|
|
|
DecodeNum[ TmpPos[ BitLength[offset + I] & 0xF ]++] = I;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: implement
|
|
|
|
@ -473,7 +471,6 @@ function Unpack20(bstream, Solid) {
|
|
|
|
|
RarCopyString(2, Distance);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
RarUpdateProgress()
|
|
|
|
|
}
|
|
|
|
@ -620,7 +617,6 @@ function Unpack29(bstream, Solid) {
|
|
|
|
|
}
|
|
|
|
|
if (num == 256) {
|
|
|
|
|
if (!RarReadEndOfBlock(bstream)) break;
|
|
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (num == 257) {
|
|
|
|
@ -662,7 +658,6 @@ function Unpack29(bstream, Solid) {
|
|
|
|
|
RarCopyString(2, Distance);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
RarUpdateProgress()
|
|
|
|
|
}
|
|
|
|
@ -671,7 +666,6 @@ function RarReadEndOfBlock(bstream) {
|
|
|
|
|
|
|
|
|
|
RarUpdateProgress()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var NewTable = false, NewFile = false;
|
|
|
|
|
if (bstream.readBits(1)) {
|
|
|
|
|
NewTable = true;
|
|
|
|
@ -728,14 +722,12 @@ function RarCopyString(length, distance) {
|
|
|
|
|
}
|
|
|
|
|
//TODO: lets hope that it never needs to read beyond file boundaries
|
|
|
|
|
while(length--) rBuffer.insertByte(rOldBuffers[l].data[destPtr++]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (length > distance) {
|
|
|
|
|
while(length--) rBuffer.insertByte(rBuffer.data[destPtr++]);
|
|
|
|
|
} else {
|
|
|
|
|
rBuffer.insertBytes(rBuffer.data.subarray(destPtr, destPtr + length));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var rOldBuffers = []
|
|
|
|
@ -828,14 +820,14 @@ var unrar = function(arrayBuffer) {
|
|
|
|
|
if (header.crc == 0x6152 &&
|
|
|
|
|
header.headType == 0x72 &&
|
|
|
|
|
header.flags.value == 0x1A21 &&
|
|
|
|
|
header.headSize == 7) {
|
|
|
|
|
header.headSize == 7)
|
|
|
|
|
{
|
|
|
|
|
info("Found RAR signature");
|
|
|
|
|
|
|
|
|
|
var mhead = new RarVolumeHeader(bstream);
|
|
|
|
|
if (mhead.headType != MAIN_HEAD) {
|
|
|
|
|
info("Error! RAR did not include a MAIN_HEAD header");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
var localFiles = [],
|
|
|
|
|
localFile = null;
|
|
|
|
|
do {
|
|
|
|
|