Skip to content

Commit b3f9b82

Browse files
fxriraveit65
authored andcommitted
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
1 parent a3a89e0 commit b3f9b82

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎src/eom-exif-details.c‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,13 +451,22 @@ exif_entry_cb (ExifEntry *entry, gpointer data)
451451
ExifIfd ifd = exif_entry_get_ifd (entry);
452452
char *path;
453453
char b[1024];
454+
const gint key = ifd << 16 | entry->tag;
455+
456+
/* This should optimize away if comparision is correct */
457+
g_warn_if_fail (EXIF_IFD_COUNT <= G_MAXUINT16);
454458

455459
view = EOM_EXIF_DETAILS (data);
456460
priv = view->priv;
457461

458462
store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
459463

460-
path = g_hash_table_lookup (priv->id_path_hash, GINT_TO_POINTER (entry->tag));
464+
/* Take the tag's IFD into account when caching their GtkTreePaths.
465+
* That should fix key collisions for tags that have the same number
466+
* but are stored in different IFDs. Exif tag numbers are 16-bit
467+
* values so we should be able to set the high word to the IFD number.
468+
*/
469+
path = g_hash_table_lookup (priv->id_path_hash, GINT_TO_POINTER (key));
461470

462471
if (path != NULL) {
463472
set_row_data (store,
@@ -500,8 +509,8 @@ exif_entry_cb (ExifEntry *entry, gpointer data)
500509
sizeof(b)));
501510

502511
g_hash_table_insert (priv->id_path_hash,
503-
GINT_TO_POINTER (entry->tag),
504-
path);
512+
GINT_TO_POINTER (key),
513+
path);
505514
}
506515
}
507516
}

0 commit comments

Comments
 (0)