Skip to content

Commit

Permalink
reverting to libraries from v1.2.42
Browse files Browse the repository at this point in the history
Switching back to pako
Commenting out dicom-character-set
Using older xss version
Using these newer libraries would build and test fine inside Daikon, but would cause building Papaya to break
  • Loading branch information
rii-mango committed May 14, 2023
1 parent 468d380 commit add2051
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 37 deletions.
50 changes: 23 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"dependencies": {
"@wearemothership/dicom-character-set": "^1.0.4-opt.1",
"jpeg-lossless-decoder-js": "^2.0.7",
"pako": "^1.0",
"fflate": "*",
"xss": "^1.0.14"
"xss": "0.0.9"
},
"devDependencies": {
"esbuild": "*",
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ var CharLS = CharLS || ((typeof require !== 'undefined') ? require('../lib/charL
var JpegLSDecoder = JpegLSDecoder || ((typeof require !== 'undefined') ? require('../lib/jpeg-ls.js') : null);

//use fflate not pako
//var pako = pako || ((typeof require !== 'undefined') ? require('pako') : null);
var fflate = fflate || ((typeof require !== 'undefined') ? require('fflate') : null);
var pako = pako || ((typeof require !== 'undefined') ? require('pako') : null);
//var fflate = fflate || ((typeof require !== 'undefined') ? require('fflate') : null);

/*** Exports ***/

Expand Down
8 changes: 4 additions & 4 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ daikon.Dictionary = daikon.Dictionary || ((typeof require !== 'undefined') ? req
daikon.Image = daikon.Image || ((typeof require !== 'undefined') ? require('./image.js') : null);

//use fflate not pako
//var pako = pako || ((typeof require !== 'undefined') ? require('pako') : null);
var fflate = fflate || ((typeof require !== 'undefined') ? require('fflate') : null);
var pako = pako || ((typeof require !== 'undefined') ? require('pako') : null);
//var fflate = fflate || ((typeof require !== 'undefined') ? require('fflate') : null);

/*** Constructor ***/

Expand Down Expand Up @@ -120,8 +120,8 @@ daikon.Parser.prototype.parse = function (data) {
this.needsDeflate = false;
copyMeta = data.buffer.slice(0, tag.offsetEnd);
copyDeflated = data.buffer.slice(tag.offsetEnd);
//this.inflated = daikon.Utils.concatArrayBuffers(copyMeta, pako.inflateRaw(copyDeflated));
this.inflated = daikon.Utils.concatArrayBuffers(copyMeta, fflate.decompressSync(new Uint8Array(copyDeflated)));
this.inflated = daikon.Utils.concatArrayBuffers(copyMeta, pako.inflateRaw(copyDeflated));
//this.inflated = daikon.Utils.concatArrayBuffers(copyMeta, fflate.decompressSync(new Uint8Array(copyDeflated)));
data = new DataView(this.inflated);
}

Expand Down
16 changes: 13 additions & 3 deletions src/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"use strict";

/*** Imports ***/
var convertBytes = require('@wearemothership/dicom-character-set').convertBytes;
//var convertBytes = require('@wearemothership/dicom-character-set').convertBytes;
var daikon = daikon || {};
daikon.Utils = daikon.Utils || {};

Expand Down Expand Up @@ -43,13 +43,23 @@ daikon.Utils.createArray = function (length) {


daikon.Utils.getStringAt = function (dataview, start, length, charset, vr) {
var str = "", ctr, ch;

for (ctr = 0; ctr < length; ctr += 1) {
ch = dataview.getUint8(start + ctr);

if (ch !== 0) {
str += String.fromCharCode(ch);
}
}

/* - @from wearemothership dicom-character-set
var strBuff = new Uint8Array(dataview.buffer, dataview.byteOffset + start, length);
var str = convertBytes(charset || "ISO 2022 IR 6", strBuff, {vr: vr} );

while (str && str.charCodeAt(str.length - 1) === 0) {
str = str.slice(0,-1);
}

*/
return str;
};

Expand Down

0 comments on commit add2051

Please sign in to comment.