提交 3f6f8e93 编写于 作者: S SheetJS

version bump 0.11.8: CFB 1.0.0

- travis node 9 test
- demo refresh
上级 1ab13069
...@@ -31,6 +31,7 @@ tmp ...@@ -31,6 +31,7 @@ tmp
*.exe *.exe
*.img *.img
.gitignore .gitignore
.gitattributes
.fossaignore .fossaignore
.spelling .spelling
.eslintrc .eslintrc
......
language: node_js language: node_js
node_js: node_js:
- "9"
- "8" - "8"
- "7" - "7"
- "6" - "6"
...@@ -9,16 +10,18 @@ matrix: ...@@ -9,16 +10,18 @@ matrix:
env: TZ="America/New_York" FMTS=misc env: TZ="America/New_York" FMTS=misc
- node_js: "8" - node_js: "8"
env: TZ="America/Los_Angeles" env: TZ="America/Los_Angeles"
- node_js: "6"
env: TZ="Europe/London" FMTS=misc
- node_js: "8" - node_js: "8"
env: TZ="Europe/London" FMTS=misc
- node_js: "6"
env: TZ="Europe/Berlin" env: TZ="Europe/Berlin"
- node_js: "6" - node_js: "6"
env: TZ="Asia/Kolkata" FMTS=misc env: TZ="Asia/Kolkata" FMTS=misc
- node_js: "7" - node_js: "9"
env: TZ="Asia/Shanghai" env: TZ="Asia/Shanghai"
- node_js: "8" - node_js: "8"
env: TZ="Asia/Seoul" FMTS=misc env: TZ="Asia/Seoul" FMTS=misc
- node_js: "7"
env: TZ="America/Cancun" FMTS=misc
- node_js: "5" - node_js: "5"
env: TZ="America/Anchorage" FMTS=misc env: TZ="America/Anchorage" FMTS=misc
......
...@@ -188,7 +188,7 @@ The [`demos` directory](demos/) includes sample projects for: ...@@ -188,7 +188,7 @@ The [`demos` directory](demos/) includes sample projects for:
**Frameworks and APIs** **Frameworks and APIs**
- [`angular 1.x`](demos/angular/) - [`angular 1.x`](demos/angular/)
- [`angular 2.x / 4.x`](demos/angular2/) - [`angular 2.x / 4.x / 5.x`](demos/angular2/)
- [`meteor`](demos/meteor/) - [`meteor`](demos/meteor/)
- [`react and react-native`](demos/react/) - [`react and react-native`](demos/react/)
- [`vue 2.x and weex`](demos/vue/) - [`vue 2.x and weex`](demos/vue/)
......
XLSX.version = '0.11.7'; XLSX.version = '0.11.8';
...@@ -38,7 +38,7 @@ type CFBFiles = {[n:string]:CFBEntry}; ...@@ -38,7 +38,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20130118 */ /* [MS-CFB] v20130118 */
var CFB = (function _CFB(){ var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/; var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '0.13.2'; exports.version = '1.0.0';
/* [MS-CFB] 2.6.4 */ /* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ { function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/"); var L = l.split("/"), R = r.split("/");
...@@ -141,16 +141,15 @@ sector_list.fat_addrs = fat_addrs; ...@@ -141,16 +141,15 @@ sector_list.fat_addrs = fat_addrs;
sector_list.ssz = ssz; sector_list.ssz = ssz;
/* [MS-CFB] 2.6.1 Compound File Directory Entry */ /* [MS-CFB] 2.6.1 Compound File Directory Entry */
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [], FullPathDir = {}; var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex); read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);
build_full_paths(FileIndex, FullPathDir, FullPaths, Paths); build_full_paths(FileIndex, FullPaths, Paths);
Paths.shift(); Paths.shift();
var o = { var o = {
FileIndex: FileIndex, FileIndex: FileIndex,
FullPaths: FullPaths, FullPaths: FullPaths
FullPathDir: FullPathDir
}; };
// $FlowIgnore // $FlowIgnore
...@@ -202,7 +201,7 @@ function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array<RawBytes>*/ { ...@@ -202,7 +201,7 @@ function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array<RawBytes>*/ {
} }
/* [MS-CFB] 2.6.4 Red-Black Tree */ /* [MS-CFB] 2.6.4 Red-Black Tree */
function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ { function build_full_paths(FI/*:CFBFileIndex*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length; var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
var dad/*:Array<number>*/ = [], q/*:Array<number>*/ = []; var dad/*:Array<number>*/ = [], q/*:Array<number>*/ = [];
...@@ -238,10 +237,23 @@ function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Arra ...@@ -238,10 +237,23 @@ function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Arra
FP[0] += "/"; FP[0] += "/";
for(i=1; i < pl; ++i) { for(i=1; i < pl; ++i) {
if(FI[i].type !== 2 /* stream */) FP[i] += "/"; if(FI[i].type !== 2 /* stream */) FP[i] += "/";
FPD[FP[i]] = FI[i];
} }
} }
function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/);
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0)/*:any*/);
return (bconcat(o).slice(0, entry.size)/*:any*/);
}
/** Chase down the rest of the DIFAT chain to build a comprehensive list /** 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 bits */ DIFAT chains by storing the next sector number as the last 32 bits */
function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/, ssz/*:number*/, fat_addrs)/*:void*/ { function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/, ssz/*:number*/, fat_addrs)/*:void*/ {
...@@ -303,7 +315,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat ...@@ -303,7 +315,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
} }
/* [MS-CFB] 2.6.1 Compound File Directory Entry */ /* [MS-CFB] 2.6.1 Compound File Directory Entry */
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex) { function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex, mini) {
var minifat_store = 0, pl = (Paths.length?2:0); var minifat_store = 0, pl = (Paths.length?2:0);
var sector = sector_list[dir_start].data; var sector = sector_list[dir_start].data;
var i = 0, namelen = 0, name; var i = 0, namelen = 0, name;
...@@ -345,7 +357,7 @@ function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sector ...@@ -345,7 +357,7 @@ function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sector
} else { } else {
o.storage = 'minifat'; o.storage = 'minifat';
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) { if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
o.content = (sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size)/*:any*/); o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
prep_blob(o.content, 0); prep_blob(o.content, 0);
} }
} }
......
...@@ -19,7 +19,7 @@ can be installed with Bash on Windows or with `cygwin`. ...@@ -19,7 +19,7 @@ can be installed with Bash on Windows or with `cygwin`.
**Frameworks and APIs** **Frameworks and APIs**
- [`angular 1.x`](angular/) - [`angular 1.x`](angular/)
- [`angular 2.x / 4.x`](angular2/) - [`angular 2.x / 4.x / 5.x`](angular2/)
- [`meteor`](meteor/) - [`meteor`](meteor/)
- [`react and react-native`](react/) - [`react and react-native`](react/)
- [`vue 2.x and weex`](vue/) - [`vue 2.x and weex`](vue/)
......
...@@ -14,3 +14,10 @@ angular: ...@@ -14,3 +14,10 @@ angular:
if [ ! -e node_modules/xlsx ]; then cd node_modules; ln -s ../../../ xlsx; cd -; fi if [ ! -e node_modules/xlsx ]; then cd node_modules; ln -s ../../../ xlsx; cd -; fi
ng build ng build
# Test Angular5 build
cp package.json-angular5 package.json
npm install
if [ ! -e node_modules ]; then mkdir node_modules; fi
if [ ! -e node_modules/xlsx ]; then cd node_modules; ln -s ../../../ xlsx; cd -; fi
ng build
...@@ -67,27 +67,20 @@ saveAs(new Blob([s2ab(wbout)]), 'SheetJS.xlsx'); ...@@ -67,27 +67,20 @@ saveAs(new Blob([s2ab(wbout)]), 'SheetJS.xlsx');
## Switching between Angular versions ## Switching between Angular versions
Modules that work with Angular 2 largely work as-is with Angular 4. Switching Modules that work with Angular 2 largely work as-is with Angular 4+. Switching
between versions is mostly a matter of installing the correct version of the between versions is mostly a matter of installing the correct version of the
core and associated modules. This demo includes a `package.json` for Angular 2 core and associated modules. This demo includes `package.json-angular#` files
and another `package.json` for Angular 4. for Angular 2, Angular 4, and Angular 5
Switching to Angular 2 is as simple as: To test a particular Angular version, overwrite `package.json`:
```bash ```bash
# switch to Angular 2
$ cp package.json-angular2 package.json $ cp package.json-angular2 package.json
$ npm install $ npm install
$ ng serve $ ng serve
``` ```
Switching to Angular 4 is as simple as:
```bash
$ cp package.json-angular4 package.json
$ npm install
$ ng serve
```
## XLSX Symbolic Link ## XLSX Symbolic Link
In this tree, `node_modules/xlsx` is a link pointing back to the root. This In this tree, `node_modules/xlsx` is a link pointing back to the root. This
......
{ {
"name": "angular2", "name": "angular5",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
...@@ -9,27 +9,31 @@ ...@@ -9,27 +9,31 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^4.0.0", "@angular/animations": "^5.0.0",
"@angular/common": "^4.0.0", "@angular/common": "^5.0.0",
"@angular/compiler": "^4.0.0", "@angular/compiler": "^5.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0", "@angular/core": "^5.0.0",
"@angular/http": "^4.0.0", "@angular/forms": "^5.0.0",
"@angular/platform-browser": "^4.0.0", "@angular/http": "^5.0.0",
"@angular/platform-browser-dynamic": "^4.0.0", "@angular/platform-browser": "^5.0.0",
"@angular/router": "^4.0.0", "@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4", "rxjs": "^5.5.2",
"zone.js": "^0.8.14",
"file-saver": "^1.3.3" "file-saver": "^1.3.3"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "1.1.2", "@angular/cli": "1.5.0",
"@angular/compiler-cli": "^4.0.0", "@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^4.0.0", "@angular/language-service": "^5.0.0",
"@types/node": "~6.0.60", "@types/node": "~6.0.60",
"ts-node": "~3.0.4", "ts-node": "~3.2.0",
"tslint": "~5.3.2", "tslint": "~5.7.0",
"typescript": "~2.3.3" "typescript": "~2.4.2"
} }
} }
{ {
"name": "angular2", "name": "angular4",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
......
{
"name": "angular5",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14",
"file-saver": "^1.3.3"
},
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/node": "~6.0.60",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.4.2"
}
}
...@@ -10,7 +10,7 @@ into web pages with script tags: ...@@ -10,7 +10,7 @@ into web pages with script tags:
The library can also be imported directly from JSX code with: The library can also be imported directly from JSX code with:
```js ```js
import * as XLSX from 'xlsx'; import XLSX from 'xlsx';
``` ```
This demo shows a simple JSX component transpiled in the browser using the babel This demo shows a simple JSX component transpiled in the browser using the babel
......
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ /* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import * as XLSX from 'xlsx'; import XLSX from 'xlsx';
import { saveAs } from 'file-saver'; import { saveAs } from 'file-saver';
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */ /* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import * as XLSX from 'xlsx'; import XLSX from 'xlsx';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { AppRegistry, StyleSheet, Text, View, Button, Alert, Image } from 'react-native'; import { AppRegistry, StyleSheet, Text, View, Button, Alert, Image } from 'react-native';
......
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
此差异由.gitattributes 抑制。
...@@ -4,7 +4,7 @@ The [`demos` directory](demos/) includes sample projects for: ...@@ -4,7 +4,7 @@ The [`demos` directory](demos/) includes sample projects for:
**Frameworks and APIs** **Frameworks and APIs**
- [`angular 1.x`](demos/angular/) - [`angular 1.x`](demos/angular/)
- [`angular 2.x / 4.x`](demos/angular2/) - [`angular 2.x / 4.x / 5.x`](demos/angular2/)
- [`meteor`](demos/meteor/) - [`meteor`](demos/meteor/)
- [`react and react-native`](demos/react/) - [`react and react-native`](demos/react/)
- [`vue 2.x and weex`](demos/vue/) - [`vue 2.x and weex`](demos/vue/)
......
...@@ -179,7 +179,7 @@ The [`demos` directory](demos/) includes sample projects for: ...@@ -179,7 +179,7 @@ The [`demos` directory](demos/) includes sample projects for:
**Frameworks and APIs** **Frameworks and APIs**
- [`angular 1.x`](demos/angular/) - [`angular 1.x`](demos/angular/)
- [`angular 2.x / 4.x`](demos/angular2/) - [`angular 2.x / 4.x / 5.x`](demos/angular2/)
- [`meteor`](demos/meteor/) - [`meteor`](demos/meteor/)
- [`react and react-native`](demos/react/) - [`react and react-native`](demos/react/)
- [`vue 2.x and weex`](demos/vue/) - [`vue 2.x and weex`](demos/vue/)
......
...@@ -55,10 +55,6 @@ type CFBModule = { ...@@ -55,10 +55,6 @@ type CFBModule = {
utils:CFBUtils; utils:CFBUtils;
}; };
type CFBFullPathDir = {
[n:string]: CFBEntry;
}
type CFBUtils = any; type CFBUtils = any;
type CheckFieldFunc = {(hexstr:string, fld:string):void;}; type CheckFieldFunc = {(hexstr:string, fld:string):void;};
...@@ -114,7 +110,6 @@ type CFBContainer = { ...@@ -114,7 +110,6 @@ type CFBContainer = {
sectors:Array<any>; sectors:Array<any>;
}; };
FileIndex:CFBFileIndex; FileIndex:CFBFileIndex;
FullPathDir:CFBFullPathDir;
FullPaths:Array<string>; FullPaths:Array<string>;
} }
......
{ {
"name": "xlsx", "name": "xlsx",
"version": "0.11.7", "version": "0.11.8",
"author": "sheetjs", "author": "sheetjs",
"description": "SheetJS Spreadsheet data parser and writer", "description": "SheetJS Spreadsheet data parser and writer",
"keywords": [ "excel", "xls", "xlsx", "xlsb", "xlsm", "ods", "csv", "dbf", "dif", "sylk", "office", "spreadsheet" ], "keywords": [ "excel", "xls", "xlsx", "xlsb", "xlsm", "ods", "csv", "dbf", "dif", "sylk", "office", "spreadsheet" ],
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"exit-on-epipe": "~1.0.1", "exit-on-epipe": "~1.0.1",
"ssf": "~0.10.1", "ssf": "~0.10.1",
"codepage": "~1.11.0", "codepage": "~1.11.0",
"cfb": "~0.13.2", "cfb": "~1.0.0",
"crc-32": "~1.1.1", "crc-32": "~1.1.1",
"adler-32": "~1.1.0", "adler-32": "~1.1.0",
"commander": "~2.11.0" "commander": "~2.11.0"
......
...@@ -1863,7 +1863,7 @@ describe('HTML', function() { ...@@ -1863,7 +1863,7 @@ describe('HTML', function() {
it('should generate strings if raw option is passed', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str), {raw:true}), true, true); }); it('should generate strings if raw option is passed', function() { plaintext_test(X.utils.table_to_book(get_dom_element(html_str), {raw:true}), true, true); });
it('should handle newlines correctly', function() { it('should handle newlines correctly', function() {
var table = get_dom_element("<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>"); var table = get_dom_element("<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>");
var wb = X.utils.table_to_book(table) var wb = X.utils.table_to_book(table);
assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar"); assert.equal(get_cell(wb.Sheets.Sheet1, "A1").v, "foo\nbar");
}); });
}); });
......
此差异由.gitattributes 抑制。
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
/*global global, exports, module, require:false, process:false, Buffer:false */ /*global global, exports, module, require:false, process:false, Buffer:false */
var XLSX = {}; var XLSX = {};
(function make_xlsx(XLSX){ (function make_xlsx(XLSX){
XLSX.version = '0.11.7'; XLSX.version = '0.11.8';
var current_codepage = 1200; var current_codepage = 1200;
/*:: declare var cptable:any; */ /*:: declare var cptable:any; */
/*global cptable:true */ /*global cptable:true */
...@@ -1089,7 +1089,7 @@ type CFBFiles = {[n:string]:CFBEntry}; ...@@ -1089,7 +1089,7 @@ type CFBFiles = {[n:string]:CFBEntry};
/* [MS-CFB] v20130118 */ /* [MS-CFB] v20130118 */
var CFB = (function _CFB(){ var CFB = (function _CFB(){
var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/; var exports/*:CFBModule*/ = /*::(*/{}/*:: :any)*/;
exports.version = '0.13.2'; exports.version = '1.0.0';
/* [MS-CFB] 2.6.4 */ /* [MS-CFB] 2.6.4 */
function namecmp(l/*:string*/, r/*:string*/)/*:number*/ { function namecmp(l/*:string*/, r/*:string*/)/*:number*/ {
var L = l.split("/"), R = r.split("/"); var L = l.split("/"), R = r.split("/");
...@@ -1192,16 +1192,15 @@ sector_list.fat_addrs = fat_addrs; ...@@ -1192,16 +1192,15 @@ sector_list.fat_addrs = fat_addrs;
sector_list.ssz = ssz; sector_list.ssz = ssz;
/* [MS-CFB] 2.6.1 Compound File Directory Entry */ /* [MS-CFB] 2.6.1 Compound File Directory Entry */
var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [], FullPathDir = {}; var files/*:CFBFiles*/ = {}, Paths/*:Array<string>*/ = [], FileIndex/*:CFBFileIndex*/ = [], FullPaths/*:Array<string>*/ = [];
read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex); read_directory(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, minifat_start);
build_full_paths(FileIndex, FullPathDir, FullPaths, Paths); build_full_paths(FileIndex, FullPaths, Paths);
Paths.shift(); Paths.shift();
var o = { var o = {
FileIndex: FileIndex, FileIndex: FileIndex,
FullPaths: FullPaths, FullPaths: FullPaths
FullPathDir: FullPathDir
}; };
// $FlowIgnore // $FlowIgnore
...@@ -1253,7 +1252,7 @@ function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array<RawBytes>*/ { ...@@ -1253,7 +1252,7 @@ function sectorify(file/*:RawBytes*/, ssz/*:number*/)/*:Array<RawBytes>*/ {
} }
/* [MS-CFB] 2.6.4 Red-Black Tree */ /* [MS-CFB] 2.6.4 Red-Black Tree */
function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ { function build_full_paths(FI/*:CFBFileIndex*/, FP/*:Array<string>*/, Paths/*:Array<string>*/)/*:void*/ {
var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length; var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length;
var dad/*:Array<number>*/ = [], q/*:Array<number>*/ = []; var dad/*:Array<number>*/ = [], q/*:Array<number>*/ = [];
...@@ -1289,10 +1288,23 @@ function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Arra ...@@ -1289,10 +1288,23 @@ function build_full_paths(FI/*:CFBFileIndex*/, FPD/*:CFBFullPathDir*/, FP/*:Arra
FP[0] += "/"; FP[0] += "/";
for(i=1; i < pl; ++i) { for(i=1; i < pl; ++i) {
if(FI[i].type !== 2 /* stream */) FP[i] += "/"; if(FI[i].type !== 2 /* stream */) FP[i] += "/";
FPD[FP[i]] = FI[i];
} }
} }
function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/);
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0)/*:any*/);
return (bconcat(o).slice(0, entry.size)/*:any*/);
}
/** Chase down the rest of the DIFAT chain to build a comprehensive list /** 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 bits */ DIFAT chains by storing the next sector number as the last 32 bits */
function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/, ssz/*:number*/, fat_addrs)/*:void*/ { function sleuth_fat(idx/*:number*/, cnt/*:number*/, sectors/*:Array<RawBytes>*/, ssz/*:number*/, fat_addrs)/*:void*/ {
...@@ -1354,7 +1366,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat ...@@ -1354,7 +1366,7 @@ function make_sector_list(sectors/*:Array<RawBytes>*/, dir_start/*:number*/, fat
} }
/* [MS-CFB] 2.6.1 Compound File Directory Entry */ /* [MS-CFB] 2.6.1 Compound File Directory Entry */
function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex) { function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sectors/*:Array<RawBytes>*/, Paths/*:Array<string>*/, nmfs, files, FileIndex, mini) {
var minifat_store = 0, pl = (Paths.length?2:0); var minifat_store = 0, pl = (Paths.length?2:0);
var sector = sector_list[dir_start].data; var sector = sector_list[dir_start].data;
var i = 0, namelen = 0, name; var i = 0, namelen = 0, name;
...@@ -1396,7 +1408,7 @@ function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sector ...@@ -1396,7 +1408,7 @@ function read_directory(dir_start/*:number*/, sector_list/*:SectorList*/, sector
} else { } else {
o.storage = 'minifat'; o.storage = 'minifat';
if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) { if(minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store]) {
o.content = (sector_list[minifat_store].data.slice(o.start*MSSZ,o.start*MSSZ+o.size)/*:any*/); o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini]||{}).data);
prep_blob(o.content, 0); prep_blob(o.content, 0);
} }
} }
......
此差异由.gitattributes 抑制。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册