refactor(plist): share binary decode plan fields (#16750)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-04 22:31:39 +08:00
1 parent b7104bec93
commit 5dbfc097e2
2 files changed
+11 -24

No files matched your search

+9 -1
View File
@@ -41,19 +41,27 @@ const containsSortedOffset = (
};
export interface BinaryPlistScalarDecodePlan {
/** Unique reachable date records in the selected value graph. */
readonly reachableDateOffsets: readonly number[];
/** Precision-unknown date offsets requiring decoder-copy isolation. */
readonly overlappingDateOffsets: readonly number[];
/** Unique reachable 16-byte integer records in the selected value graph. */
readonly reachableWideIntegerOffsets: readonly number[];
/** Source offsets requiring isolated decoder-compatible scalar records. */
readonly overlappingWideIntegerOffsets: readonly number[];
/** Reachable integer and real source records for exact number association. */
readonly reachableNumericOffsets: readonly number[];
/** Reachable UID records whose encoded width plist@5 cannot read. */
/** Reachable UID records cloned to one of plist@5's supported widths. */
readonly uidOffsetsToNormalize: readonly { offset: number; width: number }[];
/** Validated container headers and references needed for decoder-copy normalization. */
readonly containersToNormalize?: readonly {
readonly offset: number;
readonly headerLength: number;
readonly references: readonly number[];
}[];
/** Decoder-supported width selected for the source offset table. */
readonly normalizedOffsetSize?: number;
/** Decoder-supported width selected for array and dictionary references. */
readonly normalizedReferenceSize?: number;
}
+2 -23
View File
@@ -18,6 +18,7 @@ import {
binaryDateRequiresExactSeconds,
binaryPlistObjectEnd,
binaryPlistUidNormalizationWidth,
type BinaryPlistScalarDecodePlan,
} from "./plistScalars.js";
const DEFAULT_PLIST_DECODE_BUDGET = "the property list decode budget";
@@ -293,33 +294,11 @@ export interface BinaryPlistValuePlan {
}
/** Preflight size and binary-key observations; XML keys are inspected by decode. */
export interface PlistDecodePreflight {
export interface PlistDecodePreflight extends Required<BinaryPlistScalarDecodePlan> {
readonly binaryValuePlan?: BinaryPlistValuePlan;
readonly estimatedBytes: number;
/** Number of expanded references to precision-unknown overlapping dates. */
readonly datePrecisionOverlapCount: number;
/** Unique reachable date records in the selected value graph. */
readonly reachableDateOffsets: readonly number[];
/** Precision-unknown date offsets requiring decoder-copy isolation. */
readonly overlappingDateOffsets: readonly number[];
/** Unique reachable 16-byte integer records in the selected value graph. */
readonly reachableWideIntegerOffsets: readonly number[];
/** Source offsets requiring isolated decoder-compatible scalar records. */
readonly overlappingWideIntegerOffsets: readonly number[];
/** Reachable integer and real source records for exact number association. */
readonly reachableNumericOffsets: readonly number[];
/** Reachable UID records cloned to one of plist@5's supported widths. */
readonly uidOffsetsToNormalize: readonly { offset: number; width: number }[];
/** Validated container headers and references needed for decoder-copy normalization. */
readonly containersToNormalize: readonly {
readonly offset: number;
readonly headerLength: number;
readonly references: readonly number[];
}[];
/** Decoder-supported width selected for the source offset table. */
readonly normalizedOffsetSize: number;
/** Decoder-supported width selected for array and dictionary references. */
readonly normalizedReferenceSize: number;
}
type BinaryObjectSpan = { readonly offset: number; readonly end: number };