opnsense-src/lib/libc/locale
Eric van Gyzen 81f91de9f7 Fix error reporting from wcstof()
When wcstof() skipped initial space and then parsing failed, it set
endptr to the first non-space character.  Fix it to correctly report
failure by setting endptr to the beginning of the input string.
The fix is from theraven@, who fixed this bug in wcstod() and
wcstold() in r227753.

While I'm here:

Move assignments out of declarations in wcstod() and wcstold().
This is against my personal preference, but it is our agreed style(9).

Set endptr correctly on malloc() failure in all three functions.

Remove an incorrect comment:  This is pointer arithmetic,
so the code was not actually making that assumption.

wcstold() advanced the wcp pointer beyond leading whitespace
and then reset it back to the beginning of the string.
Do not reset it.  This seems to have no functional effect,
since strtold_l() also skips leading whitespace.  I'm making
the change to keep this function consistent with wcstof() and
wcstod(), and because the C11 spec prescribes the use of iswspace()
to skip leading space.

Reported by:	libc++ unit test for std::stof(std::wstring)
MFC after:	8 days
Sponsored by:	Dell EMC
2016-11-20 20:13:22 +00:00
..
ascii.c For EILSEQ case in mbsnrtowcs() and wcsnrtombs() update src to point to 2016-05-31 18:44:33 +00:00
big5.5 Markup nits. 2004-07-05 06:39:03 +00:00
big5.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
btowc.3 btowc(3), isblank(3): Correct prototypes for _l variants. 2013-03-27 21:31:40 +00:00
btowc.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
c16rtomb.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
c16rtomb_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
c32rtomb.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
c32rtomb_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
collate.c Locale fix for endian big (EB) machines. 2016-11-01 13:54:44 +00:00
collate.h 1) Eliminate possibility to call __*collate_range_cmp() with inclomplete 2016-07-14 09:07:25 +00:00
collcmp.c 1) Eliminate possibility to call __*collate_range_cmp() with inclomplete 2016-07-14 09:07:25 +00:00
ctype.3 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
ctype.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
ctype_l.3 ctype_l(3): Note that not all these functions are specified by POSIX.1-2008. 2012-07-01 22:18:20 +00:00
cXXrtomb_iconv.h Remove the const qualifier from iconv(3) to comply with POSIX: 2015-04-15 09:09:20 +00:00
DESIGN.xlocale Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
digittoint.3 mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
duplocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
endian.h Locale fix for endian big (EB) machines. 2016-11-01 13:54:44 +00:00
euc.5 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
euc.c EUC-type encodings don't have single byte characters >= 128 2016-04-04 02:43:35 +00:00
fix_grouping.c . style(9) 2003-06-26 10:46:16 +00:00
freelocale.3 Change the return type of freelocale(3) to void. 2016-07-29 17:18:47 +00:00
gb2312.5 Markup nits. 2004-07-05 06:39:03 +00:00
gb2312.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
gb18030.5 Markup nits. 2004-07-05 06:39:03 +00:00
gb18030.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
gbk.5 Markup nits. 2004-07-05 06:39:03 +00:00
gbk.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
isalnum.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isalpha.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isascii.3 Let the armchair generals handle this one. 2009-09-04 07:44:58 +00:00
isblank.3 btowc(3), isblank(3): Correct prototypes for _l variants. 2013-03-27 21:31:40 +00:00
iscntrl.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isctype.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
isdigit.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
isgraph.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
isideogram.3 Let the armchair generals handle this one. 2009-09-04 07:44:58 +00:00
islower.3 Remove trailing whitespace. 2012-07-30 21:02:44 +00:00
isphonogram.3 Let the armchair generals handle this one. 2009-09-04 07:44:58 +00:00
isprint.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
ispunct.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
isrune.3 Let the armchair generals handle this one. 2009-09-04 07:44:58 +00:00
isspace.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
isspecial.3 Let the armchair generals handle this one. 2009-09-04 07:44:58 +00:00
isupper.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
iswalnum.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
iswalnum_l.3 Start manpage with Dd macro and also remove a trailing whitespace 2012-07-26 14:46:19 +00:00
iswctype.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
isxdigit.3 mdoc: fix column names, indentation, column separation within each row, and 2012-04-07 09:05:30 +00:00
ldpart.c libc: Use O_CLOEXEC for various internal file descriptors. 2012-09-29 11:54:34 +00:00
ldpart.h Fixes to locale code to properly use indirect pointers in order to prevent 2003-06-13 00:14:07 +00:00
lmessages.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lmessages.h Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lmonetary.c libc/locale: Remove a wrong comma. 2014-09-04 17:36:21 +00:00
lmonetary.h Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lnumeric.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
lnumeric.h Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
localeconv.3 Split sentences at period boundaries. 2011-12-02 11:55:09 +00:00
localeconv.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
Makefile.inc Link localeconv(3) to localeconv_l(3) 2015-11-25 09:12:30 +00:00
mblen.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
mblen.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mblocal.h libc: tag the Rune initialization function prototypes visibility as hidden. 2016-07-19 20:22:13 +00:00
mbrlen.3 Fixed a typo. 2004-06-30 19:32:41 +00:00
mbrlen.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbrtoc16.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
mbrtoc16_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
mbrtoc32.c Add <uchar.h>. 2013-05-21 19:59:37 +00:00
mbrtoc32_iconv.c Add libiconv based versions of *c16*() and *c32*(). 2013-06-03 17:17:56 +00:00
mbrtocXX_iconv.h Remove the const qualifier from iconv(3) to comply with POSIX: 2015-04-15 09:09:20 +00:00
mbrtowc.3 Add <uchar.h>. 2013-05-21 19:59:37 +00:00
mbrtowc.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbsinit.3 Update manual pages for change to C99 mbrtowc() semantics. 2004-04-08 09:59:02 +00:00
mbsinit.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbsnrtowcs.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
mbsrtowcs.3 Scheduled mdoc(7) sweep. 2005-01-11 20:50:51 +00:00
mbsrtowcs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbstowcs.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
mbstowcs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
mbtowc.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
mbtowc.c mbtowc(3): set errno to EILSEQ if an incomplete character is passed. 2016-03-01 19:15:34 +00:00
mskanji.5 Markup nits. 2004-07-05 06:39:03 +00:00
mskanji.c SJIS encoding don't have single byte characters >= 224 2016-04-04 15:56:14 +00:00
multibyte.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
newlocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
nextwctype.3 Add COMPATIBILITY and HISTORY sections. Fix typo. 2005-07-21 10:27:45 +00:00
nextwctype.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
nl_langinfo.3 Add more locale-specific functions to the relevant man pages and Makefile: 2012-07-30 20:56:19 +00:00
nl_langinfo.c libc: spelling fixes. 2016-04-30 01:24:24 +00:00
nomacros.c Fix build of libc.so after r232620. This caused a duplicate definition 2012-03-06 21:56:30 +00:00
none.c For EILSEQ case in mbsnrtowcs() and wcsnrtombs() update src to point to 2016-05-31 18:44:33 +00:00
querylocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
rpmatch.3 Add HISTORY section. 2005-07-21 10:53:27 +00:00
rpmatch.c Implement rpmatch(), a semi-standard interface (as found on AIX, Tru64, 2005-01-09 03:55:13 +00:00
rune.c Locale fix for endian big (EB) machines. 2016-11-01 13:54:44 +00:00
runefile.h Make <runefile.h> internal to libc. 2005-05-16 09:32:41 +00:00
runetype.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
setlocale.3 mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
setlocale.c Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:18 +00:00
setlocale.h Reorganize wrapper around setrunelocale() to mark it as deprecated 2003-07-06 02:03:37 +00:00
setrunelocale.c locales: Enforce US-ASCII encoding (limited to 7-bit) 2015-11-09 22:06:22 +00:00
Symbol.map Mark __collate_load_tables_l as static 2015-08-09 10:24:24 +00:00
table.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
toascii.3 Let the armchair generals handle this one. 2009-09-04 07:44:58 +00:00
tolower.3 Apply a small grammar fix to {toupper,tolower}(3). 2010-07-25 13:32:19 +00:00
tolower.c Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:18 +00:00
toupper.3 Apply a small grammar fix to {toupper,tolower}(3). 2010-07-25 13:32:19 +00:00
toupper.c Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:50:18 +00:00
towlower.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
towupper.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
uselocale.3 Small changes to locale-related man pages. 2015-04-24 10:17:55 +00:00
utf8.5 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
utf8.c Merge from HEAD 2015-08-25 20:14:50 +00:00
wcrtomb.3 Add <uchar.h>. 2013-05-21 19:59:37 +00:00
wcrtomb.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcsftime.3 mdoc(7) police: sweep. 2002-11-29 17:35:09 +00:00
wcsftime.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcsnrtombs.c Revamp CTYPE support (from Illumos & Dragonfly) 2015-08-08 18:22:14 +00:00
wcsrtombs.3 Implement the GNU extensions of mbsnrtowcs() and wcsnrtombs(). These are 2004-07-21 10:54:57 +00:00
wcsrtombs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstod.3 Assorted mdoc(7) fixes. 2003-05-22 13:02:28 +00:00
wcstod.c Fix error reporting from wcstof() 2016-11-20 20:13:22 +00:00
wcstof.c Fix error reporting from wcstof() 2016-11-20 20:13:22 +00:00
wcstoimax.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstol.3 mdoc(7) police: sweep. 2002-11-29 17:35:09 +00:00
wcstol.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstold.c Fix error reporting from wcstof() 2016-11-20 20:13:22 +00:00
wcstoll.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstombs.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
wcstombs.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoul.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoull.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wcstoumax.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctob.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctomb.3 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
wctomb.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctrans.3 mdoc(7) police: sweep. 2002-11-29 17:35:09 +00:00
wctrans.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
wctype.3 Add missing comma. 2006-10-13 16:11:12 +00:00
wctype.c Commit log from Dragonfly: 2015-10-13 20:43:49 +00:00
wcwidth.3 /me kicks cvs update 2004-08-17 04:56:03 +00:00
wcwidth.c Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a 2011-11-20 14:45:42 +00:00
xlocale.3 mdoc: improvements to SEE ALSO. 2014-12-27 08:31:52 +00:00
xlocale.c Change the return type of freelocale(3) to void. 2016-07-29 17:18:47 +00:00
xlocale_private.h libc: replace 0 with NULL for pointers. 2016-04-10 19:33:58 +00:00