From: Jan P. <pa...@pi...> - 2006-09-06 14:56:56
|
Jef, I inspected http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Canon.html#FocalLength and here is what I have found out: 1) MNOTE_CANON_TAG_FOCAL_LENGTH data is expected to be of the EXIF_FORMAT_SHORT format and to have 4 items 2) the 1st value is FocalType, and not size of any kind. Thus the correct sanity checks & code are: CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen); CC (entry->components, 4, val, maxlen); if (t >= 4) return NULL; vs = exif_get_short (entry->data + t * 2, entry->order); Kind regards, Jan Patera > Marcus Meissner wrote: >> On Wed, Sep 06, 2006 at 03:39:30PM +0200, Jef Driesen wrote: >>> Jan Patera wrote: >>>>> case MNOTE_CANON_TAG_FOCAL_LENGTH: >>>>> CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen); >>>>> n = exif_get_short (data, entry->order) / 2; >>>>> if (t >= n) return NULL; >>>>> CC (entry->components, n, val, maxlen); >>>>> vs = exif_get_short (entry->data + 2 + t * 2, entry->order); >>>>> snprintf (buf, sizeof (buf), "0x%04x", vs); >>>>> strncpy (val, buf, maxlen - strlen (val)); >>>>> break; >>>>> >>>>> But when I run the exif commandline utility, an error is reported >>>>> for the new tag: >>>>> >>>>> Focal type |Invalid number of components (4, expected 1). >>>>> >>>>> What am I doing wrong here? >>>> >>>> this message is printed by the CC macro. It checks whether >>>> 1st & 2nd arguments are equal. apparently entry->components is 4, >>>> but n is only 1. >>> I knew it was reported by the CC macro, but I don't understand why it >>> is happening. It is exactly the same code as is used for >>> MNOTE_CANON_TAG_SETTINGS_1 (which also has multiple components), but >>> no error there! Probably I forgot to add some code somewhere else, >>> but I don't see it. >> >> Just a wild guess: >> Did you adjust mnote_canon_entry_count_values() too? > > I added an extra 'case MNOTE_CANON_TAG_FOCAL_LENGTH:' between the > others. |