NAME
S-bsdipa -- create or apply binary difference patch
SYNOPSIS
use BsDiPa;
print BsDiPa::VERSION, "\n";
print BsDiPa::CONTACT;
print BsDiPa::COPYRIGHT;
# BsDiPa::{OK,FBIG,NOMEM,INVAL}: status codes
my ($b, $a) = ("\012\013\00\01\02\03\04\05\06\07" x 3,
"\010\011\012\013\014" x 4);
my $pz;
die 'sick' if BsDiPa::core_diff_zlib($b, $a, \$pz) ne BsDiPa::OK;
my $pr;
die 'sick2' if BsDiPa::core_diff_raw($b, $a, \$pr) ne BsDiPa::OK;
my $x = uncompress($pz);
die 'sick3' unless(($pr cmp $x) == 0);
my $rz;
die 'sick4' if BsDiPa::core_patch_zlib($a, $pz, \$rz) ne BsDiPa::OK;
my $rr;
die 'sick5' if BsDiPa::core_patch_raw($a, $pr, \$rr) ne BsDiPa::OK;
die 'sick6' unless(($rz cmp $rr) == 0);
DESCRIPTION
Colin Percival's BSDiff, imported from FreeBSD and transformed into a library; please see header comment of lib/s-bsdipa-lib.h for more: create or apply binary difference patch. The perl package only uses s_BSDIPA_32
mode (31-bit size limits).
INTERFACE
VERSION
(string, eg, '0.5.2')-
A version string.
CONTACT
(string)-
Bug/Contact information. Could be multiline, but has no trailing newline.
COPYRIGHT
(string)-
A multiline string containing a copyright license summary.
OK
(number)-
Result is usable.
FBIG
(number)-
Data or resulting control block length too large.
NOMEM
(number)-
Allocation failure.
INVAL
(number)-
Any other error.
core_diff_zlib($before_sv, $after_sv, $patch_sv, $magic_window=0)
-
Create a compressed binary diff from the memory backing
$before_sv
to the memory backing$after_sv
, and place the result in the (de-)reference(d)$patch_sv
. On errorundef
is stored if only$patch_sv
is accessible.$magic_window
specifies lookaround bytes, if 0 the built-in default is used (16 at the time of this writing); the already unreasonable value 4096 is the maximum supported. core_diff_raw($before_sv, $after_sv, $patch_sv, $magic_window=0)
-
Exactly like
core_diff_zlib()
, but without compression. As compression is absolutely necessary, only meant for testing, or as a foundation for other compression methods. core_patch_zlib($after_sv, $patch_sv, $before_sv)
-
Apply a compressed binary diff
$patch_sv
to the memory backing$after_sv
in order to restore original content in the (de-)reference(d)$before_sv
. On errorundef
is stored if only$before_sv
is accessible. core_patch_raw($after_sv, $patch_sv, $before_sv)
-
Exactly like
core_patch_zlib()
, but expects raw uncompressed patch.
AUTHOR
Steffen Nurpmeso <steffen@sdaoden.eu>.
LICENSE
All included parts use Open Source licenses. Please dump the module constant COPYRIGHT
for more.