ifd_builder.go: Fix (*IfdBuilder).printTagTree() printing of child IFDs

This commit is contained in:
Dustin Oprea 2019-12-29 20:56:35 -05:00
parent a4b93837a7
commit e5cdeb0aa4

View File

@ -68,6 +68,8 @@ func (ibtv IfdBuilderTagValue) IsBytes() bool {
func (ibtv IfdBuilderTagValue) Bytes() []byte { func (ibtv IfdBuilderTagValue) Bytes() []byte {
if ibtv.IsBytes() == false { if ibtv.IsBytes() == false {
log.Panicf("this tag is not a byte-slice value") log.Panicf("this tag is not a byte-slice value")
} else if ibtv.IsIb() == true {
log.Panicf("this tag is an IFD-builder value not a byte-slice")
} }
return ibtv.valueBytes return ibtv.valueBytes
@ -80,6 +82,8 @@ func (ibtv IfdBuilderTagValue) IsIb() bool {
func (ibtv IfdBuilderTagValue) Ib() *IfdBuilder { func (ibtv IfdBuilderTagValue) Ib() *IfdBuilder {
if ibtv.IsIb() == false { if ibtv.IsIb() == false {
log.Panicf("this tag is not an IFD-builder value") log.Panicf("this tag is not an IFD-builder value")
} else if ibtv.IsBytes() == true {
log.Panicf("this tag is a byte-slice, not a IFD-builder")
} }
return ibtv.ib return ibtv.ib
@ -602,7 +606,13 @@ func (ib *IfdBuilder) printTagTree(levels int) {
} }
} }
value := tag.Value()
if value.IsIb() == true {
fmt.Printf("%s (%d): [%s] %s\n", indent, i, tagName, value.Ib())
} else {
fmt.Printf("%s (%d): [%s] %s\n", indent, i, tagName, tag) fmt.Printf("%s (%d): [%s] %s\n", indent, i, tagName, tag)
}
if isChildIb == true { if isChildIb == true {
if tag.value.IsIb() == false { if tag.value.IsIb() == false {