bpak_bsdiff — bsdiff¶
The BPAK bsdiff module, bsdiff is used to generate a binary patch between two different, binary, input files. This produces patches without any compression, which is not meningful but BPAK provides this API anyway to allow the user a choice of compression algorithm.
Source code: include/bpak/bsdiff.h, lib/bsdiff.c
BPAK - Bit Packer
Copyright (C) 2022 Jonas Blixt jonpe960@gmail.com
SPDX-License-Identifier: BSD-3-Clause
Functions
-
int bpak_bsdiff_init(struct bpak_bsdiff_context *ctx, uint8_t *origin_data, size_t origin_length, uint8_t *new_data, size_t new_length, bpak_io_t write_output, off_t output_offset, enum bpak_compression compression, void *user_priv)¶
Initialize a bsdiff context
- Parameters:
ctx – [in] The bsdiff context
origin_data – [in] pointer to origin/source data
origin_length – [in] Length of origin data
new_data – [in] New, or target data
new_length – [in] Length of target data
write_output – [in] I/O callback for writing output data
user_priv – [in] Priv context for i/o callback
- Returns:
BPAK_OK on success or a negative number
-
ssize_t bpak_bsdiff(struct bpak_bsdiff_context *ctx)¶
Perform the diff process
- Parameters:
ctx – [in] The bsdiff context
- Returns:
size out output patch on success or a negative number
-
void bpak_bsdiff_free(struct bpak_bsdiff_context *ctx)¶
Free the diff context
- Parameters:
ctx – [in] The bsdiff context
-
struct bpak_bsdiff_context¶
Public Members
-
int origin_fd¶
-
uint8_t *origin_data¶
-
size_t origin_length¶
-
int new_fd¶
-
uint8_t *new_data¶
-
size_t new_length¶
-
int64_t *suffix_array¶
-
size_t suffix_array_size¶
-
int64_t scan¶
-
int64_t len¶
-
int64_t pos¶
-
int64_t last_scan¶
-
int64_t last_pos¶
-
int64_t last_offset¶
-
int64_t scsc¶
-
off_t output_offset¶
-
size_t output_pos¶
-
enum bpak_compression compression¶
-
void *compressor_priv¶
-
void *user_priv¶
-
int origin_fd¶