backwards incompatible: Stop exporting ParseOneIfd and ParseOneTag

dustin/master
Dustin Oprea 2020-07-11 11:23:39 -04:00
parent ee26db1fc4
commit 83b844408c
3 changed files with 7 additions and 14 deletions

View File

@ -73,9 +73,6 @@ func DumpBytesClauseToString(data []byte) string {
// ExifFullTimestampString produces a string like "2018:11:30 13:01:49" from a // ExifFullTimestampString produces a string like "2018:11:30 13:01:49" from a
// `time.Time` struct. It will attempt to convert to UTC first. // `time.Time` struct. It will attempt to convert to UTC first.
func ExifFullTimestampString(t time.Time) (fullTimestampPhrase string) { 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() t = t.UTC()
return fmt.Sprintf("%04d:%02d:%02d %02d:%02d:%02d", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second()) return fmt.Sprintf("%04d:%02d:%02d %02d:%02d:%02d", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())

View File

@ -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)) 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) log.PanicIf(err)
if iteV.TagId() != exifcommon.IfdExifStandardIfdIdentity.TagId() { 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. // 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) log.PanicIf(err)
if childNextIfdOffset != uint32(0) { 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.") 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) log.PanicIf(err)
if ite.TagId() != 0x000b { if ite.TagId() != 0x000b {

View File

@ -1379,12 +1379,12 @@ func (ie *IfdEnumerate) FurthestOffset() uint32 {
return ie.furthestOffset 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 // 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 // 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 // the proper number (if its actually a sibling to the first child, for
// instance). // 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() { defer func() {
if state := recover(); state != nil { if state := recover(); state != nil {
err = log.Wrap(state.(error)) err = log.Wrap(state.(error))
@ -1393,8 +1393,6 @@ func ParseOneIfd(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exif
// TODO(dustin): Add test // TODO(dustin): Add test
// RELEASE(dustin): Stop exporting this. Just supports tests.
ebs := NewExifReadSeekerWithBytes(ifdBlock) ebs := NewExifReadSeekerWithBytes(ifdBlock)
rs, err := ebs.GetReadSeeker(0) rs, err := ebs.GetReadSeeker(0)
@ -1418,8 +1416,8 @@ func ParseOneIfd(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exif
return nextIfdOffset, entries, nil return nextIfdOffset, entries, nil
} }
// ParseOneTag is a hack to use an IE to parse a raw tag block. // 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) { func parseOneTag(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exifcommon.IfdIdentity, byteOrder binary.ByteOrder, tagBlock []byte) (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))
@ -1428,8 +1426,6 @@ func ParseOneTag(ifdMapping *exifcommon.IfdMapping, tagIndex *TagIndex, ii *exif
// TODO(dustin): Add test // TODO(dustin): Add test
// RELEASE(dustin): Stop exporting this. Just supports tests.
ebs := NewExifReadSeekerWithBytes(tagBlock) ebs := NewExifReadSeekerWithBytes(tagBlock)
rs, err := ebs.GetReadSeeker(0) rs, err := ebs.GetReadSeeker(0)