allocate 2 bytes for 16bit clipboard null terminator
This commit is contained in:
parent
2f39fb2807
commit
bf835cbeb7
@ -522,13 +522,13 @@ void PLT_MessageBox(PLT_MessageBoxKind kind, String message)
|
|||||||
|
|
||||||
void PLT_SetClipboardText(String str)
|
void PLT_SetClipboardText(String str)
|
||||||
{
|
{
|
||||||
|
TempArena scratch = BeginScratchNoConflict();
|
||||||
if (OpenClipboard(0))
|
if (OpenClipboard(0))
|
||||||
{
|
{
|
||||||
TempArena scratch = BeginScratchNoConflict();
|
|
||||||
String16 str16 = String16FromString(scratch.arena, str);
|
String16 str16 = String16FromString(scratch.arena, str);
|
||||||
u64 str16_size_bytes = str16.len * 2;
|
u64 str16_size_bytes = str16.len * 2;
|
||||||
EmptyClipboard();
|
EmptyClipboard();
|
||||||
HANDLE handle = GlobalAlloc(GMEM_MOVEABLE, str16_size_bytes + 1);
|
HANDLE handle = GlobalAlloc(GMEM_MOVEABLE, str16_size_bytes + 2);
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
u16 *dest_wstr = (u16 *)GlobalLock(handle);
|
u16 *dest_wstr = (u16 *)GlobalLock(handle);
|
||||||
@ -538,8 +538,8 @@ void PLT_SetClipboardText(String str)
|
|||||||
SetClipboardData(CF_UNICODETEXT, handle);
|
SetClipboardData(CF_UNICODETEXT, handle);
|
||||||
}
|
}
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
EndScratch(scratch);
|
|
||||||
}
|
}
|
||||||
|
EndScratch(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
String PLT_GetClipboardText(Arena *arena)
|
String PLT_GetClipboardText(Arena *arena)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user