From aaf35889b63eac36537bed70464b6b6122e7bf4f Mon Sep 17 00:00:00 2001 From: John <32036524+jkearins@users.noreply.github.com> Date: Fri, 15 Jul 2022 18:40:40 +0300 Subject: [PATCH] Change placeholder in ESP_LOGD conditionally depending on FF_FS_EXFAT In case of using EXFAT by setting in ffconf.h: the type FSIZE_t is changing from 4 to 8 bytes. As a result, ESP_LOGD() in vfs_fat_lseek() does not compile: error: format '%d' expects argument of type 'int', but argument 8 has type 'FSIZE_t' {aka 'long long unsigned int'} [-Werror=format=] ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%d", __func__, new_pos, f_size(file)); To solve the problem we need to change %d with %lld conditionally, depending on FF_FS_EXFAT. Closes https://github.com/espressif/esp-idf/pull/9361 --- components/fatfs/vfs/vfs_fat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/fatfs/vfs/vfs_fat.c b/components/fatfs/vfs/vfs_fat.c index 97511c0a83..223fc5bfaa 100644 --- a/components/fatfs/vfs/vfs_fat.c +++ b/components/fatfs/vfs/vfs_fat.c @@ -576,7 +576,11 @@ static off_t vfs_fat_lseek(void* ctx, int fd, off_t offset, int mode) return -1; } +#if FF_FS_EXFAT + ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%lld", __func__, new_pos, f_size(file)); +#else ESP_LOGD(TAG, "%s: offset=%ld, filesize:=%d", __func__, new_pos, f_size(file)); +#endif FRESULT res = f_lseek(file, new_pos); if (res != FR_OK) { ESP_LOGD(TAG, "%s: fresult=%d", __func__, res);