extern int always_checksum;
extern char *partial_dir;
extern char *basis_dir[];
-extern int copy_dest;
+extern int compare_dest;
extern int link_dest;
extern int whole_file;
extern int local_server;
else {
int32 c;
uint64 l;
- for (c = 1, l = len; l >>= 2; c <<= 1) {
- assert(c > 0);
+ int cnt;
+ for (c = 1, l = len, cnt = 0; l >>= 2; c <<= 1, cnt++) {}
+ if (cnt >= 31 || c >= MAX_BLOCK_SIZE)
+ blength = MAX_BLOCK_SIZE;
+ else {
+ blength = 0;
+ do {
+ blength |= c;
+ if (len < (uint64)blength * blength)
+ blength &= ~c;
+ c >>= 1;
+ } while (c >= 8); /* round to multiple of 8 */
+ blength = MAX(blength, BLOCK_SIZE);
}
- blength = 0;
- do {
- blength |= c;
- if (len < (uint64)blength * blength)
- blength &= ~c;
- c >>= 1;
- } while (c >= 8); /* round to multiple of 8 */
- blength = MAX(blength, BLOCK_SIZE);
}
if (protocol_version < 27) {
safe_fname(fname));
}
fnamecmp = fnamecmpbuf;
- fnamecmp_type = FNAMECMP_BASIS_DIR + i;
+ fnamecmp_type = i;
}
} else
#endif
{
fnamecmp = fnamecmpbuf;
- fnamecmp_type = FNAMECMP_BASIS_DIR + i;
+ fnamecmp_type = i;
}
}
}
return;
}
- if ((link_dest || copy_dest) && fnamecmp_type != FNAMECMP_FNAME)
+ if (!compare_dest && fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
;
else if (unchanged_file(fnamecmp, file, &st)) {
if (fnamecmp_type == FNAMECMP_FNAME)
notify_others:
write_int(f_out, i);
+ if (protocol_version >= 29 && inplace && !read_batch)
+ write_byte(f_out, fnamecmp_type);
if (f_out_name >= 0)
write_byte(f_out_name, fnamecmp_type);