Gin
Loading...
Searching...
No Matches
Functions
Diff Namespace Reference

Binary diff/patch utilities using the bsdiff algorithm. More...

Functions

std::vector< uint8_tbsDiff (const juce::String &s1, const juce::String &s2)
 Creates a binary patch that transforms s1 into s2.
 
juce::String bsApplyPatch (const juce::String &s, const std::vector< uint8_t > &patch)
 Applies a binary patch to a string.
 

Detailed Description

Binary diff/patch utilities using the bsdiff algorithm.

These functions provide efficient binary differencing and patching for strings. The bsdiff algorithm creates compact patches by finding matching sequences between the old and new data.

See also
bsDiff, bsApplyPatch

Function Documentation

◆ bsDiff()

std::vector< uint8_t > Diff::bsDiff ( const juce::String &  s1,
const juce::String &  s2 
)

Creates a binary patch that transforms s1 into s2.

Uses the bsdiff algorithm to generate a compact binary patch representing the differences between two strings. The resulting patch can be applied to s1 using bsApplyPatch() to recreate s2.

Parameters
s1The original string
s2The target string
Returns
A binary patch as a vector of bytes

◆ bsApplyPatch()

juce::String Diff::bsApplyPatch ( const juce::String &  s,
const std::vector< uint8_t > &  patch 
)

Applies a binary patch to a string.

Applies a patch created by bsDiff() to transform the original string into the target string.

Parameters
sThe original string to patch
patchThe binary patch data created by bsDiff()
Returns
The resulting string after applying the patch