mirror of https://github.com/dsoprea/go-exif.git
ifd_tag_entry.go: Renamed unexported getter to be nicer
parent
7d26e69f8d
commit
fa4e784620
|
@ -433,8 +433,8 @@ func Test_IfdByteEncoder_encodeTagToBytes_childIfd__withAllocate(t *testing.T) {
|
|||
t.Fatalf("IFD first tag type not correct: (%d)", iteV.TagType())
|
||||
} else if iteV.UnitCount() != 1 {
|
||||
t.Fatalf("IFD first tag unit-count not correct: (%d)", iteV.UnitCount())
|
||||
} else if iteV.valueOffset_() != nextIfdOffsetToWrite {
|
||||
t.Fatalf("IFD's child-IFD offset (as offset) is not correct: (%d) != (%d)", iteV.valueOffset_(), nextIfdOffsetToWrite)
|
||||
} else if iteV.getValueOffset() != nextIfdOffsetToWrite {
|
||||
t.Fatalf("IFD's child-IFD offset (as offset) is not correct: (%d) != (%d)", iteV.getValueOffset(), nextIfdOffsetToWrite)
|
||||
} else if iteV.ChildIfdPath() != exifcommon.IfdPathStandardExif {
|
||||
t.Fatalf("IFD first tag IFD-name name not correct: [%s]", iteV.ChildIfdPath())
|
||||
} else if iteV.IfdPath() != exifcommon.IfdPathStandard {
|
||||
|
|
|
@ -267,7 +267,7 @@ func (ie *IfdEnumerate) ParseIfd(fqIfdPath string, ifdIndex int, enumerator *Ifd
|
|||
if doDescend == true {
|
||||
ifdEnumerateLogger.Debugf(nil, "Descending to IFD [%s].", ite.ChildIfdPath())
|
||||
|
||||
err := ie.scan(ite.ChildFqIfdPath(), ite.valueOffset_(), visitor)
|
||||
err := ie.scan(ite.ChildFqIfdPath(), ite.getValueOffset(), visitor)
|
||||
log.PanicIf(err)
|
||||
}
|
||||
}
|
||||
|
@ -1032,7 +1032,7 @@ func (ie *IfdEnumerate) Collect(rootIfdOffset uint32) (index IfdIndex, err error
|
|||
TagId: ite.TagId(),
|
||||
|
||||
Index: 0,
|
||||
Offset: ite.valueOffset_(),
|
||||
Offset: ite.getValueOffset(),
|
||||
Parent: ifd,
|
||||
ParentTagIndex: i,
|
||||
}
|
||||
|
|
|
@ -97,9 +97,10 @@ func (ite *IfdTagEntry) updateUnitCount(unitCount uint32) {
|
|||
ite.unitCount = unitCount
|
||||
}
|
||||
|
||||
// valueOffset_ is the four-byte offset converted to an integer to point to the
|
||||
// location of its value in the EXIF block.
|
||||
func (ite *IfdTagEntry) valueOffset_() uint32 {
|
||||
// getValueOffset is the four-byte offset converted to an integer to point to
|
||||
// the location of its value in the EXIF block. The "get" parameter is obviously
|
||||
// used in order to differentiate the naming of the method from the field.
|
||||
func (ite *IfdTagEntry) getValueOffset() uint32 {
|
||||
return ite.valueOffset
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ func (Tag927CMakerNote) EncoderName() string {
|
|||
}
|
||||
|
||||
func (mn Tag927CMakerNote) String() string {
|
||||
parts := make([]string, 20)
|
||||
parts := make([]string, len(mn.MakerNoteType))
|
||||
|
||||
for i, c := range mn.MakerNoteType {
|
||||
parts[i] = fmt.Sprintf("%02x", c)
|
||||
}
|
||||
|
@ -83,8 +84,15 @@ func (Codec927CMakerNote) Decode(valueContext *exifcommon.ValueContext) (value E
|
|||
// fmt.Printf("ENTRY: 0x%02x %d\n", entry.TagId, entry.TagType)
|
||||
// }
|
||||
|
||||
var makerNoteType []byte
|
||||
if len(valueBytes) >= 20 {
|
||||
makerNoteType = valueBytes[:20]
|
||||
} else {
|
||||
makerNoteType = valueBytes
|
||||
}
|
||||
|
||||
mn := Tag927CMakerNote{
|
||||
MakerNoteType: valueBytes[:20],
|
||||
MakerNoteType: makerNoteType,
|
||||
|
||||
// MakerNoteBytes has the whole length of bytes. There's always
|
||||
// the chance that the first 20 bytes includes actual data.
|
||||
|
|
Loading…
Reference in New Issue