From add205165c63684ec4cfaf185a14eb02e033cd1c Mon Sep 17 00:00:00 2001 From: RII-Mango Date: Sun, 14 May 2023 12:03:26 -0500 Subject: [PATCH] reverting to libraries from v1.2.42 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 --- package-lock.json | 50 ++++++++++++++++++++++------------------------- package.json | 3 ++- src/main.js | 4 ++-- src/parser.js | 8 ++++---- src/utilities.js | 16 ++++++++++++--- 5 files changed, 44 insertions(+), 37 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2f7ba80..c05d8ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "@wearemothership/dicom-character-set": "^1.0.4-opt.1", "fflate": "*", "jpeg-lossless-decoder-js": "^2.0.7", - "xss": "^1.0.14" + "pako": "^1.0", + "xss": "0.0.9" }, "devDependencies": { "browserify": "*", @@ -1165,11 +1166,6 @@ "node": ">=4" } }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" - }, "node_modules/common-sequence": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/common-sequence/-/common-sequence-2.0.2.tgz", @@ -1307,11 +1303,6 @@ "node": "*" } }, - "node_modules/cssfilter": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/cssfilter/-/cssfilter-0.0.10.tgz", - "integrity": "sha512-FAaLDaplstoRsDR8XGYH51znUN0UY7nMc6Z9/fvE8EXGwvJE9hu7W2vHwx1+bd6gCYnln9nLbzxFTrcO9YQDZw==" - }, "node_modules/dash-ast": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", @@ -1765,13 +1756,14 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3" }, "funding": { @@ -1879,6 +1871,18 @@ "node": ">=8" } }, + "node_modules/has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", @@ -2812,8 +2816,7 @@ "node_modules/pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==" }, "node_modules/parents": { "version": "1.0.1", @@ -3798,18 +3801,11 @@ "dev": true }, "node_modules/xss": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/xss/-/xss-1.0.14.tgz", - "integrity": "sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==", - "dependencies": { - "commander": "^2.20.3", - "cssfilter": "0.0.10" - }, - "bin": { - "xss": "bin/xss" - }, + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/xss/-/xss-0.0.9.tgz", + "integrity": "sha512-jPFdM56EihzKcXeGjFy0kxYigtdB1CWCzS3FVp+HYv5a+BwSHpBe+FQOVgaVN1qQ81h8/W0ICj/4/sVRb8eZWQ==", "engines": { - "node": ">= 0.10.0" + "node": ">= 0.6.0" } }, "node_modules/xtend": { diff --git a/package.json b/package.json index 5173980..138eeaa 100644 --- a/package.json +++ b/package.json @@ -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": "*", diff --git a/src/main.js b/src/main.js index 777f7fd..93e0bac 100644 --- a/src/main.js +++ b/src/main.js @@ -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 ***/ diff --git a/src/parser.js b/src/parser.js index 495b4cd..0b8b6ac 100644 --- a/src/parser.js +++ b/src/parser.js @@ -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 ***/ @@ -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); } diff --git a/src/utilities.js b/src/utilities.js index f5e5cf1..7c1b7e3 100644 --- a/src/utilities.js +++ b/src/utilities.js @@ -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 || {}; @@ -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; };