clipboard: fix unsafe warning on windows (affects v-ui)

pull/8771/head
Delyan Angelov 2021-02-15 20:09:02 +02:00
parent c057b45bb1
commit 230372df09
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 2 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import time
#include <windows.h> #include <windows.h>
#flag -lUser32 #flag -lUser32
struct WndClassEx { struct WndClassEx {
cb_size u32 cb_size u32
style u32 style u32
@ -173,7 +174,7 @@ fn (mut cb Clipboard) get_text() string {
C.CloseClipboard() C.CloseClipboard()
return '' return ''
} }
str := string_from_wide(&u16(C.GlobalLock(h_data))) str := unsafe { string_from_wide(&u16(C.GlobalLock(h_data))) }
C.GlobalUnlock(h_data) C.GlobalUnlock(h_data)
return str return str
} }