From 4d777d01d20cd9a8eea2e2152142995da934b8b3 Mon Sep 17 00:00:00 2001 From: Alexey Tourbin Date: Wed, 31 Jan 2018 12:28:40 +0300 Subject: [PATCH] changed a few more vars int -> uint32_t/size_t This is probably the last change of such kind. There are many other instances left, and fixing them all is hopeless. On the other hand, the way mod 2^32 arithmetic works, although technically not always well defined, is to our advantage. I suggest that only user-visible discrepancies further be fixed. The following comparison to st_size looks particularly bad. The code turns out to be unused! lib/signature.c: > verifySizeSignature(const char * datafile, int_32 size, /*@out@*/ char * result) > [...] > if (size != st.st_size) { > sprintf(result, "Header+Archive size mismatch.\n" --- build/files.c | 2 +- lib/fsm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build/files.c b/build/files.c index 886185b..122ca85 100644 --- a/build/files.c +++ b/build/files.c @@ -2021,7 +2021,7 @@ static int finalizeSize(TFI_t fi) { if (fi == NULL) return 0; - int totalFileSize = 0; + uint32_t totalFileSize = 0; int partialHardlinkSets = 0; for (int i = 0; i < fi->fc; i++) { if (fi->actions[i] == FA_SKIP) // %ghost diff --git a/lib/fsm.c b/lib/fsm.c index 530da7c..18ca60f 100644 --- a/lib/fsm.c +++ b/lib/fsm.c @@ -691,7 +691,7 @@ static int expandRegular(/*@special@*/ FSM_t fsm) { const char * fmd5sum; const struct stat * st = &fsm->sb; - int left = st->st_size; + size_t left = st->st_size; int rc = 0; rc = fsmStage(fsm, FSM_WOPEN); @@ -758,7 +758,7 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData) struct stat * ost = &fsm->osb; size_t pos = fdGetCpioPos(fsm->cfd); char * symbuf = NULL; - int left; + size_t left; int xx; int rc;