version bump 0.5.0: scan directory first

basic parse tests pass
This commit is contained in:
SheetJS 2013-10-27 05:54:10 -07:00
parent 3bc2923826
commit 82335b172a
2 changed files with 9 additions and 10 deletions

17
cfb.js
View File

@ -240,11 +240,10 @@ for(j = 0; blob.l != 512; ) {
/** Break the file up into sectors */
if(file.length%ssz!==0) console.error("CFB: size " + file.length + " % "+ssz);
var nsectors = Math.ceil((file.length - ssz)/ssz);
var sectors = [];
for(var i=1; i != nsectors + 1; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz);
for(var i=1; i != nsectors; ++i) sectors[i-1] = file.slice(i*ssz,(i+1)*ssz);
sectors[nsectors-1] = file.slice(nsectors*ssz)
/** Chase down the rest of the DIFAT chain to build a comprehensive list
DIFAT chains by storing the next sector number as the last 32 bytes */
@ -282,11 +281,11 @@ function get_next_sector(idx) { return get_buffer_u32(idx); }
var chkd = new Array(sectors.length), sector_list = [];
var get_sector = function get_sector(k) { return sectors[k]; };
for(i=0; i != sectors.length; ++i) {
var buf = [];
if(chkd[i]) continue;
for(j=i; j<=MAXREGSECT; buf.push(j),j=get_next_sector(j)) chkd[j] = true;
sector_list[i] = {nodes: buf};
sector_list[i].data = Array(buf.map(get_sector)).toBuffer();
var buf = [], k = (i + dir_start) % sectors.length;
if(chkd[k]) continue;
for(j=k; j<=MAXREGSECT; buf.push(j),j=get_next_sector(j)) chkd[j] = true;
sector_list[k] = {nodes: buf};
sector_list[k].data = Array(buf.map(get_sector)).toBuffer();
}
sector_list[dir_start].name = "!Directory";
if(nmfs > 0 && minifat_start !== ENDOFCHAIN) sector_list[minifat_start].name = "!MiniFAT";
@ -335,7 +334,7 @@ function read_directory(idx) {
} else {
o.storage = 'minifat';
w = o.start * mssz;
if(minifat_store !== ENDOFCHAIN) {
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN) {
o.content = sector_list[minifat_store].data.slice(w,w+o.size);
prep_blob(o.content);
}

View File

@ -1,6 +1,6 @@
{
"name": "cfb",
"version": "0.4.0",
"version": "0.5.0",
"author": "Niggler",
"description": "Compound File Binary File Format extractor",
"keywords": [ "cfb", "compression", "office" ],