Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 2.06 KB

vcdiff.h

File metadata and controls

74 lines (59 loc) · 2.06 KB
 
Apr 14, 2008
Apr 14, 2008
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _INCL_VCDIFF_H_
#define _INCL_VCDIFF_H_
#include <stdio.h>
#ifdef _MSC_VER
#define inline _inline
typedef unsigned char uint8;
typedef unsigned int uint32;
typedef __int64 int64;
#else
#include <stdint.h>
typedef uint8_t uint8;
typedef uint32_t uint32;
typedef int64_t int64;
#endif
/*
* These allocators work just like the C runtime's malloc() and free()
* (in fact, they probably use malloc() and free() internally if you don't
* specify your own allocator, but don't rely on that behaviour).
* (data) is the pointer you supplied when specifying these allocator
* callbacks, in case you need instance-specific data...it is passed through
* to your allocator unmolested, and can be NULL if you like.
*/
typedef void *(*vcdiff_malloc)(int bytes, void *data);
typedef void (*vcdiff_free)(void *ptr, void *data);
/*
* If you need more fined-grained control over i/o than you get from
* filenames, you can use these abstracted i/o intefaces with
* vcdiff() instead of vcdiff_fname().
*/
typedef struct
{
int64 (*read)(void *ctx, void *buf, uint32 n);
int64 (*write)(void *ctx, void *buf, uint32 n);
int64 (*seek)(void *ctx, uint64 n);
void *ctx;
} vcdiff_io;
/* !!! FIXME: documentation. */
/*
*(iosrc) and (iodelta) need read access, (iodst) needs read
* AND write access. All three streams must be seekable!
*/
int vcdiff(vcdiff_io *iosrc, vcdiff_io *iodelta, vcdiff_io *iodst,
vcdiff_malloc m, vcdiff_free f, void *d);
/* !!! FIXME: documentation. */
/*
*(fiosrc) and (fiodelta) need read access, (fiodst) needs read
* AND write access. All three streams must be seekable!
*/
int vcdiff_stdio(FILE *fiosrc, FILE *fiodelta, FILE *fiodst,
vcdiff_malloc m, vcdiff_free f, void *d);
/* !!! FIXME: documentation. */
/*
*(src) and (delta) need read access, (dst) needs read
* AND write access. All three streams must be seekable!
*/
int vcdiff_fname(const char *src, const char *delta, const char *dst,
vcdiff_malloc m, vcdiff_free f, void *d);
#endif /* include-once blocker. */
/* end of vcdiff.h ... */