Skip to content

Commit

Permalink
webp: Cleanup endian usage
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Dec 4, 2021
1 parent dd883b3 commit e260830
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions format/webp/webp.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func decodeChunk(d *decode.D, expectedChunkID string, fn func(d *decode.D)) bool
if expectedChunkID != "" && trimChunkID != expectedChunkID {
return false
}
chunkLen := int64(d.FieldU32LE("size"))
chunkLen := int64(d.FieldU32("size"))

if fn != nil {
d.LenFn(chunkLen*8, fn)
Expand All @@ -42,8 +42,10 @@ func decodeChunk(d *decode.D, expectedChunkID string, fn func(d *decode.D)) bool
}

func webpDecode(d *decode.D, in interface{}) interface{} {
d.Endian = decode.LittleEndian

d.FieldUTF8("riff_id", 4, d.AssertStr("RIFF"))
riffLength := d.FieldU32LE("riff_length")
riffLength := d.FieldU32("riff_length")
d.FieldUTF8("webp_id", 4, d.AssertStr("WEBP"))

d.LenFn(int64(riffLength-4)*8, func(d *decode.D) {
Expand Down

0 comments on commit e260830

Please sign in to comment.