1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:00:25 -07:00

debug/pe: use appropriate type for sizeofOptionalHeader32

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/157220043
This commit is contained in:
Alex Brainman 2014-10-21 10:02:33 +11:00
parent 3ec8fe45cf
commit e5383c6854

View File

@ -125,8 +125,8 @@ func (f *File) Close() error {
}
var (
sizeofOptionalHeader32 = uintptr(binary.Size(OptionalHeader32{}))
sizeofOptionalHeader64 = uintptr(binary.Size(OptionalHeader64{}))
sizeofOptionalHeader32 = uint16(binary.Size(OptionalHeader32{}))
sizeofOptionalHeader64 = uint16(binary.Size(OptionalHeader64{}))
)
// NewFile creates a new File for accessing a PE binary in an underlying reader.
@ -209,7 +209,7 @@ func NewFile(r io.ReaderAt) (*File, error) {
}
var oh32 OptionalHeader32
var oh64 OptionalHeader64
switch uintptr(f.FileHeader.SizeOfOptionalHeader) {
switch f.FileHeader.SizeOfOptionalHeader {
case sizeofOptionalHeader32:
if err := binary.Read(sr, binary.LittleEndian, &oh32); err != nil {
return nil, err