aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fs/fs_api.c2
-rw-r--r--src/fs/fs_dirmetascan.c6
-rw-r--r--src/fs/fs_file_information.c14
-rw-r--r--src/fs/fs_publish.c24
-rw-r--r--src/fs/fs_sharetree.c2
-rw-r--r--src/fs/gnunet-helper-fs-publish.c4
-rw-r--r--src/fs/gnunet-publish.c4
7 files changed, 28 insertions, 28 deletions
diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c
index 67be447f6..1df9b2e0a 100644
--- a/src/fs/fs_api.c
+++ b/src/fs/fs_api.c
@@ -1210,7 +1210,7 @@ find_file_position (struct GNUNET_FS_FileInformation *pos, const char *srch)
1210 { 1210 {
1211 if (0 == strcmp (srch, pos->serialization)) 1211 if (0 == strcmp (srch, pos->serialization))
1212 return pos; 1212 return pos;
1213 if (pos->is_directory) 1213 if (pos->is_directory == GNUNET_YES)
1214 { 1214 {
1215 r = find_file_position (pos->data.dir.entries, srch); 1215 r = find_file_position (pos->data.dir.entries, srch);
1216 if (r != NULL) 1216 if (r != NULL)
diff --git a/src/fs/fs_dirmetascan.c b/src/fs/fs_dirmetascan.c
index 0b8b088c4..4e5354e80 100644
--- a/src/fs/fs_dirmetascan.c
+++ b/src/fs/fs_dirmetascan.c
@@ -152,7 +152,7 @@ advance (struct GNUNET_FS_ShareTreeItem *pos)
152 152
153 GNUNET_assert (NULL != pos); 153 GNUNET_assert (NULL != pos);
154 moved = 0; /* must not terminate, even on file, otherwise "normal" */ 154 moved = 0; /* must not terminate, even on file, otherwise "normal" */
155 while ( (pos->is_directory) || 155 while ( (pos->is_directory == GNUNET_YES) ||
156 (0 == moved) ) 156 (0 == moved) )
157 { 157 {
158 if ( (moved != -1) && 158 if ( (moved != -1) &&
@@ -203,7 +203,7 @@ expand_tree (struct GNUNET_FS_ShareTreeItem *parent,
203 GNUNET_asprintf (&chld->short_filename, 203 GNUNET_asprintf (&chld->short_filename,
204 "%s%s", 204 "%s%s",
205 GNUNET_STRINGS_get_short_name (filename), 205 GNUNET_STRINGS_get_short_name (filename),
206 is_directory ? "/" : ""); 206 is_directory == GNUNET_YES ? "/" : "");
207 /* make sure we do not end with '//' */ 207 /* make sure we do not end with '//' */
208 slen = strlen (chld->short_filename); 208 slen = strlen (chld->short_filename);
209 if ( (slen >= 2) && 209 if ( (slen >= 2) &&
@@ -325,7 +325,7 @@ process_helper_msgs (void *cls,
325 NULL, GNUNET_SYSERR, 325 NULL, GNUNET_SYSERR,
326 GNUNET_FS_DIRSCANNER_ALL_COUNTED); 326 GNUNET_FS_DIRSCANNER_ALL_COUNTED);
327 ds->pos = ds->toplevel; 327 ds->pos = ds->toplevel;
328 if (ds->pos->is_directory) 328 if (ds->pos->is_directory == GNUNET_YES)
329 ds->pos = advance (ds->pos); 329 ds->pos = advance (ds->pos);
330 return; 330 return;
331 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA: 331 case GNUNET_MESSAGE_TYPE_FS_PUBLISH_HELPER_META_DATA:
diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c
index a633dcb7b..85a076fee 100644
--- a/src/fs/fs_file_information.c
+++ b/src/fs/fs_file_information.c
@@ -324,7 +324,7 @@ int
324GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir, 324GNUNET_FS_file_information_add (struct GNUNET_FS_FileInformation *dir,
325 struct GNUNET_FS_FileInformation *ent) 325 struct GNUNET_FS_FileInformation *ent)
326{ 326{
327 if ((ent->dir != NULL) || (ent->next != NULL) || (!dir->is_directory)) 327 if ((ent->dir != NULL) || (ent->next != NULL) || (dir->is_directory != GNUNET_YES))
328 { 328 {
329 GNUNET_break (0); 329 GNUNET_break (0);
330 return GNUNET_SYSERR; 330 return GNUNET_SYSERR;
@@ -362,12 +362,12 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir,
362 no = GNUNET_NO; 362 no = GNUNET_NO;
363 if (GNUNET_OK != 363 if (GNUNET_OK !=
364 proc (proc_cls, dir, 364 proc (proc_cls, dir,
365 (dir->is_directory) ? dir->data.dir.dir_size : dir->data. 365 (dir->is_directory == GNUNET_YES) ? dir->data.dir.dir_size : dir->data.
366 file.file_size, dir->meta, &dir->keywords, &dir->bo, 366 file.file_size, dir->meta, &dir->keywords, &dir->bo,
367 (dir->is_directory) ? &no : &dir->data.file.do_index, 367 (dir->is_directory == GNUNET_YES) ? &no : &dir->data.file.do_index,
368 &dir->client_info)) 368 &dir->client_info))
369 return; 369 return;
370 if (!dir->is_directory) 370 if (dir->is_directory != GNUNET_YES)
371 return; 371 return;
372 pos = dir->data.dir.entries; 372 pos = dir->data.dir.entries;
373 while (pos != NULL) 373 while (pos != NULL)
@@ -375,9 +375,9 @@ GNUNET_FS_file_information_inspect (struct GNUNET_FS_FileInformation *dir,
375 no = GNUNET_NO; 375 no = GNUNET_NO;
376 if (GNUNET_OK != 376 if (GNUNET_OK !=
377 proc (proc_cls, pos, 377 proc (proc_cls, pos,
378 (pos->is_directory) ? pos->data.dir.dir_size : pos->data. 378 (pos->is_directory == GNUNET_YES) ? pos->data.dir.dir_size : pos->data.
379 file.file_size, pos->meta, &pos->keywords, &pos->bo, 379 file.file_size, pos->meta, &pos->keywords, &pos->bo,
380 (pos->is_directory) ? &no : &pos->data.file.do_index, 380 (pos->is_directory == GNUNET_YES) ? &no : &pos->data.file.do_index,
381 &pos->client_info)) 381 &pos->client_info))
382 break; 382 break;
383 pos = pos->next; 383 pos = pos->next;
@@ -404,7 +404,7 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
404 int no; 404 int no;
405 405
406 no = GNUNET_NO; 406 no = GNUNET_NO;
407 if (fi->is_directory) 407 if (fi->is_directory == GNUNET_YES)
408 { 408 {
409 /* clean up directory */ 409 /* clean up directory */
410 while (NULL != (pos = fi->data.dir.entries)) 410 while (NULL != (pos = fi->data.dir.entries))
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 315e3a157..1657e29e1 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -57,7 +57,7 @@ GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
57 pi->value.publish.pctx = (NULL == p->dir) ? NULL : p->dir->client_info; 57 pi->value.publish.pctx = (NULL == p->dir) ? NULL : p->dir->client_info;
58 pi->value.publish.filename = p->filename; 58 pi->value.publish.filename = p->filename;
59 pi->value.publish.size = 59 pi->value.publish.size =
60 (p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size; 60 (p->is_directory == GNUNET_YES) ? p->data.dir.dir_size : p->data.file.file_size;
61 pi->value.publish.eta = 61 pi->value.publish.eta =
62 GNUNET_TIME_calculate_eta (p->start_time, offset, pi->value.publish.size); 62 GNUNET_TIME_calculate_eta (p->start_time, offset, pi->value.publish.size);
63 pi->value.publish.completed = offset; 63 pi->value.publish.completed = offset;
@@ -132,7 +132,7 @@ ds_put_cont (void *cls, int success,
132 pi.value.publish.specifics.error.message = pc->fi_pos->emsg; 132 pi.value.publish.specifics.error.message = pc->fi_pos->emsg;
133 pc->fi_pos->client_info = 133 pc->fi_pos->client_info =
134 GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi_pos, 0); 134 GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi_pos, 0);
135 if ((pc->fi_pos->is_directory == GNUNET_NO) && 135 if ((pc->fi_pos->is_directory != GNUNET_YES) &&
136 (pc->fi_pos->filename != NULL) && 136 (pc->fi_pos->filename != NULL) &&
137 (pc->fi_pos->data.file.do_index == GNUNET_YES)) 137 (pc->fi_pos->data.file.do_index == GNUNET_YES))
138 { 138 {
@@ -191,7 +191,7 @@ signal_publish_error (struct GNUNET_FS_FileInformation *p,
191 pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL; 191 pi.value.publish.eta = GNUNET_TIME_UNIT_FOREVER_REL;
192 pi.value.publish.specifics.error.message = emsg; 192 pi.value.publish.specifics.error.message = emsg;
193 p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, 0); 193 p->client_info = GNUNET_FS_publish_make_status_ (&pi, pc, p, 0);
194 if ((p->is_directory == GNUNET_NO) && (p->filename != NULL) && 194 if ((p->is_directory != GNUNET_YES) && (p->filename != NULL) &&
195 (p->data.file.do_index == GNUNET_YES)) 195 (p->data.file.do_index == GNUNET_YES))
196 { 196 {
197 /* run unindex to clean up */ 197 /* run unindex to clean up */
@@ -347,7 +347,7 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
347 const char *dd; 347 const char *dd;
348 348
349 p = pc->fi_pos; 349 p = pc->fi_pos;
350 if (p->is_directory) 350 if (p->is_directory == GNUNET_YES)
351 { 351 {
352 pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset); 352 pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset);
353 dd = p->data.dir.dir_data; 353 dd = p->data.dir.dir_data;
@@ -451,7 +451,7 @@ block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset,
451 return; 451 return;
452 } 452 }
453 453
454 if ((!p->is_directory) && (GNUNET_YES == p->data.file.do_index) && 454 if ((p->is_directory != GNUNET_YES) && (GNUNET_YES == p->data.file.do_index) &&
455 (type == GNUNET_BLOCK_TYPE_FS_DBLOCK)) 455 (type == GNUNET_BLOCK_TYPE_FS_DBLOCK))
456 { 456 {
457 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 457 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -462,7 +462,7 @@ block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset,
462 odb.file_id = p->data.file.file_id; 462 odb.file_id = p->data.file.file_id;
463 GNUNET_assert (pc->qre == NULL); 463 GNUNET_assert (pc->qre == NULL);
464 pc->qre = 464 pc->qre =
465 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory) ? 0 : pc->rid, 465 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid,
466 &chk->query, sizeof (struct OnDemandBlock), &odb, 466 &chk->query, sizeof (struct OnDemandBlock), &odb,
467 GNUNET_BLOCK_TYPE_FS_ONDEMAND, 467 GNUNET_BLOCK_TYPE_FS_ONDEMAND,
468 p->bo.content_priority, p->bo.anonymity_level, 468 p->bo.content_priority, p->bo.anonymity_level,
@@ -477,7 +477,7 @@ block_proc (void *cls, const struct ContentHashKey *chk, uint64_t offset,
477 (unsigned int) block_size); 477 (unsigned int) block_size);
478 GNUNET_assert (pc->qre == NULL); 478 GNUNET_assert (pc->qre == NULL);
479 pc->qre = 479 pc->qre =
480 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory) ? 0 : pc->rid, 480 GNUNET_DATASTORE_put (pc->dsh, (p->is_directory == GNUNET_YES) ? 0 : pc->rid,
481 &chk->query, block_size, block, type, 481 &chk->query, block_size, block, type,
482 p->bo.content_priority, p->bo.anonymity_level, 482 p->bo.content_priority, p->bo.anonymity_level,
483 p->bo.replication_level, p->bo.expiration_time, -2, 483 p->bo.replication_level, p->bo.expiration_time, -2,
@@ -535,14 +535,14 @@ publish_content (struct GNUNET_FS_PublishContext *pc)
535 GNUNET_assert (p != NULL); 535 GNUNET_assert (p != NULL);
536 if (NULL == p->te) 536 if (NULL == p->te)
537 { 537 {
538 if (p->is_directory) 538 if (p->is_directory == GNUNET_YES)
539 { 539 {
540 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating directory\n"); 540 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating directory\n");
541 db = GNUNET_FS_directory_builder_create (p->meta); 541 db = GNUNET_FS_directory_builder_create (p->meta);
542 dirpos = p->data.dir.entries; 542 dirpos = p->data.dir.entries;
543 while (NULL != dirpos) 543 while (NULL != dirpos)
544 { 544 {
545 if (dirpos->is_directory) 545 if (dirpos->is_directory == GNUNET_YES)
546 { 546 {
547 raw_data = dirpos->data.dir.dir_data; 547 raw_data = dirpos->data.dir.dir_data;
548 dirpos->data.dir.dir_data = NULL; 548 dirpos->data.dir.dir_data = NULL;
@@ -578,7 +578,7 @@ publish_content (struct GNUNET_FS_PublishContext *pc)
578 &p->data.dir.dir_data); 578 &p->data.dir.dir_data);
579 GNUNET_FS_file_information_sync_ (p); 579 GNUNET_FS_file_information_sync_ (p);
580 } 580 }
581 size = (p->is_directory) ? p->data.dir.dir_size : p->data.file.file_size; 581 size = (p->is_directory == GNUNET_YES) ? p->data.dir.dir_size : p->data.file.file_size;
582 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating tree encoder\n"); 582 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating tree encoder\n");
583 p->te = 583 p->te =
584 GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader, 584 GNUNET_FS_tree_encoder_create (pc->h, size, pc, &block_reader,
@@ -783,7 +783,7 @@ GNUNET_FS_publish_main_ (void *cls,
783 return; 783 return;
784 } 784 }
785 /* find starting position */ 785 /* find starting position */
786 while ((p->is_directory) && (NULL != p->data.dir.entries) && (NULL == p->emsg) 786 while ((p->is_directory == GNUNET_YES) && (NULL != p->data.dir.entries) && (NULL == p->emsg)
787 && (NULL == p->data.dir.entries->chk_uri)) 787 && (NULL == p->data.dir.entries->chk_uri))
788 { 788 {
789 p = p->data.dir.entries; 789 p = p->data.dir.entries;
@@ -847,7 +847,7 @@ GNUNET_FS_publish_main_ (void *cls,
847 } 847 }
848 return; 848 return;
849 } 849 }
850 if ((!p->is_directory) && (p->data.file.do_index)) 850 if ((p->is_directory != GNUNET_YES) && (p->data.file.do_index))
851 { 851 {
852 if (NULL == p->filename) 852 if (NULL == p->filename)
853 { 853 {
diff --git a/src/fs/fs_sharetree.c b/src/fs/fs_sharetree.c
index ca5f38175..c929428e1 100644
--- a/src/fs/fs_sharetree.c
+++ b/src/fs/fs_sharetree.c
@@ -347,7 +347,7 @@ share_tree_trim (struct TrimContext *tc,
347 } 347 }
348 348
349 /* consider adding filename to directory meta data */ 349 /* consider adding filename to directory meta data */
350 if (tree->is_directory) 350 if (tree->is_directory == GNUNET_YES)
351 { 351 {
352 const char *user = getenv ("USER"); 352 const char *user = getenv ("USER");
353 if ( (user == NULL) || 353 if ( (user == NULL) ||
diff --git a/src/fs/gnunet-helper-fs-publish.c b/src/fs/gnunet-helper-fs-publish.c
index 94da0ce19..4f7046408 100644
--- a/src/fs/gnunet-helper-fs-publish.c
+++ b/src/fs/gnunet-helper-fs-publish.c
@@ -298,7 +298,7 @@ preprocess_file (const char *filename,
298 item->filename = GNUNET_strdup (filename); 298 item->filename = GNUNET_strdup (filename);
299 item->is_directory = (S_ISDIR (sbuf.st_mode)) ? GNUNET_YES : GNUNET_NO; 299 item->is_directory = (S_ISDIR (sbuf.st_mode)) ? GNUNET_YES : GNUNET_NO;
300 item->file_size = (uint64_t) sbuf.st_size; 300 item->file_size = (uint64_t) sbuf.st_size;
301 if (item->is_directory) 301 if (item->is_directory == GNUNET_YES)
302 { 302 {
303 struct RecursionContext rc; 303 struct RecursionContext rc;
304 304
@@ -334,7 +334,7 @@ extract_files (struct ScanTreeNode *item)
334 ssize_t size; 334 ssize_t size;
335 size_t slen; 335 size_t slen;
336 336
337 if (item->is_directory) 337 if (item->is_directory == GNUNET_YES)
338 { 338 {
339 /* for directories, we simply only descent, no extraction, no 339 /* for directories, we simply only descent, no extraction, no
340 progress reporting */ 340 progress reporting */
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index 8f8d9147c..50f507d93 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -378,7 +378,7 @@ get_file_information (struct GNUNET_FS_ShareTreeItem *item)
378 struct GNUNET_FS_FileInformation *fic; 378 struct GNUNET_FS_FileInformation *fic;
379 struct GNUNET_FS_ShareTreeItem *child; 379 struct GNUNET_FS_ShareTreeItem *child;
380 380
381 if (item->is_directory) 381 if (item->is_directory == GNUNET_YES)
382 { 382 {
383 GNUNET_CONTAINER_meta_data_delete (item->meta, 383 GNUNET_CONTAINER_meta_data_delete (item->meta,
384 EXTRACTOR_METATYPE_MIMETYPE, NULL, 0); 384 EXTRACTOR_METATYPE_MIMETYPE, NULL, 0);
@@ -481,7 +481,7 @@ directory_scan_cb (void *cls,
481 case GNUNET_FS_DIRSCANNER_FILE_START: 481 case GNUNET_FS_DIRSCANNER_FILE_START:
482 if (verbose > 1) 482 if (verbose > 1)
483 { 483 {
484 if (is_directory) 484 if (is_directory == GNUNET_YES)
485 FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename); 485 FPRINTF (stdout, _("Scanning directory `%s'.\n"), filename);
486 else 486 else
487 FPRINTF (stdout, _("Scanning file `%s'.\n"), filename); 487 FPRINTF (stdout, _("Scanning file `%s'.\n"), filename);