From 604f14d2d4c52771bc775ae7cb5670e9099ecbf6 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 25 May 2022 02:21:30 +0900 Subject: [PATCH] internal/glfwwin: refactoring: reduce risky unsafe.Pointer usages --- internal/glfwwin/win32monitor_windows.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/glfwwin/win32monitor_windows.go b/internal/glfwwin/win32monitor_windows.go index 78cbd101a..c49e7b275 100644 --- a/internal/glfwwin/win32monitor_windows.go +++ b/internal/glfwwin/win32monitor_windows.go @@ -30,9 +30,8 @@ import ( "golang.org/x/sys/windows" ) -func monitorCallback(handle _HMONITOR, dc _HDC, rect *_RECT, data _LPARAM) uintptr /* _BOOL */ { +func monitorCallback(handle _HMONITOR, dc _HDC, rect *_RECT, monitor *Monitor /* _LPARAM */) uintptr /* _BOOL */ { if mi, ok := _GetMonitorInfoW_Ex(handle); ok { - monitor := (*Monitor)(unsafe.Pointer(data)) if windows.UTF16ToString(mi.szDevice[:]) == monitor.win32.adapterName { monitor.win32.handle = handle }