Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- only keep a partial file if some literal data has been transferred,
[rsync/rsync.git]
/
checksum.c
diff --git
a/checksum.c
b/checksum.c
index
a7ee070
..
2262728
100644
(file)
--- a/
checksum.c
+++ b/
checksum.c
@@
-34,7
+34,7
@@
uint32 get_checksum1(char *buf1,int len)
{
int i;
uint32 s1, s2;
{
int i;
uint32 s1, s2;
- s
igned char *buf = (signed
char *)buf1;
+ s
char *buf = (s
char *)buf1;
s1 = s2 = 0;
for (i = 0; i < (len-4); i+=4) {
s1 = s2 = 0;
for (i = 0; i < (len-4); i+=4) {
@@
-65,8
+65,8
@@
void get_checksum2(char *buf,int len,char *sum)
{
int i;
MDstruct MD;
{
int i;
MDstruct MD;
- static char *buf1
= NULL
;
- static int len1
= 0
;
+ static char *buf1;
+ static int len1;
if (len > len1) {
if (buf1) free(buf1);
if (len > len1) {
if (buf1) free(buf1);
@@
-77,7
+77,7
@@
void get_checksum2(char *buf,int len,char *sum)
MDbegin(&MD);
MDbegin(&MD);
-
bcopy(buf,buf1
,len);
+
memcpy(buf1,buf
,len);
if (checksum_seed) {
SIVAL(buf1,len,checksum_seed);
len += 4;
if (checksum_seed) {
SIVAL(buf1,len,checksum_seed);
len += 4;
@@
-93,16
+93,16
@@
void get_checksum2(char *buf,int len,char *sum)
}
}
-void file_checksum(char *fname,char *sum,
off_t
size)
+void file_checksum(char *fname,char *sum,
OFF_T
size)
{
{
-
off_t
i;
+
OFF_T
i;
MDstruct MD;
struct map_struct *buf;
int fd;
MDstruct MD;
struct map_struct *buf;
int fd;
-
off_t
len = size;
+
OFF_T
len = size;
char tmpchunk[CSUM_CHUNK];
char tmpchunk[CSUM_CHUNK];
-
bzero(sum
,csum_length);
+
memset(sum,0
,csum_length);
fd = open(fname,O_RDONLY);
if (fd == -1) return;
fd = open(fname,O_RDONLY);
if (fd == -1) return;
@@
-112,12
+112,12
@@
void file_checksum(char *fname,char *sum,off_t size)
MDbegin(&MD);
for(i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
MDbegin(&MD);
for(i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
-
bcopy(map_ptr(buf,i,CSUM_CHUNK),tmpchunk,
CSUM_CHUNK);
+
memcpy(tmpchunk, map_ptr(buf,i,CSUM_CHUNK),
CSUM_CHUNK);
MDupdate(&MD, tmpchunk, CSUM_CHUNK*8);
}
if (len - i > 0) {
MDupdate(&MD, tmpchunk, CSUM_CHUNK*8);
}
if (len - i > 0) {
-
bcopy(map_ptr(buf,i,len-i),tmpchunk,
len-i);
+
memcpy(tmpchunk, map_ptr(buf,i,len-i),
len-i);
MDupdate(&MD, tmpchunk, (len-i)*8);
}
MDupdate(&MD, tmpchunk, (len-i)*8);
}
@@
-155,27
+155,27
@@
void sum_update(char *p,int len)
{
int i;
if (len + sumresidue < CSUM_CHUNK) {
{
int i;
if (len + sumresidue < CSUM_CHUNK) {
-
bcopy(p,sumrbuf+sumresidue,
len);
+
memcpy(sumrbuf+sumresidue, p,
len);
sumresidue += len;
return;
}
if (sumresidue) {
i = MIN(CSUM_CHUNK-sumresidue,len);
sumresidue += len;
return;
}
if (sumresidue) {
i = MIN(CSUM_CHUNK-sumresidue,len);
-
bcopy(p,sumrbuf+sumresidue
,i);
+
memcpy(sumrbuf+sumresidue,p
,i);
MDupdate(&sumMD, sumrbuf, (i+sumresidue)*8);
len -= i;
p += i;
}
for(i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
MDupdate(&sumMD, sumrbuf, (i+sumresidue)*8);
len -= i;
p += i;
}
for(i = 0; i + CSUM_CHUNK <= len; i += CSUM_CHUNK) {
-
bcopy(p+i,sumrbuf
,CSUM_CHUNK);
+
memcpy(sumrbuf,p+i
,CSUM_CHUNK);
MDupdate(&sumMD, sumrbuf, CSUM_CHUNK*8);
}
if (len - i > 0) {
sumresidue = len-i;
MDupdate(&sumMD, sumrbuf, CSUM_CHUNK*8);
}
if (len - i > 0) {
sumresidue = len-i;
-
bcopy(p+i,sumrbuf
,sumresidue);
+
memcpy(sumrbuf,p+i
,sumresidue);
} else {
sumresidue = 0;
}
} else {
sumresidue = 0;
}