X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/f9c3005bff7a2da9b350e3881e714f15f0d5263f..9dd891bb28f6cc558b87905f1adc5e3d4180b6b3:/util.c diff --git a/util.c b/util.c index 0006b006..e6acf50e 100644 --- a/util.c +++ b/util.c @@ -2,7 +2,7 @@ Copyright (C) 1996-2000 by Andrew Tridgell Copyright (C) Paul Mackerras 1996 - Copyright (C) 2001 by Martin Pool + Copyright (C) 2001, 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 @@ -275,7 +275,7 @@ int create_directory_path(char *fname) derived from GNU C's cccp.c. */ -static int full_write(int desc, char *ptr, int len) +static int full_write(int desc, char *ptr, size_t len) { int total_written; @@ -301,11 +301,11 @@ static int full_write(int desc, char *ptr, int len) for an error. derived from GNU C's cccp.c. */ -static int safe_read(int desc, char *ptr, int len) +static int safe_read(int desc, char *ptr, size_t len) { int n_chars; - if (len <= 0) + if (len == 0) return len; #ifdef EINTR @@ -836,7 +836,7 @@ static void rprint_progress(OFF_T ofs, OFF_T size, struct timeval *now, int pct = (ofs == size) ? 100 : (int)((100.0*ofs)/size); unsigned long diff = msdiff(&start_time, now); double rate = diff ? (double) (ofs-start_ofs) * 1000.0 / diff / 1024.0 : 0; - const char *units, *rem_units; + const char *units; double remain = rate ? (double) (size-ofs) / rate / 1000.0: 0.0; int remain_h, remain_m, remain_s;