gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13994 - gnunet/src/dht


From: gnunet
Subject: [GNUnet-SVN] r13994 - gnunet/src/dht
Date: Tue, 21 Dec 2010 15:41:25 +0100

Author: nevans
Date: 2010-12-21 15:41:25 +0100 (Tue, 21 Dec 2010)
New Revision: 13994

Modified:
   gnunet/src/dht/gnunet-service-dht.c
Log:
codesonar fix

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2010-12-21 14:40:37 UTC (rev 13993)
+++ gnunet/src/dht/gnunet-service-dht.c 2010-12-21 14:41:25 UTC (rev 13994)
@@ -2959,9 +2959,9 @@
   else
     random_value =
       GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_STRONG,
-                                (unsigned int) -1);
+                                UINT32_MAX);
 
-  if (random_value < (target_value * (unsigned int) -1))
+  if (random_value < (target_value * UINT32_MAX))
     forward_count += 1;
 
   return forward_count;
@@ -3969,7 +3969,7 @@
   memcpy (&put_msg[1], data, size);
   new_msg_ctx->unique_id =
     GNUNET_ntohll (GNUNET_CRYPTO_random_u64
-                   (GNUNET_CRYPTO_QUALITY_WEAK, (uint64_t) - 1));
+                   (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
   new_msg_ctx->replication = ntohl (DEFAULT_PUT_REPLICATION);
   new_msg_ctx->msg_options = ntohl (0);
   new_msg_ctx->network_size = estimate_diameter ();
@@ -4166,12 +4166,12 @@
     GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get_forever ());
   memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext));
   random_key =
-    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) - 1);
+    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
   GNUNET_CRYPTO_hash (&random_key, sizeof (uint32_t), &key);
   memcpy (&msg_ctx.key, &key, sizeof (GNUNET_HashCode));
   msg_ctx.unique_id =
     GNUNET_ntohll (GNUNET_CRYPTO_random_u64
-                   (GNUNET_CRYPTO_QUALITY_WEAK, (uint64_t) - 1));
+                   (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
   msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION);
   msg_ctx.msg_options = ntohl (0);
   msg_ctx.network_size = estimate_diameter ();
@@ -4216,12 +4216,12 @@
   get_message.type = htonl (GNUNET_BLOCK_DHT_MALICIOUS_MESSAGE_TYPE);
   memset (&msg_ctx, 0, sizeof (struct DHT_MessageContext));
   random_key =
-    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, (uint32_t) - 1);
+    GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
   GNUNET_CRYPTO_hash (&random_key, sizeof (uint32_t), &key);
   memcpy (&msg_ctx.key, &key, sizeof (GNUNET_HashCode));
   msg_ctx.unique_id =
     GNUNET_ntohll (GNUNET_CRYPTO_random_u64
-                   (GNUNET_CRYPTO_QUALITY_WEAK, (uint64_t) - 1));
+                   (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX));
   msg_ctx.replication = ntohl (DHT_DEFAULT_FIND_PEER_REPLICATION);
   msg_ctx.msg_options = ntohl (0);
   msg_ctx.network_size = estimate_diameter ();
@@ -4347,7 +4347,7 @@
   memcpy (&msg_ctx.key, &my_identity.hashPubKey, sizeof (GNUNET_HashCode));
   msg_ctx.unique_id =
     GNUNET_ntohll (GNUNET_CRYPTO_random_u64
-                   (GNUNET_CRYPTO_QUALITY_STRONG, (uint64_t) - 1));
+                   (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX));
   msg_ctx.replication = DHT_DEFAULT_FIND_PEER_REPLICATION;
   msg_ctx.msg_options = DHT_DEFAULT_FIND_PEER_OPTIONS;
   msg_ctx.network_size = estimate_diameter ();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]