From: Wayne Davison Date: Sat, 3 Jan 2004 18:37:41 +0000 (+0000) Subject: Made the types used in the sum_buf and sum_struct structures consistent X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/da9d12f5d93724cb07a4107aa7aff92be9fb2ddb Made the types used in the sum_buf and sum_struct structures consistent with the variables in the code that manipulates these values. --- diff --git a/generator.c b/generator.c index ba889703..d0177623 100644 --- a/generator.c +++ b/generator.c @@ -136,8 +136,9 @@ void write_sum_head(int f, struct sum_struct *sum) static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len) { - extern int block_size; - int blength, s2length, b; + extern unsigned int block_size; + unsigned int blength; + int s2length; uint32 c; uint64 l; @@ -166,7 +167,7 @@ static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len) } else if (csum_length == SUM_LENGTH) { s2length = SUM_LENGTH; } else { - b = BLOCKSUM_BIAS; + int b = BLOCKSUM_BIAS; l = len; while (l >>= 1) { b += 2; @@ -191,10 +192,9 @@ static void sum_sizes_sqroot(struct sum_struct *sum, uint64 len) sum->remainder = (len % blength); if (sum->count && verbose > 2) { - rprintf(FINFO, "count=%ld rem=%ld blength=%ld s2length=%ld flength=%.0f\n", - (long) sum->count, (long) sum->remainder, - (long) sum->blength, (long) sum->s2length, - (double) sum->flength); + rprintf(FINFO, "count=%ld rem=%u blength=%u s2length=%d flength=%.0f\n", + (long)sum->count, sum->remainder, sum->blength, + sum->s2length, (double)sum->flength); } } diff --git a/match.c b/match.c index dd5ac47a..1c7794a3 100644 --- a/match.c +++ b/match.c @@ -105,7 +105,7 @@ static void matched(int f,struct sum_struct *s,struct map_struct *buf, OFF_T j; if (verbose > 2 && i >= 0) - rprintf(FINFO,"match at %.0f last_match=%.0f j=%d len=%d n=%.0f\n", + rprintf(FINFO,"match at %.0f last_match=%.0f j=%d len=%u n=%.0f\n", (double)offset,(double)last_match,i,s->sums[i].len,(double)n); send_token(f,i,buf,last_match,n,i<0?0:s->sums[i].len); @@ -136,7 +136,7 @@ static void matched(int f,struct sum_struct *s,struct map_struct *buf, static void hash_search(int f,struct sum_struct *s, - struct map_struct *buf,OFF_T len) + struct map_struct *buf, OFF_T len) { OFF_T offset, end; int j,k, last_i; @@ -185,7 +185,8 @@ static void hash_search(int f,struct sum_struct *s, sum = (s1 & 0xffff) | (s2 << 16); tag_hits++; for (; j < (int) s->count && targets[j].t == t; j++) { - int l, i = targets[j].i; + unsigned int l; + int i = targets[j].i; if (sum != s->sums[i].sum1) continue; diff --git a/options.c b/options.c index 915b034e..1fe70b80 100644 --- a/options.c +++ b/options.c @@ -78,7 +78,6 @@ int do_progress=0; int keep_partial=0; int safe_symlinks=0; int copy_unsafe_links=0; -int block_size=0; int size_only=0; int bwlimit=0; int delete_after=0; @@ -88,6 +87,7 @@ int max_delete=0; int ignore_errors=0; int modify_window=0; int blocking_io=-1; +unsigned int block_size = 0; /** Network address family. **/ @@ -790,7 +790,7 @@ void server_options(char **args,int *argc) if (x != 1) args[ac++] = argstr; if (block_size) { - snprintf(bsize,sizeof(bsize),"-B%d",block_size); + snprintf(bsize, sizeof bsize, "-B%u", block_size); args[ac++] = bsize; } diff --git a/rsync.h b/rsync.h index 9e3eba17..73ba1d9b 100644 --- a/rsync.h +++ b/rsync.h @@ -404,7 +404,7 @@ struct file_list { struct sum_buf { OFF_T offset; /**< offset in file of this chunk */ - int len; /**< length of chunk of file */ + unsigned int len; /**< length of chunk of file */ int i; /**< index of this chunk */ uint32 sum1; /**< simple checksum */ char sum2[SUM_LENGTH]; /**< checksum */ @@ -413,9 +413,9 @@ struct sum_buf { struct sum_struct { OFF_T flength; /**< total file length */ size_t count; /**< how many chunks */ - size_t remainder; /**< flength % block_length */ - size_t blength; /**< block_length */ - size_t s2length; /**< sum2_length */ + unsigned int blength; /**< block_length */ + unsigned int remainder; /**< flength % block_length */ + int s2length; /**< sum2_length */ struct sum_buf *sums; /**< points to info for each chunk */ }; diff --git a/sender.c b/sender.c index 9dbee0e3..b7ebbe1f 100644 --- a/sender.c +++ b/sender.c @@ -71,10 +71,10 @@ static struct sum_struct *receive_sums(int f) s->sums = NULL; - if (verbose > 3) - rprintf(FINFO, "count=%ld n=%ld rem=%ld\n", - (long) s->count, (long) s->blength, - (long) s->remainder); + if (verbose > 3) { + rprintf(FINFO, "count=%ld n=%u rem=%u\n", + (long)s->count, s->blength, s->remainder); + } if (s->count == 0) return(s);