From bdcce656c964c6d94d85639e3f064fc8aef0c124 Mon Sep 17 00:00:00 2001 From: Jan Sucan Date: Sun, 12 Nov 2023 15:15:31 +0100 Subject: Refactor the file size and tell operations This was done in order to avoid C++ compiler warnings about comparing types with different signedness. --- src/backup.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/backup.c') diff --git a/src/backup.c b/src/backup.c index 4c9dfbd..0b558b6 100644 --- a/src/backup.c +++ b/src/backup.c @@ -43,16 +43,18 @@ static int check_files(const options_backup_t *const opts, const resources_backup_t *const res) { - const long in_size = file_size(res->in_file); + bool in_size_ok = false; + const size_t in_size = file_size(res->in_file, &in_size_ok); - if (in_size < 0) { + if (!in_size_ok) { print_error("cannot get size of input file: %s", strerror(errno)); return 1; } - const long ref_size = file_size(res->ref_file); + bool ref_size_ok = false; + const size_t ref_size = file_size(res->ref_file, &ref_size_ok); - if (ref_size < 0) { + if (!ref_size_ok) { print_error("cannot get size of reference file: %s", strerror(errno)); return 1; } -- cgit v1.2.3