Something went wrong. Try again.
BSDIFF40 binary diff and patch in pure OCaml
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738(*--------------------------------------------------------------------------- Copyright (c) 2026 Thomas Gazagnaire <thomas@gazagnaire.org> SPDX-License-Identifier: ISC ---------------------------------------------------------------------------*)
(** BSDIFF40 errors: the kinds {!Loc.Error.kind} gains and the raisers the patch reader uses. *)
type Loc.Error.kind += | Magic_mismatch of string (** The first bytes of the patch are not ["BSDIFF40"]. Carries the bytes found. *) | Truncated of string (** The patch ended while reading the named field or section. *) | Corrupt of string (** A section does not decode: a header length or control count with the sign bit set or past the native int range, a bzip2 stream error, or a control section that is not a whole number of triples. *) | Invalid of string (** The control program is inconsistent with the data: it overruns the declared size, reads outside the source, or leaves a section unconsumed. *)
val ctx_with_triple : int -> Loc.Context.t(** [ctx_with_triple n] is the context of control triple [n]. *)
val fail_magic_mismatch : ?ctx:Loc.Context.t -> string -> 'a(** [fail_magic_mismatch fnd] raises [Loc.Error] of {!Magic_mismatch}. *)
val fail_truncated : ?ctx:Loc.Context.t -> string -> 'a(** [fail_truncated what] raises [Loc.Error] of {!Truncated}. *)
val fail_corrupt : ?ctx:Loc.Context.t -> string -> 'a(** [fail_corrupt what] raises [Loc.Error] of {!Corrupt}. *)
val fail_invalid : ?ctx:Loc.Context.t -> string -> 'a(** [fail_invalid what] raises [Loc.Error] of {!Invalid}. *)