Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make BDelta usable again as a C library.

  • Loading branch information...
commit c8dcb556119085f784ac4289028cd48b3570ab8c 1 parent 94ef9a7
John Whitney authored

Showing 2 changed files with 8 additions and 8 deletions. Show diff stats Hide diff stats

  1. +4 4 src/bdelta.h
  2. +4 4 src/libbdelta.cpp
8 src/bdelta.h
@@ -17,7 +17,7 @@
17 17 extern "C" {
18 18 #endif // __cplusplus
19 19
20   -struct BDelta_Instance;
  20 +typedef struct _BDelta_Instance BDelta_Instance;
21 21
22 22 // Callback function must return a pointer to the data requested.
23 23 // A "fill and forget" buffer is provided, but can be ignored, so
@@ -29,12 +29,12 @@ BDelta_Instance *bdelta_init_alg(unsigned data1_size, unsigned data2_size,
29 29 unsigned tokenSize);
30 30 void bdelta_done_alg(BDelta_Instance *b);
31 31
32   -void bdelta_pass(BDelta_Instance *b, unsigned blockSize, unsigned minMatchSize, bool local);
  32 +void bdelta_pass(BDelta_Instance *b, unsigned blockSize, unsigned minMatchSize, int local);
33 33
34 34 void bdelta_swap_inputs(BDelta_Instance *b);
35   -void bdelta_clean_matches(BDelta_Instance *b, bool removeOverlap);
  35 +void bdelta_clean_matches(BDelta_Instance *b, int removeOverlap);
36 36
37   -unsigned bdelta_nummatches(BDelta_Instance *b);
  37 +unsigned bdelta_numMatches(BDelta_Instance *b);
38 38
39 39 void bdelta_getMatch(BDelta_Instance *b, unsigned matchNum,
40 40 unsigned *p1, unsigned *p2, unsigned *num);
8 src/libbdelta.cpp
@@ -49,7 +49,7 @@ struct Match {
49 49 {this->p1 = p1; this->p2 = p2; this->num = num;}
50 50 };
51 51
52   -struct BDelta_Instance {
  52 +struct _BDelta_Instance {
53 53 bdelta_readCallback cb;
54 54 void *handle1, *handle2;
55 55 unsigned data1_size, data2_size;
@@ -348,7 +348,7 @@ void bdelta_swap_inputs(BDelta_Instance *b) {
348 348 b->matches.sort(compareMatchP2);
349 349 }
350 350
351   -void bdelta_clean_matches(BDelta_Instance *b, bool removeOverlap) {
  351 +void bdelta_clean_matches(BDelta_Instance *b, int removeOverlap) {
352 352 // TODO: delete worse match when there's a conflict.
353 353 std::list<Match>::iterator place = b->matches.begin();
354 354 while (true) {
@@ -390,7 +390,7 @@ void get_unused_blocks(UnusedRange *unused, unsigned *numunusedptr) {
390 390 }
391 391 }
392 392
393   -void bdelta_pass(BDelta_Instance *b, unsigned blocksize, unsigned minMatchSize, bool local) {
  393 +void bdelta_pass(BDelta_Instance *b, unsigned blocksize, unsigned minMatchSize, int local) {
394 394 // Trick for including the free range at the end.
395 395 b->matches.push_back(Match(b->data1_size, b->data2_size, 0));
396 396
@@ -428,7 +428,7 @@ void bdelta_pass(BDelta_Instance *b, unsigned blocksize, unsigned minMatchSize,
428 428 delete [] unused2;
429 429 }
430 430
431   -unsigned bdelta_nummatches(BDelta_Instance *b) {
  431 +unsigned bdelta_numMatches(BDelta_Instance *b) {
432 432 return b->matches.size();
433 433 }
434 434

0 comments on commit c8dcb55

Please sign in to comment.
Something went wrong with that request. Please try again.