-monkey integration
[oweals/gnunet.git] / src / fs / fs_namespace.c
index 8537ba0e6353af3ac715563451219cc25b384726..526ebbdfc356a8df83b2366218d97d9d17d68c1a 100644 (file)
@@ -21,6 +21,7 @@
 /**
  * @file fs/fs_namespace.c
  * @brief publishing to namespaces, and tracking updateable entries
+ *        for our namespaces
  * @author Christian Grothoff
  */
 #include "platform.h"
@@ -120,6 +121,7 @@ struct GNUNET_FS_UpdateInformationGraph
  * Return the name of the directory in which we store
  * the update information graph for the given local namespace.
  *
+ * @param h file-sharing handle
  * @param ns namespace handle
  * @return NULL on error, otherwise the name of the directory
  */
@@ -130,8 +132,8 @@ get_update_information_directory (struct GNUNET_FS_Handle *h,
   char *dn;
   char *ret;
   struct GNUNET_CRYPTO_EccPublicKey pub;
-  struct GNUNET_CRYPTO_ShortHashCode hc;
-  struct GNUNET_CRYPTO_ShortHashAsciiEncoded enc;
+  struct GNUNET_HashCode hc;
+  struct GNUNET_CRYPTO_HashAsciiEncoded enc;
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_filename (h->cfg, "FS", "UPDATE_DIR",
@@ -142,13 +144,13 @@ get_update_information_directory (struct GNUNET_FS_Handle *h,
     return NULL;
   }
   GNUNET_CRYPTO_ecc_key_get_public (ns, &pub);
-  GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &hc);
-  GNUNET_CRYPTO_short_hash_to_enc (&hc,
-                                  &enc);
+  GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc);
+  GNUNET_CRYPTO_hash_to_enc (&hc,
+                            &enc);
   GNUNET_asprintf (&ret, "%s%s%s", 
                   dn, 
                   DIR_SEPARATOR_STR, 
-                  (const char *) enc.short_encoding);
+                  (const char *) enc.encoding);
   GNUNET_free (dn);
   return ret;
 }
@@ -183,9 +185,9 @@ free_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig)
 
 
 /**
- * Write the namespace update node graph to a file.
+ * Write a namespace's update node graph to a file.
  *
- * @param ns namespace to dump
+ * @param uig update information graph to dump
  */
 static void
 write_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig)
@@ -268,19 +270,15 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
   if (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &count))
   {
     GNUNET_break (0);
-    goto ERROR;
+    goto END;
   }
   if (count > 1024 * 1024)
   {
     GNUNET_break (0);
-    goto ERROR;
+    goto END;
   }
   if (0 == count)
-  {
-    GNUNET_break (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL));
-    GNUNET_free (fn);
-    return uig;
-  }
+    goto END;
   uig->update_nodes =
     GNUNET_malloc (count * sizeof (struct NamespaceUpdateNode *));
 
@@ -316,14 +314,7 @@ read_update_information_graph (struct GNUNET_FS_Handle *h,
     uig->update_nodes[i] = n;
   }
   uig->update_node_count = i;
-  if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read `%s': %s\n"), 
-               fn, emsg);
-    GNUNET_free (emsg);
-  }
-  return uig;
-ERROR:
+ END:
   if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to read `%s': %s\n"),