Mercurial > geeqie
changeset 414:49c1cbe058ae
partially fixed reading embedded color profiles with exiv2
author | nadvornik |
---|---|
date | Fri, 18 Apr 2008 22:31:58 +0000 |
parents | 9e521adbf312 |
children | 4f7362028062 |
files | src/exif.c src/exiv2.cc src/image.c |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/exif.c Fri Apr 18 22:15:01 2008 +0000 +++ b/src/exif.c Fri Apr 18 22:31:58 2008 +0000 @@ -552,7 +552,7 @@ { if (data_len) *data_len = item->data_len; - return item->data; + return g_memdup(item->data, item->data_len); } guint exif_item_get_format_id(ExifItem *item)
--- a/src/exiv2.cc Fri Apr 18 22:15:01 2008 +0000 +++ b/src/exiv2.cc Fri Apr 18 22:31:58 2008 +0000 @@ -316,7 +316,19 @@ char *exif_item_get_data(ExifItem *item, guint *data_len) { - return NULL; + try { + if (!item) return 0; + Exiv2::Metadatum *md = (Exiv2::Metadatum *)item; + if(data_len) *data_len = md->size(); + char *data = (char *)g_malloc(md->size()); + long res = md->copy((Exiv2::byte *)data, Exiv2::littleEndian /* should not matter */); + g_assert(res == md->size()); + return data; + } + catch (Exiv2::AnyError& e) { + std::cout << "Caught Exiv2 exception '" << e << "'\n"; + return NULL; + } } char *exif_item_get_description(ExifItem *item)