diff options
Diffstat (limited to 'src/fs')
-rw-r--r-- | src/fs/fs_api.c | 2 | ||||
-rw-r--r-- | src/fs/fs_file_information.c | 6 | ||||
-rw-r--r-- | src/fs/fs_publish.c | 13 | ||||
-rw-r--r-- | src/fs/fs_tree.c | 13 |
4 files changed, 17 insertions, 17 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index e5707c804..d61ef0016 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c | |||
@@ -496,7 +496,7 @@ GNUNET_FS_make_file_reader_context_ (const char *filename) | |||
496 | { | 496 | { |
497 | struct FileInfo *fi; | 497 | struct FileInfo *fi; |
498 | 498 | ||
499 | fi = GNUNET_malloc (sizeof (struct FileInfo)); | 499 | fi = GNUNET_new (struct FileInfo); |
500 | fi->filename = GNUNET_STRINGS_filename_expand (filename); | 500 | fi->filename = GNUNET_STRINGS_filename_expand (filename); |
501 | if (NULL == fi->filename) | 501 | if (NULL == fi->filename) |
502 | { | 502 | { |
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index da4e85b78..b1ec1ed5d 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c | |||
@@ -123,7 +123,7 @@ GNUNET_FS_file_information_create_from_file (struct GNUNET_FS_Handle *h, | |||
123 | return NULL; | 123 | return NULL; |
124 | } | 124 | } |
125 | fi = GNUNET_FS_make_file_reader_context_ (filename); | 125 | fi = GNUNET_FS_make_file_reader_context_ (filename); |
126 | if (fi == NULL) | 126 | if (NULL == fi) |
127 | { | 127 | { |
128 | GNUNET_break (0); | 128 | GNUNET_break (0); |
129 | return NULL; | 129 | return NULL; |
@@ -261,7 +261,7 @@ GNUNET_FS_file_information_create_from_reader (struct GNUNET_FS_Handle *h, | |||
261 | * Test if a given entry represents a directory. | 261 | * Test if a given entry represents a directory. |
262 | * | 262 | * |
263 | * @param ent check if this FI represents a directory | 263 | * @param ent check if this FI represents a directory |
264 | * @return GNUNET_YES if so, GNUNET_NO if not | 264 | * @return #GNUNET_YES if so, #GNUNET_NO if not |
265 | */ | 265 | */ |
266 | int | 266 | int |
267 | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation | 267 | GNUNET_FS_file_information_is_directory (const struct GNUNET_FS_FileInformation |
@@ -409,7 +409,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi, | |||
409 | int no; | 409 | int no; |
410 | 410 | ||
411 | no = GNUNET_NO; | 411 | no = GNUNET_NO; |
412 | if (fi->is_directory == GNUNET_YES) | 412 | if (GNUNET_YES == fi->is_directory) |
413 | { | 413 | { |
414 | /* clean up directory */ | 414 | /* clean up directory */ |
415 | while (NULL != (pos = fi->data.dir.entries)) | 415 | while (NULL != (pos = fi->data.dir.entries)) |
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index c554c8bb2..73af99ce9 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -345,8 +345,8 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) | |||
345 | { | 345 | { |
346 | struct GNUNET_FS_PublishContext *pc = cls; | 346 | struct GNUNET_FS_PublishContext *pc = cls; |
347 | struct GNUNET_FS_FileInformation *p; | 347 | struct GNUNET_FS_FileInformation *p; |
348 | size_t pt_size; | ||
349 | const char *dd; | 348 | const char *dd; |
349 | size_t pt_size; | ||
350 | 350 | ||
351 | p = pc->fi_pos; | 351 | p = pc->fi_pos; |
352 | if (GNUNET_YES == p->is_directory) | 352 | if (GNUNET_YES == p->is_directory) |
@@ -359,16 +359,15 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) | |||
359 | { | 359 | { |
360 | if (UINT64_MAX == offset) | 360 | if (UINT64_MAX == offset) |
361 | { | 361 | { |
362 | if (NULL != p->data.file.reader) | 362 | if (&GNUNET_FS_data_reader_file_ == p->data.file.reader) |
363 | { | 363 | { |
364 | pt_size = p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); | 364 | /* force closing the file to avoid keeping too many files open */ |
365 | p->data.file.reader = NULL; | 365 | p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); |
366 | return pt_size; | ||
367 | } | 366 | } |
368 | return 0; | 367 | return 0; |
369 | } | 368 | } |
370 | pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); | 369 | pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); |
371 | if (pt_size == 0) | 370 | if (0 == pt_size) |
372 | return 0; /* calling reader with pt_size==0 | 371 | return 0; /* calling reader with pt_size==0 |
373 | * might free buf, so don't! */ | 372 | * might free buf, so don't! */ |
374 | if (pt_size != | 373 | if (pt_size != |
diff --git a/src/fs/fs_tree.c b/src/fs/fs_tree.c index b27fea57f..762989824 100644 --- a/src/fs/fs_tree.c +++ b/src/fs/fs_tree.c | |||
@@ -250,13 +250,13 @@ GNUNET_FS_tree_calculate_block_size (uint64_t fsize, uint64_t offset, | |||
250 | 250 | ||
251 | 251 | ||
252 | /** | 252 | /** |
253 | * Initialize a tree encoder. This function will call "proc" and | 253 | * Initialize a tree encoder. This function will call @a proc and |
254 | * "progress" on each block in the tree. Once all blocks have been | 254 | * "progress" on each block in the tree. Once all blocks have been |
255 | * processed, "cont" will be scheduled. The "reader" will be called | 255 | * processed, "cont" will be scheduled. The @a reader will be called |
256 | * to obtain the (plaintext) blocks for the file. Note that this | 256 | * to obtain the (plaintext) blocks for the file. Note that this |
257 | * function will not actually call "proc". The client must | 257 | * function will not actually call @a proc. The client must |
258 | * call "GNUNET_FS_tree_encoder_next" to trigger encryption (and | 258 | * call #GNUNET_FS_tree_encoder_next to trigger encryption (and |
259 | * calling of "proc") for the each block. | 259 | * calling of @a proc) for the each block. |
260 | * | 260 | * |
261 | * @param h the global FS context | 261 | * @param h the global FS context |
262 | * @param size overall size of the file to encode | 262 | * @param size overall size of the file to encode |
@@ -268,7 +268,8 @@ GNUNET_FS_tree_calculate_block_size (uint64_t fsize, uint64_t offset, | |||
268 | */ | 268 | */ |
269 | struct GNUNET_FS_TreeEncoder * | 269 | struct GNUNET_FS_TreeEncoder * |
270 | GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, uint64_t size, | 270 | GNUNET_FS_tree_encoder_create (struct GNUNET_FS_Handle *h, uint64_t size, |
271 | void *cls, GNUNET_FS_DataReader reader, | 271 | void *cls, |
272 | GNUNET_FS_DataReader reader, | ||
272 | GNUNET_FS_TreeBlockProcessor proc, | 273 | GNUNET_FS_TreeBlockProcessor proc, |
273 | GNUNET_FS_TreeProgressCallback progress, | 274 | GNUNET_FS_TreeProgressCallback progress, |
274 | GNUNET_SCHEDULER_Task cont) | 275 | GNUNET_SCHEDULER_Task cont) |