diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-15 19:18:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-15 19:18:51 +0000 |
commit | 46b058edf69a21871629eea1984b00300815755e (patch) | |
tree | 9785a1a9b7d1d6710a74665239d6267bad1678c1 | |
parent | ac6d9d268b89d6c9ea932834f9a490ea45476899 (diff) | |
download | gnunet-gtk-46b058edf69a21871629eea1984b00300815755e.tar.gz gnunet-gtk-46b058edf69a21871629eea1984b00300815755e.zip |
-fix return value to agree with iteration API
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index 3bf02db4..b152b503 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -1000,7 +1000,7 @@ copy_search_uri_to_clipboard_ctx_menu (GtkMenuItem *item, gpointer user_data) | |||
1000 | /** | 1000 | /** |
1001 | * Callback invoked for each embedded URIs. | 1001 | * Callback invoked for each embedded URIs. |
1002 | * | 1002 | * |
1003 | * @return #GNUNET_OK to continue iteration | 1003 | * @return 0 to continue iteration, 1 to abort |
1004 | */ | 1004 | */ |
1005 | typedef int (*EmbeddedUriCallback) (void *cls, | 1005 | typedef int (*EmbeddedUriCallback) (void *cls, |
1006 | const struct GNUNET_FS_Uri *uri); | 1006 | const struct GNUNET_FS_Uri *uri); |
@@ -1034,7 +1034,7 @@ struct UriScannerCallbackContext | |||
1034 | * @param data_mime_type mime type of the meta data | 1034 | * @param data_mime_type mime type of the meta data |
1035 | * @param data the meta data value | 1035 | * @param data the meta data value |
1036 | * @param data_size number of bytes in @a data | 1036 | * @param data_size number of bytes in @a data |
1037 | * @return #GNUNET_OK if we did not invoke the callback, otherwise | 1037 | * @return 0 we did not invoke the callback, otherwise |
1038 | * whatever the callback returned | 1038 | * whatever the callback returned |
1039 | */ | 1039 | */ |
1040 | static int | 1040 | static int |
@@ -1050,13 +1050,17 @@ check_for_embedded_uri (void *cls, | |||
1050 | char *emsg; | 1050 | char *emsg; |
1051 | struct GNUNET_FS_Uri *uri; | 1051 | struct GNUNET_FS_Uri *uri; |
1052 | 1052 | ||
1053 | fprintf (stderr, | ||
1054 | "Checking meta %d/%d %.*s for URI\n", | ||
1055 | type, format, | ||
1056 | (int) data_size, data); | ||
1053 | if ((EXTRACTOR_METATYPE_URI != type) || | 1057 | if ((EXTRACTOR_METATYPE_URI != type) || |
1054 | (EXTRACTOR_METAFORMAT_UTF8 != format) || | 1058 | (EXTRACTOR_METAFORMAT_UTF8 != format) || |
1055 | (NULL == data_mime_type) || | 1059 | (NULL == data_mime_type) || |
1056 | (0 != strcmp ("text/plain", data_mime_type)) || | 1060 | (0 != strcmp ("text/plain", data_mime_type)) || |
1057 | (0 == data_size) || | 1061 | (0 == data_size) || |
1058 | ('\0' != data[data_size - 1]) ) | 1062 | ('\0' != data[data_size - 1]) ) |
1059 | return GNUNET_OK; | 1063 | return 0; |
1060 | emsg = NULL; | 1064 | emsg = NULL; |
1061 | uri = GNUNET_FS_uri_parse (data, &emsg); | 1065 | uri = GNUNET_FS_uri_parse (data, &emsg); |
1062 | if (NULL == uri) | 1066 | if (NULL == uri) |
@@ -1067,8 +1071,9 @@ check_for_embedded_uri (void *cls, | |||
1067 | data, | 1071 | data, |
1068 | emsg); | 1072 | emsg); |
1069 | GNUNET_free_non_null (emsg); | 1073 | GNUNET_free_non_null (emsg); |
1070 | return GNUNET_OK; | 1074 | return 0; |
1071 | } | 1075 | } |
1076 | fprintf (stderr, "URI found!\n"); | ||
1072 | result = ctx->cb (ctx->cls, uri); | 1077 | result = ctx->cb (ctx->cls, uri); |
1073 | GNUNET_FS_uri_destroy (uri); | 1078 | GNUNET_FS_uri_destroy (uri); |
1074 | return result; | 1079 | return result; |
@@ -1119,8 +1124,8 @@ struct UriPopulationContext | |||
1119 | * | 1124 | * |
1120 | * @param cls the `struct UriPopulationContext` | 1125 | * @param cls the `struct UriPopulationContext` |
1121 | * @param uri URI to download | 1126 | * @param uri URI to download |
1122 | * @return #GNUNET_OK if we might add more iterms, | 1127 | * @return 0 if we might add more iterms, |
1123 | * #GNUNET_SYSERR if we have reached the limit | 1128 | * 1 if we have reached the limit |
1124 | */ | 1129 | */ |
1125 | static int | 1130 | static int |
1126 | populate_popup_with_uri_items (void *cls, | 1131 | populate_popup_with_uri_items (void *cls, |
@@ -1159,7 +1164,7 @@ populate_popup_with_uri_items (void *cls, | |||
1159 | gtk_widget_show (child); | 1164 | gtk_widget_show (child); |
1160 | gtk_menu_shell_append (GTK_MENU_SHELL (ctx->menu), child); | 1165 | gtk_menu_shell_append (GTK_MENU_SHELL (ctx->menu), child); |
1161 | 1166 | ||
1162 | return (ctx->counter < 4) ? GNUNET_OK : GNUNET_SYSERR; | 1167 | return (ctx->counter < 4) ? 0 : 1; |
1163 | } | 1168 | } |
1164 | 1169 | ||
1165 | 1170 | ||
@@ -1251,7 +1256,7 @@ search_list_popup (GtkTreeModel *tm, | |||
1251 | 1256 | ||
1252 | /* check for embedded URIs */ | 1257 | /* check for embedded URIs */ |
1253 | uri_pop_ctx.counter = 0; | 1258 | uri_pop_ctx.counter = 0; |
1254 | uri_pop_ctx.menu = menu; | 1259 | uri_pop_ctx.menu = menu; |
1255 | find_embedded_uris (meta, | 1260 | find_embedded_uris (meta, |
1256 | &populate_popup_with_uri_items, | 1261 | &populate_popup_with_uri_items, |
1257 | &uri_pop_ctx); | 1262 | &uri_pop_ctx); |
@@ -2224,7 +2229,7 @@ update_search_result (struct SearchResult *sr, | |||
2224 | * | 2229 | * |
2225 | * @param cls pointer to a `gboolean` | 2230 | * @param cls pointer to a `gboolean` |
2226 | * @param sks_uri a URI | 2231 | * @param sks_uri a URI |
2227 | * @return #GNUNET_SYSERR (abort iteration) | 2232 | * @return 1 (abort iteration) |
2228 | */ | 2233 | */ |
2229 | static int | 2234 | static int |
2230 | see_if_there_are_any_uris (void *cls, | 2235 | see_if_there_are_any_uris (void *cls, |
@@ -2233,7 +2238,7 @@ see_if_there_are_any_uris (void *cls, | |||
2233 | gboolean *gb = cls; | 2238 | gboolean *gb = cls; |
2234 | 2239 | ||
2235 | *gb = TRUE; | 2240 | *gb = TRUE; |
2236 | return GNUNET_SYSERR; | 2241 | return 1; |
2237 | } | 2242 | } |
2238 | 2243 | ||
2239 | 2244 | ||