gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r33769 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r33769 - gnunet/src/fs
Date: Mon, 23 Jun 2014 11:08:06 +0200

Author: grothoff
Date: 2014-06-23 11:08:06 +0200 (Mon, 23 Jun 2014)
New Revision: 33769

Modified:
   gnunet/src/fs/fs_api.c
   gnunet/src/fs/fs_api.h
   gnunet/src/fs/fs_file_information.c
   gnunet/src/fs/fs_publish.c
   gnunet/src/fs/gnunet-publish.c
   gnunet/src/fs/test_fs_uri.c
Log:
-fix URI test to handle new encoder, print both SKS and CHK URIs when 
publishing to namespace

Modified: gnunet/src/fs/fs_api.c
===================================================================
--- gnunet/src/fs/fs_api.c      2014-06-23 09:07:49 UTC (rev 33768)
+++ gnunet/src/fs/fs_api.c      2014-06-23 09:08:06 UTC (rev 33769)
@@ -873,6 +873,7 @@
   char b;
   char *ksks;
   char *chks;
+  char *skss;
   char *filename;
   uint32_t dsize;
 
@@ -885,6 +886,7 @@
   ret->h = h;
   ksks = NULL;
   chks = NULL;
+  skss = NULL;
   filename = NULL;
   if ((GNUNET_OK != GNUNET_BIO_read_meta_data (rh, "metadata", &ret->meta)) ||
       (GNUNET_OK != GNUNET_BIO_read_string (rh, "ksk-uri", &ksks, 32 * 1024)) 
||
@@ -895,6 +897,10 @@
       ( (NULL != chks) &&
        ( (NULL == (ret->chk_uri = GNUNET_FS_uri_parse (chks, NULL))) ||
          (GNUNET_YES != GNUNET_FS_uri_test_chk (ret->chk_uri))) ) ||
+      (GNUNET_OK != GNUNET_BIO_read_string (rh, "sks-uri", &skss, 1024)) ||
+      ( (NULL != skss) &&
+       ( (NULL == (ret->sks_uri = GNUNET_FS_uri_parse (skss, NULL))) ||
+         (GNUNET_YES != GNUNET_FS_uri_test_sks (ret->sks_uri))) ) ||
       (GNUNET_OK != read_start_time (rh, &ret->start_time)) ||
       (GNUNET_OK != GNUNET_BIO_read_string (rh, "emsg", &ret->emsg, 16 * 1024))
       || (GNUNET_OK !=
@@ -1054,11 +1060,13 @@
     filename = NULL;
   }
   GNUNET_free_non_null (ksks);
+  GNUNET_free_non_null (skss);
   GNUNET_free_non_null (chks);
   return ret;
 cleanup:
   GNUNET_free_non_null (ksks);
   GNUNET_free_non_null (chks);
+  GNUNET_free_non_null (skss);
   GNUNET_free_non_null (filename);
   GNUNET_FS_file_information_destroy (ret, NULL, NULL);
   return NULL;
@@ -1267,6 +1275,7 @@
   char b;
   char *ksks;
   char *chks;
+  char *skss;
 
   if (NULL == fi->serialization)
     fi->serialization =
@@ -1299,10 +1308,15 @@
     chks = GNUNET_FS_uri_to_string (fi->chk_uri);
   else
     chks = NULL;
+  if (NULL != fi->sks_uri)
+    skss = GNUNET_FS_uri_to_string (fi->sks_uri);
+  else
+    skss = NULL;
   if ((GNUNET_OK != GNUNET_BIO_write (wh, &b, sizeof (b))) ||
       (GNUNET_OK != GNUNET_BIO_write_meta_data (wh, fi->meta)) ||
       (GNUNET_OK != GNUNET_BIO_write_string (wh, ksks)) ||
       (GNUNET_OK != GNUNET_BIO_write_string (wh, chks)) ||
+      (GNUNET_OK != GNUNET_BIO_write_string (wh, skss)) ||
       (GNUNET_OK != write_start_time (wh, fi->start_time)) ||
       (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->emsg)) ||
       (GNUNET_OK != GNUNET_BIO_write_string (wh, fi->filename)) ||
@@ -1319,6 +1333,8 @@
   chks = NULL;
   GNUNET_free_non_null (ksks);
   ksks = NULL;
+  GNUNET_free_non_null (skss);
+  skss = NULL;
 
   switch (b)
   {
@@ -1410,6 +1426,7 @@
     (void) GNUNET_BIO_write_close (wh);
   GNUNET_free_non_null (chks);
   GNUNET_free_non_null (ksks);
+  GNUNET_free_non_null (skss);
   fn = get_serialization_file_name (fi->h, GNUNET_FS_SYNC_PATH_FILE_INFO,
                                     fi->serialization);
   if (NULL != fn)

Modified: gnunet/src/fs/fs_api.h
===================================================================
--- gnunet/src/fs/fs_api.h      2014-06-23 09:07:49 UTC (rev 33768)
+++ gnunet/src/fs/fs_api.h      2014-06-23 09:08:06 UTC (rev 33769)
@@ -269,6 +269,12 @@
   struct GNUNET_FS_Uri *chk_uri;
 
   /**
+   * SKS URI for this file or directory. NULL if
+   * we have not yet computed it.
+   */
+  struct GNUNET_FS_Uri *sks_uri;
+
+  /**
    * Block options for the file.
    */
   struct GNUNET_FS_BlockOptions bo;
@@ -735,7 +741,7 @@
 /**
  * Main function that performs the upload.
  *
- * @param cls "struct GNUNET_FS_PublishContext" identifies the upload
+ * @param cls `struct GNUNET_FS_PublishContext` identifies the upload
  * @param tc task context
  */
 void

Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2014-06-23 09:07:49 UTC (rev 33768)
+++ gnunet/src/fs/fs_file_information.c 2014-06-23 09:08:06 UTC (rev 33769)
@@ -436,7 +436,10 @@
   }
   GNUNET_free_non_null (fi->filename);
   GNUNET_free_non_null (fi->emsg);
-  GNUNET_free_non_null (fi->chk_uri);
+  if (NULL != fi->sks_uri)
+      GNUNET_FS_uri_destroy (fi->sks_uri);
+  if (NULL != fi->chk_uri)
+      GNUNET_FS_uri_destroy (fi->chk_uri);
   /* clean up serialization */
   if ((NULL != fi->serialization) && (0 != UNLINK (fi->serialization)))
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink",

Modified: gnunet/src/fs/fs_publish.c
===================================================================
--- gnunet/src/fs/fs_publish.c  2014-06-23 09:07:49 UTC (rev 33768)
+++ gnunet/src/fs/fs_publish.c  2014-06-23 09:08:06 UTC (rev 33769)
@@ -17,7 +17,6 @@
      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
      Boston, MA 02111-1307, USA.
 */
-
 /**
  * @file fs/fs_publish.c
  * @brief publish a file or directory in GNUnet
@@ -25,7 +24,6 @@
  * @author Krista Bennett
  * @author Christian Grothoff
  */
-
 #include "platform.h"
 #include "gnunet_constants.h"
 #include "gnunet_signatures.h"
@@ -57,9 +55,10 @@
   pi->value.publish.pctx = (NULL == p->dir) ? NULL : p->dir->client_info;
   pi->value.publish.filename = p->filename;
   pi->value.publish.size =
-      (p->is_directory == GNUNET_YES) ? p->data.dir.dir_size : 
p->data.file.file_size;
+      (GNUNET_YES == p->is_directory) ? p->data.dir.dir_size : 
p->data.file.file_size;
   pi->value.publish.eta =
-      GNUNET_TIME_calculate_eta (p->start_time, offset, 
pi->value.publish.size);
+      GNUNET_TIME_calculate_eta (p->start_time, offset,
+                                 pi->value.publish.size);
   pi->value.publish.completed = offset;
   pi->value.publish.duration =
       GNUNET_TIME_absolute_get_duration (p->start_time);
@@ -77,8 +76,9 @@
 static void
 publish_cleanup (struct GNUNET_FS_PublishContext *pc)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up publish context 
(done!)\n");
-  if (pc->fhc != NULL)
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Cleaning up publish context (done!)\n");
+  if (NULL != pc->fhc)
   {
     GNUNET_CRYPTO_hash_file_cancel (pc->fhc);
     pc->fhc = NULL;
@@ -87,12 +87,12 @@
   GNUNET_free_non_null (pc->nid);
   GNUNET_free_non_null (pc->nuid);
   GNUNET_free_non_null (pc->serialization);
-  if (pc->dsh != NULL)
+  if (NULL != pc->dsh)
   {
     GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO);
     pc->dsh = NULL;
   }
-  if (pc->client != NULL)
+  if (NULL != pc->client)
   {
     GNUNET_CLIENT_disconnect (pc->client);
     pc->client = NULL;
@@ -122,7 +122,9 @@
   pc->qre = NULL;
   if (GNUNET_SYSERR == success)
   {
-    GNUNET_asprintf (&pc->fi_pos->emsg, _("Publishing failed: %s"), msg);
+    GNUNET_asprintf (&pc->fi_pos->emsg,
+                     _("Publishing failed: %s"),
+                     msg);
     pi.status = GNUNET_FS_STATUS_PUBLISH_ERROR;
     pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL;
     pi.value.publish.specifics.error.message = pc->fi_pos->emsg;
@@ -160,10 +162,10 @@
   pi.status = GNUNET_FS_STATUS_PUBLISH_COMPLETED;
   pi.value.publish.eta = GNUNET_TIME_UNIT_ZERO;
   pi.value.publish.specifics.completed.chk_uri = p->chk_uri;
+  pi.value.publish.specifics.completed.sks_uri = p->sks_uri;
   p->client_info =
       GNUNET_FS_publish_make_status_ (&pi, pc, p,
-                                      GNUNET_ntohll (p->chk_uri->data.
-                                                     chk.file_length));
+                                      p->data.file.file_size);
 }
 
 
@@ -178,7 +180,8 @@
  */
 static void
 signal_publish_error (struct GNUNET_FS_FileInformation *p,
-                      struct GNUNET_FS_PublishContext *pc, const char *emsg)
+                      struct GNUNET_FS_PublishContext *pc,
+                      const char *emsg)
 {
   struct GNUNET_FS_ProgressInfo pi;
 
@@ -225,12 +228,13 @@
  * We've finished publishing the SBlock as part of a larger upload.
  * Check the result and complete the larger upload.
  *
- * @param cls the "struct GNUNET_FS_PublishContext*" of the larger upload
+ * @param cls the `struct GNUNET_FS_PublishContext *` of the larger upload
  * @param uri URI of the published SBlock
  * @param emsg NULL on success, otherwise error message
  */
 static void
-publish_sblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri,
+publish_sblocks_cont (void *cls,
+                      const struct GNUNET_FS_Uri *uri,
                       const char *emsg)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
@@ -242,6 +246,11 @@
     GNUNET_FS_publish_sync_ (pc);
     return;
   }
