Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Fix usage of deprecated decode
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Nov 12, 2024
1 parent aeafd0c commit 533361c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/VolumeDescriptor.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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));
}
}
}
10 changes: 5 additions & 5 deletions src/entries.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
}

Expand Down

0 comments on commit 533361c

Please sign in to comment.