mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
glfw: Take a byte pointer instead of a uintptr at the callback
Make 'go vet' happy on Windows.
This commit is contained in:
parent
9a0cefedce
commit
51951d6087
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user