From 9cb0bca4d3627c06ef767585c42c49581dcc6ecf Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 14 Aug 2025 18:14:12 +0200 Subject: [PATCH] etch: cast off_t to uintmax_t in printf We use %j modifier in printf to display off_t, but it's defined to use with intmax_t or intmax_t Signed-off-by: Laurent Vivier --- libemile/emile_floppy_create_image.c | 3 ++- second/load.c | 2 +- tools/emile-map-set.c | 3 ++- tools/emile.c | 3 ++- tools/iso9660_cat.c | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libemile/emile_floppy_create_image.c b/libemile/emile_floppy_create_image.c index 823bb17..a49fe5a 100644 --- a/libemile/emile_floppy_create_image.c +++ b/libemile/emile_floppy_create_image.c @@ -7,6 +7,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$"; #include #include +#include #include #include #include @@ -164,7 +165,7 @@ char* emile_floppy_add(int fd, char *image) if (size == -1) return NULL; - sprintf(buf, "block:(fd0)0x%jx,0x%zx", offset / 512, size); + sprintf(buf, "block:(fd0)0x%jx,0x%zx", (uintmax_t)offset / 512, size); return strdup(buf); } diff --git a/second/load.c b/second/load.c index b06a23e..477fd09 100644 --- a/second/load.c +++ b/second/load.c @@ -294,7 +294,7 @@ char* load_chainloader(char *path) if (ret != stat.st_size) { - printf("Cannot read %jd from %s\n", stat.st_size, path); + printf("Cannot read %jd from %s\n", (intmax_t)stat.st_size, path); free(loader); return NULL; } diff --git a/tools/emile-map-set.c b/tools/emile-map-set.c index 0720b78..f161943 100644 --- a/tools/emile-map-set.c +++ b/tools/emile-map-set.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -252,7 +253,7 @@ static int put_driver(map_t *map, int partition, char* appledriver) code = malloc(st.st_size); if (code == NULL) { - fprintf(stderr, "ERROR: cannot malloc %jd\n", st.st_size); + fprintf(stderr, "ERROR: cannot malloc %jd\n", (uintmax_t)st.st_size); return -1; } diff --git a/tools/emile.c b/tools/emile.c index 02cfffb..d3e5b1e 100644 --- a/tools/emile.c +++ b/tools/emile.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -570,7 +571,7 @@ static int8_t *set_config_no_fs(char *config_path) sprintf(chainloader, "block:(sd%d)0x%x,0x%jx", unit_id, container->blocks[0].offset, - st.st_size); + (uintmax_t)st.st_size); free(container); config_set_indexed_property(configuration, "title", property, diff --git a/tools/iso9660_cat.c b/tools/iso9660_cat.c index d1a20ad..5f7e29e 100644 --- a/tools/iso9660_cat.c +++ b/tools/iso9660_cat.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -67,7 +68,7 @@ int main(int argc, char **argv) if (get_info) { struct stream_stat st; iso9660_fstat(file, &st); - printf("%jd %jd\n", st.st_base * 4, st.st_size); + printf("%jd %jd\n", (uintmax_t)st.st_base * 4, (uintmax_t)st.st_size); } else { while((size = iso9660_read(file, buffer, 512)) > 0) write(STDOUT_FILENO, buffer, size);