backwards incompatible: ifd_enumerate.go: Drop fqIfdPath and ifdIndex from visitor function signature

dustin/master
Dustin Oprea 2020-07-11 13:10:57 -04:00
parent f2c3d1c0ec
commit d19e38a723
3 changed files with 5 additions and 7 deletions

View File

@ -67,7 +67,7 @@ func TestVisit(t *testing.T) {
tags := make([]string, 0) tags := make([]string, 0)
// DEPRECATED(dustin): fqIfdPath and ifdIndex are now redundant. Remove in next module version. // DEPRECATED(dustin): fqIfdPath and ifdIndex are now redundant. Remove in next module version.
visitor := func(fqIfdPath string, ifdIndex int, ite *IfdTagEntry) (err error) { visitor := func(ite *IfdTagEntry) (err error) {
defer func() { defer func() {
if state := recover(); state != nil { if state := recover(); state != nil {
err = log.Wrap(state.(error)) err = log.Wrap(state.(error))

View File

@ -270,10 +270,8 @@ func (ie *IfdEnumerate) parseTag(ii *exifcommon.IfdIdentity, tagPosition int, bp
return ite, nil return ite, nil
} }
// RELEASE(dustin): Drop fqIfdPath and ifdIndex arguments to visitor callback. They're both accessible on the IfdTagEntry struct.
// TagVisitorFn is called for each tag when enumerating through the EXIF. // TagVisitorFn is called for each tag when enumerating through the EXIF.
type TagVisitorFn func(fqIfdPath string, ifdIndex int, ite *IfdTagEntry) (err error) type TagVisitorFn func(ite *IfdTagEntry) (err error)
// tagPostParse do some tag-level processing here following the parse of each. // tagPostParse do some tag-level processing here following the parse of each.
func (ie *IfdEnumerate) tagPostParse(ite *IfdTagEntry, med *MiscellaneousExifData) (err error) { func (ie *IfdEnumerate) tagPostParse(ite *IfdTagEntry, med *MiscellaneousExifData) (err error) {
@ -422,7 +420,7 @@ func (ie *IfdEnumerate) parseIfd(ii *exifcommon.IfdIdentity, bp *byteParser, vis
tagId := ite.TagId() tagId := ite.TagId()
if visitor != nil { if visitor != nil {
err := visitor(ii.String(), ii.Index(), ite) err := visitor(ite)
log.PanicIf(err) log.PanicIf(err)
} }

View File

@ -89,7 +89,7 @@ func GetFlatExifData(exifData []byte, so *ScanOptions) (exifTags []ExifTag, med
exifTags = make([]ExifTag, 0) exifTags = make([]ExifTag, 0)
visitor := func(fqIfdPath string, ifdIndex int, ite *IfdTagEntry) (err error) { visitor := func(ite *IfdTagEntry) (err error) {
// This encodes down to base64. Since this an example tool and we do not // This encodes down to base64. Since this an example tool and we do not
// expect to ever decode the output, we are not worried about // expect to ever decode the output, we are not worried about
// specifically base64-encoding it in order to have a measure of // specifically base64-encoding it in order to have a measure of
@ -113,7 +113,7 @@ func GetFlatExifData(exifData []byte, so *ScanOptions) (exifTags []ExifTag, med
} }
et := ExifTag{ et := ExifTag{
IfdPath: fqIfdPath, IfdPath: ite.IfdPath(),
TagId: ite.TagId(), TagId: ite.TagId(),
TagName: ite.TagName(), TagName: ite.TagName(),
UnitCount: ite.UnitCount(), UnitCount: ite.UnitCount(),