Innocent rename for correctness

- Added comments for all of the "unknown" symbols that will have to be
  renamed as well. See https://github.com/dsoprea/go-exif/issues/27 .
pull/28/head
Dustin Oprea 2020-01-01 09:45:26 -05:00
parent 6c9ad5e3df
commit f63d2907c8
2 changed files with 19 additions and 1 deletions

View File

@ -15,6 +15,10 @@ const (
UnparseableUnknownTagValuePlaceholder = "!UNKNOWN"
)
// TODO(dustin): Rename "unknown" in symbol names to "undefined" in the next release.
//
// See https://github.com/dsoprea/go-exif/issues/27 .
const (
TagUnknownType_9298_UserComment_Encoding_ASCII = iota
TagUnknownType_9298_UserComment_Encoding_JIS = iota
@ -75,16 +79,22 @@ var (
}
)
// TODO(dustin): Rename `UnknownTagValue` to `UndefinedTagValue`.
type UnknownTagValue interface {
ValueBytes() ([]byte, error)
}
// TODO(dustin): Rename `TagUnknownType_GeneralString` to `TagUnknownType_GeneralString`.
type TagUnknownType_GeneralString string
func (gs TagUnknownType_GeneralString) ValueBytes() (value []byte, err error) {
return []byte(gs), nil
}
// TODO(dustin): Rename `TagUnknownType_9298_UserComment` to `TagUndefinedType_9298_UserComment`.
type TagUnknownType_9298_UserComment struct {
EncodingType int
EncodingBytes []byte
@ -116,6 +126,8 @@ func (uc TagUnknownType_9298_UserComment) ValueBytes() (value []byte, err error)
return value, nil
}
// TODO(dustin): Rename `TagUnknownType_927C_MakerNote` to `TagUndefinedType_927C_MakerNote`.
type TagUnknownType_927C_MakerNote struct {
MakerNoteType []byte
MakerNoteBytes []byte
@ -141,6 +153,8 @@ func (uc TagUnknownType_927C_MakerNote) ValueBytes() (value []byte, err error) {
return uc.MakerNoteBytes, nil
}
// TODO(dustin): Rename `TagUnknownType_9101_ComponentsConfiguration` to `TagUndefinedType_9101_ComponentsConfiguration`.
type TagUnknownType_9101_ComponentsConfiguration struct {
ConfigurationId int
ConfigurationBytes []byte
@ -154,6 +168,8 @@ func (uc TagUnknownType_9101_ComponentsConfiguration) ValueBytes() (value []byte
return uc.ConfigurationBytes, nil
}
// TODO(dustin): Rename `EncodeUnknown_9286` to `EncodeUndefined_9286`.
func EncodeUnknown_9286(uc TagUnknownType_9298_UserComment) (encoded []byte, err error) {
defer func() {
if state := recover(); state != nil {
@ -207,6 +223,8 @@ func EncodeUndefined(ifdPath string, tagId uint16, value interface{}) (ed Encode
return EncodedData{}, nil
}
// TODO(dustin): Rename `TagUnknownType_UnknownValue` to `TagUndefinedType_UnknownValue`.
type TagUnknownType_UnknownValue []byte
func (tutuv TagUnknownType_UnknownValue) String() string {
@ -309,7 +327,7 @@ func UndefinedValue(ifdPath string, tagId uint16, valueContext interface{}, byte
// TODO(dustin): Doesn't work, but here as an example.
// ie := NewIfdEnumerate(valueBytes, byteOrder)
// // TODO(dustin): !! Validate types (might have proprietary types, but it might be worth splitting the list between valid and not validate; maybe fail if a certain proportion are invalid, or maybe aren't less then a certain small integer)?
// // TODO(dustin): !! Validate types (might have proprietary types, but it might be worth splitting the list between valid and not valid; maybe fail if a certain proportion are invalid, or maybe aren't less then a certain small integer)?
// ii, err := ie.Collect(0x0)
// for _, entry := range ii.RootIfd.Entries {