Commit 5e805aff authored by Alex Brainman's avatar Alex Brainman

syscall: fix handling of bool return values in mksyscall_windows.go

LGTM=chines
R=chines
CC=golang-codereviews
https://golang.org/cl/118160044
parent 43ad89d6
...@@ -283,9 +283,12 @@ func (r *Rets) SetErrorCode() string { ...@@ -283,9 +283,12 @@ func (r *Rets) SetErrorCode() string {
return fmt.Sprintf(code, r.Name, syscalldot()) return fmt.Sprintf(code, r.Name, syscalldot())
} }
s := "" s := ""
if r.Type[0] == '*' { switch {
case r.Type[0] == '*':
s = fmt.Sprintf("%s = (%s)(unsafe.Pointer(r0))", r.Name, r.Type) s = fmt.Sprintf("%s = (%s)(unsafe.Pointer(r0))", r.Name, r.Type)
} else { case r.Type == "bool":
s = fmt.Sprintf("%s = r0 != 0", r.Name)
default:
s = fmt.Sprintf("%s = %s(r0)", r.Name, r.Type) s = fmt.Sprintf("%s = %s(r0)", r.Name, r.Type)
} }
if !r.ReturnsError { if !r.ReturnsError {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment