# HG changeset patch # User nadvornik # Date 1208557918 0 # Node ID 49c1cbe058ae2000cf15bbcd9b20b69fa6d9d5f2 # Parent 9e521adbf3129cb2c0641c7f7c9ec7c715f4fabf partially fixed reading embedded color profiles with exiv2 diff -r 9e521adbf312 -r 49c1cbe058ae src/exif.c --- 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) diff -r 9e521adbf312 -r 49c1cbe058ae src/exiv2.cc --- 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) diff -r 9e521adbf312 -r 49c1cbe058ae src/image.c --- a/src/image.c Fri Apr 18 22:15:01 2008 +0000 +++ b/src/image.c Fri Apr 18 22:31:58 2008 +0000 @@ -403,6 +403,7 @@ cm = color_man_new_embedded(run_in_bg ? imd : NULL, NULL, data, data_len, screen_type, screen_file); + g_free(data); } else {