From 7c6c6b8f3e7247ccdd75a89086dd108eba44e00a Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 13 Aug 2025 17:37:14 +0200 Subject: [PATCH] off_t: fix mixed type and printf format Signed-off-by: Laurent Vivier --- libemile/emile_floppy_create_image.c | 2 +- libext2/ext2_lseek.c | 6 +++--- libext2/libext2.h | 2 +- libiso9660/iso9660_lseek.c | 6 +++--- libiso9660/libiso9660.h | 2 +- libstream/libstream.h | 4 ++-- libstream/stream_lseek.c | 4 ++-- second/console.h | 2 +- second/load.c | 2 +- tools/emile-map-set.c | 2 +- tools/emile.c | 2 +- tools/iso9660_cat.c | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/libemile/emile_floppy_create_image.c b/libemile/emile_floppy_create_image.c index 3a143c8..823bb17 100644 --- a/libemile/emile_floppy_create_image.c +++ b/libemile/emile_floppy_create_image.c @@ -164,7 +164,7 @@ char* emile_floppy_add(int fd, char *image) if (size == -1) return NULL; - sprintf(buf, "block:(fd0)0x%lx,0x%zx", offset / 512, size); + sprintf(buf, "block:(fd0)0x%jx,0x%zx", offset / 512, size); return strdup(buf); } diff --git a/libext2/ext2_lseek.c b/libext2/ext2_lseek.c index e2fc458..04a12ce 100644 --- a/libext2/ext2_lseek.c +++ b/libext2/ext2_lseek.c @@ -7,10 +7,10 @@ #include "libext2.h" #include "ext2.h" -int ext2_lseek(stream_FILE *_file, long offset, int whence) +int ext2_lseek(stream_FILE *_file, off_t offset, int whence) { - ext2_FILE *file = (ext2_FILE*)_file; - long new_offset; + ext2_FILE *file = (ext2_FILE*)_file; + long new_offset; switch(whence) { diff --git a/libext2/libext2.h b/libext2/libext2.h index 2e47e55..001bc18 100644 --- a/libext2/libext2.h +++ b/libext2/libext2.h @@ -18,7 +18,7 @@ extern void ext2_closedir(stream_DIR *dir); extern stream_FILE* ext2_open(stream_VOLUME *, char* pathname); extern size_t ext2_read(stream_FILE *file, void *buf, size_t count); extern void ext2_close(stream_FILE *file); -extern int ext2_lseek(stream_FILE *file, long offset, int whence); +extern int ext2_lseek(stream_FILE *file, off_t offset, int whence); extern int ext2_fstat(stream_FILE *file, struct stream_stat *buf); #endif /* __LIBEXT2_H__ */ diff --git a/libiso9660/iso9660_lseek.c b/libiso9660/iso9660_lseek.c index 317fc8c..a452faa 100644 --- a/libiso9660/iso9660_lseek.c +++ b/libiso9660/iso9660_lseek.c @@ -9,10 +9,10 @@ #include "libiso9660.h" #include "iso9660.h" -int iso9660_lseek(stream_FILE *_file, long offset, int whence) +int iso9660_lseek(stream_FILE *_file, off_t offset, int whence) { - iso9660_FILE *file = (iso9660_FILE*)_file; - long new_offset; + iso9660_FILE *file = (iso9660_FILE*)_file; + long new_offset; switch(whence) { diff --git a/libiso9660/libiso9660.h b/libiso9660/libiso9660.h index aad4505..2b96ff0 100644 --- a/libiso9660/libiso9660.h +++ b/libiso9660/libiso9660.h @@ -22,7 +22,7 @@ extern struct iso_directory_record *iso9660_readdir(stream_DIR *dir); extern int iso9660_is_directory(struct iso_directory_record * idr); extern size_t iso9660_read(stream_FILE *file, void *buf, size_t count); extern void iso9660_close(stream_FILE *file); -extern int iso9660_lseek(stream_FILE *file, long offset, int whence); +extern int iso9660_lseek(stream_FILE *file, off_t offset, int whence); extern int iso9660_fstat(stream_FILE *file, struct stream_stat *buf); extern void iso9660_name(stream_VOLUME *volume, struct iso_directory_record * idr, char *buffer); diff --git a/libstream/libstream.h b/libstream/libstream.h index d26f90c..b144073 100644 --- a/libstream/libstream.h +++ b/libstream/libstream.h @@ -46,7 +46,7 @@ typedef stream_FILE *(*stream_open_t)(stream_VOLUME *volume, char *path); typedef int (*stream_umount_t)(stream_VOLUME *volume); typedef size_t (*stream_read_t)(stream_FILE *file, void *buf, size_t count); -typedef int (*stream_lseek_t)(stream_FILE *file, long offset, int whence); +typedef int (*stream_lseek_t)(stream_FILE *file, off_t offset, int whence); typedef void (*stream_close_t)(stream_FILE *file); typedef int (*stream_fstat_t)(stream_FILE *file, struct stream_stat *buf); @@ -91,7 +91,7 @@ extern stream_t *stream_open(char *dev); extern int stream_read_sector(stream_t *stream, off_t offset, void* buffer, size_t size); extern int stream_read(stream_t *stream, void *buf, size_t count); -extern int stream_lseek(stream_t *stream, long offset, int whence); +extern int stream_lseek(stream_t *stream, off_t offset, int whence); extern int stream_close(stream_t *stream); extern int stream_uncompress(stream_t *stream); extern int stream_fstat(stream_t *stream, struct stream_stat *buf); diff --git a/libstream/stream_lseek.c b/libstream/stream_lseek.c index d266bdb..1b908a5 100644 --- a/libstream/stream_lseek.c +++ b/libstream/stream_lseek.c @@ -6,7 +6,7 @@ #include "libstream.h" -int stream_lseek(stream_t *stream, long offset, int whence) +int stream_lseek(stream_t *stream, off_t offset, int whence) { - return stream->fs.lseek(stream->file, offset, whence); + return stream->fs.lseek(stream->file, offset, whence); } diff --git a/second/console.h b/second/console.h index 3d1f4ec..46a9e2a 100644 --- a/second/console.h +++ b/second/console.h @@ -15,7 +15,7 @@ extern void console_init(void); extern int console_putchar(int c); extern void console_putstring(const char *s); -int wait_char; +extern int wait_char; #ifdef USE_CLI extern int console_keypressed(int timeout); extern int console_getchar(void); diff --git a/second/load.c b/second/load.c index de4f859..b06a23e 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 %ld from %s\n", stat.st_size, path); + printf("Cannot read %jd from %s\n", stat.st_size, path); free(loader); return NULL; } diff --git a/tools/emile-map-set.c b/tools/emile-map-set.c index db1dd4d..0720b78 100644 --- a/tools/emile-map-set.c +++ b/tools/emile-map-set.c @@ -252,7 +252,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 %ld\n", st.st_size); + fprintf(stderr, "ERROR: cannot malloc %jd\n", st.st_size); return -1; } diff --git a/tools/emile.c b/tools/emile.c index 8d1fa55..02cfffb 100644 --- a/tools/emile.c +++ b/tools/emile.c @@ -568,7 +568,7 @@ static int8_t *set_config_no_fs(char *config_path) return NULL; } sprintf(chainloader, - "block:(sd%d)0x%x,0x%lx", unit_id, + "block:(sd%d)0x%x,0x%jx", unit_id, container->blocks[0].offset, st.st_size); free(container); diff --git a/tools/iso9660_cat.c b/tools/iso9660_cat.c index 379e29b..d1a20ad 100644 --- a/tools/iso9660_cat.c +++ b/tools/iso9660_cat.c @@ -67,7 +67,7 @@ int main(int argc, char **argv) if (get_info) { struct stream_stat st; iso9660_fstat(file, &st); - printf("%ld %ld\n", st.st_base * 4, st.st_size); + printf("%jd %jd\n", st.st_base * 4, st.st_size); } else { while((size = iso9660_read(file, buffer, 512)) > 0) write(STDOUT_FILENO, buffer, size);