mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-18 16:37:32 +00:00
Patch::apply wrote each cross-reference entry by walking every edit, so a pass with many edits took time in proportion to objects times edits. It now keeps the running total of the length changes and finds, by binary search over the edits' ends, how far each object moved. For every edit set that apply still accepts, the written file is byte for byte the same. An offset that no longer fits the ten digits of a cross-reference entry (ISO 32000-1, 7.5.4) is now refused with an error instead of writing an eleven-digit entry that breaks the table. A change in length too large for an isize is refused with an error instead of wrapping.