mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-09 08:43:49 +02:00
Clarify EBML strings are ASCII
This commit is contained in:
@@ -312,8 +312,7 @@ export class EBMLWriter {
|
||||
this.writer.write(this.helper.subarray(0, pos));
|
||||
}
|
||||
|
||||
// Assumes the string is ASCII
|
||||
writeString(str: string) {
|
||||
writeAsciiString(str: string) {
|
||||
this.writer.write(new Uint8Array(str.split('').map(x => x.charCodeAt(0))));
|
||||
}
|
||||
|
||||
@@ -359,7 +358,7 @@ export class EBMLWriter {
|
||||
this.writeUnsignedInt(data.data, size);
|
||||
} else if (typeof data.data === 'string') {
|
||||
this.writeVarInt(data.data.length);
|
||||
this.writeString(data.data);
|
||||
this.writeAsciiString(data.data);
|
||||
} else if (data.data instanceof Uint8Array) {
|
||||
this.writeVarInt(data.data.byteLength, data.size);
|
||||
this.writer.write(data.data);
|
||||
@@ -495,7 +494,7 @@ export class EBMLReader {
|
||||
return value;
|
||||
}
|
||||
|
||||
readString(length: number) {
|
||||
readAsciiString(length: number) {
|
||||
const { view, offset } = this.reader.getViewAndOffset(this.pos, this.pos + length);
|
||||
this.pos += length;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user