From f8f4c862e8e66360925a28a593836cc7b69a3242 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Wed, 3 Apr 2002 05:55:54 +0000 Subject: [PATCH] Change code that writes s_count to a batch file to squish it into an int first -- a stopgap for compilers that reasonably complain about a ternary that returns either a size_t or an int. Really we should not write an int, but rather a larger type. Somebody more familiar with the batch code should look at it. --- batch.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/batch.c b/batch.c index f27e6fc3..6ef89e88 100644 --- a/batch.c +++ b/batch.c @@ -392,20 +392,27 @@ void close_batch_csums_file(void) close(fdb); } + +/** + * Write csum info to batch file + * + * @todo This will break if s->count is ever larger than maxint. The + * batch code should probably be changed to consistently use the + * variable-length integer routines, which is probably a compatible + * change. + **/ void write_batch_csum_info(int *flist_entry, int flist_count, struct sum_struct *s) { size_t i; - size_t int_zero = 0; + size_t int_count; extern int csum_length; fdb_open = 1; - /* Write csum info to batch file */ - - /* FIXME: This will break if s->count is ever not exactly an int. */ write_batch_csums_file(flist_entry, sizeof(int)); - write_batch_csums_file(s ? &s->count : &int_zero, sizeof(int)); + int_count = s->count; + write_batch_csums_file(&int_count, int_count); if (s) { for (i = 0; i < s->count; i++) { -- 2.34.1