diff options
-rw-r--r-- | src/fs/fs_api.c | 8 | ||||
-rw-r--r-- | src/fs/fs_file_information.c | 9 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 14 | ||||
-rw-r--r-- | src/fs/fs_tree.c | 6 |
4 files changed, 28 insertions, 9 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 91c568554..be351b279 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c | |||
@@ -1391,12 +1391,16 @@ cleanup: | |||
1391 | * @return NULL if srch was not found in this subtree | 1391 | * @return NULL if srch was not found in this subtree |
1392 | */ | 1392 | */ |
1393 | static struct GNUNET_FS_FileInformation * | 1393 | static struct GNUNET_FS_FileInformation * |
1394 | find_file_position (struct GNUNET_FS_FileInformation *pos, const char *srch) | 1394 | find_file_position (struct GNUNET_FS_FileInformation *pos, |
1395 | const char *srch) | ||
1395 | { | 1396 | { |
1396 | struct GNUNET_FS_FileInformation *r; | 1397 | struct GNUNET_FS_FileInformation *r; |
1397 | 1398 | ||
1398 | while (NULL != pos) | 1399 | while (NULL != pos) |
1399 | { | 1400 | { |
1401 | fprintf (stderr, | ||
1402 | "CMP: %s %s\n", | ||
1403 | srch, pos->serialization); | ||
1400 | if (0 == strcmp (srch, pos->serialization)) | 1404 | if (0 == strcmp (srch, pos->serialization)) |
1401 | return pos; | 1405 | return pos; |
1402 | if ( (GNUNET_YES == pos->is_directory) && | 1406 | if ( (GNUNET_YES == pos->is_directory) && |
@@ -1457,7 +1461,7 @@ fip_signal_resume (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
1457 | * | 1461 | * |
1458 | * @param cls the 'struct GNUNET_FS_Handle*' | 1462 | * @param cls the 'struct GNUNET_FS_Handle*' |
1459 | * @param filename complete filename (absolute path) | 1463 | * @param filename complete filename (absolute path) |
1460 | * @return GNUNET_OK (continue to iterate) | 1464 | * @return #GNUNET_OK (continue to iterate) |
1461 | */ | 1465 | */ |
1462 | static int | 1466 | static int |
1463 | deserialize_publish_file (void *cls, const char *filename) | 1467 | deserialize_publish_file (void *cls, const char *filename) |
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index 7726fc7d9..3e6d53af6 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -426,8 +426,11 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | |||
426 | else | 426 | else |
427 | { | 427 | { |
428 | /* call clean-up function of the reader */ | 428 | /* call clean-up function of the reader */ |
429 | if (fi->data.file.reader != NULL) | 429 | if (NULL != fi->data.file.reader) |
430 | fi->data.file.reader (fi->data.file.reader_cls, 0, 0, NULL, NULL); | 430 | { |
431 | (void) fi->data.file.reader (fi->data.file.reader_cls, 0, 0, NULL, NULL); | ||
432 | fi->data.file.reader = NULL; | ||
433 | } | ||
431 | /* clean up client-info */ | 434 | /* clean up client-info */ |
432 | if (NULL != cleaner) | 435 | if (NULL != cleaner) |
433 | cleaner (cleaner_cls, fi, fi->data.file.file_size, fi->meta, | 436 | cleaner (cleaner_cls, fi, fi->data.file.file_size, fi->meta, |
@@ -446,7 +449,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | |||
446 | if (NULL != fi->meta) | 449 | if (NULL != fi->meta) |
447 | GNUNET_CONTAINER_meta_data_destroy (fi->meta); | 450 | GNUNET_CONTAINER_meta_data_destroy (fi->meta); |
448 | GNUNET_free_non_null (fi->serialization); | 451 | GNUNET_free_non_null (fi->serialization); |
449 | if (fi->te != NULL) | 452 | if (NULL != fi->te) |
450 | { | 453 | { |
451 | GNUNET_FS_tree_encoder_finish (fi->te, NULL, NULL); | 454 | GNUNET_FS_tree_encoder_finish (fi->te, NULL, NULL); |
452 | fi->te = NULL; | 455 | fi->te = NULL; |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 1ed37d7e4..9483ec36a 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -349,7 +349,7 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) | |||
349 | const char *dd; | 349 | const char *dd; |
350 | 350 | ||
351 | p = pc->fi_pos; | 351 | p = pc->fi_pos; |
352 | if (p->is_directory == GNUNET_YES) | 352 | if (GNUNET_YES == p->is_directory) |
353 | { | 353 | { |
354 | pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset); | 354 | pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset); |
355 | dd = p->data.dir.dir_data; | 355 | dd = p->data.dir.dir_data; |
@@ -357,8 +357,16 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) | |||
357 | } | 357 | } |
358 | else | 358 | else |
359 | { | 359 | { |
360 | if (UINT64_MAX == offset) | 360 | if (UINT64_MAX == offset) |
361 | return p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); | 361 | { |
362 | if (NULL != p->data.file.reader) | ||
363 | { | ||
364 | pt_size = p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); | ||
365 | p->data.file.reader = NULL; | ||
366 | return pt_size; | ||
367 | } | ||
368 | return 0; | ||
369 | } | ||
362 | pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); | 370 | pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); |
363 | if (pt_size == 0) | 371 | if (pt_size == 0) |
364 | return 0; /* calling reader with pt_size==0 | 372 | return 0; /* calling reader with pt_size==0 |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index 3a697c539..b27fea57f 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -429,7 +429,11 @@ void | |||
429 | GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, | 429 | GNUNET_FS_tree_encoder_finish (struct GNUNET_FS_TreeEncoder *te, |
430 | struct GNUNET_FS_Uri **uri, char **emsg) | 430 | struct GNUNET_FS_Uri **uri, char **emsg) |
431 | { | 431 | { |
432 | (void) te->reader (te->cls, UINT64_MAX, 0, 0, NULL); | 432 | if (NULL != te->reader) |
433 | { | ||
434 | (void) te->reader (te->cls, UINT64_MAX, 0, 0, NULL); | ||
435 | te->reader = NULL; | ||
436 | } | ||
433 | GNUNET_assert (GNUNET_NO == te->in_next); | 437 | GNUNET_assert (GNUNET_NO == te->in_next); |
434 | if (uri != NULL) | 438 | if (uri != NULL) |
435 | *uri = te->uri; | 439 | *uri = te->uri; |