This is an automated email from the ASF dual-hosted git repository.
michallenc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 8579459bb boot/nxboot: fix Clang warnings for format and va_start
8579459bb is described below
commit 8579459bb0bf4fa28c044b7b7de71a7a09029b4d
Author: Neil Berkman <[email protected]>
AuthorDate: Sun Mar 8 17:22:48 2026 -0700
boot/nxboot: fix Clang warnings for format and va_start
Use PRIdOFF instead of %ld for off_t arguments in flash.c syslog
calls, fixing -Wformat errors when off_t is not long.
Change nxboot_progress parameter from enum progress_type_e to int
to avoid undefined behavior from va_start on a parameter that
undergoes default argument promotion (-Wvarargs).
Signed-off-by: Neil Berkman <[email protected]>
---
boot/nxboot/include/nxboot.h | 2 +-
boot/nxboot/loader/flash.c | 13 ++++++++-----
boot/nxboot/nxboot_main.c | 2 +-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/boot/nxboot/include/nxboot.h b/boot/nxboot/include/nxboot.h
index 6821cc703..3d92e9753 100644
--- a/boot/nxboot/include/nxboot.h
+++ b/boot/nxboot/include/nxboot.h
@@ -169,7 +169,7 @@ enum progress_msg_e
****************************************************************************/
#ifdef CONFIG_NXBOOT_PROGRESS
-void nxboot_progress(enum progress_type_e type, ...);
+void nxboot_progress(int type, ...);
#else
#define nxboot_progress(type, ...) do {} while (0)
#endif
diff --git a/boot/nxboot/loader/flash.c b/boot/nxboot/loader/flash.c
index 9142b25d9..f1a359573 100644
--- a/boot/nxboot/loader/flash.c
+++ b/boot/nxboot/loader/flash.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <errno.h>
+#include <inttypes.h>
#include <string.h>
#include <stddef.h>
#include <fcntl.h>
@@ -137,14 +138,15 @@ int flash_partition_write(int fd, const void *buf, size_t
count, off_t off)
pos = lseek(fd, off, SEEK_SET);
if (pos != off)
{
- syslog(LOG_ERR, "Could not seek to %ld: %s\n", off, strerror(errno));
+ syslog(LOG_ERR, "Could not seek to %" PRIdOFF ": %s\n",
+ off, strerror(errno));
return ERROR;
}
nbytes = write(fd, buf, count);
if (nbytes != count)
{
- syslog(LOG_ERR, "Write to offset %ld failed %s\n",
+ syslog(LOG_ERR, "Write to offset %" PRIdOFF " failed %s\n",
off, strerror(errno));
return ERROR;
}
@@ -195,15 +197,16 @@ int flash_partition_read(int fd, void *buf, size_t count,
off_t off)
pos = lseek(fd, off, SEEK_SET);
if (pos != off)
{
- syslog(LOG_ERR, "Could not seek to %ld: %s\n", off, strerror(errno));
+ syslog(LOG_ERR, "Could not seek to %" PRIdOFF ": %s\n",
+ off, strerror(errno));
return ERROR;
}
nbytes = read(fd, buf, count);
if (nbytes != count)
{
- syslog(LOG_ERR, "Read from offset %ld failed %s\n", off,
- strerror(errno));
+ syslog(LOG_ERR, "Read from offset %" PRIdOFF " failed %s\n",
+ off, strerror(errno));
return ERROR;
}
diff --git a/boot/nxboot/nxboot_main.c b/boot/nxboot/nxboot_main.c
index ddc2f2284..976b03b4c 100644
--- a/boot/nxboot/nxboot_main.c
+++ b/boot/nxboot/nxboot_main.c
@@ -124,7 +124,7 @@ static const char *progress_msgs[] =
****************************************************************************/
#ifdef CONFIG_NXBOOT_PROGRESS
-void nxboot_progress(enum progress_type_e type, ...)
+void nxboot_progress(int type, ...)
{
#ifdef CONFIG_NXBOOT_PRINTF_PROGRESS
va_list arg;