summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfscanf.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-04-07 09:55:05 +0000
committertjr <tjr@FreeBSD.org>2004-04-07 09:55:05 +0000
commit1c584f59a55cb440f0487854db33b28a08898f82 (patch)
tree12c84b3433d9dfe7221d8772b9282c58a3f99811 /lib/libc/stdio/vfscanf.c
parent226e976dd71faa4ff636611c2de2ce44dcce5ba9 (diff)
downloadFreeBSD-src-1c584f59a55cb440f0487854db33b28a08898f82.zip
FreeBSD-src-1c584f59a55cb440f0487854db33b28a08898f82.tar.gz
Prepare to handle trivial state-dependent encodings. Full support for
state-dependent encodings with locking shifts will come later if there is demand for it.
Diffstat (limited to 'lib/libc/stdio/vfscanf.c')
-rw-r--r--lib/libc/stdio/vfscanf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c
index dabf16e..6a05343 100644
--- a/lib/libc/stdio/vfscanf.c
+++ b/lib/libc/stdio/vfscanf.c
@@ -142,6 +142,8 @@ __svfscanf(FILE *fp, const char *fmt0, va_list ap)
wchar_t *wcp; /* handy wide character pointer */
wchar_t *wcp0; /* saves original value of wcp */
size_t nconv; /* length of multibyte sequence converted */
+ static const mbstate_t initial;
+ mbstate_t mbs;
/* `basefix' is used to avoid `if' tests in the integer scanner */
static short basefix[17] =
@@ -367,7 +369,8 @@ literal:
buf[n++] = *fp->_p;
fp->_p++;
fp->_r--;
- nconv = mbrtowc(wcp, buf, n, NULL);
+ mbs = initial;
+ nconv = mbrtowc(wcp, buf, n, &mbs);
if (nconv == (size_t)-1) {
fp->_flags |= __SERR;
goto input_failure;
@@ -446,7 +449,8 @@ literal:
buf[n++] = *fp->_p;
fp->_p++;
fp->_r--;
- nconv = mbrtowc(wcp, buf, n, NULL);
+ mbs = initial;
+ nconv = mbrtowc(wcp, buf, n, &mbs);
if (nconv == (size_t)-1) {
fp->_flags |= __SERR;
goto input_failure;
@@ -546,7 +550,8 @@ literal:
buf[n++] = *fp->_p;
fp->_p++;
fp->_r--;
- nconv = mbrtowc(wcp, buf, n, NULL);
+ mbs = initial;
+ nconv = mbrtowc(wcp, buf, n, &mbs);
if (nconv == (size_t)-1) {
fp->_flags |= __SERR;
goto input_failure;
OpenPOWER on IntegriCloud