clipboard: fix `to_wide()` in clipboard_windows.c.v (#7768)

pull/7781/head
yuyi 2021-01-01 17:07:58 +08:00 committed by GitHub
parent bf7da14ba1
commit b6136f9f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -125,7 +125,7 @@ fn (mut cb Clipboard) free() {
} }
// the string.to_wide doesn't work with SetClipboardData, don't know why // the string.to_wide doesn't work with SetClipboardData, don't know why
fn to_wide(text string) &C.HGLOBAL { fn to_wide(text string) C.HGLOBAL {
len_required := C.MultiByteToWideChar(C.CP_UTF8, C.MB_ERR_INVALID_CHARS, text.str, len_required := C.MultiByteToWideChar(C.CP_UTF8, C.MB_ERR_INVALID_CHARS, text.str,
text.len + 1, C.NULL, 0) text.len + 1, C.NULL, 0)
buf := C.GlobalAlloc(C.GMEM_MOVEABLE, i64(sizeof(u16)) * len_required) buf := C.GlobalAlloc(C.GMEM_MOVEABLE, i64(sizeof(u16)) * len_required)