+  if (NULL != uri)
+  {
+    /* sks publication, remember namespace URI */
+    pc->fi->sks_uri = GNUNET_FS_uri_dup (uri);
+  }
   GNUNET_assert (pc->qre == NULL);
   if ((pc->dsh != NULL) && (pc->rid != 0))
   {
@@ -291,7 +300,8 @@
  * @param emsg NULL on success, otherwise error message
  */
 static void
-publish_kblocks_cont (void *cls, const struct GNUNET_FS_Uri *uri,
+publish_kblocks_cont (void *cls,
+                      const struct GNUNET_FS_Uri *uri,
                       const char *emsg)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
@@ -309,7 +319,9 @@
     GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == pc->upload_task);
     pc->upload_task =
       GNUNET_SCHEDULER_add_with_priority
-      (GNUNET_SCHEDULER_PRIORITY_BACKGROUND, &GNUNET_FS_publish_main_, pc);
+      (GNUNET_SCHEDULER_PRIORITY_BACKGROUND,
+       &GNUNET_FS_publish_main_,
+       pc);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -343,7 +355,11 @@
  * @return number of bytes copied to buf, 0 on error
  */
 static size_t
-block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
+block_reader (void *cls,
+              uint64_t offset,
+              size_t max,
+              void *buf,
+              char **emsg)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
   struct GNUNET_FS_FileInformation *p;
@@ -884,9 +900,9 @@
     if (0 == p->bo.anonymity_level)
     {
       /* zero anonymity, box CHK URI in LOC URI */
-      loc =
-          GNUNET_FS_uri_loc_create (p->chk_uri, pc->h->cfg,
-                                    p->bo.expiration_time);
+      loc = GNUNET_FS_uri_loc_create (p->chk_uri,
+                                      pc->h->cfg,
+                                      p->bo.expiration_time);
       GNUNET_FS_uri_destroy (p->chk_uri);
       p->chk_uri = loc;
       GNUNET_FS_file_information_sync_ (p);
@@ -895,8 +911,13 @@
     /* upload of "p" complete, publish KBlocks! */
     if (NULL != p->keywords)
     {
-      pc->ksk_pc = GNUNET_FS_publish_ksk (pc->h, p->keywords, p->meta, 
p->chk_uri, &p->bo,
-                                         pc->options, &publish_kblocks_cont, 
pc);
+      pc->ksk_pc = GNUNET_FS_publish_ksk (pc->h,
+                                          p->keywords,
+                                          p->meta,
+                                          p->chk_uri,
+                                          &p->bo,
+                                         pc->options,
+                                          &publish_kblocks_cont, pc);
     }
     else
     {
@@ -910,9 +931,9 @@
     {
       p->data.file.do_index = GNUNET_NO;
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  _
-                  ("Can not index file `%s': %s.  Will try to insert 
instead.\n"),
-                  "<no-name>", _("needs to be an actual file"));
+                  _("Can not index file `%s': %s.  Will try to insert 
instead.\n"),
+                  "<no-name>",
+                  _("needs to be an actual file"));
       GNUNET_FS_file_information_sync_ (p);
       publish_content (pc);
       return;
@@ -1239,14 +1260,15 @@
   {
     GNUNET_assert (NULL == ret->qre);
     GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _
-                ("Reserving space for %u entries and %llu bytes for 
publication\n"),
+                _("Reserving space for %u entries and %llu bytes for 
publication\n"),
                 (unsigned int) ret->reserve_entries,
                 (unsigned long long) ret->reserve_space);
     ret->qre =
         GNUNET_DATASTORE_reserve (ret->dsh, ret->reserve_space,
-                                  ret->reserve_entries, UINT_MAX, UINT_MAX,
-                                  GNUNET_TIME_UNIT_FOREVER_REL, 
&finish_reserve,
+                                  ret->reserve_entries,
+                                  UINT_MAX, UINT_MAX,
+                                  GNUNET_TIME_UNIT_FOREVER_REL,
+                                  &finish_reserve,
                                   ret);
   }
   else
@@ -1275,9 +1297,12 @@
  * @return #GNUNET_OK to continue (always)
  */
 static int
-fip_signal_stop (void *cls, struct GNUNET_FS_FileInformation *fi,
-                 uint64_t length, struct GNUNET_CONTAINER_MetaData *meta,
-                 struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo,
+fip_signal_stop (void *cls,
+                 struct GNUNET_FS_FileInformation *fi,
+                 uint64_t length,
+                 struct GNUNET_CONTAINER_MetaData *meta,
+                 struct GNUNET_FS_Uri **uri,
+                 struct GNUNET_FS_BlockOptions *bo,
                  int *do_index, void **client_info)
 {
   struct GNUNET_FS_PublishContext *pc = cls;
@@ -1324,7 +1349,8 @@
   struct GNUNET_FS_ProgressInfo pi;
   uint64_t off;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Publish stop called\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Publish stop called\n");
   GNUNET_FS_end_top (pc->h, pc->top);
   if (NULL != pc->ksk_pc)
   {
@@ -1344,16 +1370,19 @@
   pc->skip_next_fi_callback = GNUNET_YES;
   GNUNET_FS_file_information_inspect (pc->fi, &fip_signal_stop, pc);
 
-  if (pc->fi->serialization != NULL)
+  if (NULL != pc->fi->serialization)
   {
     GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_FILE_INFO,
                                  pc->fi->serialization);
     GNUNET_free (pc->fi->serialization);
     pc->fi->serialization = NULL;
   }
-  off = (pc->fi->chk_uri == NULL) ? 0 : GNUNET_ntohll 
(pc->fi->chk_uri->data.chk.file_length);
+  if (NULL == pc->fi->chk_uri)
+    off = 0; /* won't be completed anymore */
+  else
+    off = pc->fi->is_directory ? pc->fi->data.dir.contents_completed : 
pc->fi->data.file.file_size; /* we were done */
 
-  if (pc->serialization != NULL)
+  if (NULL != pc->serialization)
   {
     GNUNET_FS_remove_sync_file_ (pc->h, GNUNET_FS_SYNC_PATH_MASTER_PUBLISH,
                                  pc->serialization);
@@ -1371,5 +1400,4 @@
 }
 
 
-
 /* end of fs_publish.c */

Modified: gnunet/src/fs/gnunet-publish.c
===================================================================
--- gnunet/src/fs/gnunet-publish.c      2014-06-23 09:07:49 UTC (rev 33768)
+++ gnunet/src/fs/gnunet-publish.c      2014-06-23 09:08:06 UTC (rev 33769)
@@ -154,11 +154,17 @@
  * @param tc scheduler context
  */
 static void
-do_stop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_stop_task (void *cls,
+              const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_FS_PublishContext *p;
 
   kill_task = GNUNET_SCHEDULER_NO_TASK;
+  if (NULL != identity)
+  {
+    GNUNET_IDENTITY_disconnect (identity);
+    identity = NULL;
+  }
   if (NULL != pc)
   {
     p = pc;
@@ -213,7 +219,8 @@
  *         field in the GNUNET_FS_ProgressInfo struct.
  */
 static void *
-progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *info)
+progress_cb (void *cls,
+             const struct GNUNET_FS_ProgressInfo *info)
 {
   const char *s;
   char *suri;
@@ -257,19 +264,28 @@
     kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL);
     break;
   case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
-    FPRINTF (stdout, _("Publishing `%s' done.\n"),
+    FPRINTF (stdout,
+             _("Publishing `%s' done.\n"),
              info->value.publish.filename);
     suri = GNUNET_FS_uri_to_string (info->value.publish.specifics.
-                                 completed.chk_uri);
-    FPRINTF (stdout, _("URI is `%s'.\n"), suri);
+                                    completed.chk_uri);
+    FPRINTF (stdout,
+             _("URI is `%s'.\n"),
+             suri);
     GNUNET_free (suri);
+    if (NULL != info->value.publish.specifics.completed.sks_uri)
+    {
+      suri = GNUNET_FS_uri_to_string (info->value.publish.specifics.
+                                      completed.sks_uri);
+      FPRINTF (stdout,
+               _("Namespace URI is `%s'.\n"),
+               suri);
+      GNUNET_free (suri);
+    }
     if (NULL == info->value.publish.pctx)
     {
       if (GNUNET_SCHEDULER_NO_TASK != kill_task)
-      {
         GNUNET_SCHEDULER_cancel (kill_task);
-        kill_task = GNUNET_SCHEDULER_NO_TASK;
-      }
       kill_task = GNUNET_SCHEDULER_add_now (&do_stop_task, NULL);
     }
     ret = 0;
@@ -280,7 +296,9 @@
   case GNUNET_FS_STATUS_UNINDEX_PROGRESS:
     return NULL;
   case GNUNET_FS_STATUS_UNINDEX_COMPLETED:
-    FPRINTF (stderr, "%s",  _("Cleanup after abort complete.\n"));
+    FPRINTF (stderr,
+             "%s",
+             _("Cleanup after abort complete.\n"));
     return NULL;
   default:
     FPRINTF (stderr, _("Unexpected status: %d\n"), info->status);
@@ -300,12 +318,15 @@
  * @param format format of data
  * @param data_mime_type mime type of data
  * @param data value of the meta data
- * @param data_size number of bytes in data
+ * @param data_size number of bytes in @a data
  * @return always 0
  */
 static int
-meta_printer (void *cls, const char *plugin_name, enum EXTRACTOR_MetaType type,
-              enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
+meta_printer (void *cls,
+              const char *plugin_name,
+              enum EXTRACTOR_MetaType type,
+              enum EXTRACTOR_MetaFormat format,
+              const char *data_mime_type,
               const char *data, size_t data_size)
 {
   if ((EXTRACTOR_METAFORMAT_UTF8 != format) &&
@@ -324,10 +345,12 @@
  * @param cls closure
  * @param keyword the keyword
  * @param is_mandatory is the keyword mandatory (in a search)
- * @return GNUNET_OK to continue to iterate, GNUNET_SYSERR to abort
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to abort
  */
 static int
-keyword_printer (void *cls, const char *keyword, int is_mandatory)
+keyword_printer (void *cls,
+                 const char *keyword,
+                 int is_mandatory)
 {
   FPRINTF (stdout, "\t%s\n", keyword);
   return GNUNET_OK;
@@ -347,15 +370,18 @@
  * @param bo block options
  * @param do_index should we index?
  * @param client_info pointer to client context set upon creation (can be 
modified)
- * @return GNUNET_OK to continue, GNUNET_NO to remove
- *         this entry from the directory, GNUNET_SYSERR
+ * @return #GNUNET_OK to continue, #GNUNET_NO to remove
+ *         this entry from the directory, #GNUNET_SYSERR
  *         to abort the iteration
  */
 static int
-publish_inspector (void *cls, struct GNUNET_FS_FileInformation *fi,
-                   uint64_t length, struct GNUNET_CONTAINER_MetaData *m,
+publish_inspector (void *cls,
+                   struct GNUNET_FS_FileInformation *fi,
+                   uint64_t length,
+                   struct GNUNET_CONTAINER_MetaData *m,
                    struct GNUNET_FS_Uri **uri,
-                   struct GNUNET_FS_BlockOptions *bo, int *do_index,
+                   struct GNUNET_FS_BlockOptions *bo,
+                   int *do_index,
                    void **client_info)
 {
   char *fn;
@@ -423,7 +449,8 @@
  * @param emsg error message, NULL on success
  */
 static void
-uri_sks_continuation (void *cls, const struct GNUNET_FS_Uri *sks_uri,
+uri_sks_continuation (void *cls,
+                      const struct GNUNET_FS_Uri *sks_uri,
                       const char *emsg)
 {
   if (NULL != emsg)
@@ -540,7 +567,9 @@
   GNUNET_FS_share_tree_free (directory_scan_result);
   if (NULL == fi)
   {
-    FPRINTF (stderr, "%s", _("Could not publish\n"));
+    FPRINTF (stderr,
+             "%s",
+             _("Could not publish\n"));
     GNUNET_SCHEDULER_shutdown ();
     ret = 1;
     return;
@@ -563,7 +592,9 @@
                                 GNUNET_FS_PUBLISH_OPTION_NONE);
   if (NULL == pc)
   {
-    FPRINTF (stderr, "%s",  _("Could not start publishing.\n"));
+    FPRINTF (stderr,
+             "%s",
+             _("Could not start publishing.\n"));
     GNUNET_SCHEDULER_shutdown ();
     ret = 1;
     return;
@@ -577,9 +608,9 @@
  *
  * @param cls closure
  * @param filename which file we are making progress on
- * @param is_directory GNUNET_YES if this is a directory,
- *                     GNUNET_NO if this is a file
- *                     GNUNET_SYSERR if it is neither (or unknown)
+ * @param is_directory #GNUNET_YES if this is a directory,
+ *                     #GNUNET_NO if this is a file
+ *                     #GNUNET_SYSERR if it is neither (or unknown)
  * @param reason kind of progress we are making
  */
 static void
@@ -596,9 +627,13 @@
     if (verbose > 1)
     {
       if (is_directory == GNUNET_YES)
-       FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename);
+       FPRINTF (stdout,
+                 _("Scanning directory `%s'.\n"),
+                 filename);
       else
-       FPRINTF (stdout, _("Scanning file `%s'.\n"), filename);
+       FPRINTF (stdout,
+                 _("Scanning file `%s'.\n"),
+                 filename);
     }
     break;
   case GNUNET_FS_DIRSCANNER_FILE_IGNORED:
@@ -608,22 +643,30 @@
     break;
   case GNUNET_FS_DIRSCANNER_ALL_COUNTED:
     if (verbose)
-      FPRINTF (stdout, "%s", _("Preprocessing complete.\n"));
+      FPRINTF (stdout,
+               "%s",
+               _("Preprocessing complete.\n"));
     break;
   case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED:
     if (verbose > 2)
-      FPRINTF (stdout, _("Extracting meta data from file `%s' complete.\n"), 
filename);
+      FPRINTF (stdout,
+               _("Extracting meta data from file `%s' complete.\n"),
+               filename);
     break;
   case GNUNET_FS_DIRSCANNER_FINISHED:
     if (verbose > 1)
-      FPRINTF (stdout, "%s", _("Meta data extraction has finished.\n"));
+      FPRINTF (stdout,
+               "%s",
+               _("Meta data extraction has finished.\n"));
     directory_scan_result = GNUNET_FS_directory_scan_get_result (ds);
     ds = NULL;
     GNUNET_FS_share_tree_trim (directory_scan_result);
     directory_trim_complete (directory_scan_result);
     break;
   case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR:
-    FPRINTF (stdout, "%s", _("Internal error scanning directory.\n"));
+    FPRINTF (stdout,
+             "%s",
+             _("Internal error scanning directory.\n"));
     if (kill_task != GNUNET_SCHEDULER_NO_TASK)
     {
       GNUNET_SCHEDULER_cancel (kill_task);
@@ -654,7 +697,9 @@
   if ( (NULL != pseudonym) &&
        (NULL == namespace) )
   {
-    FPRINTF (stderr, _("Selected pseudonym `%s' unknown\n"), pseudonym);
+    FPRINTF (stderr,
+             _("Selected pseudonym `%s' unknown\n"),
+             pseudonym);
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
@@ -663,14 +708,19 @@
     emsg = NULL;
     if (NULL == (uri = GNUNET_FS_uri_parse (uri_string, &emsg)))
     {
-      FPRINTF (stderr, _("Failed to parse URI: %s\n"), emsg);
+      FPRINTF (stderr,
+               _("Failed to parse URI: %s\n"),
+               emsg);
       GNUNET_free (emsg);
       GNUNET_SCHEDULER_shutdown ();
       ret = 1;
       return;
     }
-    GNUNET_FS_publish_ksk (ctx, topKeywords, meta, uri, &bo,
-                           GNUNET_FS_PUBLISH_OPTION_NONE, 
&uri_ksk_continuation,
+    GNUNET_FS_publish_ksk (ctx, topKeywords,
+                           meta, uri,
+                           &bo,
+                           GNUNET_FS_PUBLISH_OPTION_NONE,
+                           &uri_ksk_continuation,
                            NULL);
     return;
   }
@@ -693,7 +743,8 @@
   if (NULL == ds)
   {
     FPRINTF (stderr,
-            "%s", _("Failed to start meta directory scanner.  Is 
gnunet-helper-publish-fs installed?\n"));
+            "%s",
+             _("Failed to start meta directory scanner.  Is 
gnunet-helper-publish-fs installed?\n"));
     GNUNET_free_non_null (ex);
     return;
   }
@@ -725,6 +776,8 @@
     identity_continuation (args0);
     return;
   }
+  if (NULL == name)
+    return;
   if (0 == strcmp (name, pseudonym))
     namespace = ego;
 }
@@ -739,7 +792,9 @@
  * @param c configuration
  */
 static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+     char *const *args,
+     const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   /* check arguments */
@@ -776,14 +831,16 @@
   {                             /* ordinary insertion checks */
     if (NULL != next_id)
     {
-      FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
+      FPRINTF (stderr,
+               _("Option `%s' makes no sense without option `%s'.\n"),
                "-N", "-P");
       ret = -1;
       return;
     }
     if (NULL != this_id)
     {
-      FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
+      FPRINTF (stderr,
+               _("Option `%s' makes no sense without option `%s'.\n"),
                "-t", "-P");
       ret = -1;
       return;
@@ -795,16 +852,20 @@
                        GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
   if (NULL == ctx)
   {
-    FPRINTF (stderr, _("Could not initialize `%s' subsystem.\n"), "FS");
+    FPRINTF (stderr,
+             _("Could not initialize `%s' subsystem.\n"),
+             "FS");
     ret = 1;
     return;
   }
   kill_task =
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 
&do_stop_task,
-                                    NULL);
+    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+                                  &do_stop_task,
+                                  NULL);
   if (NULL != pseudonym)
     identity = GNUNET_IDENTITY_connect (cfg,
-                                       &identity_cb, args[0]);
+                                       &identity_cb,
+                                        args[0]);
   else
     identity_continuation (args[0]);
 }

Modified: gnunet/src/fs/test_fs_uri.c
===================================================================
--- gnunet/src/fs/test_fs_uri.c 2014-06-23 09:07:49 UTC (rev 33768)
+++ gnunet/src/fs/test_fs_uri.c 2014-06-23 09:08:06 UTC (rev 33769)
@@ -181,7 +181,7 @@
   if (NULL !=
       (ret =
        GNUNET_FS_uri_parse
-       ("gnunet://fs/sks/D1KJS9H2A82Q65VKQ0ML3RFU6U1D3V/test", &emsg)))
+       
("gnunet://fs/sks/XQHH4R288W26EBV369F6RCE0PJVJTX2Y74Q2FJPMPGA31HJX2JG/this", 
&emsg)))
   {
     GNUNET_FS_uri_destroy (ret);
     GNUNET_assert (0);
@@ -273,7 +273,7 @@
   GNUNET_free (emsg);
   ret =
       GNUNET_FS_uri_parse
-      
("gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42",
+      
("gnunet://fs/chk/4QZP479A9SKGFNMQ2ZBCYE71YV2QMTVGWTVPB6A10ASVCKXDHB05DKPSC7ZF6E9P9W1VE47394EQY7NXA47Q6R35M7P1MJPGP59D1Z8.D54QD1K5XCG5878T6YZ19AM60MQ6FC0YNVK7QY08KK0KM0FJJ3KQWYG112FN5T07KN7J0X35DF6WVBT9B8ZMZ3X2BXJ22X3KFQ6MV2G.42",
        &emsg);
   if (ret == NULL)
   {
@@ -299,7 +299,7 @@
   uri = GNUNET_FS_uri_to_string (ret);
   if (0 !=
       strcmp (uri,
-              
"gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.42"))
+              
"gnunet://fs/chk/4QZP479A9SKGFNMQ2ZBCYE71YV2QMTVGWTVPB6A10ASVCKXDHB05DKPSC7ZF6E9P9W1VE47394EQY7NXA47Q6R35M7P1MJPGP59D1Z8.D54QD1K5XCG5878T6YZ19AM60MQ6FC0YNVK7QY08KK0KM0FJJ3KQWYG112FN5T07KN7J0X35DF6WVBT9B8ZMZ3X2BXJ22X3KFQ6MV2G.42"))
   {
     GNUNET_free (uri);
     GNUNET_FS_uri_destroy (ret);




reply via email to

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