s-bsdipa, a mutation of BSDiff
==============================

Colin Percival's BSDiff, imported from FreeBSD and transformed into
a library; please see header comment of s-bsdipa-lib.h for more:
create or apply binary difference patch.  In general:

- one includes s-bsdipa-lib.h and uses the all-in-memory s_bsdipa_diff()
  and s_bsdipa_patch() functions to create and apply patches.
  Ie, (for example mmap(2)ed) memory in, (heap) memory out.

- necessary compression / storage preparation can (could) be achieved
  easily by including s-bsdipa-io.h after defining s_BSDIPA_IO as
  desired, followed by using the according s_bsdipa_io_write_*() and
  _read_*() functions; These still do not perform direct I/O, but call
  a supplied hook with fully prepared buffers or store in (heap) memory,
  respectively.  Multiple _IO methods are provided.

- in general the lib/ directory of the source repository is self-
  contained, and may be copied for inclusion in other projects.

- please see the introductional header comments of s-bsdipa-lib.h and
  s-bsdipa-io.h for more.

- the directory s-bsdipa contains a self-contained (except for
  compression libraries) (example) program which can create and apply
  patches (like a combined FreeBSD bsdiff and bspatch program).
  It times execution and tracks memory usage on stderr.

- the directory perl contains the self-contained BsDiPa CPAN module.
  (Perl ships with ZLIB, liblzma/XZ support is compile-time detected.)

Licenses (full text included in s-bsdipa-lib.h):
  libdivsufsort(/LICENSE): MIT
  s-bsdiff.c, s-bspatch.c: BSD-2-clause
  s-bsdipa-lib.h, s-bsdipa-io.h, s-bsdipa.c: ISC

Repository:
  browse: https?://git.sdaoden.eu/browse/s-bsdipa.git
  clone:  https?://git.sdaoden.eu/scm/s-bsdipa.git

  alternatively: https://github.com/sdaoden/s-bsdipa

Contact: steffen at sdaoden dot eu.

RELEASES
--------

v0.8.0, 2025-07-03:
  - ABI and API breakage.
  - Fixes a cast that could have lost bits on systems with a 64-bit
    bsdipa_off_t and a 32-bit size_t (if any).
  - Adds an "is equal data" state.
  - Adds optional XZ (LZMA2, liblzma, XZ utils) _IO method support.
  - Adds I/O cookie support (yet only for XZ): cookie can be reused by
    successive calls to diff/patch, which can aid in dramatical
    reduction of resource aquire/release cycles.
  - s-bsdipa is now a real program, with options, manual, test, etc.
  - Coverity.com (project 31371 / s-bsdipa) still sees us 0.0.

v0.7.0, 2025-02-19:
  - CHANGE: honour s_bsdipa_patch_ctx::pc_max_allowed_restored_len
    already on the s-bsdipa-io.h layer, directly after having called
    s_bsdipa_patch_parse_header().  (Ie, before the ".pc_patch_dat
    allocation" even.)
  - FIX for s-bsdipa example program: when compiled without NDEBUG
    it would munmap(2) invalidated pointer/length combo.

v0.6.1, 2025-02-17:
  - Coverity.com (project 31371 / s-bsdipa) FIXes for the s-bsdipa
    example program: one unused value, one fd resource leak.
    (Tool design changed without that being adopted in early design
    stage: obviously not enough iterations and/or too much fuzz.)
  - bsdipa_patch() CHANGE: until now field lengths were not verified
    in the (unusual) .pc_patch_dat==NULL case, as the user was expected
    to have done this before; instead, always check anything.
  -- Do not increment minor number nonetheless, no ABI change.

v0.6.0, 2025-01-31:
  - Adds struct s_bsdipa_patch_ctx::pc_max_allowed_restored_len, which
    allows to configure the maximum allowed size of the restored data.
    (Mostly for perl or other possible script/xy interfaces, the
    C interface as such has s_bsdipa_header::h_before_len ...)

v0.5.3, 2025-01-17:
  - FIXes totally false buffer usage blindlessly introduced to fix
    (correct .. but nonetheless false) cpantesters.org assertion
    failure.  (That is: it is binary data so NUL termination is a fake,
    .. but that is how it has to be, stupid!)
    What a mess.

v0.5.2, 2025-01-09:
  - CHANGE/FIX: ensure patch fits in _OFF_MAX, including control data.
    s_bsdipa_patch_parse_header() did verify that on the patch side,
    but on the diff side we yet did not care, as in theory the data
    could have been stored in individual chunks.
  - FIX: perl CPAN testers started failing (in a second round?)
    due to assertion failures regarding SV_HAS_TRAILING_NUL and that
    missing.  Therefore ensure our memory results have one byte in
    addition and do always terminate them.
  - more perl module creation related tweaks.

v0.5.1, 2025-01-05:
  - perl module creation related tweaks.

v0.5.0, 2024-12-26: (first release)

# s-ts-mode
