summaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2005-07-28 01:46:12 +0000
committerWayne Davison <wayned@samba.org>2005-07-28 01:46:12 +0000
commit6cc119828892f4c28fc55274e11055f8c420515c (patch)
treefbd1f013f487c30a37f35a43ce5de4cc506ed143 /match.c
parenta015788d2199115585634f93142a401ae03310df (diff)
downloadrsync-6cc119828892f4c28fc55274e11055f8c420515c.tar.gz
rsync-6cc119828892f4c28fc55274e11055f8c420515c.tar.bz2
rsync-6cc119828892f4c28fc55274e11055f8c420515c.zip
Support new --append option.
Diffstat (limited to 'match.c')
-rw-r--r--match.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/match.c b/match.c
index 00a38aa4..e42abca6 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;
@@ -330,6 +331,21 @@ 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) {
+ 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;
+ 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);
@@ -343,7 +359,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);
}