Made the types used in the sum_buf and sum_struct structures consistent
authorWayne Davison <wayned@samba.org>
Sat, 3 Jan 2004 18:37:41 +0000 (18:37 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 3 Jan 2004 18:37:41 +0000 (18:37 +0000)
with the variables in the code that manipulates these values.

generator.c
match.c
options.c
rsync.h
sender.c

index ba88970..d017762 100644 (file)
@@ -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)
 {
 
 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;
 
        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 {
        } else if (csum_length == SUM_LENGTH) {
                s2length = SUM_LENGTH;
        } else {
-               b = BLOCKSUM_BIAS;
+               int b = BLOCKSUM_BIAS;
                l = len;
                while (l >>= 1) {
                        b += 2;
                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) {
        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 dd5ac47..1c7794a 100644 (file)
--- 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)
        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);
                        (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,
 
 
 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;
 {
        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++) {
                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;
 
 
                        if (sum != s->sums[i].sum1) continue;
 
index 915b034..1fe70b8 100644 (file)
--- 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 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;
 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;
 int ignore_errors=0;
 int modify_window=0;
 int blocking_io=-1;
+unsigned int block_size = 0;
 
 
 /** Network address family. **/
 
 
 /** Network address family. **/
@@ -790,7 +790,7 @@ void server_options(char **args,int *argc)
        if (x != 1) args[ac++] = argstr;
 
        if (block_size) {
        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;
        }
 
                args[ac++] = bsize;
        }
 
diff --git a/rsync.h b/rsync.h
index 9e3eba1..73ba1d9 100644 (file)
--- 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 */
 
 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  */
        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 */
 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 */
 };
 
        struct sum_buf *sums;   /**< points to info for each chunk */
 };
 
index 9dbee0e..b7ebbe1 100644 (file)
--- a/sender.c
+++ b/sender.c
@@ -71,10 +71,10 @@ static struct sum_struct *receive_sums(int f)
 
        s->sums = NULL;
 
 
        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);
 
        if (s->count == 0)
                return(s);