From 533361c7f414ba73f528abaa181a67c078305fbc Mon Sep 17 00:00:00 2001 From: James Prevett Date: Mon, 11 Nov 2024 23:25:08 -0600 Subject: [PATCH] Fix usage of deprecated `decode` --- src/VolumeDescriptor.ts | 7 +++---- src/entries.ts | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/VolumeDescriptor.ts b/src/VolumeDescriptor.ts index fdf2f5a..bddb1aa 100644 --- a/src/VolumeDescriptor.ts +++ b/src/VolumeDescriptor.ts @@ -1,4 +1,4 @@ -import { decode } from '@zenfs/core'; +import { decodeRaw } from '@zenfs/core'; import { Errno, ErrnoError } from '@zenfs/core/error.js'; import type { TextDecoder as TTextDecoder } from 'util'; import { deserialize, member, struct, types as t } from 'utilium'; @@ -245,10 +245,9 @@ export class SupplementaryVolumeDescriptor extends PrimaryOrSupplementaryVolumeD if (this.type !== VolumeDescriptorType.Supplementary) { throw new ErrnoError(Errno.EIO, 'Invalid supplementary volume descriptor.'); } - // Third character identifies what 'level' of the UCS specification to follow. - // We ignore it. + // Third character identifies what 'level' of the UCS specification to follow. We ignore it. if (this.escapeSequence[0] !== 37 || this.escapeSequence[1] !== 47 || ![64, 67, 69].includes(this.escapeSequence[2])) { - throw new ErrnoError(Errno.EIO, 'Unrecognized escape sequence for SupplementaryVolumeDescriptor: ' + decode(this.escapeSequence)); + throw new ErrnoError(Errno.EIO, 'Unrecognized escape sequence for SupplementaryVolumeDescriptor: ' + decodeRaw(this.escapeSequence)); } } } diff --git a/src/entries.ts b/src/entries.ts index 4fb6a41..38eac28 100644 --- a/src/entries.ts +++ b/src/entries.ts @@ -1,4 +1,4 @@ -import { decode } from '@zenfs/core'; +import { decodeUTF8 } from '@zenfs/core'; import { deserialize, sizeof, struct, types as t, type Tuple } from 'utilium'; import { SLComponentRecord } from './SLComponentRecord.js'; import { LongFormDate, ShortFormDate } from './utils.js'; @@ -40,7 +40,7 @@ class SystemUseEntry { @t.uint16 public signature!: EntrySignature; public get signatureString(): string { - return decode(this.data.slice(0, 2)); + return decodeUTF8(this.data.slice(0, 2)); } @t.uint8 public length!: number; @@ -116,16 +116,16 @@ export class EREntry extends SystemUseEntry { @t.uint8 public extensionVersion!: number; public get extensionIdentifier(): string { - return decode(this.data.slice(8, 8 + this.idLength)); + return decodeUTF8(this.data.slice(8, 8 + this.idLength)); } public get extensionDescriptor(): string { - return decode(this.data.slice(8 + this.idLength, 8 + this.idLength + this.descriptorLength)); + return decodeUTF8(this.data.slice(8 + this.idLength, 8 + this.idLength + this.descriptorLength)); } public get extensionSource(): string { const start = 8 + this.idLength + this.descriptorLength; - return decode(this.data.slice(start, start + this.sourceLength)); + return decodeUTF8(this.data.slice(start, start + this.sourceLength)); } }