2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2004 Net Integration Technologies, Inc.
5 * Generates a librsync delta that can turn one file into another.
6 * Uses a callback to handle a large delta so it doesn't need to be all in
13 #include "wvsyncfile.h"
15 static off_t totalsize
= 0;
17 void deltacb(WvSyncObj
&, WvBuf
&out
)
19 totalsize
+= out
.used();
20 off_t size
= out
.used();
21 wvcon
->print("--> deltacb() called (%s)\n", size
);
22 wvcon
->print(hexdump_buffer(out
.get(size
), size
));
26 int main(int argc
, char *argv
[])
30 wvcon
->print("Usage: %s srcfile newfile\n", argv
[0]);
35 WvSyncFile
srcfile(argv
[1], "");
38 srcfile
.getsig(sigbuf
);
43 size_t size
= sigbuf
.used();
44 wvcon
->print("Signature is %s bytes.\n", size
);
45 wvcon
->print(hexdump_buffer(sigbuf
.peek(0, size
), size
));
48 WvSyncFile
newfile(argv
[2], "");
51 newfile
.makedelta(sigbuf
, deltabuf
, deltacb
);
56 size
= deltabuf
.used();
58 wvcon
->print("Here's the last bit.\n");
59 wvcon
->print(hexdump_buffer(deltabuf
.get(size
), size
));
60 wvcon
->print("Delta was %s bytes.\n", totalsize
);