-fix shifting issues
authorChristian Grothoff <christian@grothoff.org>
Fri, 8 Jul 2016 16:48:10 +0000 (16:48 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 8 Jul 2016 16:48:10 +0000 (16:48 +0000)
src/datacache/plugin_datacache_heap.c
src/fragmentation/defragmentation.c
src/statistics/statistics.h

index a32835cf49aace9545be4ccbed3579e8e2f1c413..afc320b206c1ad2d211207bbcd059fa6fad78421 100644 (file)
@@ -245,7 +245,8 @@ heap_plugin_put (void *cls,
   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,
index 5433ffb5a2b06b85369b2cac1da5f4ab8eed698d..50fc4a1d564c3c8009ef38a988e5927ebdffd3f7 100644 (file)
@@ -506,7 +506,7 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
     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 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
   }
 
   /* 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 @@ GNUNET_DEFRAGMENT_process_fragment (struct GNUNET_DEFRAGMENT_Context *dc,
   /* 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;
index ac88aadef8c8b39327a1c68a1790332e520218f3..41863a64f7c16e7b634d7b7b91e9b4e311a6b23c 100644 (file)
@@ -63,7 +63,7 @@ struct GNUNET_STATISTICS_ReplyMessage
  * 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.