Fix compile warnings.
This commit is contained in:
parent
1eee08040f
commit
3f0e1952ef
2 changed files with 6 additions and 3 deletions
|
@ -89,7 +89,7 @@ uint32_t rabin_polynomial_max_block_size = RAB_POLYNOMIAL_MAX_BLOCK_SIZE;
|
||||||
* Initialize the algorithm with the default params.
|
* Initialize the algorithm with the default params.
|
||||||
*/
|
*/
|
||||||
rabin_context_t *
|
rabin_context_t *
|
||||||
create_rabin_context(uint64_t chunksize, char *algo) {
|
create_rabin_context(uint64_t chunksize, const char *algo) {
|
||||||
rabin_context_t *ctx;
|
rabin_context_t *ctx;
|
||||||
unsigned char *current_window_data;
|
unsigned char *current_window_data;
|
||||||
uint32_t blknum, index;
|
uint32_t blknum, index;
|
||||||
|
@ -254,7 +254,7 @@ rabin_dedup(rabin_context_t *ctx, uchar_t *buf, ssize_t *size, ssize_t offset)
|
||||||
// If we found at least a few chunks, perform dedup.
|
// If we found at least a few chunks, perform dedup.
|
||||||
if (blknum > 2) {
|
if (blknum > 2) {
|
||||||
uint64_t prev_cksum;
|
uint64_t prev_cksum;
|
||||||
uint32_t blk, prev_length;
|
uint32_t blk, prev_length, nblocks;
|
||||||
ssize_t pos, matchlen;
|
ssize_t pos, matchlen;
|
||||||
int valid = 1;
|
int valid = 1;
|
||||||
char *tmp, *prev_offset;
|
char *tmp, *prev_offset;
|
||||||
|
@ -331,6 +331,7 @@ rabin_dedup(rabin_context_t *ctx, uchar_t *buf, ssize_t *size, ssize_t offset)
|
||||||
*/
|
*/
|
||||||
prev_index = 0;
|
prev_index = 0;
|
||||||
prev_length = 0;
|
prev_length = 0;
|
||||||
|
nblocks = 0;
|
||||||
for (blk = 0; blk < blknum; blk++) {
|
for (blk = 0; blk < blknum; blk++) {
|
||||||
rabin_blockentry_t *be;
|
rabin_blockentry_t *be;
|
||||||
|
|
||||||
|
@ -368,6 +369,7 @@ rabin_dedup(rabin_context_t *ctx, uchar_t *buf, ssize_t *size, ssize_t offset)
|
||||||
prev_length += be->length;
|
prev_length += be->length;
|
||||||
rabin_index[prev_index] = htonl(prev_length);
|
rabin_index[prev_index] = htonl(prev_length);
|
||||||
rabin_index[blk] = 0;
|
rabin_index[blk] = 0;
|
||||||
|
nblocks++;
|
||||||
} else {
|
} else {
|
||||||
prev_index = 0;
|
prev_index = 0;
|
||||||
prev_length = 0;
|
prev_length = 0;
|
||||||
|
@ -386,6 +388,7 @@ cont:
|
||||||
uchar_t *cbuf = ctx->cbuf;
|
uchar_t *cbuf = ctx->cbuf;
|
||||||
ssize_t *entries;
|
ssize_t *entries;
|
||||||
|
|
||||||
|
printf("blknum: %u, nblocks: %u\n", blknum, nblocks);
|
||||||
*((uint32_t *)cbuf) = htonl(blknum);
|
*((uint32_t *)cbuf) = htonl(blknum);
|
||||||
cbuf += sizeof (uint32_t);
|
cbuf += sizeof (uint32_t);
|
||||||
entries = (ssize_t *)cbuf;
|
entries = (ssize_t *)cbuf;
|
||||||
|
|
|
@ -137,7 +137,7 @@ typedef struct {
|
||||||
int level;
|
int level;
|
||||||
} rabin_context_t;
|
} rabin_context_t;
|
||||||
|
|
||||||
extern rabin_context_t *create_rabin_context(uint64_t chunksize, char *algo);
|
extern rabin_context_t *create_rabin_context(uint64_t chunksize, const char *algo);
|
||||||
extern void destroy_rabin_context(rabin_context_t *ctx);
|
extern void destroy_rabin_context(rabin_context_t *ctx);
|
||||||
extern unsigned int rabin_dedup(rabin_context_t *ctx, unsigned char *buf,
|
extern unsigned int rabin_dedup(rabin_context_t *ctx, unsigned char *buf,
|
||||||
ssize_t *size, ssize_t offset);
|
ssize_t *size, ssize_t offset);
|
||||||
|
|
Loading…
Reference in a new issue