Skip to content

Commit

Permalink
partially fixed reading embedded color profiles with exiv2
Browse files Browse the repository at this point in the history
  • Loading branch information
nadvornik committed Apr 18, 2008
1 parent aa3a6e8 commit f595a30
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ char *exif_item_get_data(ExifItem *item, guint *data_len)
{
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)
Expand Down
14 changes: 13 additions & 1 deletion src/exiv2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,19 @@ guint exif_item_get_elements(ExifItem *item)

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)
Expand Down
1 change: 1 addition & 0 deletions src/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ static gint image_post_process_color(ImageWindow *imd, gint start_row, ExifData
cm = color_man_new_embedded(run_in_bg ? imd : NULL, NULL,
data, data_len,
screen_type, screen_file);
g_free(data);
}
else
{
Expand Down

0 comments on commit f595a30

Please sign in to comment.