From a065930a3ad29db593857c3807ebe9deacb5321a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 13 May 2008 11:40:45 +0000 Subject: * random.cc (initstate): Align to POSIX definition. (setstate): Ditto. --- winsup/cygwin/random.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/random.cc') 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; -- cgit v1.2.3