gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r11971 - in gnunet: . src/fs src/include


From: gnunet
Subject: [GNUnet-SVN] r11971 - in gnunet: . src/fs src/include
Date: Sun, 27 Jun 2010 13:50:00 +0200

Author: grothoff
Date: 2010-06-27 13:50:00 +0200 (Sun, 27 Jun 2010)
New Revision: 11971

Modified:
   gnunet/TODO
   gnunet/src/fs/fs_directory.c
   gnunet/src/include/gnunet_fs_service.h
Log:
return if directory is well-formed

Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-06-27 11:14:37 UTC (rev 11970)
+++ gnunet/TODO 2010-06-27 11:50:00 UTC (rev 11971)
@@ -8,13 +8,14 @@
     [On W32, we need to select after calling socket before doing connect etc.]
 * GNUNET-GTK: [CG]
   - from-URI only tab:
-    + display from open directory (needs 'from-URI only' tab!)
-    + handle download lost-parent (move to 'from-URI only' tab!)
+    + display from open directory
   - recursive downloads:
     + download start: recursive/directory (!)
-      * display directory content from download as part of search
+      * display directory content as part of 'open directory'
+      * display directory content from download as part of search       
       * honor recursion option (may already be done, check!)
   - TEST download-start from-URI only in event handler
+  - TEST download lost-parent 
 
 * BUGS:
   Jun 27 11:51:54 core-7670 ERROR Assertion failed at 
gnunet-service-core.c:3616.

Modified: gnunet/src/fs/fs_directory.c
===================================================================
--- gnunet/src/fs/fs_directory.c        2010-06-27 11:14:37 UTC (rev 11970)
+++ gnunet/src/fs/fs_directory.c        2010-06-27 11:50:00 UTC (rev 11971)
@@ -179,8 +179,11 @@
  * @param offset offset of data in the directory
  * @param dep function to call on each entry
  * @param dep_cls closure for dep
+ * @return GNUNET_OK if this could be a block in a directory,
+ *         GNUNET_NO if this could be part of a directory (but not 100% OK)
+ *         GNUNET_SYSERR if 'data' does not represent a directory
  */
-void 
+int 
 GNUNET_FS_directory_list_contents (size_t size,
                                   const void *data,
                                   uint64_t offset,
@@ -209,16 +212,16 @@
        {
          /* invalid size */
          GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                     _("Not a GNUnet directory.\n"));
-         return;
+                     _("MAGIC mismatch.  This is not a GNUnet directory.\n"));
+         return GNUNET_SYSERR;
        }
       md = GNUNET_CONTAINER_meta_data_deserialize (&cdata[8 +
                                                         sizeof (uint32_t)],
                                                   mdSize);
       if (md == NULL)
         {
-          GNUNET_break (0);
-          return; /* malformed ! */
+         GNUNET_break (0);
+          return GNUNET_SYSERR; /* malformed ! */
         }
       dep (dep_cls,
           NULL,
@@ -254,7 +257,7 @@
       while ((epos < size) && (cdata[epos] != '\0'))
         epos++;
       if (epos >= size)
-        return;   /* malformed - or partial download */
+        return GNUNET_NO;   /* malformed - or partial download */
       
       uri = GNUNET_FS_uri_parse (&cdata[pos], &emsg);
       pos = epos + 1;
@@ -268,7 +271,7 @@
         {
           GNUNET_FS_uri_destroy (uri);
           GNUNET_break (0);
-          return; /* illegal in directory! */
+          return GNUNET_NO; /* illegal in directory! */
         }
 
       memcpy (&mdSize, &cdata[pos], sizeof (uint32_t));
@@ -277,7 +280,7 @@
       if (pos + mdSize > size)
         {
           GNUNET_FS_uri_destroy (uri);
-          return; /* malformed - or partial download */
+          return GNUNET_NO; /* malformed - or partial download */
         }
 
       md = GNUNET_CONTAINER_meta_data_deserialize (&cdata[pos], mdSize);
@@ -285,7 +288,7 @@
         {
           GNUNET_FS_uri_destroy (uri);
           GNUNET_break (0);
-          return; /* malformed ! */
+          return GNUNET_NO; /* malformed ! */
         }
       pos += mdSize;
       filename = GNUNET_CONTAINER_meta_data_get_by_type (md,
@@ -309,6 +312,7 @@
       GNUNET_CONTAINER_meta_data_destroy (md);
       GNUNET_FS_uri_destroy (uri);
     }
+  return GNUNET_OK;
 }
 
 /**

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2010-06-27 11:14:37 UTC (rev 
11970)
+++ gnunet/src/include/gnunet_fs_service.h      2010-06-27 11:50:00 UTC (rev 
11971)
@@ -2602,8 +2602,11 @@
  * @param offset offset of data in the directory
  * @param dep function to call on each entry
  * @param dep_cls closure for dep
+ * @return GNUNET_OK if this could be a block in a directory,
+ *         GNUNET_NO if this could be part of a directory (but not 100% OK)
+ *         GNUNET_SYSERR if 'data' does not represent a directory
  */
-void 
+int 
 GNUNET_FS_directory_list_contents (size_t size,
                                   const void *data,
                                   uint64_t offset,




reply via email to

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