Browse Source

use bytes.Equal() instead, Thanks for Thomas' suggestion

pull/2/head
Chris Lu 12 years ago
parent
commit
1165632fa0
  1. 9
      go/storage/volume.go

9
go/storage/volume.go

@ -1,6 +1,7 @@
package storage
import (
"bytes"
"errors"
"fmt"
"io"
@ -166,13 +167,7 @@ func (v *Volume) isFileUnchanged(n *Needle) bool {
}
oldNeedle := new(Needle)
oldNeedle.Read(v.dataFile, nv.Size, v.Version())
if len(oldNeedle.Data) == len(n.Data) && oldNeedle.Checksum == n.Checksum {
length := len(n.Data)
for i := 0; i < length; i++ {
if n.Data[i] != oldNeedle.Data[i] {
return false
}
}
if oldNeedle.Checksum == n.Checksum && bytes.Equal(oldNeedle.Data, n.Data) {
n.Size = oldNeedle.Size
return true
}

Loading…
Cancel
Save