Mercurial > geeqie.yaz
changeset 646:91dfc98f3ca1
Reading of Iptc.Application2.Keywords should now be fixed.
Use uft8_validate_or_convert() on exif's text data to be safe.
author | zas_ |
---|---|
date | Mon, 12 May 2008 23:26:00 +0000 |
parents | b50deb0f9968 |
children | 42d36db921bc |
files | src/bar_info.c |
diffstat | 1 files changed, 19 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/bar_info.c Mon May 12 23:21:35 2008 +0000 +++ b/src/bar_info.c Mon May 12 23:26:00 2008 +0000 @@ -283,7 +283,9 @@ if (comment) { ExifItem *item = exif_get_item(exif, COMMENT_KEY); + *comment = exif_item_get_string(item, 0); + *comment = utf8_validate_or_convert(*comment); } if (keywords) @@ -297,25 +299,35 @@ { gchar *kw = exif_item_get_string(item, i); + kw = utf8_validate_or_convert(kw); if (!kw) break; *keywords = g_list_append(*keywords, (gpointer) kw); } -#if 0 + /* FIXME: * Exiv2 handles Iptc keywords as multiple entries with the * same key, thus exif_get_item returns only the first keyword * and the only way to get all keywords is to iterate through * the item list. */ - item = exif_get_item(exif, "Iptc.Application2.Keywords"); - for (i = 0; i < exif_item_get_elements(item); i++) + for (item = exif_get_first_item(exif); + item; + item = exif_get_next_item(exif)) { - gchar *kw = exif_item_get_string(item, i); + guint tag; + + tag = exif_item_get_tag_id(item); + if (tag == 0x0019) /* Iptc.Application2.Keywords */ + { + gchar *kw; - if (!kw) break; - *keywords = g_list_append(*keywords, (gpointer) kw); + kw = exif_item_get_data_as_text(item); + kw = utf8_validate_or_convert(kw); + + if (!kw) continue; + *keywords = g_list_append(*keywords, (gpointer) kw); + } } -#endif } exif_free(exif);