diff --git a/internal/glfw/wgl_context_windows.go b/internal/glfw/wgl_context_windows.go index a0233b18c..5606d7d11 100644 --- a/internal/glfw/wgl_context_windows.go +++ b/internal/glfw/wgl_context_windows.go @@ -8,6 +8,7 @@ package glfw import ( "errors" "fmt" + "slices" "strings" "unsafe" @@ -331,12 +332,7 @@ func extensionSupportedWGL(extension string) bool { return false } - for _, str := range strings.Split(extensions, " ") { - if extension == str { - return true - } - } - return false + return slices.Contains(strings.Split(extensions, " "), extension) } func getProcAddressWGL(procname string) uintptr { diff --git a/internal/glfw/win32_init_windows.go b/internal/glfw/win32_init_windows.go index b33027786..a75eced45 100644 --- a/internal/glfw/win32_init_windows.go +++ b/internal/glfw/win32_init_windows.go @@ -145,7 +145,7 @@ func createKeyTables() { _glfw.platformWindow.keycodes[0x037] = KeyKPMultiply _glfw.platformWindow.keycodes[0x04A] = KeyKPSubtract - for scancode := 0; scancode < 512; scancode++ { + for scancode := range 512 { if _glfw.platformWindow.keycodes[scancode] > 0 { _glfw.platformWindow.scancodes[_glfw.platformWindow.keycodes[scancode]] = scancode } diff --git a/internal/glfw/win32_window_windows.go b/internal/glfw/win32_window_windows.go index f3c6a2072..c45ffbeb3 100644 --- a/internal/glfw/win32_window_windows.go +++ b/internal/glfw/win32_window_windows.go @@ -2366,7 +2366,7 @@ func (c *Cursor) platformCreateCursor(img *image.NRGBA, xhot, yhot int) error { // Repack into a tight RGBA buffer: createIcon expects contiguous pixels // and a non-zero image origin or non-trivial stride would confuse it. pixels := make([]byte, w*h*4) - for y := 0; y < h; y++ { + for y := range h { src := img.PixOffset(b.Min.X, b.Min.Y+y) copy(pixels[y*w*4:(y+1)*w*4], img.Pix[src:src+w*4]) }