Fix bogus value for endp in strtod(), remove warnings.
authorJordan K. Hubbard <jkh@whisker.hubbard.ie>
Sun, 28 Mar 1993 00:00:00 +0000 (00:00 +0000)
committerJordan K. Hubbard <jkh@whisker.hubbard.ie>
Sun, 28 Mar 1993 00:00:00 +0000 (00:00 +0000)
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.

AUTHOR: Jordan K. Hubbard
386BSD-Patchkit: patch00108

usr/src/lib/libc/i386/stdlib/atof.c

index 70f1c7e..2fba195 100644 (file)
  *
  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
  * --------------------         -----   ----------------------
  *
  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
  * --------------------         -----   ----------------------
- * CURRENT PATCH LEVEL:         1       00089
+ * CURRENT PATCH LEVEL:         2       00108
  * --------------------         -----   ----------------------
  *
  * 27 Feb 93    Joerg Wunsch   Implement strtod, fix atof.
  * --------------------         -----   ----------------------
  *
  * 27 Feb 93    Joerg Wunsch   Implement strtod, fix atof.
+ * 28 Mar 93   Jordan Hubbard  Fix stdtod bug with endp, remove warnings.
  *
  */
 
  *
  */
 
@@ -153,7 +154,7 @@ strtod(p, endp)
        /* according to ANSI, check for over-/underflow */
        if(exp > 0) {
                if(endp)
        /* according to ANSI, check for over-/underflow */
        if(exp > 0) {
                if(endp)
-                       *endp = oldp;
+                       *endp = (char *)oldp;
                errno = ERANGE;
                return neg < 0? -HUGE_VAL: HUGE_VAL;
        }
                errno = ERANGE;
                return neg < 0? -HUGE_VAL: HUGE_VAL;
        }
@@ -166,7 +167,7 @@ strtod(p, endp)
        fl = ldexp(fl, bexp);
 
        if(endp)
        fl = ldexp(fl, bexp);
 
        if(endp)
-               *endp = p;
+               *endp = (char *)(p - 1);
        return neg < 0 ? -fl : fl;
 }
 
        return neg < 0 ? -fl : fl;
 }