From 406a80da4b87d4e984696030d8a8e5c962c1ad4b Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 8 Sep 2022 18:54:16 -0700 Subject: [PATCH] adjust variable names --- weed/storage/volume_read.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/weed/storage/volume_read.go b/weed/storage/volume_read.go index d4f6a55d6..d072e0ac9 100644 --- a/weed/storage/volume_read.go +++ b/weed/storage/volume_read.go @@ -134,12 +134,9 @@ func (v *Volume) readNeedleDataInto(n *needle.Needle, readOption *ReadOption, wr // read needle data crc := needle.CRC(0) - r := v.DataBackend - volumeOffset := actualOffset - needleOffset := offset - for x := needleOffset; x < needleOffset+size; x += int64(len(buf)) { - count, err := n.ReadNeedleData(r, volumeOffset, buf, x) - toWrite := min(count, int(needleOffset+size-x)) + for x := offset; x < offset+size; x += int64(len(buf)) { + count, err := n.ReadNeedleData(v.DataBackend, actualOffset, buf, x) + toWrite := min(count, int(offset+size-x)) if toWrite > 0 { crc = crc.Update(buf[0:toWrite]) if _, err = writer.Write(buf[0:toWrite]); err != nil { @@ -157,7 +154,7 @@ func (v *Volume) readNeedleDataInto(n *needle.Needle, readOption *ReadOption, wr break } } - if needleOffset == 0 && size == int64(n.DataSize) && (n.Checksum != crc && uint32(n.Checksum) != crc.Value()) { + if offset == 0 && size == int64(n.DataSize) && (n.Checksum != crc && uint32(n.Checksum) != crc.Value()) { // the crc.Value() function is to be deprecated. this double checking is for backward compatible. return fmt.Errorf("ReadNeedleData checksum %v expected %v", crc, n.Checksum) }