aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_uri.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-03 21:42:52 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-03 21:42:52 +0000
commit3c5249af8087b0b1a4f131a3e19a9759639ab5db (patch)
tree697ff622324a7d259dc59da63205f398661a56fa /src/fs/fs_uri.c
parentebd1325d27e2062f3fb8e92766178ab0660c2dac (diff)
downloadgnunet-3c5249af8087b0b1a4f131a3e19a9759639ab5db.tar.gz
gnunet-3c5249af8087b0b1a4f131a3e19a9759639ab5db.zip
adapting main code base to work with libextractor 0.6 API; testcases will follow later
Diffstat (limited to 'src/fs/fs_uri.c')
-rw-r--r--src/fs/fs_uri.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 02310a080..16b6e26e9 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -1469,19 +1469,34 @@ GNUNET_FS_uri_test_loc (const struct GNUNET_FS_Uri *uri)
1469 * Adds it to the URI. 1469 * Adds it to the URI.
1470 * 1470 *
1471 * @param cls URI to update 1471 * @param cls URI to update
1472 * @param type type of the meta data 1472 * @param plugin_name name of the plugin that produced this value;
1473 * @param data value of the meta data 1473 * special values can be used (i.e. '<zlib>' for zlib being
1474 * @return GNUNET_OK (always) 1474 * used in the main libextractor library and yielding
1475 * meta data).
1476 * @param type libextractor-type describing the meta data
1477 * @param format basic format information about data
1478 * @param data_mime_type mime-type of data (not of the original file);
1479 * can be NULL (if mime-type is not known)
1480 * @param data actual meta-data found
1481 * @param data_len number of bytes in data
1482 * @return 0 (always)
1475 */ 1483 */
1476static int 1484static int
1477gather_uri_data (void *cls, 1485gather_uri_data (void *cls,
1478 EXTRACTOR_KeywordType type, 1486 const char *plugin_name,
1479 const char *data) 1487 enum EXTRACTOR_MetaType type,
1488 enum EXTRACTOR_MetaFormat format,
1489 const char *data_mime_type,
1490 const char *data,
1491 size_t data_len)
1480{ 1492{
1481 struct GNUNET_FS_Uri *uri = cls; 1493 struct GNUNET_FS_Uri *uri = cls;
1482 char *nkword; 1494 char *nkword;
1483 int j; 1495 int j;
1484 1496
1497 if ( (format != EXTRACTOR_METAFORMAT_UTF8) &&
1498 (format != EXTRACTOR_METAFORMAT_C_STRING) )
1499 return 0;
1485 for (j = uri->data.ksk.keywordCount - 1; j >= 0; j--) 1500 for (j = uri->data.ksk.keywordCount - 1; j >= 0; j--)
1486 if (0 == strcmp (&uri->data.ksk.keywords[j][1], data)) 1501 if (0 == strcmp (&uri->data.ksk.keywords[j][1], data))
1487 return GNUNET_OK; 1502 return GNUNET_OK;
@@ -1489,7 +1504,7 @@ gather_uri_data (void *cls,
1489 strcpy (nkword, " "); /* not mandatory */ 1504 strcpy (nkword, " "); /* not mandatory */
1490 strcat (nkword, data); 1505 strcat (nkword, data);
1491 uri->data.ksk.keywords[uri->data.ksk.keywordCount++] = nkword; 1506 uri->data.ksk.keywords[uri->data.ksk.keywordCount++] = nkword;
1492 return GNUNET_OK; 1507 return 0;
1493} 1508}
1494 1509
1495 1510
@@ -1514,8 +1529,8 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData
1514 ret->data.ksk.keywords = NULL; 1529 ret->data.ksk.keywords = NULL;
1515 ret->data.ksk.keywords 1530 ret->data.ksk.keywords
1516 = GNUNET_malloc (sizeof (char *) * 1531 = GNUNET_malloc (sizeof (char *) *
1517 GNUNET_CONTAINER_meta_data_get_contents (md, NULL, NULL)); 1532 GNUNET_CONTAINER_meta_data_iterate (md, NULL, NULL));
1518 GNUNET_CONTAINER_meta_data_get_contents (md, &gather_uri_data, ret); 1533 GNUNET_CONTAINER_meta_data_iterate (md, &gather_uri_data, ret);
1519 return ret; 1534 return ret;
1520 1535
1521} 1536}