History log of /freebsd-10-stable/lib/libc/locale/wcstold.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 309334 30-Nov-2016 vangyzen

MFC r308904

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)
Sponsored by: Dell EMC


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 227753 20-Nov-2011 theraven

Implement xlocale APIs from Darwin, mainly for use by libc++. This adds a
load of _l suffixed versions of various standard library functions that use
the global locale, making them take an explicit locale parameter. Also
adds support for per-thread locales. This work was funded by the FreeBSD
Foundation.

Please test any code you have that uses the C standard locale functions!

Reviewed by: das (gdtoa changes)
Approved by: dim (mentor)


# 127998 07-Apr-2004 tjr

Prepare to handle state-dependent encodings. This mainly involves not
taking shortcuts when it comes to storing and passing around conversion
states.


# 124174 06-Jan-2004 nectar

Remove unused variables and function declarations. Add missing headers.


# 121796 31-Oct-2003 tjr

Don't bother passing a freshly-zeroed mbstate to mbsrtowcs() etc.
when the current implementation won't use it, anyway. Just pass NULL.
This will need to be changed when state-dependent encodings are
supported, but there's no need to take the performance hit
in the meantime.


# 112177 13-Mar-2003 tjr

MFp4: Implementations of the wcstof() and wcstold() functions.