More signedness fixes; should be harmless.
authorMartin Pool <mbp@samba.org>
Fri, 25 Jan 2002 23:07:33 +0000 (23:07 +0000)
committerMartin Pool <mbp@samba.org>
Fri, 25 Jan 2002 23:07:33 +0000 (23:07 +0000)
fileio.c
flist.c
match.c
receiver.c
sender.c
util.c

index 3ed2803..92631bc 100644 (file)
--- a/fileio.c
+++ b/fileio.c
@@ -1,5 +1,6 @@
 /* 
    Copyright (C) Andrew Tridgell 1998
+   Copyright (C) 2002 by Martin Pool
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -38,7 +39,7 @@ int sparse_end(int f)
 
 static int write_sparse(int f,char *buf,size_t len)
 {
-       int l1=0,l2=0;
+       size_t l1=0, l2=0;
        int ret;
 
        for (l1=0;l1<len && buf[l1]==0;l1++) ;
@@ -56,10 +57,11 @@ static int write_sparse(int f,char *buf,size_t len)
        if (l1 == len) 
                return len;
 
-       if ((ret=write(f,buf+l1,len-(l1+l2))) != len-(l1+l2)) {
-               if (ret == -1 || ret == 0) return ret;
+       ret = write(f, buf + l1, len - (l1+l2));
+       if (ret == -1 || ret == 0)
+               return ret;
+       else if (ret != (int) (len - (l1+l2))) 
                return (l1+ret);
-       }
 
        if (l2 > 0)
                do_lseek(f,l2,SEEK_CUR);
diff --git a/flist.c b/flist.c
index ab729c8..96ed47f 100644 (file)
--- a/flist.c
+++ b/flist.c
@@ -980,7 +980,7 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
        }
 
        if (f != -1) {
-               io_end_buffering(f);
+               io_end_buffering();
                stats.flist_size = stats.total_written - start_write;
                stats.num_files = flist->count;
                if (write_batch)        /*  dw  */
diff --git a/match.c b/match.c
index 7b0f601..adc298e 100644 (file)
--- a/match.c
+++ b/match.c
@@ -71,7 +71,7 @@ static void build_hash_table(struct sum_struct *s)
   if (!tag_table || !targets) 
     out_of_memory("build_hash_table");
 
-  for (i=0;i<s->count;i++) {
+  for (i=0;i<(int) s->count;i++) {
     targets[i].i = i;
     targets[i].t = gettag(s->sums[i].sum1);
   }
@@ -175,7 +175,7 @@ static void hash_search(int f,struct sum_struct *s,
 
                sum = (s1 & 0xffff) | (s2 << 16);
                tag_hits++;
-               for (; j<s->count && targets[j].t == t; j++) {
+               for (; j < (int) s->count && targets[j].t == t; j++) {
                        int l, i = targets[j].i;
                        
                        if (sum != s->sums[i].sum1) continue;
@@ -201,7 +201,7 @@ static void hash_search(int f,struct sum_struct *s,
 
                        /* we've found a match, but now check to see
                            if last_i can hint at a better match */
-                       for (j++; j<s->count && targets[j].t == t; j++) {
+                       for (j++; j < (int) s->count && targets[j].t == t; j++) {
                                int i2 = targets[j].i;
                                if (i2 == last_i + 1) {
                                        if (sum != s->sums[i2].sum1) break;
index 5776ff2..6b6b63a 100644 (file)
@@ -249,7 +249,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname,
                i = -(i+1);
                offset2 = i*(OFF_T)n;
                len = n;
-               if (i == count-1 && remainder != 0)
+               if (i == (int) count-1 && remainder != 0)
                        len = remainder;
                
                stats.matched_data += len;
@@ -265,7 +265,7 @@ static int receive_data(int f_in,struct map_struct *buf,int fd,char *fname,
                        sum_update(map,len);
                }
                
-               if (fd != -1 && write_file(fd,map,len) != len) {
+               if (fd != -1 && write_file(fd,map,len) != (int) len) {
                        rprintf(FERROR,"write failed on %s : %s\n",
                                fname,strerror(errno));
                        exit_cleanup(RERR_FILEIO);
index d9fc5e6..ca853ef 100644 (file)
--- a/sender.c
+++ b/sender.c
@@ -55,14 +55,14 @@ static struct sum_struct *receive_sums(int f)
        s->sums = (struct sum_buf *)malloc(sizeof(s->sums[0])*s->count);
        if (!s->sums) out_of_memory("receive_sums");
 
-       for (i=0;i<s->count;i++) {
+       for (i=0; i < (int) s->count;i++) {
                s->sums[i].sum1 = read_int(f);
                read_buf(f,s->sums[i].sum2,csum_length);
 
                s->sums[i].offset = offset;
                s->sums[i].i = i;
 
-               if (i == s->count-1 && s->remainder != 0) {
+               if (i == (int) s->count-1 && s->remainder != 0) {
                        s->sums[i].len = s->remainder;
                } else {
                        s->sums[i].len = s->n;
diff --git a/util.c b/util.c
index f3c126b..64473a3 100644 (file)
--- a/util.c
+++ b/util.c
@@ -559,7 +559,7 @@ static void glob_expand_one(char *s, char **argv, int *argc, int maxargs)
                globfree(&globbuf);
                return;
        }
-       for (i=0; i<(maxargs - (*argc)) && i<globbuf.gl_pathc;i++) {
+       for (i=0; i<(maxargs - (*argc)) && i < (int) globbuf.gl_pathc;i++) {
                if (i == 0) free(argv[*argc]);
                argv[(*argc) + i] = strdup(globbuf.gl_pathv[i]);
                if (!argv[(*argc) + i]) out_of_memory("glob_expand");