gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r19517 - in gnunet/src: fs include
Date: Sun, 29 Jan 2012 22:41:24 +0100

Author: grothoff
Date: 2012-01-29 22:41:24 +0100 (Sun, 29 Jan 2012)
New Revision: 19517

Modified:
   gnunet/src/fs/fs_dirmetascan.c
   gnunet/src/fs/fs_sharetree.c
   gnunet/src/fs/gnunet-helper-fs-publish.c
   gnunet/src/include/gnunet_fs_service.h
Log:
-fs publish should basically work now

Modified: gnunet/src/fs/fs_dirmetascan.c
===================================================================
--- gnunet/src/fs/fs_dirmetascan.c      2012-01-29 21:32:50 UTC (rev 19516)
+++ gnunet/src/fs/fs_dirmetascan.c      2012-01-29 21:41:24 UTC (rev 19517)
@@ -95,8 +95,9 @@
 GNUNET_FS_directory_scan_abort (struct GNUNET_FS_DirScanner *ds)
 {
   /* terminate helper */
-  GNUNET_HELPER_stop (ds->helper);
-
+  if (NULL != ds->helper)
+    GNUNET_HELPER_stop (ds->helper);
+  
   /* free resources */
   if (NULL != ds->toplevel)
     GNUNET_FS_share_tree_free (ds->toplevel);
@@ -190,6 +191,7 @@
   chld = GNUNET_malloc (sizeof (struct GNUNET_FS_ShareTreeItem));
   chld->parent = parent;
   chld->filename = GNUNET_strdup (filename);
+  chld->short_filename = GNUNET_strdup (GNUNET_STRINGS_get_short_name 
(filename));
   chld->is_directory = is_directory;
   if (NULL != parent)
       GNUNET_CONTAINER_DLL_insert (parent->children_head,
@@ -300,10 +302,6 @@
       if (0 != strcmp (filename,
                       ds->pos->filename))
       {
-       fprintf (stderr,
-                "Expected `%s', got `%s'\n",
-                ds->pos->filename,
-                filename);
        GNUNET_break (0);
        break;
       }
@@ -319,7 +317,6 @@
          break;
        }
        /* having full filenames is too dangerous; always make sure we clean 
them up */
-       ds->pos->short_filename = GNUNET_strdup (GNUNET_STRINGS_get_short_name 
(filename));
        GNUNET_CONTAINER_meta_data_delete (ds->pos->meta, 
                                           EXTRACTOR_METATYPE_FILENAME,
                                           NULL, 0);
@@ -343,10 +340,11 @@
       GNUNET_break (0);
       break;
     }
+    GNUNET_HELPER_stop (ds->helper);
+    ds->helper = NULL;
     ds->progress_callback (ds->progress_callback_cls, 
                           NULL, GNUNET_SYSERR,
-                          GNUNET_FS_DIRSCANNER_INTERNAL_ERROR);
-    
+                          GNUNET_FS_DIRSCANNER_FINISHED);    
     return;
   default:
     GNUNET_break (0);

Modified: gnunet/src/fs/fs_sharetree.c
===================================================================
--- gnunet/src/fs/fs_sharetree.c        2012-01-29 21:32:50 UTC (rev 19516)
+++ gnunet/src/fs/fs_sharetree.c        2012-01-29 21:41:24 UTC (rev 19517)
@@ -305,12 +305,16 @@
   struct MetaCounter *counter = value;
 
   if (counter->count >= tc->move_threshold)
+  {
+    if (NULL == tc->pos->meta)
+      tc->pos->meta = GNUNET_CONTAINER_meta_data_create ();
     GNUNET_CONTAINER_meta_data_insert (tc->pos->meta,
                                       counter->plugin_name,
                                       counter->type,
                                       counter->format,
                                       counter->data_mime_type, counter->data,
                                       counter->data_size); 
+  }
   GNUNET_assert (GNUNET_YES ==
                 GNUNET_CONTAINER_multihashmap_remove (tc->metacounter,
                                                       key,
@@ -350,6 +354,8 @@
         (0 != strncasecmp (user, tree->short_filename, strlen(user))))
     {
       /* only use filename if it doesn't match $USER */
+      if (NULL == tree->meta)
+       tree->meta = GNUNET_CONTAINER_meta_data_create ();
       GNUNET_CONTAINER_meta_data_insert (tree->meta, "<libgnunetfs>",
                                         
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
                                         EXTRACTOR_METAFORMAT_UTF8,
@@ -364,7 +370,8 @@
   /* now, count keywords and meta data in children */
   for (pos = tree->children_head; NULL != pos; pos = pos->next)
   {
-    GNUNET_CONTAINER_meta_data_iterate (pos->meta, &add_to_meta_counter, 
tc->metacounter);    
+    if (NULL != pos->meta)
+      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);
   }

Modified: gnunet/src/fs/gnunet-helper-fs-publish.c
===================================================================
--- gnunet/src/fs/gnunet-helper-fs-publish.c    2012-01-29 21:32:50 UTC (rev 
19516)
+++ gnunet/src/fs/gnunet-helper-fs-publish.c    2012-01-29 21:41:24 UTC (rev 
19517)
@@ -340,7 +340,7 @@
   }
   {
     char buf[size + slen];
-    char *dst = buf;
+    char *dst = &buf[slen];
     
     memcpy (buf, item->filename, slen);
     size = GNUNET_CONTAINER_meta_data_serialize (meta,

Modified: gnunet/src/include/gnunet_fs_service.h
===================================================================
--- gnunet/src/include/gnunet_fs_service.h      2012-01-29 21:32:50 UTC (rev 
19516)
+++ gnunet/src/include/gnunet_fs_service.h      2012-01-29 21:41:24 UTC (rev 
19517)
@@ -2703,7 +2703,7 @@
   char *filename;
 
   /**
-   * Base name of the file/directory; FIXME: needed?
+   * Base name of the file/directory.
    */
   char *short_filename;
 




reply via email to

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