aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk-common.c')
-rw-r--r--src/fs/gnunet-fs-gtk-common.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/fs/gnunet-fs-gtk-common.c b/src/fs/gnunet-fs-gtk-common.c
index bd33d17a..4d416849 100644
--- a/src/fs/gnunet-fs-gtk-common.c
+++ b/src/fs/gnunet-fs-gtk-common.c
@@ -39,7 +39,8 @@
39 * freeable with GNUNET_free* (). 39 * freeable with GNUNET_free* ().
40 */ 40 */
41char * 41char *
42GNUNET_FS_GTK_dubious_meta_to_utf8 (enum EXTRACTOR_MetaFormat format, const char *data, size_t data_len) 42GNUNET_FS_GTK_dubious_meta_to_utf8 (enum EXTRACTOR_MetaFormat format,
43 const char *data, size_t data_len)
43{ 44{
44 gchar *result = NULL; 45 gchar *result = NULL;
45 46
@@ -51,18 +52,19 @@ GNUNET_FS_GTK_dubious_meta_to_utf8 (enum EXTRACTOR_MetaFormat format, const char
51 else 52 else
52 { 53 {
53 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 54 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
54 "Failed to validate supposedly utf-8 string `%s' of length %u, assuming it to be a C string\n", 55 "Failed to validate supposedly utf-8 string `%s' of length %u, assuming it to be a C string\n",
55 data, data_len); 56 data, data_len);
56 format = EXTRACTOR_METAFORMAT_C_STRING; 57 format = EXTRACTOR_METAFORMAT_C_STRING;
57 } 58 }
58 } 59 }
59 if (format == EXTRACTOR_METAFORMAT_C_STRING) 60 if (format == EXTRACTOR_METAFORMAT_C_STRING)
60 { 61 {
61 if (data_len > 0) 62 if (data_len > 0)
62 { /* There are no guarantees that data is NULL-terminated, AFAIU, 63 { /* There are no guarantees that data is NULL-terminated, AFAIU,
63 * so let's play it safe, shall we? 64 * so let's play it safe, shall we?
64 */ 65 */
65 char *data_copy = GNUNET_malloc (data_len + 1); 66 char *data_copy = GNUNET_malloc (data_len + 1);
67
66 memcpy (data_copy, data, data_len); 68 memcpy (data_copy, data, data_len);
67 data_copy[data_len] = '\0'; 69 data_copy[data_len] = '\0';
68 result = GNUNET_GTK_from_loc_to_utf8 (data_copy); 70 result = GNUNET_GTK_from_loc_to_utf8 (data_copy);
@@ -100,7 +102,7 @@ GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls, const char *plugin_name,
100 102
101 data_to_insert = GNUNET_FS_GTK_dubious_meta_to_utf8 (format, data, data_len); 103 data_to_insert = GNUNET_FS_GTK_dubious_meta_to_utf8 (format, data, data_len);
102 104
103 if (NULL != data_to_insert) 105 if (NULL != data_to_insert)
104 { 106 {
105 gtk_list_store_insert_with_values (ls, NULL, G_MAXINT, 0, type, 1, format, 107 gtk_list_store_insert_with_values (ls, NULL, G_MAXINT, 0, type, 1, format,
106 2, EXTRACTOR_metatype_to_string (type), 108 2, EXTRACTOR_metatype_to_string (type),