stream_getc: use lib_stream_eof instead of EOF

Will case scanftest break #14778, at " %4c%n" case.
scanf use INT_MAX cause EOF break.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen
2024-11-22 22:40:47 +08:00
committed by Xiang Xiao
parent f3213efc7f
commit 3e24aab208
8 changed files with 23 additions and 14 deletions
+1 -1
View File
@@ -1149,7 +1149,7 @@ static int vscanf_internal(FAR struct lib_instream_s *stream, FAR int *lastc,
{
size_t nchars = (size_t) (stream->nget - ngetstart);
if (c != EOF)
if (!lib_stream_eof(c))
{
/* One more character already read */
+1 -1
View File
@@ -41,7 +41,7 @@ int vsscanf(FAR const char *buf, FAR const IPTR char *fmt, va_list ap)
/* Initialize a memory stream to freadm from the buffer */
lib_meminstream(&meminstream, buf, INT_MAX);
lib_meminstream(&meminstream, buf, strlen(buf));
/* Then let lib_vscanf do the real work */