VLC 4.0.0-dev
Loading...
Searching...
No Matches
diffutil.c File Reference
Include dependency graph for diffutil.c:

Data Structures

struct  diffutil_snakepoint_t
 
struct  diffutil_snake_t
 
struct  diffutil_box_t
 
struct  diffutil_context_t
 
struct  vlc_build_result_context
 

Macros

#define POS_MOD(x, n)   ((x) % n + n) % n
 

Typedefs

typedef struct diffutil_snake_t diffutil_snake_t
 

Functions

static bool Forwards (diffutil_context_t *ctx, const diffutil_box_t *box, int32_t d, diffutil_snakepoint_t *snakeOut)
 
static bool Backward (diffutil_context_t *ctx, const diffutil_box_t *box, int32_t d, diffutil_snakepoint_t *snakeOut)
 
static bool FindMidPoint (diffutil_context_t *ctx, const diffutil_box_t *box, diffutil_snakepoint_t snakeOut[2])
 
static diffutil_snake_tMergeSnake (const diffutil_snakepoint_t *start, const diffutil_snakepoint_t *stop, diffutil_snake_t *head, diffutil_snake_t *tail)
 
static diffutil_snake_tDiffUtilFindPath (diffutil_context_t *ctx, int32_t left, int32_t top, int32_t right, int32_t bottom)
 
diffutil_snake_tvlc_diffutil_build_snake (const vlc_diffutil_callback_t *diffOp, const void *dataOld, const void *dataNew)
 vlc_diffutil_build_snake compute a diff model between the dataOld model and the dataNew model.
 
void vlc_diffutil_free_snake (diffutil_snake_t *snake)
 free the snake created by vlc_diffutil_build_snake
 
bool vlc_diffutil_walk_snake (const diffutil_snake_t *snake, const vlc_diffutil_snake_callback_t *snakeOp, void *cbData, const vlc_diffutil_callback_t *diffOp, const void *dataOld, const void *dataNew)
 iterate over the changelist and callback user on each operation (keep/insert/remove)
 
static void buildResultInsert (void *cbData, const void *listOld, uint32_t oldPos, const void *listNew, uint32_t newPos)
 
static void buildResultRemove (void *cbData, const void *listOld, unsigned posOld, const void *listNew, uint32_t posNew)
 
static void buildResultEqual (void *cbData, const void *listOld, uint32_t posOld, const void *listNew, uint32_t posNew)
 
static void vlc_diffutil_gather_move_changes (vlc_build_result_context *ctx, const vlc_diffutil_callback_t *diffOp, const void *dataOld, const void *dataNew, enum vlc_diffutil_result_flag flags)
 
vlc_diffutil_changelist_tvlc_diffutil_build_change_list (const diffutil_snake_t *snake, const vlc_diffutil_callback_t *diffOp, const void *dataOld, const void *dataNew, int flags)
 
void vlc_diffutil_free_change_list (vlc_diffutil_changelist_t *changelist)
 free the changelist created by vlc_diffutil_build_change_list
 

Macro Definition Documentation

◆ POS_MOD

#define POS_MOD (   x,
 
)    ((x) % n + n) % n

Typedef Documentation

◆ diffutil_snake_t

Function Documentation

◆ Backward()

◆ buildResultEqual()

static void buildResultEqual ( void *  cbData,
const void *  listOld,
uint32_t  posOld,
const void *  listNew,
uint32_t  posNew 
)
static

◆ buildResultInsert()

◆ buildResultRemove()

◆ DiffUtilFindPath()

◆ FindMidPoint()

◆ Forwards()

◆ MergeSnake()

◆ vlc_diffutil_build_change_list()

◆ vlc_diffutil_build_snake()

diffutil_snake_t * vlc_diffutil_build_snake ( const vlc_diffutil_callback_t diffOp,
const void *  dataOld,
const void *  dataNew 
)

vlc_diffutil_build_snake compute a diff model between the dataOld model and the dataNew model.

This model can be processed manually using vlc_diffutil_walk_snake or translated into a change list using vlc_diffutil_build_change_list

Parameters
diffOpcallback to compare the elements from the old and new model
dataOldold model
dataNewnew model
Returns
the diff model, NULL on error

References diffutil_context_t::backward, diffutil_context_t::dataNew, diffutil_context_t::dataOld, DiffUtilFindPath(), diffutil_context_t::forward, vlc_diffutil_callback_t::getNewSize, vlc_diffutil_callback_t::getOldSize, vlc_diffutil_callback_t::isSame, diffutil_context_t::op, vlc_vector_init, and diffutil_context_t::z.

◆ vlc_diffutil_free_change_list()

void vlc_diffutil_free_change_list ( vlc_diffutil_changelist_t changelist)

free the changelist created by vlc_diffutil_build_change_list

References vlc_vector_destroy.

◆ vlc_diffutil_free_snake()

void vlc_diffutil_free_snake ( diffutil_snake_t snake)

free the snake created by vlc_diffutil_build_snake

References vlc_vector_destroy.

◆ vlc_diffutil_gather_move_changes()

◆ vlc_diffutil_walk_snake()

bool vlc_diffutil_walk_snake ( const diffutil_snake_t snake,
const vlc_diffutil_snake_callback_t snakeOp,
void *  cbData,
const vlc_diffutil_callback_t diffOp,
const void *  dataOld,
const void *  dataNew 
)

iterate over the changelist and callback user on each operation (keep/insert/remove)

Parameters
snakethe snake created with vlc_diffutil_build_snake
snakeOpsnake callback
cbDatauser data for snake callbacks
diffOpcallbacks used in vlc_diffutil_build_snake
dataOldold model
dataNewnew model
Returns
false on error
Warning
dataOld and dataNew should not be altered during the operation

References diffutil_snake_t::data, vlc_diffutil_snake_callback_t::equal, vlc_diffutil_snake_callback_t::insert, vlc_diffutil_snake_callback_t::remove, diffutil_snake_t::size, diffutil_snakepoint_t::x, and diffutil_snakepoint_t::y.

Referenced by vlc_diffutil_build_change_list().