clipboard: wrap pointer indexing in unsafe block (#6178)
parent
d8d707b4fe
commit
6eea13ecc2
|
@ -133,7 +133,9 @@ fn to_wide(text string) &C.HGLOBAL {
|
|||
if buf != C.HGLOBAL(C.NULL) {
|
||||
mut locked := &u16(C.GlobalLock(buf))
|
||||
C.MultiByteToWideChar(C.CP_UTF8, C.MB_ERR_INVALID_CHARS, text.str, text.len + 1, locked, len_required)
|
||||
unsafe {
|
||||
locked[len_required - 1] = u16(0)
|
||||
}
|
||||
C.GlobalUnlock(buf)
|
||||
}
|
||||
return buf
|
||||
|
|
Loading…
Reference in New Issue