extern int only_existing;
extern int orig_umask;
extern int safe_symlinks;
-extern unsigned int block_size;
+extern long block_size; /* "long" because popt can't set an int32. */
extern struct exclude_list_struct server_exclude_list;
*/
static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len)
{
- unsigned int blength;
+ int32 blength;
int s2length;
- uint32 c;
- uint64 l;
- if (block_size) {
+ if (block_size)
blength = block_size;
- } else if (len <= BLOCK_SIZE * BLOCK_SIZE) {
+ else if (len <= BLOCK_SIZE * BLOCK_SIZE)
blength = BLOCK_SIZE;
- } else {
- l = len;
- c = 1;
- while (l >>= 2) {
- c <<= 1;
+ else {
+ int32 c;
+ uint64 l;
+ for (c = 1, l = len; l >>= 2; c <<= 1) {
+ assert(c > 0);
}
blength = 0;
do {
} else if (csum_length == SUM_LENGTH) {
s2length = SUM_LENGTH;
} else {
+ int32 c;
+ uint64 l;
int b = BLOCKSUM_BIAS;
- l = len;
- while (l >>= 1) {
- b += 2;
- }
- c = blength;
- while (c >>= 1 && b) {
- b--;
- }
- s2length = (b + 1 - 32 + 7) / 8; /* add a bit,
- * subtract rollsum,
- * round up
- * --optimize in compiler--
- */
+ for (l = len; l >>= 1; b += 2) {}
+ for (c = blength; c >>= 1 && b; b--) {}
+ /* add a bit, subtract rollsum, round up. */
+ s2length = (b + 1 - 32 + 7) / 8; /* --optimize in compiler-- */
s2length = MAX(s2length, csum_length);
s2length = MIN(s2length, SUM_LENGTH);
}
sum->remainder = (len % blength);
if (sum->count && verbose > 2) {
- rprintf(FINFO, "count=%.0f rem=%u blength=%u s2length=%d flength=%.0f\n",
- (double)sum->count, sum->remainder, sum->blength,
+ rprintf(FINFO,
+ "count=%.0f rem=%ld blength=%ld s2length=%d flength=%.0f\n",
+ (double)sum->count, (long)sum->remainder, (long)sum->blength,
sum->s2length, (double)sum->flength);
}
}
write_sum_head(f_out, &sum);
for (i = 0; i < sum.count; i++) {
- unsigned int n1 = MIN(len, sum.blength);
+ int32 n1 = (int32)MIN(len, (OFF_T)sum.blength);
char *map = map_ptr(mapbuf, offset, n1);
uint32 sum1 = get_checksum1(map, n1);
char sum2[SUM_LENGTH];
if (verbose > 3) {
rprintf(FINFO,
- "chunk[%.0f] offset=%.0f len=%u sum1=%08lx\n",
- (double)i, (double)offset, n1,
+ "chunk[%.0f] offset=%.0f len=%ld sum1=%08lx\n",
+ (double)i, (double)offset, (long)n1,
(unsigned long)sum1);
}
write_int(f_out, sum1);
stat_errno = ENOENT;
}
- if (partial_dir && (partialptr = partial_dir_fname(fname))
+ if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
&& link_stat(partialptr, &partial_st, 0) == 0
&& S_ISREG(partial_st.st_mode)) {
if (statret == -1)
}
prepare_to_open:
+ if (partialptr) {
+ st = partial_st;
+ fnamecmp = partialptr;
+ fnamecmp_type = FNAMECMP_PARTIAL_DIR;
+ statret = 0;
+ }
+
if (dry_run || whole_file > 0) {
statret = -1;
goto notify_others;
if (read_batch)
goto notify_others;
- if (partialptr) {
- st = partial_st;
- fnamecmp = partialptr;
- fnamecmp_type = FNAMECMP_PARTIAL_DIR;
- }
-
/* open the file */
fd = do_open(fnamecmp, O_RDONLY, 0);
write_int(f_out, -1);
+ /* Read post-redo-phase MSG_DONE and any prior messages. */
+ get_redo_num();
+
if (preserve_hard_links)
do_hard_links();