diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/random.cc | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index fcde1c4ff..a1df7692d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2008-05-13 Corinna Vinschen <corinna@vinschen.de> + + * random.cc (initstate): Align to POSIX definition. + (setstate): Ditto. + 2008-05-10 Corinna Vinschen <corinna@vinschen.de> * Makefile.in (DLL_OFILES): Remove _def_time.o. diff --git a/winsup/cygwin/random.cc b/winsup/cygwin/random.cc index 583276d0f..037990880 100644 --- a/winsup/cygwin/random.cc +++ b/winsup/cygwin/random.cc @@ -354,9 +354,9 @@ srandomdev() * complain about mis-alignment, but you should disregard these messages. */ char * -initstate(unsigned long seed, /* seed for R.N.G. */ +initstate(unsigned seed, /* seed for R.N.G. */ char *arg_state, /* pointer to state array */ - long n) /* # bytes of state info */ + size_t n) /* # bytes of state info */ { char *ostate = (char *)(&state[-1]); uint32_t *int_arg_state = (uint32_t *)arg_state; @@ -367,7 +367,8 @@ initstate(unsigned long seed, /* seed for R.N.G. */ state[-1] = MAX_TYPES * (rptr - state) + rand_type; if (n < BREAK_0) { (void)fprintf(stderr, - "random: not enough state (%ld bytes); ignored.\n", n); + "random: not enough state (%lu bytes); ignored.\n", + (unsigned long) n); return(0); } if (n < BREAK_1) { @@ -421,7 +422,7 @@ initstate(unsigned long seed, /* seed for R.N.G. */ * complain about mis-alignment, but you should disregard these messages. */ char * -setstate(char *arg_state /* pointer to state array */) +setstate(const char *arg_state /* pointer to state array */) { uint32_t *new_state = (uint32_t *)arg_state; uint32_t type = new_state[0] % MAX_TYPES; |