glfw: Take a byte pointer instead of a uintptr at the callback

Make 'go vet' happy on Windows.
This commit is contained in:
Hajime Hoshi 2019-06-27 22:47:00 +09:00
parent 9a0cefedce
commit 51951d6087

View File

@ -91,15 +91,14 @@ func (d *dll) unload() error {
return nil return nil
} }
func uintptrToString(ptr uintptr) string { func bytePtrToString(ptr *byte) string {
var bs []byte var bs []byte
for { for i := uintptr(0); ; i++ {
b := *(*byte)(unsafe.Pointer(ptr)) b := *(*byte)(unsafe.Pointer(uintptr(unsafe.Pointer(ptr)) + i))
if b == 0 { if b == 0 {
break break
} }
bs = append(bs, b) bs = append(bs, b)
ptr++
} }
return string(bs) return string(bs)
} }
@ -154,11 +153,11 @@ func acceptError(codes ...ErrorCode) error {
return err return err
} }
func goGLFWErrorCallback(code uintptr, desc uintptr) uintptr { func goGLFWErrorCallback(code uintptr, desc *byte) uintptr {
flushErrors() flushErrors()
err := &glfwError{ err := &glfwError{
code: ErrorCode(code), code: ErrorCode(code),
desc: uintptrToString(desc), desc: bytePtrToString(desc),
} }
select { select {
case lastErr <- err: case lastErr <- err: