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