#[unsafe(no_mangle)]pub unsafe extern "C" fn hurray_file_writer_finish(
handle: *mut HurrayFileWriter,
kv: *const HurrayKvEntry,
kv_count: usize,
) -> HurrayStatusExpand description
Writes the KV section, the footer index and the 40-byte trailer, completing the file.
Until this returns HURRAY_OK the bytes on the sink are not a container: the index
a reader opens from is written here. Calling it twice after it returned
HURRAY_OK fails.
A footer that failed before any of its bytes reached the sink may be written again: nothing was emitted, so the file is still completable (ADR-041 § 6b). This is the one retry worth having here — the data is already on the sink, and only the index is missing. A footer that failed after its first byte poisons the writer like any other torn item.
kv MAY be null with a kv_count of 0 for a file with no metadata section. Keys
MUST be non-empty, at most 65 535 bytes, and unique. Entries read out of another file
with hurray_file_reader_kv_entry can be
passed straight in.
The writer handle stays alive and MUST still be destroyed with
hurray_file_writer_destroy; any flush or close belongs to the transport’s release
callback, because only the caller knows what its sink is.
§Safety
handleMUST point to a liveHurrayFileWriter.- If
kv_countis non-zero,kvMUST point tokv_countreadableHurrayKvEntryvalues whose own pointers are readable for their declared lengths, all unmodified until this call returns.