Removed all the pointers
This commit is contained in:
+16
-2
@@ -4,6 +4,7 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"io"
|
||||
"io/fs"
|
||||
"math"
|
||||
"runtime"
|
||||
"sync"
|
||||
@@ -23,10 +24,11 @@ type FullReader struct {
|
||||
finalBlockSize uint64
|
||||
blockSize uint32
|
||||
goroutineLimit uint16
|
||||
closed bool
|
||||
}
|
||||
|
||||
func NewFullReader(r io.ReaderAt, initialOffset int64, d decompress.Decompressor, sizes []uint32, finalBlockSize uint64, blockSize uint32) *FullReader {
|
||||
return &FullReader{
|
||||
func NewFullReader(r io.ReaderAt, initialOffset int64, d decompress.Decompressor, sizes []uint32, finalBlockSize uint64, blockSize uint32) FullReader {
|
||||
return FullReader{
|
||||
r: r,
|
||||
d: d,
|
||||
sizes: sizes,
|
||||
@@ -37,6 +39,15 @@ func NewFullReader(r io.ReaderAt, initialOffset int64, d decompress.Decompressor
|
||||
}
|
||||
}
|
||||
|
||||
func (r *FullReader) Close() error {
|
||||
r.closed = true
|
||||
r.r = nil
|
||||
r.d = nil
|
||||
r.frag = nil
|
||||
r.sizes = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *FullReader) AddFrag(frag FragReaderConstructor) {
|
||||
r.frag = frag
|
||||
}
|
||||
@@ -77,6 +88,9 @@ func (r FullReader) process(index uint64, fileOffset uint64, pool *sync.Pool, re
|
||||
}
|
||||
|
||||
func (r FullReader) WriteTo(w io.Writer) (int64, error) {
|
||||
if r.closed {
|
||||
return 0, fs.ErrClosed
|
||||
}
|
||||
// if wa, is := w.(io.WriterAt); is {
|
||||
// return r.writeToWriteAt(wa)
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user