mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
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:
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user