1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:04:44 -07:00

debug/buildinfo: remove redundant type conversion

Change-Id: Ia8ffc9a17646ad2c74f633610aaf34fef006c023
GitHub-Last-Rev: 6ab0d10739
GitHub-Pull-Request: golang/go#54856
Reviewed-on: https://go-review.googlesource.com/c/go/+/428235
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Sasha Melentyev 2022-09-03 20:08:12 +00:00 committed by Gopher Robot
parent efa357ce3c
commit b71ca76065

View File

@ -394,13 +394,13 @@ type xcoffExe struct {
func (x *xcoffExe) ReadData(addr, size uint64) ([]byte, error) { func (x *xcoffExe) ReadData(addr, size uint64) ([]byte, error) {
for _, sect := range x.f.Sections { for _, sect := range x.f.Sections {
if uint64(sect.VirtualAddress) <= addr && addr <= uint64(sect.VirtualAddress+sect.Size-1) { if sect.VirtualAddress <= addr && addr <= sect.VirtualAddress+sect.Size-1 {
n := uint64(sect.VirtualAddress+sect.Size) - addr n := sect.VirtualAddress + sect.Size - addr
if n > size { if n > size {
n = size n = size
} }
data := make([]byte, n) data := make([]byte, n)
_, err := sect.ReadAt(data, int64(addr-uint64(sect.VirtualAddress))) _, err := sect.ReadAt(data, int64(addr-sect.VirtualAddress))
if err != nil { if err != nil {
return nil, err return nil, err
} }