Problem: ptr/ref parameters and local variables are non-const but never modified

Solution: add const
This commit is contained in:
Simon Giesecke
2019-12-25 13:51:21 +01:00
parent 759fed8e7e
commit 41e3f14d6a
71 changed files with 319 additions and 312 deletions

View File

@@ -49,7 +49,7 @@
void zmq::seed_random ()
{
#if defined ZMQ_HAVE_WINDOWS
int pid = static_cast<int> (GetCurrentProcessId ());
const int pid = static_cast<int> (GetCurrentProcessId ());
#else
int pid = static_cast<int> (getpid ());
#endif
@@ -59,7 +59,7 @@ void zmq::seed_random ()
uint32_t zmq::generate_random ()
{
// Compensate for the fact that rand() returns signed integer.
uint32_t low = static_cast<uint32_t> (rand ());
const uint32_t low = static_cast<uint32_t> (rand ());
uint32_t high = static_cast<uint32_t> (rand ());
high <<= (sizeof (int) * 8 - 1);
return high | low;