about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/erand48_r.c4
-rw-r--r--stdlib/random_r.c4
-rw-r--r--stdlib/strtod_l.c2
-rw-r--r--stdlib/strtof_l.c2
-rw-r--r--stdlib/strtol_l.c2
-rw-r--r--stdlib/strtold_l.c2
-rw-r--r--stdlib/strtoll_l.c2
-rw-r--r--stdlib/strtoul_l.c2
-rw-r--r--stdlib/strtoull_l.c2
-rw-r--r--stdlib/testsort.c7
10 files changed, 19 insertions, 10 deletions
diff --git a/stdlib/erand48_r.c b/stdlib/erand48_r.c
index 40c3665c74..b3f8b634e3 100644
--- a/stdlib/erand48_r.c
+++ b/stdlib/erand48_r.c
@@ -39,11 +39,11 @@ __erand48_r (xsubi, buffer, result)
 
 #if USHRT_MAX == 65535
   temp.ieee.negative = 0;
-  temp.ieee.exponent = IEEE754_DOUBLE_BIAS - 1;
+  temp.ieee.exponent = IEEE754_DOUBLE_BIAS;
   temp.ieee.mantissa0 = (xsubi[2] << 4) | (xsubi[1] >> 12);
   temp.ieee.mantissa1 = ((xsubi[1] & 0xfff) << 20) | (xsubi[0] << 4);
   /* Please note the lower 4 bits of mantissa1 are always 0.  */
-  *result = temp.d;
+  *result = temp.d - 1.0;
 #else
 # error Unsupported size of short int
 #endif
diff --git a/stdlib/random_r.c b/stdlib/random_r.c
index 677aa21ba5..6355097a93 100644
--- a/stdlib/random_r.c
+++ b/stdlib/random_r.c
@@ -177,10 +177,6 @@ __initstate_r (seed, arg_state, n, buf)
   if (buf == NULL)
     return -1;
 
-  if (buf->rand_type == TYPE_0)
-    buf->state[-1] = buf->rand_type;
-  else
-    buf->state[-1] = (MAX_TYPES * (buf->rptr - buf->state)) + buf->rand_type;
   if (n < BREAK_1)
     {
       if (n < BREAK_0)
diff --git a/stdlib/strtod_l.c b/stdlib/strtod_l.c
index c2f08233a1..451168fce4 100644
--- a/stdlib/strtod_l.c
+++ b/stdlib/strtod_l.c
@@ -20,6 +20,8 @@
 
 #define USE_IN_EXTENDED_LOCALE_MODEL	1
 
+#include <xlocale.h>
+
 extern double ____strtod_l_internal (const char *, char **, int, __locale_t);
 
 #include <strtod.c>
diff --git a/stdlib/strtof_l.c b/stdlib/strtof_l.c
index 262c5e063b..67f1360cbd 100644
--- a/stdlib/strtof_l.c
+++ b/stdlib/strtof_l.c
@@ -20,6 +20,8 @@
 
 #define USE_IN_EXTENDED_LOCALE_MODEL	1
 
+#include <xlocale.h>
+
 extern float ____strtof_l_internal (const char *, char **, int, __locale_t);
 
 #include <strtof.c>
diff --git a/stdlib/strtol_l.c b/stdlib/strtol_l.c
index 38f7555de2..f6f9bd8dcf 100644
--- a/stdlib/strtol_l.c
+++ b/stdlib/strtol_l.c
@@ -20,6 +20,8 @@
 
 #define USE_IN_EXTENDED_LOCALE_MODEL	1
 
+#include <xlocale.h>
+
 extern long int ____strtol_l_internal (const char *, char **, int, int,
 				       __locale_t);
 
diff --git a/stdlib/strtold_l.c b/stdlib/strtold_l.c
index fb36ef7164..8f2fe3274d 100644
--- a/stdlib/strtold_l.c
+++ b/stdlib/strtold_l.c
@@ -20,6 +20,8 @@
 
 #define USE_IN_EXTENDED_LOCALE_MODEL	1
 
+#include <xlocale.h>
+
 extern long double ____strtold_l_internal (const char *, char **, int,
 					   __locale_t);
 
diff --git a/stdlib/strtoll_l.c b/stdlib/strtoll_l.c
index 7611887a9d..2372b844d5 100644
--- a/stdlib/strtoll_l.c
+++ b/stdlib/strtoll_l.c
@@ -20,6 +20,8 @@
 
 #define USE_IN_EXTENDED_LOCALE_MODEL	1
 
+#include <xlocale.h>
+
 extern long long int ____strtoll_l_internal (const char *, char **, int, int,
 					     __locale_t);
 
diff --git a/stdlib/strtoul_l.c b/stdlib/strtoul_l.c
index c26e234769..c64c0c0097 100644
--- a/stdlib/strtoul_l.c
+++ b/stdlib/strtoul_l.c
@@ -20,6 +20,8 @@
 
 #define USE_IN_EXTENDED_LOCALE_MODEL	1
 
+#include <xlocale.h>
+
 extern unsigned long int ____strtoul_l_internal (const char *, char **, int,
 						 int, __locale_t);
 
diff --git a/stdlib/strtoull_l.c b/stdlib/strtoull_l.c
index 2d8058fac3..59d6fd7a37 100644
--- a/stdlib/strtoull_l.c
+++ b/stdlib/strtoull_l.c
@@ -20,6 +20,8 @@
 
 #define USE_IN_EXTENDED_LOCALE_MODEL	1
 
+#include <xlocale.h>
+
 extern unsigned long long int ____strtoull_l_internal (const char *, char **,
 						       int, int, __locale_t);
 
diff --git a/stdlib/testsort.c b/stdlib/testsort.c
index a171a62130..041de5caca 100644
--- a/stdlib/testsort.c
+++ b/stdlib/testsort.c
@@ -1,17 +1,16 @@
-#include <ansidecl.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 
 int
-DEFUN(compare, (a, b), CONST PTR a AND CONST PTR b)
+compare (a, b)
+     const char *a, *b;
 {
   return strcmp (*(char **) a, *(char **) b);
 }
 
-
 int
-DEFUN_VOID(main)
+main (void)
 {
   char bufs[500][20];
   char *lines[500];