From 3d92c8c82746636a85eca2f2d86f7714bde1465c Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 May 2011 07:56:04 -0400 Subject: [PATCH] Explicitly cast time value in cmSystemTools::RandomSeed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use static_cast to avoid warnings like conversion to ‘unsigned int’ from ‘__time_t’ may alter its value conversion to ‘unsigned int’ from ‘__suseconds_t’ may alter its value We do not care if the value is truncated because we are looking for just 32 bits anyway. --- Source/cmSystemTools.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 1491a9950..b99205485 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2294,8 +2294,8 @@ unsigned int cmSystemTools::RandomSeed() struct timeval t; gettimeofday(&t, 0); unsigned int pid = static_cast(getpid()); - unsigned int tv_sec = t.tv_sec; - unsigned int tv_usec = t.tv_usec; + unsigned int tv_sec = static_cast(t.tv_sec); + unsigned int tv_usec = static_cast(t.tv_usec); // Since tv_usec never fills more than 11 bits we shift it to fill // in the slow-changing high-order bits of tv_sec. return tv_sec ^ (tv_usec << 21) ^ pid;