aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cvsignore75
-rw-r--r--checksum.c8
-rw-r--r--match.c10
-rw-r--r--rsync.c10
-rw-r--r--rsync.h5
5 files changed, 43 insertions, 65 deletions
diff --git a/.cvsignore b/.cvsignore
index 1c8e87b6..c64ccd20 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -7,55 +7,7 @@ config.log
config.status
dist.tar.gz
rsync
-rsync-0.1
-rsync-0.1
-rsync-0.1
-rsync-0.1.tar.gz
-rsync-0.2
-rsync-0.2
-rsync-0.2.tar.gz
-rsync-0.3
-rsync-0.3
-rsync-0.3.tar.gz
-rsync-0.4
-rsync-0.4
-rsync-0.4.tar.gz
-rsync-0.5
-rsync-0.5
-rsync-0.5
-rsync-0.5
-rsync-0.5
-rsync-0.5
-rsync-0.5
-rsync-0.5
-rsync-0.5.tar.gz
-rsync-0.6
-rsync-0.7
-rsync-0.7
-rsync-0.8
-rsync-0.8
-rsync-0.8
-rsync-0.8
-rsync-0.8.tar.gz
-rsync-0.9
-rsync-0.9.tar.gz
-rsync-1.0
-rsync-1.1
-rsync-1.1.tar.gz
-rsync-1.2
-rsync-1.2.tar.gz
-rsync-1.3
-rsync-1.4
-rsync-1.4.1
-rsync-1.4.1.tar.gz
-rsync-1.4.2
-rsync-1.4.2.tar.gz
-rsync-1.4.3
-rsync-1.4.4
-rsync-1.4.5
-rsync-1.4.5.tar.gz
-rsync-1.4.tar.gz
-rsync-ERSION
+rsync-*
rsync.aux
rsync.dvi
rsync.log
@@ -64,3 +16,28 @@ tech_report.dvi
tech_report.log
tech_report.ps
test
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/checksum.c b/checksum.c
index 1fd1c55c..6be1993e 100644
--- a/checksum.c
+++ b/checksum.c
@@ -19,7 +19,7 @@
#include "rsync.h"
-int csum_length=SUM_LENGTH;
+int csum_length=2; /* initial value */
#define CSUM_CHUNK 64
@@ -37,11 +37,11 @@ uint32 get_checksum1(char *buf,int len)
s1 = s2 = 0;
for (i = 0; i < (len-4); i+=4) {
- s2 += 4*(s1 + buf[i]) + 3*buf[i+1] + 2*buf[i+2] + buf[i+3];
- s1 += (buf[i+0] + buf[i+1] + buf[i+2] + buf[i+3]);
+ s2 += 4*(s1 + buf[i]) + 3*buf[i+1] + 2*buf[i+2] + buf[i+3] + 10;
+ s1 += (buf[i+0] + buf[i+1] + buf[i+2] + buf[i+3] + 4);
}
for (; i < len; i++) {
- s1 += buf[i]; s2 += s1;
+ s1 += (buf[i]+1); s2 += s1;
}
return (s1 & 0xffff) + (s2 << 16);
}
diff --git a/match.c b/match.c
index 16df8714..e15f4401 100644
--- a/match.c
+++ b/match.c
@@ -221,12 +221,12 @@ static void hash_search(int f,struct sum_struct *s,
/* Trim off the first byte from the checksum */
map = window_ptr(buf,offset,k+1);
- s1 -= map[0];
- s2 -= k * map[0];
+ s1 -= map[0] + 1;
+ s2 -= k * (map[0]+1);
/* Add on the next byte (if there is one) to the checksum */
if (k < (len-offset)) {
- s1 += map[k];
+ s1 += (map[k]+1);
s2 += s1;
} else {
--k;
@@ -241,7 +241,7 @@ static void hash_search(int f,struct sum_struct *s,
void match_sums(int f,struct sum_struct *s,struct map_struct *buf,off_t len)
{
- char file_sum[SUM_LENGTH];
+ char file_sum[MD4_SUM_LENGTH];
last_match = 0;
false_alarms = 0;
@@ -270,7 +270,7 @@ void match_sums(int f,struct sum_struct *s,struct map_struct *buf,off_t len)
if (remote_version >= 14) {
if (verbose > 2)
fprintf(FERROR,"sending file_sum\n");
- write_buf(f,file_sum,SUM_LENGTH);
+ write_buf(f,file_sum,MD4_SUM_LENGTH);
}
if (targets) {
diff --git a/rsync.c b/rsync.c
index 18412488..79e0b748 100644
--- a/rsync.c
+++ b/rsync.c
@@ -257,7 +257,7 @@ void recv_generator(char *fname,struct file_list *flist,int i,int f_out)
struct stat st;
struct map_struct *buf;
struct sum_struct *s;
- char sum[SUM_LENGTH];
+ char sum[MD4_SUM_LENGTH];
int statret;
struct file_struct *file = &flist->files[i];
@@ -408,8 +408,8 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
off_t offset = 0;
off_t offset2;
char *data;
- static char file_sum1[SUM_LENGTH];
- static char file_sum2[SUM_LENGTH];
+ static char file_sum1[MD4_SUM_LENGTH];
+ static char file_sum2[MD4_SUM_LENGTH];
char *map=NULL;
count = read_int(f_in);
@@ -462,10 +462,10 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname)
sum_end(file_sum1);
if (remote_version >= 14) {
- read_buf(f_in,file_sum2,SUM_LENGTH);
+ read_buf(f_in,file_sum2,MD4_SUM_LENGTH);
if (verbose > 2)
fprintf(FERROR,"got file_sum\n");
- if (memcmp(file_sum1,file_sum2,SUM_LENGTH) != 0)
+ if (memcmp(file_sum1,file_sum2,MD4_SUM_LENGTH) != 0)
return 0;
}
return 1;
diff --git a/rsync.h b/rsync.h
index 9bd631a1..9301062a 100644
--- a/rsync.h
+++ b/rsync.h
@@ -170,6 +170,7 @@
#endif
/* the length of the md4 checksum */
+#define MD4_SUM_LENGTH 16
#define SUM_LENGTH 16
#ifndef MAXPATHLEN
@@ -188,7 +189,7 @@ struct file_struct {
char *name;
char *dir;
char *link;
- char sum[SUM_LENGTH];
+ char sum[MD4_SUM_LENGTH];
};
struct file_list {
@@ -202,7 +203,7 @@ struct sum_buf {
int len; /* length of chunk of file */
int i; /* index of this chunk */
uint32 sum1; /* simple checksum */
- char sum2[SUM_LENGTH]; /* md4 checksum */
+ char sum2[SUM_LENGTH]; /* checksum */
};
struct sum_struct {