Merge modified --with-rsh patch: we now determine the default
[rsync/rsync.git] / batch.c
diff --git a/batch.c b/batch.c
index 3482673..a470710 100644 (file)
--- a/batch.c
+++ b/batch.c
@@ -354,7 +354,7 @@ void read_batch_flist_info(struct file_struct **fptr)
        }
 }
 
-void write_batch_csums_file(char *buff, int bytes_to_write)
+void write_batch_csums_file(void *buff, int bytes_to_write)
 {
 
        static int fdb_open = 1;
@@ -395,21 +395,24 @@ void close_batch_csums_file()
 void write_batch_csum_info(int *flist_entry, int flist_count,
                           struct sum_struct *s)
 {
-       int i;
-       int int_zero = 0;
+       size_t i;
+       unsigned int int_zero = 0;
        extern int csum_length;
 
        fdb_open = 1;
 
        /* Write csum info to batch file */
 
-       write_batch_csums_file((char *) flist_entry, sizeof(int));
-       write_batch_csums_file((char *) (s ? &s->count : &int_zero),
-                              sizeof(int));
+       /* FIXME: This will break if s->count is ever not exactly an int. */
+       write_batch_csums_file(flist_entry, sizeof(int));
+       if (s)
+               write_batch_csums_file(&s->count, sizeof(int));
+       else
+               write_batch_csums_file(&int_zero, sizeof (int));
+       
        if (s) {
                for (i = 0; i < s->count; i++) {
-                       write_batch_csums_file((char *) &s->sums[i].sum1,
-                                              sizeof(uint32));
+                       write_batch_csums_file(&s->sums[i].sum1, sizeof(uint32));
                        if ((*flist_entry == flist_count - 1)
                            && (i == s->count - 1)) {
                                fdb_close = 1;