gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r9231 - gnunet/src/fs
Date: Tue, 20 Oct 2009 13:39:44 -0600

Author: grothoff
Date: 2009-10-20 13:39:44 -0600 (Tue, 20 Oct 2009)
New Revision: 9231

Modified:
   gnunet/src/fs/fs_directory.c
   gnunet/src/fs/fs_download.c
   gnunet/src/fs/fs_file_information.c
   gnunet/src/fs/gnunet-download.c
   gnunet/src/fs/gnunet-publish.c
   gnunet/src/fs/gnunet-service-fs.c
   gnunet/src/fs/gnunet-unindex.c
Log:
minor bugfixes

Modified: gnunet/src/fs/fs_directory.c
===================================================================
--- gnunet/src/fs/fs_directory.c        2009-10-20 19:28:31 UTC (rev 9230)
+++ gnunet/src/fs/fs_directory.c        2009-10-20 19:39:44 UTC (rev 9231)
@@ -313,6 +313,7 @@
                                 const struct GNUNET_CONTAINER_MetaData *md,
                                 const void *data)
 {
+  struct GNUNET_FS_Uri *curi;
   struct BuilderEntry *e;
   uint64_t fsize;
   uint32_t big;
@@ -330,7 +331,11 @@
     if (GNUNET_FS_uri_test_chk (uri))
       fsize = GNUNET_FS_uri_chk_get_file_size (uri);
     else
-      fsize = GNUNET_FS_uri_chk_get_file_size (GNUNET_FS_uri_loc_get_uri 
(uri));
+      {
+       curi = GNUNET_FS_uri_loc_get_uri (uri);
+       fsize = GNUNET_FS_uri_chk_get_file_size (curi);
+       GNUNET_FS_uri_destroy (curi);
+      }
   else
     fsize = 0; /* not given */
   if (fsize > MAX_INLINE_SIZE)

Modified: gnunet/src/fs/fs_download.c
===================================================================
--- gnunet/src/fs/fs_download.c 2009-10-20 19:28:31 UTC (rev 9230)
+++ gnunet/src/fs/fs_download.c 2009-10-20 19:39:44 UTC (rev 9231)
@@ -766,19 +766,19 @@
   struct GNUNET_FS_DownloadContext *dc;
   struct GNUNET_CLIENT_Connection *client;
 
+  GNUNET_assert (GNUNET_FS_uri_test_chk (uri));
+  if ( (offset + length < offset) ||
+       (offset + length > uri->data.chk.file_length) )
+    {      
+      GNUNET_break (0);
+      return NULL;
+    }
   client = GNUNET_CLIENT_connect (h->sched,
                                  "fs",
                                  h->cfg);
   if (NULL == client)
     return NULL;
   // FIXME: add support for "loc" URIs!
-  GNUNET_assert (GNUNET_FS_uri_test_chk (uri));
-  if ( (offset + length < offset) ||
-       (offset + length > uri->data.chk.file_length) )
-    {
-      GNUNET_break (0);
-      return NULL;
-    }
 #if DEBUG_DOWNLOAD
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Starting download `%s' of %llu bytes\n",

Modified: gnunet/src/fs/fs_file_information.c
===================================================================
--- gnunet/src/fs/fs_file_information.c 2009-10-20 19:28:31 UTC (rev 9230)
+++ gnunet/src/fs/fs_file_information.c 2009-10-20 19:39:44 UTC (rev 9231)
@@ -633,6 +633,7 @@
                                                           anonymity,
                                                           priority,
                                                           expirationTime);
+  GNUNET_CONTAINER_meta_data_destroy (meta);
   ret->data.dir.entries = dc.entries;
   while (dc.entries != NULL)
     {

Modified: gnunet/src/fs/gnunet-download.c
===================================================================
--- gnunet/src/fs/gnunet-download.c     2009-10-20 19:28:31 UTC (rev 9230)
+++ gnunet/src/fs/gnunet-download.c     2009-10-20 19:39:44 UTC (rev 9231)
@@ -64,19 +64,28 @@
 progress_cb (void *cls,
             const struct GNUNET_FS_ProgressInfo *info)
 {
+  char *s;
+  char *t;
+
   switch (info->status)
     {
     case GNUNET_FS_STATUS_DOWNLOAD_START:
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
       if (verbose)
-       fprintf (stdout,
-                _("Downloading `%s' at %llu/%llu (%s remaining, %s/s)\n"),
-                info->value.download.filename,
-                (unsigned long long) info->value.download.completed,
-                (unsigned long long) info->value.download.size,
-                
GNUNET_STRINGS_relative_time_to_string(info->value.download.eta),
-                GNUNET_STRINGS_byte_size_fancy(info->value.download.completed 
* 1000 / (info->value.download.duration.value + 1)));
+       {
+         s = GNUNET_STRINGS_relative_time_to_string(info->value.download.eta);
+         t = GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 
1000 / (info->value.download.duration.value + 1));
+         fprintf (stdout,
+                  _("Downloading `%s' at %llu/%llu (%s remaining, %s/s)\n"),
+                  info->value.download.filename,
+                  (unsigned long long) info->value.download.completed,
+                  (unsigned long long) info->value.download.size,
+                  s,
+                  t);
+         GNUNET_free (s);
+         GNUNET_free (t);
+       }
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
       fprintf (stderr,
@@ -85,10 +94,12 @@
       GNUNET_FS_download_stop (dc, delete_incomplete); 
       break;
     case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
+      s = GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 1000 
/ (info->value.download.duration.value + 1));
       fprintf (stdout,
               _("Downloading `%s' done (%s/s).\n"),
               info->value.download.filename,
-              GNUNET_STRINGS_byte_size_fancy(info->value.download.completed * 
1000 / (info->value.download.duration.value + 1)));
+              s);
+      GNUNET_free (s);
       if (info->value.download.dc == dc)
        GNUNET_FS_download_stop (dc, delete_incomplete);
       break;

