Merge branch 'master' of git+ssh://gnunet.org/gnunet
[oweals/gnunet.git] / src / fs / fs_sharetree.c
index 954d450a7d3d3ccce3687e6700ad301d743ac0aa..906e78dd3ef95c0fb674a39728897d353242d5a9 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2005-2012 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2005-2012 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -172,9 +172,9 @@ add_to_keyword_counter (void *cls, const char *keyword, int is_mandatory)
   {
     cnt = GNUNET_malloc (sizeof (struct KeywordCounter) + klen);
     cnt->value = (const char *) &cnt[1];
-    memcpy (&cnt[1], keyword, klen);
+    GNUNET_memcpy (&cnt[1], keyword, klen);
     GNUNET_assert (GNUNET_OK ==
-                  GNUNET_CONTAINER_multihashmap_put (mcm, 
+                  GNUNET_CONTAINER_multihashmap_put (mcm,
                                                      &hc, cnt,
                                                      GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   }
@@ -313,7 +313,7 @@ migrate_and_drop_metadata (void *cls, const struct GNUNET_HashCode * key, void *
                                       counter->type,
                                       counter->format,
                                       counter->data_mime_type, counter->data,
-                                      counter->data_size); 
+                                      counter->data_size);
   }
   GNUNET_assert (GNUNET_YES ==
                 GNUNET_CONTAINER_multihashmap_remove (tc->metacounter,
@@ -350,7 +350,7 @@ share_tree_trim (struct TrimContext *tc,
   if (tree->is_directory == GNUNET_YES)
   {
     const char *user = getenv ("USER");
-    if ( (user == NULL) || 
+    if ( (user == NULL) ||
         (0 != strncasecmp (user, tree->short_filename, strlen(user))))
     {
       /* only use filename if it doesn't match $USER */
@@ -366,12 +366,12 @@ share_tree_trim (struct TrimContext *tc,
 
   if (1 >= num_children)
     return; /* nothing to trim */
-  
+
   /* now, count keywords and meta data in children */
   for (pos = tree->children_head; NULL != pos; pos = pos->next)
   {
     if (NULL != pos->meta)
-      GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter);    
+      GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, tc->metacounter);
     if (NULL != pos->ksk_uri)
       GNUNET_FS_uri_ksk_get_keywords (pos->ksk_uri, &add_to_keyword_counter, tc->keywordcounter);
   }
@@ -393,10 +393,10 @@ share_tree_trim (struct TrimContext *tc,
 
   /* add high-frequency meta data and keywords to parent */
   tc->pos = tree;
-  GNUNET_CONTAINER_multihashmap_iterate (tc->keywordcounter, 
+  GNUNET_CONTAINER_multihashmap_iterate (tc->keywordcounter,
                                         &migrate_and_drop_keywords,
                                         tc);
-  GNUNET_CONTAINER_multihashmap_iterate (tc->metacounter, 
+  GNUNET_CONTAINER_multihashmap_iterate (tc->metacounter,
                                         &migrate_and_drop_metadata,
                                         tc);
 }
@@ -414,7 +414,7 @@ GNUNET_FS_share_tree_trim (struct GNUNET_FS_ShareTreeItem *toplevel)
   struct TrimContext tc;
 
   if (toplevel == NULL)
-    return;  
+    return;
   tc.keywordcounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO);
   tc.metacounter = GNUNET_CONTAINER_multihashmap_create (1024, GNUNET_NO);
   share_tree_trim (&tc, toplevel);