Merge pull request #11 from korylprince/fix-int32-parse

use int32 instead of int when parsing
This commit is contained in:
Fabian Weber 2020-07-27 23:31:08 +02:00 committed by GitHub
commit 95fd773625
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -351,8 +351,8 @@ type Attribute struct {
// Resolution defines the resolution attribute // Resolution defines the resolution attribute
type Resolution struct { type Resolution struct {
Height int Height int32
Width int Width int32
Depth int8 Depth int8
} }
@ -480,7 +480,7 @@ func (d *AttributeDecoder) decodeDate() ([]int, error) {
return is, nil return is, nil
} }
func (d *AttributeDecoder) decodeRange() ([]int, error) { func (d *AttributeDecoder) decodeRange() ([]int32, error) {
length, err := d.readValueLength() length, err := d.readValueLength()
if err != nil { if err != nil {
return nil, err return nil, err
@ -488,10 +488,10 @@ func (d *AttributeDecoder) decodeRange() ([]int, error) {
// initialize range element count (c) and range slice (r) // initialize range element count (c) and range slice (r)
c := length / 4 c := length / 4
r := make([]int, c) r := make([]int32, c)
for i := int16(0); i < c; i++ { for i := int16(0); i < c; i++ {
var ti int var ti int32
if err = binary.Read(d.reader, binary.BigEndian, &ti); err != nil { if err = binary.Read(d.reader, binary.BigEndian, &ti); err != nil {
return nil, err return nil, err
} }