From: Matt Joiner Date: Sun, 3 Dec 2017 02:44:08 +0000 (+1100) Subject: missinggo.LimitLen changed X-Git-Tag: v1.0.0~316 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=b9a1cb5b8be0bf95fdcfdbba1792bbc62e902388;p=btrtrc.git missinggo.LimitLen changed --- diff --git a/reader.go b/reader.go index 5c3bccad..bdfeed04 100644 --- a/reader.go +++ b/reader.go @@ -193,11 +193,10 @@ func (r *Reader) readOnceAt(b []byte, pos int64, ctxErr *error) (n int, err erro return } } - b1 := b[:avail] pi := int(pos / r.t.info.PieceLength) ip := r.t.info.Piece(pi) po := pos % r.t.info.PieceLength - missinggo.LimitLen(&b1, ip.Length()-po) + b1 := missinggo.LimitLen(b, ip.Length()-po, avail) n, err = r.t.readAt(b1, pos) if n != 0 { err = nil diff --git a/storage/wrappers.go b/storage/wrappers.go index b8ba050b..044a1f5a 100644 --- a/storage/wrappers.go +++ b/storage/wrappers.go @@ -45,7 +45,7 @@ func (p Piece) WriteAt(b []byte, off int64) (n int, err error) { if off+int64(len(b)) > p.mip.Length() { panic("write overflows piece") } - missinggo.LimitLen(&b, p.mip.Length()-off) + b = missinggo.LimitLen(b, p.mip.Length()-off) return p.PieceImpl.WriteAt(b, off) } @@ -58,7 +58,7 @@ func (p Piece) ReadAt(b []byte, off int64) (n int, err error) { err = io.EOF return } - missinggo.LimitLen(&b, p.mip.Length()-off) + b = missinggo.LimitLen(b, p.mip.Length()-off) if len(b) == 0 { return }