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 <laurent@vivier.eu>
This commit is contained in:
Laurent Vivier committed 2025-08-14 18:14:12 +02:00
1 parent fa7c05f6a6
commit 9cb0bca4d3
5 files changed
+9 -5

No files matched your search

+2 -1
View File
@@ -7,6 +7,7 @@ static __attribute__((used)) char* rcsid = "$CVSHeader$";
#include <sys/types.h>
#include <unistd.h>
#include <stdint.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
@@ -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);
}
+1 -1
View File
@@ -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;
}
+2 -1
View File
@@ -5,6 +5,7 @@
*/
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -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;
}
+2 -1
View File
@@ -7,6 +7,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
@@ -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,
+2 -1
View File
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
@@ -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);