mirror of https://github.com/golang/go.git
image/png: remove too early declaration of "n"
Before this commit, the code declares and assigns "n" with the result of io.ReadFull() -- but the value is not used. The variable is then reused later in the function. This commit removes the first declaration of "n" and declares it closer to where it is used. Change-Id: I7ffe19a10f2a563c306bb6fe6562493435b9dc5a Reviewed-on: https://go-review.googlesource.com/c/go/+/232917 Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
7cfa7d6925
commit
c844fec7f6
|
|
@ -862,8 +862,7 @@ func (d *decoder) parseIEND(length uint32) error {
|
|||
|
||||
func (d *decoder) parseChunk() error {
|
||||
// Read the length and chunk type.
|
||||
n, err := io.ReadFull(d.r, d.tmp[:8])
|
||||
if err != nil {
|
||||
if _, err := io.ReadFull(d.r, d.tmp[:8]); err != nil {
|
||||
return err
|
||||
}
|
||||
length := binary.BigEndian.Uint32(d.tmp[:4])
|
||||
|
|
@ -920,7 +919,7 @@ func (d *decoder) parseChunk() error {
|
|||
// Ignore this chunk (of a known length).
|
||||
var ignored [4096]byte
|
||||
for length > 0 {
|
||||
n, err = io.ReadFull(d.r, ignored[:min(len(ignored), int(length))])
|
||||
n, err := io.ReadFull(d.r, ignored[:min(len(ignored), int(length))])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue