X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/7cacd47eddc8fc7d932a67ab7775c428e8387bbe..e912bd4dfbd9cfa83f7b76209b3fcb34f59b92f9:/match.c diff --git a/match.c b/match.c index f8c4de69..f9412618 100644 --- a/match.c +++ b/match.c @@ -23,6 +23,7 @@ extern int verbose; extern int am_server; extern int do_progress; extern int checksum_seed; +extern int append_mode; int updating_basis_file; @@ -102,7 +103,7 @@ static OFF_T last_match; * have only literal data. **/ static void matched(int f, struct sum_struct *s, struct map_struct *buf, - OFF_T offset, int i) + OFF_T offset, int32 i) { int32 n = offset - last_match; /* max value: block_size (int32) */ int32 j; @@ -127,18 +128,13 @@ static void matched(int f, struct sum_struct *s, struct map_struct *buf, sum_update(map_ptr(buf, last_match + j, n1), n1); } - if (i >= 0) last_match = offset + s->sums[i].len; else last_match = offset; - if (buf && do_progress) { + if (buf && do_progress) show_progress(last_match, buf->file_size); - - if (i == -1) - end_progress(buf->file_size); - } } @@ -334,6 +330,25 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len) sum_init(checksum_seed); + if (append_mode) { + OFF_T j = 0; + for (j = CHUNK_SIZE; j < s->flength; j += CHUNK_SIZE) { + if (buf && do_progress) + show_progress(last_match, buf->file_size); + sum_update(map_ptr(buf, last_match, CHUNK_SIZE), + CHUNK_SIZE); + last_match = j; + } + if (last_match < s->flength) { + int32 len = s->flength - last_match; + if (buf && do_progress) + show_progress(last_match, buf->file_size); + sum_update(map_ptr(buf, last_match, len), len); + last_match = s->flength; + } + s->count = 0; + } + if (len > 0 && s->count > 0) { build_hash_table(s); @@ -347,7 +362,7 @@ void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len) } else { OFF_T j; /* by doing this in pieces we avoid too many seeks */ - for (j = CHUNK_SIZE; j < len; j += CHUNK_SIZE) + for (j = last_match + CHUNK_SIZE; j < len; j += CHUNK_SIZE) matched(f, s, buf, j, -2); matched(f, s, buf, len, -1); }