*
* @param md metadata to extend
* @param plugin_name name of the plugin that produced this value;
- * special values can be used (i.e. '<zlib>' for zlib being
+ * special values can be used (i.e. '<zlib>' for zlib being
* used in the main libextractor library and yielding
* meta data).
* @param type libextractor-type describing the meta data
}
pos = pos->next;
}
- if (match == NULL)
+ if ( (match == NULL) ||
+ (match->data_size == 0) )
return 0;
*thumb = GNUNET_malloc (match->data_size);
memcpy (*thumb, match->data, match->data_size);
*
* @param cls closure, our meta data container
* @param plugin_name name of the plugin that produced this value;
- * special values can be used (i.e. '<zlib>' for zlib being
+ * special values can be used (i.e. '<zlib>' for zlib being
* used in the main libextractor library and yielding
* meta data).
* @param type libextractor-type describing the meta data
off -= pos->data_size;
memcpy (&mdata[off], pos->data, pos->data_size);
off -= plen;
- memcpy (&mdata[off], pos->plugin_name, plen);
+ if (pos->plugin_name != NULL)
+ memcpy (&mdata[off], pos->plugin_name, plen);
off -= mlen;
- memcpy (&mdata[off], pos->mime_type, mlen);
+ if (pos->mime_type != NULL)
+ memcpy (&mdata[off], pos->mime_type, mlen);
i++;
pos = pos->next;
}
GNUNET_assert (off == 0);
+ clen = 0;
+ cdata = NULL;
left = size;
+ pos = md->items;
for (i=0;i<md->item_count;i++)
{
comp = GNUNET_NO;
hdr->entries = htonl (md->item_count);
if (GNUNET_YES == comp)
{
+ GNUNET_assert (clen < left);
hdr->version = htonl (2 | HEADER_COMPRESSED);
memcpy (&hdr[1],
cdata,
if (pos->plugin_name != NULL)
left -= strlen (pos->plugin_name) + 1;
if (pos->mime_type != NULL)
- left -= strlen (pos->mime_type) + 1;
+ left -= strlen (pos->mime_type) + 1;
+ pos = pos->next;
}
GNUNET_free (ent);