diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-23 09:30:12 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-23 09:30:12 +0000 |
commit | e6a87a8d28f07de8c5852df60e893ef1700f48bb (patch) | |
tree | e0abd3014421119cad97dfa325a455399c6702d5 | |
parent | 3aa855513181f3714e50823588b7d719faaf5bf0 (diff) | |
download | gnunet-gtk-e6a87a8d28f07de8c5852df60e893ef1700f48bb.tar.gz gnunet-gtk-e6a87a8d28f07de8c5852df60e893ef1700f48bb.zip |
- coverity and unused vars
-rw-r--r-- | src/gns/gnunet-gns-gtk.c | 1 | ||||
-rw-r--r-- | src/gns/gnunet-gns-gtk_zone.c | 70 |
2 files changed, 39 insertions, 32 deletions
diff --git a/src/gns/gnunet-gns-gtk.c b/src/gns/gnunet-gns-gtk.c index 995aa3f8..a6aca2d6 100644 --- a/src/gns/gnunet-gns-gtk.c +++ b/src/gns/gnunet-gns-gtk.c | |||
@@ -231,7 +231,6 @@ GNUNET_GNS_GTK_zone_open_dialog_response_cb (GtkDialog * dialog, | |||
231 | gpointer user_data) | 231 | gpointer user_data) |
232 | { | 232 | { |
233 | struct GNUNET_GNS_Context *gns = user_data; | 233 | struct GNUNET_GNS_Context *gns = user_data; |
234 | GtkBuilder *builder = gns->builder; | ||
235 | char *filename; | 234 | char *filename; |
236 | 235 | ||
237 | if (GTK_RESPONSE_OK != response_id) | 236 | if (GTK_RESPONSE_OK != response_id) |
diff --git a/src/gns/gnunet-gns-gtk_zone.c b/src/gns/gnunet-gns-gtk_zone.c index ca37784a..e17c8823 100644 --- a/src/gns/gnunet-gns-gtk_zone.c +++ b/src/gns/gnunet-gns-gtk_zone.c | |||
@@ -199,7 +199,11 @@ check_name_validity_and_commit (struct GNUNET_GNS_Context *gns, gchar *path) | |||
199 | g_free (n_value); | 199 | g_free (n_value); |
200 | g_free (n_value_color); | 200 | g_free (n_value_color); |
201 | 201 | ||
202 | gtk_tree_model_iter_next (gns->tm, &it); | 202 | if (FALSE == gtk_tree_model_iter_next (gns->tm, &it)) |
203 | { | ||
204 | GNUNET_break (0); | ||
205 | break; | ||
206 | } | ||
203 | } | 207 | } |
204 | 208 | ||
205 | if (GNUNET_NO == valid) | 209 | if (GNUNET_NO == valid) |
@@ -574,7 +578,6 @@ GNUNET_GNS_GTK_expiration_cellrenderertext_edited_cb (GtkCellRendererText *rende | |||
574 | GtkTreeIter it; | 578 | GtkTreeIter it; |
575 | struct GNUNET_TIME_Absolute abstime; | 579 | struct GNUNET_TIME_Absolute abstime; |
576 | gboolean is_rel; | 580 | gboolean is_rel; |
577 | char *time = new_text; | ||
578 | char *old_text; | 581 | char *old_text; |
579 | 582 | ||
580 | if ((NULL != new_text)) | 583 | if ((NULL != new_text)) |
@@ -589,7 +592,7 @@ GNUNET_GNS_GTK_expiration_cellrenderertext_edited_cb (GtkCellRendererText *rende | |||
589 | 592 | ||
590 | if ((0 == strcmp(new_text,"")) || (0 == strcmp(new_text,EXPIRE_NEVER_STRING))) | 593 | if ((0 == strcmp(new_text,"")) || (0 == strcmp(new_text,EXPIRE_NEVER_STRING))) |
591 | { | 594 | { |
592 | time = EXPIRE_NEVER_STRING; | 595 | new_text = EXPIRE_NEVER_STRING; |
593 | abstime = GNUNET_TIME_absolute_get_forever(); | 596 | abstime = GNUNET_TIME_absolute_get_forever(); |
594 | } | 597 | } |
595 | else | 598 | else |
@@ -812,26 +815,28 @@ void set_relative_expiration_time (struct GNUNET_GNS_Context *gns, struct GNUNET | |||
812 | char *path; | 815 | char *path; |
813 | int not_dummy; | 816 | int not_dummy; |
814 | 817 | ||
815 | gtk_tree_selection_get_selected (ts, &tm, &it); | 818 | if (TRUE == gtk_tree_selection_get_selected (ts, &tm, &it)) |
816 | gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); | 819 | { |
817 | if (GNUNET_NO == not_dummy) | 820 | gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); |
818 | return; | 821 | if (GNUNET_NO == not_dummy) |
822 | return; | ||
819 | 823 | ||
820 | /* Has parent? */ | 824 | /* Has parent? */ |
821 | has_parent = gtk_tree_model_iter_parent (tm, &parent, &it); | 825 | has_parent = gtk_tree_model_iter_parent (tm, &parent, &it); |
822 | 826 | ||
823 | if (FALSE == has_parent) | 827 | if (FALSE == has_parent) |
824 | return; | 828 | return; |
825 | 829 | ||
826 | abstime = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), reltime); | 830 | abstime = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), reltime); |
827 | 831 | ||
828 | /* this is a single record */ | 832 | /* this is a single record */ |
829 | renderer = GTK_CELL_RENDERER_TEXT((gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_name_cellrenderertext"))); | 833 | renderer = GTK_CELL_RENDERER_TEXT((gtk_builder_get_object (gns->builder, "GNUNET_GNS_GTK_name_cellrenderertext"))); |
830 | path = gtk_tree_model_get_string_from_iter (tm, &it); | 834 | path = gtk_tree_model_get_string_from_iter (tm, &it); |
831 | GNUNET_GNS_GTK_expiration_cellrenderertext_edited_cb (renderer, | 835 | GNUNET_GNS_GTK_expiration_cellrenderertext_edited_cb (renderer, |
832 | path, | 836 | path, |
833 | convert_time_to_string (abstime), | 837 | convert_time_to_string (abstime), |
834 | gns); | 838 | gns); |
839 | } | ||
835 | } | 840 | } |
836 | 841 | ||
837 | 842 | ||
@@ -909,14 +914,17 @@ void GNUNET_GNS_GTK_delete_popup_menu_delete_cb (GtkMenuItem *menuitem, | |||
909 | char *path; | 914 | char *path; |
910 | 915 | ||
911 | ts = gtk_tree_view_get_selection(gns->tv); | 916 | ts = gtk_tree_view_get_selection(gns->tv); |
912 | gtk_tree_selection_get_selected (ts, &tm, &it); | 917 | if (TRUE == gtk_tree_selection_get_selected (ts, &tm, &it)) |
913 | gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); | 918 | { |
914 | if (GNUNET_NO == not_dummy) | 919 | gtk_tree_selection_get_selected (ts, &tm, &it); |
915 | return; /* do not delete the dummy line */ | 920 | gtk_tree_model_get(tm, &it, TREE_COL_NOT_DUMMY_ROW, ¬_dummy, -1); |
916 | 921 | if (GNUNET_NO == not_dummy) | |
917 | path = gtk_tree_model_get_string_from_iter (gns->tm, &it); | 922 | return; /* do not delete the dummy line */ |
918 | check_name_validity_and_remove(gns, path); | 923 | |
919 | g_free (path); | 924 | path = gtk_tree_model_get_string_from_iter (gns->tm, &it); |
925 | check_name_validity_and_remove(gns, path); | ||
926 | g_free (path); | ||
927 | } | ||
920 | } | 928 | } |
921 | 929 | ||
922 | void zone_iteration_proc (void *cls, | 930 | void zone_iteration_proc (void *cls, |
@@ -1014,11 +1022,11 @@ void zone_iteration_proc (void *cls, | |||
1014 | rd[c].data, | 1022 | rd[c].data, |
1015 | rd[c].data_size); | 1023 | rd[c].data_size); |
1016 | if (NULL == val) | 1024 | if (NULL == val) |
1017 | GNUNET_asprintf(val, "%s", EXPIRE_INVALID_STRING); | 1025 | GNUNET_asprintf(&val, "%s", EXPIRE_INVALID_STRING); |
1018 | 1026 | ||
1019 | type_str = GNUNET_NAMESTORE_number_to_typename(rd[c].record_type); | 1027 | type_str = strdup (GNUNET_NAMESTORE_number_to_typename(rd[c].record_type)); |
1020 | if (NULL == type_str) | 1028 | if (NULL == type_str) |
1021 | GNUNET_asprintf(type_str, "%s", EXPIRE_INVALID_STRING); | 1029 | GNUNET_asprintf(&type_str, "%s", EXPIRE_INVALID_STRING); |
1022 | 1030 | ||
1023 | if (GNUNET_NAMESTORE_TYPE_PSEU == rd[c].record_type) | 1031 | if (GNUNET_NAMESTORE_TYPE_PSEU == rd[c].record_type) |
1024 | zc_ctx->label = strdup(val); | 1032 | zc_ctx->label = strdup(val); |
@@ -1036,7 +1044,7 @@ void zone_iteration_proc (void *cls, | |||
1036 | TREE_COL_IS_RECORD_ROW, GNUNET_YES, | 1044 | TREE_COL_IS_RECORD_ROW, GNUNET_YES, |
1037 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, | 1045 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, |
1038 | -1); | 1046 | -1); |
1039 | 1047 | GNUNET_free (type_str); | |
1040 | GNUNET_free (exp); | 1048 | GNUNET_free (exp); |
1041 | GNUNET_free (val); | 1049 | GNUNET_free (val); |
1042 | } | 1050 | } |