diff options
author | Reinhard Tartler <siretart@tauware.de> | 2022-11-26 11:30:56 -0500 |
---|---|---|
committer | Reinhard Tartler <siretart@tauware.de> | 2022-11-26 11:30:56 -0500 |
commit | d6caca7a938130982d713b6be0ca0823f46b0b4c (patch) | |
tree | dc35be0da27e89eb9208a44aabbd24b00df629db /pkg/sif/buffer.go | |
parent | dc1634f506b369be461ff65c77b2a804e06df87f (diff) | |
parent | dab73e7c0f7576075e7f073f71cc3f32a656b161 (diff) |
Update upstream source from tag 'upstream/2.8.3'
Update to upstream version '2.8.3'
with Debian dir 7536ac56d7f18b29fd849f99100170df028e78fe
Diffstat (limited to 'pkg/sif/buffer.go')
-rw-r--r-- | pkg/sif/buffer.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/sif/buffer.go b/pkg/sif/buffer.go index d706fb1..1d73a47 100644 --- a/pkg/sif/buffer.go +++ b/pkg/sif/buffer.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Sylabs Inc. All rights reserved. +// Copyright (c) 2021-2022, Sylabs Inc. All rights reserved. // This software is licensed under a 3-clause BSD license. Please consult the // LICENSE file distributed with the sources of this project regarding your // rights to use or distribute this software. @@ -25,7 +25,7 @@ func NewBuffer(buf []byte) *Buffer { var errNegativeOffset = errors.New("negative offset") // ReadAt implements the io.ReaderAt interface. -func (b *Buffer) ReadAt(p []byte, off int64) (n int, err error) { +func (b *Buffer) ReadAt(p []byte, off int64) (int, error) { if off < 0 { return 0, errNegativeOffset } @@ -34,17 +34,17 @@ func (b *Buffer) ReadAt(p []byte, off int64) (n int, err error) { return 0, io.EOF } - n = copy(p, b.buf[off:]) + n := copy(p, b.buf[off:]) if n < len(p) { - err = io.EOF + return n, io.EOF } - return n, err + return n, nil } var errNegativePosition = errors.New("negative position") // Write implements the io.Writer interface. -func (b *Buffer) Write(p []byte) (n int, err error) { +func (b *Buffer) Write(p []byte) (int, error) { if b.pos < 0 { return 0, errNegativePosition } @@ -53,7 +53,7 @@ func (b *Buffer) Write(p []byte) (n int, err error) { b.buf = append(b.buf, make([]byte, need-have)...) } - n = copy(b.buf[b.pos:], p) + n := copy(b.buf[b.pos:], p) b.pos += int64(n) return n, nil } |