from patch 108, by jordan hubbard:
The value of endp returned by strtod() was off by one. There was also a const char * vs char * assignment that I took the opportunity to fix.
This commit is contained in:
parent
5600c7c78a
commit
3f59fa9bd9
|
@ -33,14 +33,6 @@
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
|
||||||
* PATCHES MAGIC LEVEL PATCH THAT GOT US HERE
|
|
||||||
* -------------------- ----- ----------------------
|
|
||||||
* CURRENT PATCH LEVEL: 1 00089
|
|
||||||
* -------------------- ----- ----------------------
|
|
||||||
*
|
|
||||||
* 27 Feb 93 Joerg Wunsch Implement strtod, fix atof.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#if defined(LIBC_SCCS) && !defined(lint)
|
||||||
|
@ -153,7 +145,7 @@ strtod(p, endp)
|
||||||
/* according to ANSI, check for over-/underflow */
|
/* according to ANSI, check for over-/underflow */
|
||||||
if(exp > 0) {
|
if(exp > 0) {
|
||||||
if(endp)
|
if(endp)
|
||||||
*endp = oldp;
|
*endp = (char *)oldp;
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
return neg < 0? -HUGE_VAL: HUGE_VAL;
|
return neg < 0? -HUGE_VAL: HUGE_VAL;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +158,7 @@ strtod(p, endp)
|
||||||
fl = ldexp(fl, bexp);
|
fl = ldexp(fl, bexp);
|
||||||
|
|
||||||
if(endp)
|
if(endp)
|
||||||
*endp = p;
|
*endp = (char *)(p - 1);
|
||||||
return neg < 0 ? -fl : fl;
|
return neg < 0 ? -fl : fl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue