From: Christian Grothoff Date: Tue, 20 Oct 2009 19:39:44 +0000 (+0000) Subject: minor bugfixes X-Git-Tag: initial-import-from-subversion-38251~23293 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c4bd9004dbd3849a5ccb841c526b9b192e2270e5;p=oweals%2Fgnunet.git minor bugfixes --- diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c index 00407ad3a..e037130c8 100644 --- a/src/fs/fs_directory.c +++ b/src/fs/fs_directory.c @@ -313,6 +313,7 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, 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 @@ GNUNET_FS_directory_builder_add (struct GNUNET_FS_DirectoryBuilder *bld, 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) diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 3054048e4..ca1a8325a 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -766,19 +766,19 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h, struct GNUNET_FS_DownloadContext *dc; struct GNUNET_CLIENT_Connection *client; - 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; } + client = GNUNET_CLIENT_connect (h->sched, + "fs", + h->cfg); + if (NULL == client) + return NULL; + // FIXME: add support for "loc" URIs! #if DEBUG_DOWNLOAD GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting download `%s' of %llu bytes\n", diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index d1d897b24..f4f4fb567 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c @@ -633,6 +633,7 @@ GNUNET_FS_file_information_create_from_directory (void *client_info, anonymity, priority, expirationTime); + GNUNET_CONTAINER_meta_data_destroy (meta); ret->data.dir.entries = dc.entries; while (dc.entries != NULL) { diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index bf3daa68f..1c28cf7c9 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c @@ -64,19 +64,28 @@ static void * 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 @@ progress_cb (void *cls, 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; diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 777370c90..e3918f6fb 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c @@ -87,18 +87,24 @@ static void * 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, diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index ed817e848..0eede0c99 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -920,6 +920,7 @@ read_index_list () pos->next = indexed_files; indexed_files = pos; } + GNUNET_free (fname); } if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c index cce08bb20..c6b75c9c3 100644 --- a/src/fs/gnunet-unindex.c +++ b/src/fs/gnunet-unindex.c @@ -56,17 +56,23 @@ static void * 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,