From 83b844408cc8f16bddd721fd83b6f4fbc5523e7c Mon Sep 17 00:00:00 2001 From: Dustin Oprea Date: Sat, 11 Jul 2020 11:23:39 -0400 Subject: [PATCH] backwards incompatible: Stop exporting ParseOneIfd and ParseOneTag --- v3/common/utility.go | 3 --- v3/ifd_builder_encode_test.go | 6 +++--- v3/ifd_enumerate.go | 12 ++++-------- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/v3/common/utility.go b/v3/common/utility.go index 35e4712..65165bf 100644 --- a/v3/common/utility.go +++ b/v3/common/utility.go @@ -73,9 +73,6 @@ func DumpBytesClauseToString(data []byte) string { // ExifFullTimestampString produces a string like "2018:11:30 13:01:49" from a // `time.Time` struct. It will attempt to convert to UTC first. func ExifFullTimestampString(t time.Time) (fullTimestampPhrase string) { - - // RELEASE(dustin): Dump this for the next release. It duplicates the same function now in exifcommon. - t = t.UTC() return fmt.Sprintf("%04d:%02d:%02d %02d:%02d:%02d", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()) diff --git a/v3/ifd_builder_encode_test.go b/v3/ifd_builder_encode_test.go index 5711e22..907dbfc 100644 --- a/v3/ifd_builder_encode_test.go +++ b/v3/ifd_builder_encode_test.go @@ -412,7 +412,7 @@ func Test_IfdByteEncoder_encodeTagToBytes_childIfd__withAllocate(t *testing.T) { t.Fatalf("Child IFD is not the right size: (%d)", len(childIfdBlock)) } - iteV, err := ParseOneTag(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder, tagBytes) + iteV, err := parseOneTag(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder, tagBytes) log.PanicIf(err) if iteV.TagId() != exifcommon.IfdExifStandardIfdIdentity.TagId() { @@ -433,7 +433,7 @@ func Test_IfdByteEncoder_encodeTagToBytes_childIfd__withAllocate(t *testing.T) { // Validate the child's raw IFD bytes. - childNextIfdOffset, childEntries, err := ParseOneIfd(im, ti, exifcommon.IfdExifStandardIfdIdentity, exifcommon.TestDefaultByteOrder, childIfdBlock, nil) + childNextIfdOffset, childEntries, err := parseOneIfd(im, ti, exifcommon.IfdExifStandardIfdIdentity, exifcommon.TestDefaultByteOrder, childIfdBlock, nil) log.PanicIf(err) if childNextIfdOffset != uint32(0) { @@ -513,7 +513,7 @@ func Test_IfdByteEncoder_encodeTagToBytes_simpleTag_allocate(t *testing.T) { t.Fatalf("Child IFD not have been allocated.") } - ite, err := ParseOneTag(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder, tagBytes) + ite, err := parseOneTag(im, ti, exifcommon.IfdStandardIfdIdentity, exifcommon.TestDefaultByteOrder, tagBytes) log.PanicIf(err) if ite.TagId() != 0x000b { diff --git a/v3/ifd_enumerate.go b/v3/ifd_enumerate.go index 4d07b8a..6097543 100644 --- a/v3/ifd_enumerate.go +++ b/v3/ifd_enumerate.go @@ -1379,12 +1379,12 @@ func (ie *IfdEnumerate) FurthestOffset() uint32 { return ie.furthestOffset } -// ParseOneIfd is a hack to use an IE to parse a raw IFD block. Can be used for +// parseOneIfd is a hack to use an IE to parse a raw IFD block. Can be used for // testing. The fqIfdPath ("fully-qualified IFD path") will be less qualified // in that the numeric index will always be zero (the zeroth child) rather than // the proper number (if its actually a sibling to the first child, for // instance). -func ParseOneIfd(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exifcommon.IfdIdentity, byteOrder binary.ByteOrder, ifdBlock []byte, visitor TagVisitorFn) (nextIfdOffset uint32, entries []*IfdTagEntry, err error) { +func parseOneIfd(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exifcommon.IfdIdentity, byteOrder binary.ByteOrder, ifdBlock []byte, visitor TagVisitorFn) (nextIfdOffset uint32, entries []*IfdTagEntry, err error) { defer func() { if state := recover(); state != nil { err = log.Wrap(state.(error)) @@ -1393,8 +1393,6 @@ func ParseOneIfd(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exif // TODO(dustin): Add test - // RELEASE(dustin): Stop exporting this. Just supports tests. - ebs := NewExifReadSeekerWithBytes(ifdBlock) rs, err := ebs.GetReadSeeker(0) @@ -1418,8 +1416,8 @@ func ParseOneIfd(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exif return nextIfdOffset, entries, nil } -// ParseOneTag is a hack to use an IE to parse a raw tag block. -func ParseOneTag(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exifcommon.IfdIdentity, byteOrder binary.ByteOrder, tagBlock []byte) (ite *IfdTagEntry, err error) { +// parseOneTag is a hack to use an IE to parse a raw tag block. +func parseOneTag(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exifcommon.IfdIdentity, byteOrder binary.ByteOrder, tagBlock []byte) (ite *IfdTagEntry, err error) { defer func() { if state := recover(); state != nil { err = log.Wrap(state.(error)) @@ -1428,8 +1426,6 @@ func ParseOneTag(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exif // TODO(dustin): Add test - // RELEASE(dustin): Stop exporting this. Just supports tests. - ebs := NewExifReadSeekerWithBytes(tagBlock) rs, err := ebs.GetReadSeeker(0)