You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/01/14 18:22:54 UTC
(nuttx) 02/02: fsetpos: makes the fsetpos function comply with POSIX standard
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 80fcbf7aa8305452b3d0301650bec0109f9e4881
Author: guoshichao <gu...@xiaomi.com>
AuthorDate: Wed Sep 3 15:35:42 2025 +0800
fsetpos: makes the fsetpos function comply with POSIX standard
Change the 'pos' parameter of fsetpos() from 'fpos_t *' to 'const fpos_t *'
in both the prototype and implementation, aligning with POSIX specification
which requires the position parameter to be const-qualified.
Signed-off-by: guoshichao <gu...@xiaomi.com>
---
include/stdio.h | 2 +-
libs/libc/stdio/lib_fsetpos.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/stdio.h b/include/stdio.h
index 65b11586964..591bb91079c 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -163,7 +163,7 @@ int fscanf(FAR FILE *stream, FAR const IPTR char *fmt, ...)
scanf_like(2, 3);
int fseek(FAR FILE *stream, long int offset, int whence);
int fseeko(FAR FILE *stream, off_t offset, int whence);
-int fsetpos(FAR FILE *stream, FAR fpos_t *pos);
+int fsetpos(FAR FILE *stream, FAR const fpos_t *pos);
long ftell(FAR FILE *stream);
off_t ftello(FAR FILE *stream);
size_t fwrite(FAR const void *ptr, size_t size, size_t n_items,
diff --git a/libs/libc/stdio/lib_fsetpos.c b/libs/libc/stdio/lib_fsetpos.c
index a0ac40ffc09..c42b8e07fc1 100644
--- a/libs/libc/stdio/lib_fsetpos.c
+++ b/libs/libc/stdio/lib_fsetpos.c
@@ -53,7 +53,7 @@
*
****************************************************************************/
-int fsetpos(FAR FILE *stream, FAR fpos_t *pos)
+int fsetpos(FAR FILE *stream, FAR const fpos_t *pos)
{
#ifdef CONFIG_DEBUG_FEATURES
if (!stream || !pos)