void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const { if (selection) {return; } // for copying the selection, used on X11 if (OpenClipboard(NULL)) { HLOCAL clipbuffer; wchar_t *data; if (buffer) { size_t len = count_utf_16_from_8(buffer); EmptyClipboard(); clipbuffer = LocalAlloc(LMEM_FIXED, sizeof(wchar_t) * len); data = (wchar_t *)GlobalLock(clipbuffer); conv_utf_8_to_16(buffer, data, len); LocalUnlock(clipbuffer); SetClipboardData(CF_UNICODETEXT, clipbuffer); } CloseClipboard(); } else { return; } }
static wchar_t *UNUSED_FUNCTION(BLI_alloc_utf16_from_8) (char *in8, size_t add) { size_t bsize = count_utf_16_from_8(in8); wchar_t *out16 = NULL; if (!bsize) return NULL; out16 = (wchar_t *) MEM_mallocN(sizeof(wchar_t) * (bsize + add), "UTF-16 String"); conv_utf_8_to_16(in8, out16, bsize); return out16; }