Skip to content
Browse files

Make BDelta usable again as a C library.

  • Loading branch information...
1 parent 94ef9a7 commit c8dcb556119085f784ac4289028cd48b3570ab8c @jjwhitney committed Jan 11, 2012
Showing with 8 additions and 8 deletions.
  1. +4 −4 src/bdelta.h
  2. +4 −4 src/libbdelta.cpp
View
8 src/bdelta.h
@@ -17,7 +17,7 @@
extern "C" {
#endif // __cplusplus
-struct BDelta_Instance;
+typedef struct _BDelta_Instance BDelta_Instance;
// Callback function must return a pointer to the data requested.
// 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,
unsigned tokenSize);
void bdelta_done_alg(BDelta_Instance *b);
-void bdelta_pass(BDelta_Instance *b, unsigned blockSize, unsigned minMatchSize, bool local);
+void bdelta_pass(BDelta_Instance *b, unsigned blockSize, unsigned minMatchSize, int local);
void bdelta_swap_inputs(BDelta_Instance *b);
-void bdelta_clean_matches(BDelta_Instance *b, bool removeOverlap);
+void bdelta_clean_matches(BDelta_Instance *b, int removeOverlap);
-unsigned bdelta_nummatches(BDelta_Instance *b);
+unsigned bdelta_numMatches(BDelta_Instance *b);
void bdelta_getMatch(BDelta_Instance *b, unsigned matchNum,
unsigned *p1, unsigned *p2, unsigned *num);
View
8 src/libbdelta.cpp
@@ -49,7 +49,7 @@ struct Match {
{this->p1 = p1; this->p2 = p2; this->num = num;}
};
-struct BDelta_Instance {
+struct _BDelta_Instance {
bdelta_readCallback cb;
void *handle1, *handle2;
unsigned data1_size, data2_size;
@@ -348,7 +348,7 @@ void bdelta_swap_inputs(BDelta_Instance *b) {
b->matches.sort(compareMatchP2);
}
-void bdelta_clean_matches(BDelta_Instance *b, bool removeOverlap) {
+void bdelta_clean_matches(BDelta_Instance *b, int removeOverlap) {
// TODO: delete worse match when there's a conflict.
std::list<Match>::iterator place = b->matches.begin();
while (true) {
@@ -390,7 +390,7 @@ void get_unused_blocks(UnusedRange *unused, unsigned *numunusedptr) {
}
}
-void bdelta_pass(BDelta_Instance *b, unsigned blocksize, unsigned minMatchSize, bool local) {
+void bdelta_pass(BDelta_Instance *b, unsigned blocksize, unsigned minMatchSize, int local) {
// Trick for including the free range at the end.
b->matches.push_back(Match(b->data1_size, b->data2_size, 0));
@@ -428,7 +428,7 @@ void bdelta_pass(BDelta_Instance *b, unsigned blocksize, unsigned minMatchSize,
delete [] unused2;
}
-unsigned bdelta_nummatches(BDelta_Instance *b) {
+unsigned bdelta_numMatches(BDelta_Instance *b) {
return b->matches.size();
}

0 comments on commit c8dcb55

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