Avoid copying timezone data bytes (#21028)
This was missed in the PR when changing the implementation to use slices of Uint8Array rather than slices of ArrayBuffer. Making the function non-async since it's entirely synchronous.
This commit is contained in:
parent
2bd662fe0b
commit
202d21431e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,7 @@
|
||||||
import { readInt32LE } from "../../BinaryDecoder";
|
import { readInt32LE } from "../../BinaryDecoder";
|
||||||
import { decodeUtf8 } from "../../Utf8Decoder";
|
import { decodeUtf8 } from "../../Utf8Decoder";
|
||||||
|
|
||||||
export async function loadTimezoneData(arrayBuffer: ArrayBuffer) : Promise<void> {
|
export function loadTimezoneData(arrayBuffer: ArrayBuffer) {
|
||||||
let remainingData = new Uint8Array(arrayBuffer);
|
let remainingData = new Uint8Array(arrayBuffer);
|
||||||
|
|
||||||
// The timezone file is generated by https://github.com/dotnet/blazor/tree/master/src/TimeZoneData.
|
// The timezone file is generated by https://github.com/dotnet/blazor/tree/master/src/TimeZoneData.
|
||||||
|
|
@ -34,11 +34,10 @@ export async function loadTimezoneData(arrayBuffer: ArrayBuffer) : Promise<void>
|
||||||
Module['FS_createPath']('/zoneinfo', folder, true, true));
|
Module['FS_createPath']('/zoneinfo', folder, true, true));
|
||||||
|
|
||||||
for (const [name, length] of manifest) {
|
for (const [name, length] of manifest) {
|
||||||
const bytes = new Uint8Array(remainingData.slice(0, length));
|
const bytes = remainingData.slice(0, length);
|
||||||
Module['FS_createDataFile'](`/zoneinfo/${name}`, null, bytes, true, true, true);
|
Module['FS_createDataFile'](`/zoneinfo/${name}`, null, bytes, true, true, true);
|
||||||
remainingData = remainingData.slice(length);
|
remainingData = remainingData.slice(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ManifestEntry = [string, number];
|
type ManifestEntry = [string, number];
|
||||||
Loading…
Reference in New Issue