From d19e38a7236c421f436c496041aaf872c8b4cc24 Mon Sep 17 00:00:00 2001 From: Dustin Oprea Date: Sat, 11 Jul 2020 13:10:57 -0400 Subject: [PATCH] backwards incompatible: ifd_enumerate.go: Drop fqIfdPath and ifdIndex from visitor function signature --- v3/exif_test.go | 2 +- v3/ifd_enumerate.go | 6 ++---- v3/utility.go | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/v3/exif_test.go b/v3/exif_test.go index aca39a9..f251d6a 100644 --- a/v3/exif_test.go +++ b/v3/exif_test.go @@ -67,7 +67,7 @@ func TestVisit(t *testing.T) { tags := make([]string, 0) // 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() { if state := recover(); state != nil { err = log.Wrap(state.(error)) diff --git a/v3/ifd_enumerate.go b/v3/ifd_enumerate.go index 6960faf..79a58af 100644 --- a/v3/ifd_enumerate.go +++ b/v3/ifd_enumerate.go @@ -270,10 +270,8 @@ func (ie *IfdEnumerate) parseTag(ii *exifcommon.IfdIdentity, tagPosition int, bp 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. -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. 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() if visitor != nil { - err := visitor(ii.String(), ii.Index(), ite) + err := visitor(ite) log.PanicIf(err) } diff --git a/v3/utility.go b/v3/utility.go index 78c0cfd..ded4353 100644 --- a/v3/utility.go +++ b/v3/utility.go @@ -89,7 +89,7 @@ func GetFlatExifData(exifData []byte, so *ScanOptions) (exifTags []ExifTag, med 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 // expect to ever decode the output, we are not worried about // 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{ - IfdPath: fqIfdPath, + IfdPath: ite.IfdPath(), TagId: ite.TagId(), TagName: ite.TagName(), UnitCount: ite.UnitCount(),