summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Fl_win32.cxx2
-rw-r--r--src/fl_dnd_win32.cxx3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 539e271ee..e8a09d2d0 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -559,7 +559,7 @@ void Fl::copy(const char *stuff, int len, int clipboard) {
EmptyClipboard();
HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc.
LPVOID memLock = GlobalLock(hMem);
- fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len * 2);
+ fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len + 1);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
diff --git a/src/fl_dnd_win32.cxx b/src/fl_dnd_win32.cxx
index 2deadd37d..7673af165 100644
--- a/src/fl_dnd_win32.cxx
+++ b/src/fl_dnd_win32.cxx
@@ -425,8 +425,7 @@ public:
int utf16_len = fl_utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], 0, 0);
HGLOBAL gh = GlobalAlloc( GHND, utf16_len * 2 + 2 );
char *pMem = (char*)GlobalLock( gh );
- fl_utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], (unsigned short*)pMem, utf16_len * 2);
- pMem[ 2*utf16_len ] = 0;
+ fl_utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], (unsigned short*)pMem, utf16_len + 1);
// HGLOBAL gh = GlobalAlloc( GHND| GMEM_SHARE,
// (fl_selection_length[0]+4) * sizeof(short)
// + sizeof(DROPFILES));