diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-22 19:07:50 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-22 19:07:50 +0000 |
commit | 3aa855513181f3714e50823588b7d719faaf5bf0 (patch) | |
tree | 87063006ccc46001ab17d46b9498b56fa3039dec | |
parent | 75b3c5a17acdf01efc4e59ceb49f490fd0ea4059 (diff) | |
download | gnunet-gtk-3aa855513181f3714e50823588b7d719faaf5bf0.tar.gz gnunet-gtk-3aa855513181f3714e50823588b7d719faaf5bf0.zip |
- fix
-rw-r--r-- | src/gns/gnunet-gns-gtk_zone.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/gns/gnunet-gns-gtk_zone.c b/src/gns/gnunet-gns-gtk_zone.c index 5c40e002..ca37784a 100644 --- a/src/gns/gnunet-gns-gtk_zone.c +++ b/src/gns/gnunet-gns-gtk_zone.c | |||
@@ -936,6 +936,7 @@ void zone_iteration_proc (void *cls, | |||
936 | 936 | ||
937 | char *exp; | 937 | char *exp; |
938 | char *val; | 938 | char *val; |
939 | char * type_str; | ||
939 | int public; | 940 | int public; |
940 | guint64 exp_t; | 941 | guint64 exp_t; |
941 | 942 | ||
@@ -946,7 +947,9 @@ void zone_iteration_proc (void *cls, | |||
946 | GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc); | 947 | GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc); |
947 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s 'iteration done\n", &shenc); | 948 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s 'iteration done\n", &shenc); |
948 | pseu_entry = GTK_ENTRY((gtk_builder_get_object (zc_ctx->gns->builder, "GNUNET_GNS_GTK_pseu_entry"))); | 949 | pseu_entry = GTK_ENTRY((gtk_builder_get_object (zc_ctx->gns->builder, "GNUNET_GNS_GTK_pseu_entry"))); |
949 | GNUNET_assert (zc_ctx->label != NULL); | 950 | if (zc_ctx->label == NULL) |
951 | GNUNET_asprintf(&zc_ctx->label, "%s", EXPIRE_INVALID_STRING); | ||
952 | |||
950 | gtk_entry_set_text (pseu_entry, zc_ctx->label); | 953 | gtk_entry_set_text (pseu_entry, zc_ctx->label); |
951 | GNUNET_free (zc_ctx->label); | 954 | GNUNET_free (zc_ctx->label); |
952 | GNUNET_free (zc_ctx); | 955 | GNUNET_free (zc_ctx); |
@@ -959,28 +962,6 @@ void zone_iteration_proc (void *cls, | |||
959 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s' iteration result `%s', %u records\n", | 962 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Zone `%s' iteration result `%s', %u records\n", |
960 | &shenc, name, rd_count); | 963 | &shenc, name, rd_count); |
961 | 964 | ||
962 | if (0 == strcmp(name, "+")) | ||
963 | { | ||
964 | |||
965 | if ((rd == NULL) || (rd_count != 1)) | ||
966 | { | ||
967 | GNUNET_break (0); | ||
968 | return; | ||
969 | } | ||
970 | if (rd->data_size == 0) | ||
971 | { | ||
972 | GNUNET_break(0); | ||
973 | return; | ||
974 | } | ||
975 | |||
976 | val = GNUNET_NAMESTORE_value_to_string (rd[0].record_type, | ||
977 | rd[0].data, | ||
978 | rd[0].data_size); | ||
979 | zc_ctx->label = val; | ||
980 | GNUNET_NAMESTORE_zone_iterator_next(zc_ctx->it); | ||
981 | return; | ||
982 | } | ||
983 | |||
984 | GNUNET_assert(GTK_IS_TREE_STORE(zc_ctx->gns->ts)); | 965 | GNUNET_assert(GTK_IS_TREE_STORE(zc_ctx->gns->ts)); |
985 | gtk_tree_store_append(zc_ctx->gns->ts, &iter_name, NULL); | 966 | gtk_tree_store_append(zc_ctx->gns->ts, &iter_name, NULL); |
986 | gtk_tree_store_set(zc_ctx->gns->ts, &iter_name, | 967 | gtk_tree_store_set(zc_ctx->gns->ts, &iter_name, |
@@ -1032,11 +1013,21 @@ void zone_iteration_proc (void *cls, | |||
1032 | val = GNUNET_NAMESTORE_value_to_string (rd[c].record_type, | 1013 | val = GNUNET_NAMESTORE_value_to_string (rd[c].record_type, |
1033 | rd[c].data, | 1014 | rd[c].data, |
1034 | rd[c].data_size); | 1015 | rd[c].data_size); |
1016 | if (NULL == val) | ||
1017 | GNUNET_asprintf(val, "%s", EXPIRE_INVALID_STRING); | ||
1018 | |||
1019 | type_str = GNUNET_NAMESTORE_number_to_typename(rd[c].record_type); | ||
1020 | if (NULL == type_str) | ||
1021 | GNUNET_asprintf(type_str, "%s", EXPIRE_INVALID_STRING); | ||
1022 | |||
1023 | if (GNUNET_NAMESTORE_TYPE_PSEU == rd[c].record_type) | ||
1024 | zc_ctx->label = strdup(val); | ||
1025 | |||
1035 | gtk_tree_store_insert_with_values(zc_ctx->gns->ts, &iter_record , &iter_name, 0, | 1026 | gtk_tree_store_insert_with_values(zc_ctx->gns->ts, &iter_record , &iter_name, 0, |
1036 | TREE_COL_NAME, name, | 1027 | TREE_COL_NAME, name, |
1037 | TREE_COL_NAME_IS_VISIBLE, FALSE, | 1028 | TREE_COL_NAME_IS_VISIBLE, FALSE, |
1038 | TREE_COL_RECORD_TYPE, rd[c].record_type, | 1029 | TREE_COL_RECORD_TYPE, rd[c].record_type, |
1039 | TREE_COL_RECORD_TYPE_AS_STR, GNUNET_NAMESTORE_number_to_typename(rd[c].record_type), | 1030 | TREE_COL_RECORD_TYPE_AS_STR, type_str, |
1040 | TREE_COL_IS_PUBLIC, public, | 1031 | TREE_COL_IS_PUBLIC, public, |
1041 | TREE_COL_EXP_TIME, exp_t, | 1032 | TREE_COL_EXP_TIME, exp_t, |
1042 | TREE_COL_EXP_TIME_AS_STR, exp, | 1033 | TREE_COL_EXP_TIME_AS_STR, exp, |
@@ -1045,8 +1036,9 @@ void zone_iteration_proc (void *cls, | |||
1045 | TREE_COL_IS_RECORD_ROW, GNUNET_YES, | 1036 | TREE_COL_IS_RECORD_ROW, GNUNET_YES, |
1046 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, | 1037 | TREE_COL_NOT_DUMMY_ROW, GNUNET_YES, |
1047 | -1); | 1038 | -1); |
1039 | |||
1048 | GNUNET_free (exp); | 1040 | GNUNET_free (exp); |
1049 | GNUNET_free_non_null (val); | 1041 | GNUNET_free (val); |
1050 | } | 1042 | } |
1051 | 1043 | ||
1052 | GNUNET_NAMESTORE_zone_iterator_next(zc_ctx->it); | 1044 | GNUNET_NAMESTORE_zone_iterator_next(zc_ctx->it); |