use constants instead of casting -1
authorChristian Grothoff <christian@grothoff.org>
Fri, 11 Jun 2010 21:58:28 +0000 (21:58 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 11 Jun 2010 21:58:28 +0000 (21:58 +0000)
src/util/crypto_hash.c
src/util/test_time.c

index 60104b604263a2b0a6b95b20618e66cd379b9a6d..73b9c965496ddeeec0304da85a3a1ca24bc1110d 100644 (file)
@@ -688,7 +688,7 @@ GNUNET_CRYPTO_hash_create_random (enum GNUNET_CRYPTO_Quality mode,
 {
   int i;
   for (i = (sizeof (GNUNET_HashCode) / sizeof (uint32_t)) - 1; i >= 0; i--)
-    result->bits[i] = GNUNET_CRYPTO_random_u32 (mode, (uint32_t) - 1);
+    result->bits[i] = GNUNET_CRYPTO_random_u32 (mode, UINT32_MAX);
 }
 
 void
index ec8d3e9ad9e636b1432b7d48457ac6bee53c8ff1..84147ecf9b2647b9a85db02c44a1bc74663853bb 100644 (file)
@@ -65,7 +65,7 @@ check ()
   GNUNET_assert (last.value == GNUNET_TIME_UNIT_FOREVER_ABS.value);
 
   /* check overflow for r2a */
-  rel.value = ((uint64_t) - 1LL) - 1024;
+  rel.value = (UINT64_MAX) - 1024;
   GNUNET_log_skip (1, GNUNET_NO);
   last = GNUNET_TIME_relative_to_absolute (rel);
   GNUNET_log_skip (0, GNUNET_NO);
@@ -124,7 +124,7 @@ check ()
   future = GNUNET_TIME_absolute_add (forever, GNUNET_TIME_UNIT_ZERO);
   GNUNET_assert (future.value == forever.value);
 
-  rel.value = ((uint64_t) - 1LL) - 1024;
+  rel.value = (UINT64_MAX) - 1024;
   now.value = rel.value;
   future = GNUNET_TIME_absolute_add (now, rel);
   GNUNET_assert (future.value == forever.value);