logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: debf485d1890d84e830a415a1063aadab281065a
parent 17511616429d58e3939d357d2dfcebb02d60ff42
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 29 Nov 2025 18:16:59 +0100

fix integer size warnings on ppc32

Diffstat:

Mtest-libutils/t_strtodur.c15++++++++-------
Mtest-libutils/t_truncation.c16+++++++++++++---
2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/test-libutils/t_strtodur.c b/test-libutils/t_strtodur.c @@ -6,6 +6,7 @@ #include "../libutils/strtodur.h" #include <assert.h> +#include <stdint.h> #include <stdio.h> // printf const char *argv0 = "t_strtodur"; @@ -22,22 +23,22 @@ t_strtodur(char *str, time_t ex_sec, long ex_nsec) if(dur.tv_sec == ex_sec && dur.tv_nsec == ex_nsec && ret == 0) { - printf("ok %d - strtodur(\"%s\", _) -> {.tv_sec = %ld, .tv_nsec = %ld}\n", + printf("ok %d - strtodur(\"%s\", _) -> {.tv_sec = %jd, .tv_nsec = %jd}\n", id, str, - dur.tv_sec, - dur.tv_nsec); + (intmax_t)dur.tv_sec, + (intmax_t)dur.tv_nsec); return; } err = 1; - printf("not ok %d - strtodur(\"%s\", _) -> {.tv_sec = %ld, .tv_nsec = %ld}\n", + printf("not ok %d - strtodur(\"%s\", _) -> {.tv_sec = %jd, .tv_nsec = %jd}\n", id, str, - dur.tv_sec, - dur.tv_nsec); + (intmax_t)dur.tv_sec, + (intmax_t)dur.tv_nsec); if(dur.tv_sec != ex_sec || dur.tv_nsec != ex_nsec) - printf("# Expected: {.tv_sec = %ld, .tv_nsec = %ld}\n", ex_sec, ex_nsec); + printf("# Expected: {.tv_sec = %jd, .tv_nsec = %jd}\n", (intmax_t)ex_sec, (intmax_t)ex_nsec); if(ret != 0) printf("# Exit status: %d\n", ret); } diff --git a/test-libutils/t_truncation.c b/test-libutils/t_truncation.c @@ -6,6 +6,7 @@ #include "../libutils/truncation.h" #include <assert.h> +#include <stdint.h> #include <stdio.h> // printf const char *argv0 = "test-lib/truncation"; @@ -22,13 +23,22 @@ t_parse_size(const char *str, off_t size, enum operation_e op) int ret = parse_size(str, &tr); if(ret == 0 && tr.size == size && tr.op == op) { - printf("ok %d - parse_size(\"%s\", _) -> {.size = %ld, .op = %d}\n", id, str, tr.size, tr.op); + printf("ok %d - parse_size(\"%s\", _) -> {.size = %jd, .op = %d}\n", + id, + str, + (intmax_t)tr.size, + tr.op); return; } err = 1; - printf("not ok %d - parse_size(\"%s\", _) -> {.size = %ld, .op = %d}\n", id, str, tr.size, tr.op); - if(tr.size != size || tr.op != op) printf("# Expected: {.size = %ld, .op = %d}\n", size, op); + printf("not ok %d - parse_size(\"%s\", _) -> {.size = %jd, .op = %d}\n", + id, + str, + (intmax_t)tr.size, + tr.op); + if(tr.size != size || tr.op != op) + printf("# Expected: {.size = %jd, .op = %d}\n", (intmax_t)size, op); if(ret != 0) printf("# Exit status: %d\n", ret); }