From 81712be04e7a532b433f86b7e47fefcf8910e245 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 9 Jan 2017 10:35:28 -0600 Subject: [PATCH 1/3] sscanf: Backs out logic of ca1150ce6c9c5d6949dddf6533bd21dbfb19b87c --- libc/stdio/lib_sscanf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libc/stdio/lib_sscanf.c b/libc/stdio/lib_sscanf.c index 858cf8db2d0..fed7d71f347 100644 --- a/libc/stdio/lib_sscanf.c +++ b/libc/stdio/lib_sscanf.c @@ -90,6 +90,7 @@ static const char spaces[] = " \t\n\r\f\v"; static int findwidth(FAR const char *buf, FAR const char *fmt) { +#if 0 /* Behavior no longer supported */ FAR const char *next = fmt + 1; /* No... is there a space after the format? Or does the format string end @@ -114,7 +115,7 @@ static int findwidth(FAR const char *buf, FAR const char *fmt) */ FAR const char *ptr = strchr(buf, *next); - if (ptr) + if (ptr != NULL) { return (int)(ptr - buf); } @@ -130,6 +131,9 @@ static int findwidth(FAR const char *buf, FAR const char *fmt) * determining the width of the data if there is no fieldwidth, no space * separating the input, and no usable delimiter character. */ +#endif + + /* Use the input up until the first white space is encountered. */ return strcspn(buf, spaces); } From bbc16f9aea2e770308ce4942733a6ad44e8f7991 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 9 Jan 2017 11:15:06 -0600 Subject: [PATCH 2/3] libc/Kconfig: Correct an error in variable type --- libc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/Kconfig b/libc/Kconfig index c33aa553e58..a8d40fed543 100644 --- a/libc/Kconfig +++ b/libc/Kconfig @@ -62,7 +62,7 @@ config LIBC_LONG_LONG is enabled. config LIBC_SCANSET - default "Scanset support" + bool "Scanset support" default n ---help--- Add scanset support to sscanf(). From e3a535f66f12aaaa5a66985b3c3531db32626048 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 9 Jan 2017 11:23:05 -0600 Subject: [PATCH 3/3] Fix verboten C99/C11 construct in sscanf() --- libc/stdio/lib_sscanf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc/stdio/lib_sscanf.c b/libc/stdio/lib_sscanf.c index fed7d71f347..b5fd60f4de8 100644 --- a/libc/stdio/lib_sscanf.c +++ b/libc/stdio/lib_sscanf.c @@ -159,6 +159,7 @@ static FAR const char *findscanset(FAR const char *fmt, int c; int n; int v; + int i; fmt++; /* Skip '[' */ @@ -253,7 +254,7 @@ doswitch: doexit: if (v) /* Default => accept */ { - for (int i = 0; i < 32; i++) /* Invert all */ + for (i = 0; i < 32; i++) /* Invert all */ { set[i] ^= 0xFF; }