* specific IFD, so exif_tag_get_name_in_ifd won't work
*/
exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData",
- "Sub-IFD entry 0x%x at %u.", tag, o);
+ "Sub-IFD entry 0x%x ('%s') at %u.", tag,
+ exif_tag_get_name(tag), o);
switch (tag) {
case EXIF_TAG_EXIF_IFD_POINTER:
CHECK_REC (EXIF_IFD_EXIF);
* When there are such duplicate entries, there must be no overlap in their
* support levels.
* The entries MUST be sorted in tag order.
- * The name and title are mandatory, but the description may be NULL.
+ * The name and title are mandatory, but the description may be an empty
+ * string. None of the entries may be NULL except the final array terminator.
*/
static const struct TagEntry {
/*! Tag ID. There may be duplicate tags when the same number is used for
first = exif_tag_table_first(tag);
if (first < 0)
return NULL;
- for (i = first; ExifTagTable[i].name; i++)
- if ((ExifTagTable[i].tag == tag) && RECORDED) break;
+
+ for (i = first; ExifTagTable[i].name; i++) {
+ if (ExifTagTable[i].tag == tag) {
+ if (RECORDED)
+ break;
+ } else
+ return NULL; /* Recorded tag not found in the table */
+ }
return ExifTagTable[i].name;
}
first = exif_tag_table_first(tag);
if (first < 0)
return NULL;
- for (i = first; ExifTagTable[i].title; i++)
- if ((ExifTagTable[i].tag == tag) && RECORDED) break;
+
+ for (i = first; ExifTagTable[i].name; i++) {
+ if (ExifTagTable[i].tag == tag) {
+ if (RECORDED)
+ break;
+ } else
+ return NULL; /* Recorded tag not found in the table */
+ }
return _(ExifTagTable[i].title);
}
first = exif_tag_table_first(tag);
if (first < 0)
return NULL;
- for (i = 0; ExifTagTable[i].description; i++)
- if ((ExifTagTable[i].tag == tag) && RECORDED) {
- /* GNU gettext acts strangely when given an empty string */
- if (!*ExifTagTable[i].description)
- return "";
- return _(ExifTagTable[i].description);
- }
- return NULL;
+
+ for (i = 0; ExifTagTable[i].name; i++) {
+ if (ExifTagTable[i].tag == tag) {
+ if (RECORDED)
+ break;
+ } else
+ return NULL; /* Recorded tag not found in the table */
+ }
+
+ /* GNU gettext acts strangely when given an empty string */
+ if (!ExifTagTable[i].description || !*ExifTagTable[i].description)
+ return "";
+ return _(ExifTagTable[i].description);
}
static const char *
exif_tag_get_stuff (ExifTag tag, get_stuff_func func)
{
+ /* Search IFDs in this order, in decreasing order of number of valid tags */
static const ExifIfd ifds[EXIF_IFD_COUNT] = {
+ EXIF_IFD_EXIF,
EXIF_IFD_0,
EXIF_IFD_1,
- EXIF_IFD_EXIF,
EXIF_IFD_INTEROPERABILITY,
EXIF_IFD_GPS
};
int first = exif_tag_table_first(tag);
if (first < 0)
return EXIF_SUPPORT_LEVEL_NOT_RECORDED;
+
for (i = first; ExifTagTable[i].name; i++) {
if (ExifTagTable[i].tag == tag) {
const ExifSupportLevel supp = ExifTagTable[i].esl[ifd][t];