aboutsummaryrefslogtreecommitdiffhomepage
path: root/fishd.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-08-05 13:24:33 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-08-05 13:24:33 -0700
commit84729c4dfa6d16cf81aa23c249d0ffb030549e08 (patch)
tree76e71d7c457f3a377f33dd84a5bb9a7872f5f412 /fishd.cpp
parent8de8877c7c0972db668b06ca5d693f622a54c97a (diff)
Additional warnings cleanup, effective C++ violations, dead code removal
Diffstat (limited to 'fishd.cpp')
-rw-r--r--fishd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/fishd.cpp b/fishd.cpp
index 1cd7be6f..be69ac41 100644
--- a/fishd.cpp
+++ b/fishd.cpp
@@ -224,8 +224,9 @@ static void sprint_rand_digits( char *str, int maxlen )
Cast to unsigned so that wrapping occurs on overflow as per ANSI C.
*/
(void)gettimeofday( &tv, NULL );
- srand( (unsigned int)tv.tv_sec + (unsigned int)tv.tv_usec * 1000000UL );
- max = 1 + (maxlen - 1) * (rand() / (RAND_MAX + 1.0));
+ unsigned long long seed = tv.tv_sec + tv.tv_usec * 1000000ULL;
+ srand( (unsigned int)seed );
+ max = (int)(1 + (maxlen - 1) * (rand() / (RAND_MAX + 1.0)));
for( i = 0; i < max; i++ )
{
str[i] = '0' + 10 * (rand() / (RAND_MAX + 1.0));