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.6.0')

A version string.

CONTACT (string)

Bug/Contact information. Could be multiline, but has no trailing newline.

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, like invalid argument.

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 error undef is stored if at least $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, $max_allowed_restored_len=0)

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. $max_allowed_restored_len specifies the maximum allowed size of the restored data in bytes, if 0 the effective limit is 31-bit. On error undef is stored if at least $before_sv is accessible.

core_patch_raw($after_sv, $patch_sv, $before_sv, $max_allowed_restored_len=0)

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.