gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37492 - in gnunet/src: datacache fragmentation statistics


From: gnunet
Subject: [GNUnet-SVN] r37492 - in gnunet/src: datacache fragmentation statistics
Date: Fri, 8 Jul 2016 18:48:11 +0200

Author: grothoff
Date: 2016-07-08 18:48:10 +0200 (Fri, 08 Jul 2016)
New Revision: 37492

Modified:
   gnunet/src/datacache/plugin_datacache_heap.c
   gnunet/src/fragmentation/defragmentation.c
   gnunet/src/statistics/statistics.h
Log:
-fix shifting issues

Modified: gnunet/src/datacache/plugin_datacache_heap.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_heap.c        2016-07-08 16:35:59 UTC 
(rev 37491)
+++ gnunet/src/datacache/plugin_datacache_heap.c        2016-07-08 16:48:10 UTC 
(rev 37492)
@@ -245,7 +245,8 @@
   GNUNET_array_grow (val->path_info,
                     val->path_info_len,
                     path_info_len);
-  memcpy (val->path_info, path_info,
+  memcpy (val->path_info,
+          path_info,
          path_info_len * sizeof (struct GNUNET_PeerIdentity));
   (void) GNUNET_CONTAINER_multihashmap_put (plugin->map,
                                            &val->key,

Modified: gnunet/src/fragmentation/defragmentation.c
===================================================================
--- gnunet/src/fragmentation/defragmentation.c  2016-07-08 16:35:59 UTC (rev 
37491)
+++ gnunet/src/fragmentation/defragmentation.c  2016-07-08 16:48:10 UTC (rev 
37492)
@@ -506,7 +506,7 @@
     if (n == 64)
       mc->bits = UINT64_MAX;    /* set all 64 bit */
     else
-      mc->bits = (1LL << n) - 1;        /* set lowest 'bits' bit */
+      mc->bits = (1LLU << n) - 1;        /* set lowest 'bits' bit */
     if (dc->list_size >= dc->num_msgs)
       discard_oldest_mc (dc);
     GNUNET_CONTAINER_DLL_insert (dc->head,
@@ -516,9 +516,9 @@
   }
 
   /* copy data to 'mc' */
-  if (0 != (mc->bits & (1LL << bit)))
+  if (0 != (mc->bits & (1LLU << bit)))
   {
-    mc->bits -= 1LL << bit;
+    mc->bits -= 1LLU << bit;
     mbuf = (char *) &mc[1];
     memcpy (&mbuf[bit * (dc->mtu - sizeof (struct FragmentHeader))], &fh[1],
             ntohs (msg->size) - sizeof (struct FragmentHeader));
@@ -543,7 +543,7 @@
   /* count number of missing fragments after the current one */
   bc = 0;
   for (b = bit; b < 64; b++)
-    if (0 != (mc->bits & (1LL << b)))
+    if (0 != (mc->bits & (1LLU << b)))
       bc++;
     else
       bc = 0;

Modified: gnunet/src/statistics/statistics.h
===================================================================
--- gnunet/src/statistics/statistics.h  2016-07-08 16:35:59 UTC (rev 37491)
+++ gnunet/src/statistics/statistics.h  2016-07-08 16:48:10 UTC (rev 37492)
@@ -63,7 +63,7 @@
  * Flag for the `struct GNUNET_STATISTICS_ReplyMessage` UID only.
  * Note that other messages use #GNUNET_STATISTICS_SETFLAG_PERSISTENT.
  */
-#define GNUNET_STATISTICS_PERSIST_BIT (1<<31)
+#define GNUNET_STATISTICS_PERSIST_BIT ((uint32_t) (1LLU<<31))
 
 /**
  * The value being set is an absolute change.




reply via email to

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