From 281924766d145019dc558e21aba60de3cd298e3d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 19 Dec 2013 18:50:00 +0000 Subject: [PATCH] * libc/stdio/vfwscanf.c (__SVFWSCANF_R): Fix fetching decimal_point in !_MB_CAPABLE as well as in !__HAVE_LOCALE_INFO_EXTENDED__ case. --- newlib/ChangeLog | 5 +++++ newlib/libc/stdio/vfwscanf.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 9798aea55..c334de9a1 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2013-12-19 Corinna Vinschen + + * libc/stdio/vfwscanf.c (__SVFWSCANF_R): Fix fetching decimal_point in + !_MB_CAPABLE as well as in !__HAVE_LOCALE_INFO_EXTENDED__ case. + 2013-12-18 Corinna Vinschen * libc/stdio/vfscanf.c (BUF): Change definition to take multibyte diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 731197a1c..263d8f23d 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -161,6 +161,7 @@ C99, POSIX-1.2008 #ifdef FLOATING_POINT #include #include +#include #ifdef __HAVE_LOCALE_INFO_EXTENDED__ #include "../locale/lnumeric.h" #endif @@ -452,16 +453,16 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), { size_t nconv; - memset (&state, '\0', sizeof (state)); - nconv = _mbrtowc_r (data, &decpt, - _localeconv_r (data)->decimal_point, - MB_CUR_MAX, &state); + memset (&mbs, '\0', sizeof (mbs)); + nconv = _mbrtowc_r (rptr, &decpt, + _localeconv_r (rptr)->decimal_point, + MB_CUR_MAX, &mbs); if (nconv == (size_t) -1 || nconv == (size_t) -2) decpt = L'.'; } #endif /* !__HAVE_LOCALE_INFO_EXTENDED__ */ #else - decpt = (wchar_t) *_localeconv_r (data)->decimal_point; + decpt = (wchar_t) *_localeconv_r (rptr)->decimal_point; #endif /* !_MB_CAPABLE */ #endif /* FLOATING_POINT */