diff options
Diffstat (limited to 'src/plugins/fs/download.c')
-rw-r--r-- | src/plugins/fs/download.c | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index c58a18e4..1f67235c 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c | |||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | static int | 41 | static int |
42 | addFilesToDirectory (const ECRS_FileInfo * fi, | 42 | addFilesToDirectory (const ECRS_FileInfo * fi, |
43 | const HashCode512 * key, int isRoot, void *closure) | 43 | const GNUNET_HashCode * key, int isRoot, void *closure) |
44 | { | 44 | { |
45 | DownloadList *list = closure; | 45 | DownloadList *list = closure; |
46 | GtkTreeIter iter; | 46 | GtkTreeIter iter; |
@@ -49,16 +49,16 @@ addFilesToDirectory (const ECRS_FileInfo * fi, | |||
49 | GtkTreePath *path; | 49 | GtkTreePath *path; |
50 | GtkTreeModel *model; | 50 | GtkTreeModel *model; |
51 | 51 | ||
52 | if (isRoot == YES) | 52 | if (isRoot == GNUNET_YES) |
53 | return OK; | 53 | return GNUNET_OK; |
54 | if (!gtk_tree_row_reference_valid (list->searchViewRowReference)) | 54 | if (!gtk_tree_row_reference_valid (list->searchViewRowReference)) |
55 | return SYSERR; | 55 | return GNUNET_SYSERR; |
56 | model = GTK_TREE_MODEL (list->searchList->tree); | 56 | model = GTK_TREE_MODEL (list->searchList->tree); |
57 | path = gtk_tree_row_reference_get_path (list->searchViewRowReference); | 57 | path = gtk_tree_row_reference_get_path (list->searchViewRowReference); |
58 | if (path == NULL) | 58 | if (path == NULL) |
59 | { | 59 | { |
60 | GE_BREAK (ectx, 0); | 60 | GE_BREAK (ectx, 0); |
61 | return SYSERR; | 61 | return GNUNET_SYSERR; |
62 | } | 62 | } |
63 | gtk_tree_model_get_iter (model, &iter, path); | 63 | gtk_tree_model_get_iter (model, &iter, path); |
64 | gtk_tree_path_free (path); | 64 | gtk_tree_path_free (path); |
@@ -72,12 +72,12 @@ addFilesToDirectory (const ECRS_FileInfo * fi, | |||
72 | uri = NULL; | 72 | uri = NULL; |
73 | gtk_tree_model_get (model, &child, SEARCH_URI, &uri, -1); | 73 | gtk_tree_model_get (model, &child, SEARCH_URI, &uri, -1); |
74 | if ((uri != NULL) && (ECRS_equalsUri (uri, fi->uri))) | 74 | if ((uri != NULL) && (ECRS_equalsUri (uri, fi->uri))) |
75 | return OK; | 75 | return GNUNET_OK; |
76 | } | 76 | } |
77 | } | 77 | } |
78 | gtk_tree_store_append (GTK_TREE_STORE (model), &child, &iter); | 78 | gtk_tree_store_append (GTK_TREE_STORE (model), &child, &iter); |
79 | addEntryToSearchTree (list->searchList, list, fi, &child); | 79 | addEntryToSearchTree (list->searchList, list, fi, &child); |
80 | return OK; | 80 | return GNUNET_OK; |
81 | } | 81 | } |
82 | 82 | ||
83 | static void | 83 | static void |
@@ -91,7 +91,7 @@ refreshDirectoryViewFromDisk (DownloadList * list) | |||
91 | struct stat buf; | 91 | struct stat buf; |
92 | const char *f; | 92 | const char *f; |
93 | 93 | ||
94 | if ((list->is_directory != YES) || | 94 | if ((list->is_directory != GNUNET_YES) || |
95 | (list->searchList == NULL) || | 95 | (list->searchList == NULL) || |
96 | (list->searchViewRowReference == NULL) || | 96 | (list->searchViewRowReference == NULL) || |
97 | (!gtk_tree_row_reference_valid (list->searchViewRowReference))) | 97 | (!gtk_tree_row_reference_valid (list->searchViewRowReference))) |
@@ -102,14 +102,14 @@ refreshDirectoryViewFromDisk (DownloadList * list) | |||
102 | if (S_ISDIR (buf.st_mode)) | 102 | if (S_ISDIR (buf.st_mode)) |
103 | { | 103 | { |
104 | fn = | 104 | fn = |
105 | MALLOC (strlen (list->filename) + strlen (GNUNET_DIRECTORY_EXT) + 1); | 105 | GNUNET_malloc (strlen (list->filename) + strlen (GNUNET_DIRECTORY_EXT) + 1); |
106 | strcpy (fn, list->filename); | 106 | strcpy (fn, list->filename); |
107 | if (fn[strlen (fn) - 1] == '/') | 107 | if (fn[strlen (fn) - 1] == '/') |
108 | fn[strlen (fn) - 1] = '\0'; | 108 | fn[strlen (fn) - 1] = '\0'; |
109 | strcat (fn, GNUNET_DIRECTORY_EXT); | 109 | strcat (fn, GNUNET_DIRECTORY_EXT); |
110 | if (0 != stat (list->filename, &buf)) | 110 | if (0 != stat (list->filename, &buf)) |
111 | { | 111 | { |
112 | FREE (fn); | 112 | GNUNET_free (fn); |
113 | return; | 113 | return; |
114 | } | 114 | } |
115 | f = fn; | 115 | f = fn; |
@@ -122,13 +122,13 @@ refreshDirectoryViewFromDisk (DownloadList * list) | |||
122 | size = buf.st_size; | 122 | size = buf.st_size; |
123 | if (size == 0) | 123 | if (size == 0) |
124 | { | 124 | { |
125 | FREENONNULL (fn); | 125 | GNUNET_free_non_null (fn); |
126 | return; | 126 | return; |
127 | } | 127 | } |
128 | fd = disk_file_open (ectx, list->filename, O_RDONLY); | 128 | fd = GNUNET_disk_file_open (ectx, list->filename, O_RDONLY); |
129 | if (fd == -1) | 129 | if (fd == -1) |
130 | { | 130 | { |
131 | FREENONNULL (fn); | 131 | GNUNET_free_non_null (fn); |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | data = MMAP (NULL, size, PROT_READ, MAP_SHARED, fd, 0); | 134 | data = MMAP (NULL, size, PROT_READ, MAP_SHARED, fd, 0); |
@@ -136,10 +136,10 @@ refreshDirectoryViewFromDisk (DownloadList * list) | |||
136 | { | 136 | { |
137 | GE_LOG_STRERROR_FILE (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "mmap", f); | 137 | GE_LOG_STRERROR_FILE (ectx, GE_ERROR | GE_ADMIN | GE_BULK, "mmap", f); |
138 | CLOSE (fd); | 138 | CLOSE (fd); |
139 | FREENONNULL (fn); | 139 | GNUNET_free_non_null (fn); |
140 | return; | 140 | return; |
141 | } | 141 | } |
142 | FREENONNULL (fn); | 142 | GNUNET_free_non_null (fn); |
143 | meta = NULL; | 143 | meta = NULL; |
144 | ECRS_listDirectory (ectx, data, size, &meta, &addFilesToDirectory, list); | 144 | ECRS_listDirectory (ectx, data, size, &meta, &addFilesToDirectory, list); |
145 | MUNMAP (data, size); | 145 | MUNMAP (data, size); |
@@ -162,7 +162,7 @@ fs_download_started (struct FSUI_DownloadList *fsui_dl, | |||
162 | const ECRS_FileInfo * fi, | 162 | const ECRS_FileInfo * fi, |
163 | const char *filename, | 163 | const char *filename, |
164 | unsigned long long completed, | 164 | unsigned long long completed, |
165 | cron_t eta, FSUI_State state) | 165 | GNUNET_CronTime eta, FSUI_State state) |
166 | { | 166 | { |
167 | DownloadList *list; | 167 | DownloadList *list; |
168 | GtkTreeIter iter; | 168 | GtkTreeIter iter; |
@@ -178,10 +178,10 @@ fs_download_started (struct FSUI_DownloadList *fsui_dl, | |||
178 | GtkTreeModel *model; | 178 | GtkTreeModel *model; |
179 | 179 | ||
180 | /* setup visualization */ | 180 | /* setup visualization */ |
181 | list = MALLOC (sizeof (DownloadList)); | 181 | list = GNUNET_malloc (sizeof (DownloadList)); |
182 | memset (list, 0, sizeof (DownloadList)); | 182 | memset (list, 0, sizeof (DownloadList)); |
183 | list->uri = ECRS_dupUri (fi->uri); | 183 | list->uri = ECRS_dupUri (fi->uri); |
184 | list->filename = STRDUP (filename); | 184 | list->filename = GNUNET_strdup (filename); |
185 | if ((dl_parent != NULL) && | 185 | if ((dl_parent != NULL) && |
186 | (NULL != | 186 | (NULL != |
187 | (path = | 187 | (path = |
@@ -205,7 +205,7 @@ fs_download_started (struct FSUI_DownloadList *fsui_dl, | |||
205 | gtk_tree_store_append (download_summary, &iter, NULL); | 205 | gtk_tree_store_append (download_summary, &iter, NULL); |
206 | } | 206 | } |
207 | size = ECRS_fileSize (fi->uri); | 207 | size = ECRS_fileSize (fi->uri); |
208 | size_h = string_get_fancy_byte_size (size); | 208 | size_h = GNUNET_get_byte_size_as_fancy_string (size); |
209 | sname = &filename[strlen (filename) - 1]; | 209 | sname = &filename[strlen (filename) - 1]; |
210 | while ((sname > filename) && (sname[-1] != '/') && (sname[-1] != '\\')) | 210 | while ((sname > filename) && (sname[-1] != '/') && (sname[-1] != '\\')) |
211 | sname--; | 211 | sname--; |
@@ -223,8 +223,8 @@ fs_download_started (struct FSUI_DownloadList *fsui_dl, | |||
223 | DOWNLOAD_PROGRESS, progress, | 223 | DOWNLOAD_PROGRESS, progress, |
224 | DOWNLOAD_URISTRING, uri_name, | 224 | DOWNLOAD_URISTRING, uri_name, |
225 | DOWNLOAD_INTERNAL, list, -1); | 225 | DOWNLOAD_INTERNAL, list, -1); |
226 | FREE (uri_name); | 226 | GNUNET_free (uri_name); |
227 | FREE (size_h); | 227 | GNUNET_free (size_h); |
228 | path = gtk_tree_model_get_path (GTK_TREE_MODEL (download_summary), &iter); | 228 | path = gtk_tree_model_get_path (GTK_TREE_MODEL (download_summary), &iter); |
229 | list->summaryViewRowReference | 229 | list->summaryViewRowReference |
230 | = gtk_tree_row_reference_new (GTK_TREE_MODEL (download_summary), path); | 230 | = gtk_tree_row_reference_new (GTK_TREE_MODEL (download_summary), path); |
@@ -304,7 +304,7 @@ fs_download_started (struct FSUI_DownloadList *fsui_dl, | |||
304 | list->has_terminated = ((state != FSUI_ACTIVE) && (state != FSUI_PENDING)); | 304 | list->has_terminated = ((state != FSUI_ACTIVE) && (state != FSUI_PENDING)); |
305 | list->next = download_head; | 305 | list->next = download_head; |
306 | download_head = list; | 306 | download_head = list; |
307 | if ((list->is_directory == YES) && (completed != 0)) | 307 | if ((list->is_directory == GNUNET_YES) && (completed != 0)) |
308 | refreshDirectoryViewFromDisk (list); | 308 | refreshDirectoryViewFromDisk (list); |
309 | return list; | 309 | return list; |
310 | } | 310 | } |
@@ -337,7 +337,7 @@ fs_download_update (DownloadList * list, | |||
337 | else | 337 | else |
338 | val = 100; | 338 | val = 100; |
339 | gtk_tree_store_set (download_summary, &iter, DOWNLOAD_PROGRESS, val, -1); | 339 | gtk_tree_store_set (download_summary, &iter, DOWNLOAD_PROGRESS, val, -1); |
340 | if ((list->is_directory == YES) && | 340 | if ((list->is_directory == GNUNET_YES) && |
341 | (list->searchList != NULL) && (list->searchViewRowReference != NULL)) | 341 | (list->searchList != NULL) && (list->searchViewRowReference != NULL)) |
342 | { | 342 | { |
343 | meta = NULL; | 343 | meta = NULL; |
@@ -372,7 +372,7 @@ fs_download_completed (DownloadList * downloadContext) | |||
372 | SEARCH_CELL_BG_COLOR, | 372 | SEARCH_CELL_BG_COLOR, |
373 | getColorCode (URITRACK_DOWNLOAD_COMPLETED), -1); | 373 | getColorCode (URITRACK_DOWNLOAD_COMPLETED), -1); |
374 | } | 374 | } |
375 | downloadContext->has_terminated = YES; | 375 | downloadContext->has_terminated = GNUNET_YES; |
376 | refreshDirectoryViewFromDisk (downloadContext); | 376 | refreshDirectoryViewFromDisk (downloadContext); |
377 | } | 377 | } |
378 | 378 | ||
@@ -400,7 +400,7 @@ fs_download_aborted (DownloadList * downloadContext) | |||
400 | SEARCH_CELL_BG_COLOR, | 400 | SEARCH_CELL_BG_COLOR, |
401 | getColorCode (URITRACK_DOWNLOAD_ABORTED), -1); | 401 | getColorCode (URITRACK_DOWNLOAD_ABORTED), -1); |
402 | } | 402 | } |
403 | downloadContext->has_terminated = YES; | 403 | downloadContext->has_terminated = GNUNET_YES; |
404 | refreshDirectoryViewFromDisk (downloadContext); | 404 | refreshDirectoryViewFromDisk (downloadContext); |
405 | } | 405 | } |
406 | 406 | ||
@@ -432,7 +432,7 @@ fs_download_stopped (DownloadList * list) | |||
432 | list->summaryViewRowReference = NULL; | 432 | list->summaryViewRowReference = NULL; |
433 | gtk_tree_store_remove (download_summary, &iter); | 433 | gtk_tree_store_remove (download_summary, &iter); |
434 | } | 434 | } |
435 | FREE (list->filename); | 435 | GNUNET_free (list->filename); |
436 | ECRS_freeUri (list->uri); | 436 | ECRS_freeUri (list->uri); |
437 | 437 | ||
438 | /* if we have child-results in view, remove them! */ | 438 | /* if we have child-results in view, remove them! */ |
@@ -473,7 +473,7 @@ fs_download_stopped (DownloadList * list) | |||
473 | else | 473 | else |
474 | GE_BREAK (ectx, 0); | 474 | GE_BREAK (ectx, 0); |
475 | } | 475 | } |
476 | FREE (list); | 476 | GNUNET_free (list); |
477 | } | 477 | } |
478 | 478 | ||
479 | 479 | ||
@@ -483,7 +483,7 @@ fs_download_stopped (DownloadList * list) | |||
483 | * Check if a download for the given filename is | 483 | * Check if a download for the given filename is |
484 | * already running. | 484 | * already running. |
485 | * | 485 | * |
486 | * @return OK if no download is pending, SYSERR if | 486 | * @return GNUNET_OK if no download is pending, GNUNET_SYSERR if |
487 | * such a download is already active. | 487 | * such a download is already active. |
488 | */ | 488 | */ |
489 | static int | 489 | static int |
@@ -502,16 +502,16 @@ check_pending (const char *filename, GtkTreeIter * parent) | |||
502 | if ((name != NULL) && (0 == strcmp (name, filename))) | 502 | if ((name != NULL) && (0 == strcmp (name, filename))) |
503 | { | 503 | { |
504 | free (name); | 504 | free (name); |
505 | return SYSERR; | 505 | return GNUNET_SYSERR; |
506 | } | 506 | } |
507 | if (name != NULL) | 507 | if (name != NULL) |
508 | free (name); | 508 | free (name); |
509 | if (SYSERR == check_pending (filename, &iter)) | 509 | if (GNUNET_SYSERR == check_pending (filename, &iter)) |
510 | return SYSERR; | 510 | return GNUNET_SYSERR; |
511 | } | 511 | } |
512 | while (gtk_tree_model_iter_next (model, &iter)); | 512 | while (gtk_tree_model_iter_next (model, &iter)); |
513 | } | 513 | } |
514 | return OK; | 514 | return GNUNET_OK; |
515 | } | 515 | } |
516 | 516 | ||
517 | typedef struct | 517 | typedef struct |
@@ -582,8 +582,8 @@ initiateDownload (GtkTreeModel * model, | |||
582 | (!(ECRS_isFileUri (sdc.idc_uri) || ECRS_isLocationUri (sdc.idc_uri)))) | 582 | (!(ECRS_isFileUri (sdc.idc_uri) || ECRS_isLocationUri (sdc.idc_uri)))) |
583 | { | 583 | { |
584 | GE_BREAK (ectx, 0); | 584 | GE_BREAK (ectx, 0); |
585 | FREENONNULL (idc_name); | 585 | GNUNET_free_non_null (idc_name); |
586 | FREENONNULL (idc_mime); | 586 | GNUNET_free_non_null (idc_mime); |
587 | return; | 587 | return; |
588 | } | 588 | } |
589 | sdc.uri_name = ECRS_uriToString (sdc.idc_uri); | 589 | sdc.uri_name = ECRS_uriToString (sdc.idc_uri); |
@@ -592,9 +592,9 @@ initiateDownload (GtkTreeModel * model, | |||
592 | strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX))) | 592 | strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX))) |
593 | { | 593 | { |
594 | GE_BREAK (ectx, 0); | 594 | GE_BREAK (ectx, 0); |
595 | FREENONNULL (sdc.uri_name); | 595 | GNUNET_free_non_null (sdc.uri_name); |
596 | FREENONNULL (idc_name); | 596 | GNUNET_free_non_null (idc_name); |
597 | FREENONNULL (idc_mime); | 597 | GNUNET_free_non_null (idc_mime); |
598 | return; | 598 | return; |
599 | } | 599 | } |
600 | /* reduce "//" to "/" */ | 600 | /* reduce "//" to "/" */ |
@@ -614,21 +614,21 @@ initiateDownload (GtkTreeModel * model, | |||
614 | GE_ASSERT (NULL, | 614 | GE_ASSERT (NULL, |
615 | strlen (sdc.uri_name) > | 615 | strlen (sdc.uri_name) > |
616 | strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX)); | 616 | strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX)); |
617 | FREENONNULL (idc_name); | 617 | GNUNET_free_non_null (idc_name); |
618 | filehash = | 618 | filehash = |
619 | STRDUP (&sdc. | 619 | GNUNET_strdup (&sdc. |
620 | uri_name[strlen (ECRS_URI_PREFIX) + | 620 | uri_name[strlen (ECRS_URI_PREFIX) + |
621 | strlen (ECRS_FILE_INFIX)]); | 621 | strlen (ECRS_FILE_INFIX)]); |
622 | filehash[16] = 0; | 622 | filehash[16] = 0; |
623 | idc_name = STRDUP (filehash); | 623 | idc_name = GNUNET_strdup (filehash); |
624 | FREENONNULL (filehash); | 624 | GNUNET_free_non_null (filehash); |
625 | #else | 625 | #else |
626 | GE_ASSERT (NULL, | 626 | GE_ASSERT (NULL, |
627 | strlen (sdc.uri_name) > | 627 | strlen (sdc.uri_name) > |
628 | strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX)); | 628 | strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX)); |
629 | FREENONNULL (idc_name); | 629 | GNUNET_free_non_null (idc_name); |
630 | idc_name = | 630 | idc_name = |
631 | STRDUP (&sdc. | 631 | GNUNET_strdup (&sdc. |
632 | uri_name[strlen (ECRS_URI_PREFIX) + | 632 | uri_name[strlen (ECRS_URI_PREFIX) + |
633 | strlen (ECRS_FILE_INFIX)]); | 633 | strlen (ECRS_FILE_INFIX)]); |
634 | #endif | 634 | #endif |
@@ -636,7 +636,7 @@ initiateDownload (GtkTreeModel * model, | |||
636 | 636 | ||
637 | /* dname = directory portion of idc_name */ | 637 | /* dname = directory portion of idc_name */ |
638 | cname = idc_name; | 638 | cname = idc_name; |
639 | dname = STRDUP (idc_name); | 639 | dname = GNUNET_strdup (idc_name); |
640 | cname = &dname[strlen (dname) - 1]; | 640 | cname = &dname[strlen (dname) - 1]; |
641 | if (cname != dname) | 641 | if (cname != dname) |
642 | cname--; /* ignore tailing '/' */ | 642 | cname--; /* ignore tailing '/' */ |
@@ -645,8 +645,8 @@ initiateDownload (GtkTreeModel * model, | |||
645 | if (*cname == DIR_SEPARATOR) | 645 | if (*cname == DIR_SEPARATOR) |
646 | { | 646 | { |
647 | *cname = '\0'; | 647 | *cname = '\0'; |
648 | FREE (idc_name); | 648 | GNUNET_free (idc_name); |
649 | idc_name = STRDUP (cname + 1); | 649 | idc_name = GNUNET_strdup (cname + 1); |
650 | } | 650 | } |
651 | else | 651 | else |
652 | { | 652 | { |
@@ -661,7 +661,7 @@ initiateDownload (GtkTreeModel * model, | |||
661 | &final_download_dir); | 661 | &final_download_dir); |
662 | if (strlen (dname) > 0) | 662 | if (strlen (dname) > 0) |
663 | { | 663 | { |
664 | tmp = MALLOC (strlen (final_download_dir) + strlen (dname) + 2); | 664 | tmp = GNUNET_malloc (strlen (final_download_dir) + strlen (dname) + 2); |
665 | strcpy (tmp, final_download_dir); | 665 | strcpy (tmp, final_download_dir); |
666 | if (tmp[strlen (tmp)] != DIR_SEPARATOR) | 666 | if (tmp[strlen (tmp)] != DIR_SEPARATOR) |
667 | strcat (tmp, DIR_SEPARATOR_STR); | 667 | strcat (tmp, DIR_SEPARATOR_STR); |
@@ -669,14 +669,14 @@ initiateDownload (GtkTreeModel * model, | |||
669 | strcat (tmp, &dname[1]); | 669 | strcat (tmp, &dname[1]); |
670 | else | 670 | else |
671 | strcat (tmp, dname); | 671 | strcat (tmp, dname); |
672 | FREE (final_download_dir); | 672 | GNUNET_free (final_download_dir); |
673 | final_download_dir = tmp; | 673 | final_download_dir = tmp; |
674 | } | 674 | } |
675 | FREE (dname); | 675 | GNUNET_free (dname); |
676 | dname = NULL; | 676 | dname = NULL; |
677 | /* If file is inside a directory, get the full path */ | 677 | /* If file is inside a directory, get the full path */ |
678 | dirTreePath = gtk_tree_path_copy (path); | 678 | dirTreePath = gtk_tree_path_copy (path); |
679 | dirPath = MALLOC (1); | 679 | dirPath = GNUNET_malloc (1); |
680 | dirPath[0] = '\0'; | 680 | dirPath[0] = '\0'; |
681 | dirPathLen = 0; | 681 | dirPathLen = 0; |
682 | while (gtk_tree_path_get_depth (dirTreePath) > 1) | 682 | while (gtk_tree_path_get_depth (dirTreePath) > 1) |
@@ -691,12 +691,12 @@ initiateDownload (GtkTreeModel * model, | |||
691 | gtk_tree_model_get (model, &iiter, SEARCH_NAME, &dirname, -1); | 691 | gtk_tree_model_get (model, &iiter, SEARCH_NAME, &dirname, -1); |
692 | dirPathLen = | 692 | dirPathLen = |
693 | strlen (dirPath) + strlen (dirname) + strlen (DIR_SEPARATOR_STR) + 1; | 693 | strlen (dirPath) + strlen (dirname) + strlen (DIR_SEPARATOR_STR) + 1; |
694 | newPath = MALLOC (dirPathLen + 1); | 694 | newPath = GNUNET_malloc (dirPathLen + 1); |
695 | strcpy (newPath, dirname); | 695 | strcpy (newPath, dirname); |
696 | if (newPath[strlen (newPath) - 1] != DIR_SEPARATOR) | 696 | if (newPath[strlen (newPath) - 1] != DIR_SEPARATOR) |
697 | strcat (newPath, DIR_SEPARATOR_STR); | 697 | strcat (newPath, DIR_SEPARATOR_STR); |
698 | strcat (newPath, dirPath); | 698 | strcat (newPath, dirPath); |
699 | FREE (dirPath); | 699 | GNUNET_free (dirPath); |
700 | dirPath = newPath; | 700 | dirPath = newPath; |
701 | free (dirname); | 701 | free (dirname); |
702 | } | 702 | } |
@@ -704,7 +704,7 @@ initiateDownload (GtkTreeModel * model, | |||
704 | 704 | ||
705 | /* construct completed/directory/real-filename */ | 705 | /* construct completed/directory/real-filename */ |
706 | sdc.idc_final_download_destination = | 706 | sdc.idc_final_download_destination = |
707 | MALLOC (strlen (final_download_dir) + 2 + strlen (idc_name) + | 707 | GNUNET_malloc (strlen (final_download_dir) + 2 + strlen (idc_name) + |
708 | strlen (GNUNET_DIRECTORY_EXT) + strlen (dirPath)); | 708 | strlen (GNUNET_DIRECTORY_EXT) + strlen (dirPath)); |
709 | strcpy (sdc.idc_final_download_destination, final_download_dir); | 709 | strcpy (sdc.idc_final_download_destination, final_download_dir); |
710 | if (sdc. | 710 | if (sdc. |
@@ -718,7 +718,7 @@ initiateDownload (GtkTreeModel * model, | |||
718 | "downloadAnonymitySpinButton"); | 718 | "downloadAnonymitySpinButton"); |
719 | sdc.recursive = getToggleButtonValue (sdc.searchContext->searchXML, | 719 | sdc.recursive = getToggleButtonValue (sdc.searchContext->searchXML, |
720 | "downloadRecursiveCheckButton"); | 720 | "downloadRecursiveCheckButton"); |
721 | if (OK == check_pending (idc_name, NULL)) | 721 | if (GNUNET_OK == check_pending (idc_name, NULL)) |
722 | { | 722 | { |
723 | addLogEntry (_("Downloading `%s'\n"), idc_name); | 723 | addLogEntry (_("Downloading `%s'\n"), idc_name); |
724 | run_with_save_calls (&init_download_helper, &sdc); | 724 | run_with_save_calls (&init_download_helper, &sdc); |
@@ -727,17 +727,17 @@ initiateDownload (GtkTreeModel * model, | |||
727 | { | 727 | { |
728 | addLogEntry (_("ERROR: already downloading `%s'"), idc_name); | 728 | addLogEntry (_("ERROR: already downloading `%s'"), idc_name); |
729 | } | 729 | } |
730 | FREE (sdc.uri_name); | 730 | GNUNET_free (sdc.uri_name); |
731 | FREE (dirPath); | 731 | GNUNET_free (dirPath); |
732 | FREE (sdc.idc_final_download_destination); | 732 | GNUNET_free (sdc.idc_final_download_destination); |
733 | FREENONNULL (final_download_dir); | 733 | GNUNET_free_non_null (final_download_dir); |
734 | FREENONNULL (idc_name); | 734 | GNUNET_free_non_null (idc_name); |
735 | FREENONNULL (idc_mime); | 735 | GNUNET_free_non_null (idc_mime); |
736 | } | 736 | } |
737 | 737 | ||
738 | /** | 738 | /** |
739 | * The download button in the search dialog was | 739 | * The download button in the search dialog was |
740 | * clicked. Download all selected entries. | 740 | * clicked. GNUNET_ND_DOWNLOAD all selected entries. |
741 | */ | 741 | */ |
742 | void | 742 | void |
743 | on_downloadButton_clicked_fs (GtkWidget * treeview, | 743 | on_downloadButton_clicked_fs (GtkWidget * treeview, |
@@ -770,27 +770,27 @@ on_statusDownloadURIEntry_editing_done_fs (GtkWidget * entry, | |||
770 | SDC sdc; | 770 | SDC sdc; |
771 | 771 | ||
772 | uris = gtk_entry_get_text (GTK_ENTRY (entry)); | 772 | uris = gtk_entry_get_text (GTK_ENTRY (entry)); |
773 | urid = STRDUP (uris); | 773 | urid = GNUNET_strdup (uris); |
774 | gtk_entry_set_text (GTK_ENTRY (entry), ECRS_URI_PREFIX); | 774 | gtk_entry_set_text (GTK_ENTRY (entry), ECRS_URI_PREFIX); |
775 | sdc.idc_uri = ECRS_stringToUri (ectx, urid); | 775 | sdc.idc_uri = ECRS_stringToUri (ectx, urid); |
776 | if (sdc.idc_uri == NULL) | 776 | if (sdc.idc_uri == NULL) |
777 | { | 777 | { |
778 | addLogEntry (_("Invalid URI `%s'"), urid); | 778 | addLogEntry (_("Invalid URI `%s'"), urid); |
779 | FREE (urid); | 779 | GNUNET_free (urid); |
780 | return; | 780 | return; |
781 | } | 781 | } |
782 | if (ECRS_isKeywordUri (sdc.idc_uri)) | 782 | if (ECRS_isKeywordUri (sdc.idc_uri)) |
783 | { | 783 | { |
784 | addLogEntry (_ | 784 | addLogEntry (_ |
785 | ("Please use the search function for keyword (KSK) URIs!")); | 785 | ("Please use the search function for keyword (KSK) URIs!")); |
786 | FREE (urid); | 786 | GNUNET_free (urid); |
787 | ECRS_freeUri (sdc.idc_uri); | 787 | ECRS_freeUri (sdc.idc_uri); |
788 | return; | 788 | return; |
789 | } | 789 | } |
790 | else if (ECRS_isLocationUri (sdc.idc_uri)) | 790 | else if (ECRS_isLocationUri (sdc.idc_uri)) |
791 | { | 791 | { |
792 | addLogEntry (_("Location URIs are not yet supported")); | 792 | addLogEntry (_("Location URIs are not yet supported")); |
793 | FREE (urid); | 793 | GNUNET_free (urid); |
794 | ECRS_freeUri (sdc.idc_uri); | 794 | ECRS_freeUri (sdc.idc_uri); |
795 | return; | 795 | return; |
796 | } | 796 | } |
@@ -799,12 +799,12 @@ on_statusDownloadURIEntry_editing_done_fs (GtkWidget * entry, | |||
799 | "INCOMINGDIR", | 799 | "INCOMINGDIR", |
800 | "$HOME/gnunet-downloads/", | 800 | "$HOME/gnunet-downloads/", |
801 | &final_download_dir); | 801 | &final_download_dir); |
802 | disk_directory_create (ectx, final_download_dir); | 802 | GNUNET_disk_directory_create (ectx, final_download_dir); |
803 | dname = &uris[strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX)]; | 803 | dname = &uris[strlen (ECRS_URI_PREFIX) + strlen (ECRS_FILE_INFIX)]; |
804 | sdc.idc_final_download_destination = | 804 | sdc.idc_final_download_destination = |
805 | MALLOC (strlen (final_download_dir) + strlen (dname) + 2); | 805 | GNUNET_malloc (strlen (final_download_dir) + strlen (dname) + 2); |
806 | strcpy (sdc.idc_final_download_destination, final_download_dir); | 806 | strcpy (sdc.idc_final_download_destination, final_download_dir); |
807 | FREE (final_download_dir); | 807 | GNUNET_free (final_download_dir); |
808 | if (sdc. | 808 | if (sdc. |
809 | idc_final_download_destination[strlen | 809 | idc_final_download_destination[strlen |
810 | (sdc.idc_final_download_destination)] != | 810 | (sdc.idc_final_download_destination)] != |
@@ -815,13 +815,13 @@ on_statusDownloadURIEntry_editing_done_fs (GtkWidget * entry, | |||
815 | addLogEntry (_("Downloading `%s'\n"), uris); | 815 | addLogEntry (_("Downloading `%s'\n"), uris); |
816 | sdc.idc_meta = ECRS_createMetaData (); | 816 | sdc.idc_meta = ECRS_createMetaData (); |
817 | sdc.anonymity = getSpinButtonValue (getMainXML (), "fsstatusAnonymitySpin"); | 817 | sdc.anonymity = getSpinButtonValue (getMainXML (), "fsstatusAnonymitySpin"); |
818 | sdc.recursive = NO; | 818 | sdc.recursive = GNUNET_NO; |
819 | sdc.searchContext = NULL; | 819 | sdc.searchContext = NULL; |
820 | sdc.parentContext = NULL; | 820 | sdc.parentContext = NULL; |
821 | run_with_save_calls (&init_download_helper, &sdc); | 821 | run_with_save_calls (&init_download_helper, &sdc); |
822 | ECRS_freeMetaData (sdc.idc_meta); | 822 | ECRS_freeMetaData (sdc.idc_meta); |
823 | FREE (sdc.idc_final_download_destination); | 823 | GNUNET_free (sdc.idc_final_download_destination); |
824 | FREE (urid); | 824 | GNUNET_free (urid); |
825 | } | 825 | } |
826 | 826 | ||
827 | struct FCBC | 827 | struct FCBC |