Modified: gnunet/src/fs/gnunet-publish.c
===================================================================
--- gnunet/src/fs/gnunet-publish.c      2009-10-20 19:28:31 UTC (rev 9230)
+++ gnunet/src/fs/gnunet-publish.c      2009-10-20 19:39:44 UTC (rev 9231)
@@ -87,18 +87,24 @@
 progress_cb (void *cls,
             const struct GNUNET_FS_ProgressInfo *info)
 {
+  char *s;
+
   switch (info->status)
     {
     case GNUNET_FS_STATUS_PUBLISH_START:
       break;
     case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
       if (verbose)
-       fprintf (stdout,
-                _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
-                info->value.publish.filename,
-                (unsigned long long) info->value.publish.completed,
-                (unsigned long long) info->value.publish.size,
-                
GNUNET_STRINGS_relative_time_to_string(info->value.publish.eta));
+       {
+         s = GNUNET_STRINGS_relative_time_to_string(info->value.publish.eta);
+         fprintf (stdout,
+                  _("Publishing `%s' at %llu/%llu (%s remaining)\n"),
+                  info->value.publish.filename,
+                  (unsigned long long) info->value.publish.completed,
+                  (unsigned long long) info->value.publish.size,
+                  s);
+         GNUNET_free (s);
+       }
       break;
     case GNUNET_FS_STATUS_PUBLISH_ERROR:
       fprintf (stderr,

Modified: gnunet/src/fs/gnunet-service-fs.c
===================================================================
--- gnunet/src/fs/gnunet-service-fs.c   2009-10-20 19:28:31 UTC (rev 9230)
+++ gnunet/src/fs/gnunet-service-fs.c   2009-10-20 19:39:44 UTC (rev 9231)
@@ -920,6 +920,7 @@
          pos->next = indexed_files;
          indexed_files = pos;
        }
+      GNUNET_free (fname);
     }
   if (GNUNET_OK != 
       GNUNET_BIO_read_close (rh, &emsg))

Modified: gnunet/src/fs/gnunet-unindex.c
===================================================================
--- gnunet/src/fs/gnunet-unindex.c      2009-10-20 19:28:31 UTC (rev 9230)
+++ gnunet/src/fs/gnunet-unindex.c      2009-10-20 19:39:44 UTC (rev 9231)
@@ -56,17 +56,23 @@
 progress_cb (void *cls,
             const struct GNUNET_FS_ProgressInfo *info)
 {
+  char *s;
+
   switch (info->status)
     {
     case GNUNET_FS_STATUS_UNINDEX_START:
       break;
     case GNUNET_FS_STATUS_UNINDEX_PROGRESS:
       if (verbose)
-       fprintf (stdout,
-                _("Unindexing at %llu/%llu (%s remaining)\n"),
-                (unsigned long long) info->value.unindex.completed,
-                (unsigned long long) info->value.unindex.size,
-                
GNUNET_STRINGS_relative_time_to_string(info->value.unindex.eta));
+       {
+         s = GNUNET_STRINGS_relative_time_to_string(info->value.unindex.eta);
+         fprintf (stdout,
+                  _("Unindexing at %llu/%llu (%s remaining)\n"),
+                  (unsigned long long) info->value.unindex.completed,
+                  (unsigned long long) info->value.unindex.size,
+                  s);
+         GNUNET_free (s);
+       }
       break;
     case GNUNET_FS_STATUS_UNINDEX_ERROR:
       fprintf (stderr,





reply via email to

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