diff options
author | Felix Riemann <[email protected]> | 2012-02-26 15:51:23 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-07-14 16:25:43 +0200 |
commit | b3f9b82e3a18ccbcd291d3e942d536e3211f9418 (patch) | |
tree | ddf9a41891d89d2cdb4a47ecd043ef56bb606f61 /src/eom-exif-details.c | |
parent | a3a89e0c0b7b7f8874964481de8d714d61cc4037 (diff) | |
download | eom-b3f9b82e3a18ccbcd291d3e942d536e3211f9418.tar.bz2 eom-b3f9b82e3a18ccbcd291d3e942d536e3211f9418.tar.xz |
EomExifDetails: Take Exif IFD into account when creating hash keys
This should solve conflicts with Exif values that have the same number
but are stored in different IFD blocks (e.g GPS and Interoperability).
https://bugzilla.gnome.org/show_bug.cgi?id=670700
origin commit:
https://gitlab.gnome.org/GNOME/eog/commit/38f49dc
Diffstat (limited to 'src/eom-exif-details.c')
-rw-r--r-- | src/eom-exif-details.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/eom-exif-details.c b/src/eom-exif-details.c index 1b1e548..efe1e42 100644 --- a/src/eom-exif-details.c +++ b/src/eom-exif-details.c @@ -451,13 +451,22 @@ exif_entry_cb (ExifEntry *entry, gpointer data) ExifIfd ifd = exif_entry_get_ifd (entry); char *path; char b[1024]; + const gint key = ifd << 16 | entry->tag; + + /* This should optimize away if comparision is correct */ + g_warn_if_fail (EXIF_IFD_COUNT <= G_MAXUINT16); view = EOM_EXIF_DETAILS (data); priv = view->priv; store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view))); - path = g_hash_table_lookup (priv->id_path_hash, GINT_TO_POINTER (entry->tag)); + /* Take the tag's IFD into account when caching their GtkTreePaths. + * That should fix key collisions for tags that have the same number + * but are stored in different IFDs. Exif tag numbers are 16-bit + * values so we should be able to set the high word to the IFD number. + */ + path = g_hash_table_lookup (priv->id_path_hash, GINT_TO_POINTER (key)); if (path != NULL) { set_row_data (store, @@ -500,8 +509,8 @@ exif_entry_cb (ExifEntry *entry, gpointer data) sizeof(b))); g_hash_table_insert (priv->id_path_hash, - GINT_TO_POINTER (entry->tag), - path); + GINT_TO_POINTER (key), + path); } } } |