diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-12-14 19:46:55 +0000 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2010-12-14 19:46:55 +0000 |
| commit | 1f0da6516596f60822e423fe40153884f6b7e2fc (patch) | |
| tree | d3d1808aa4416f7d888f75557859bd6e442d3040 /src | |
| parent | 5889675f7db09dc14cdddc189ad93b152987da7c (diff) | |
Windows: Fixed off-by-one error when dropping Unicode text
and wrong data size value.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8028 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_dnd_win32.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fl_dnd_win32.cxx b/src/fl_dnd_win32.cxx index 5d54c933d..263058833 100644 --- a/src/fl_dnd_win32.cxx +++ b/src/fl_dnd_win32.cxx @@ -216,7 +216,7 @@ private: clearCurrentDragData(); currDragRef = data; - // fill currDrag* with ASCII data, if available + // fill currDrag* with UTF-8 data, if available FORMATETC fmt = { 0 }; STGMEDIUM medium = { 0 }; fmt.tymed = TYMED_HGLOBAL; @@ -229,12 +229,12 @@ private: void *stuff = GlobalLock( medium.hGlobal ); unsigned srclen = 0; const wchar_t *wstuff = (const wchar_t *)stuff; - while(*wstuff++) srclen++; + while (*wstuff++) srclen++; wstuff = (const wchar_t *)stuff; unsigned utf8len = fl_utf8fromwc(NULL, 0, wstuff, srclen); currDragSize = utf8len; currDragData = (char*)malloc(utf8len + 1); - fl_utf8fromwc(currDragData, currDragSize, wstuff, srclen); + fl_utf8fromwc(currDragData, currDragSize+1, wstuff, srclen+1); // include null-byte GlobalUnlock( medium.hGlobal ); ReleaseStgMedium( &medium ); currDragResult = 1; @@ -259,7 +259,7 @@ private: q += len; } *q = 0; - currDragSize = q - Fl::e_text; + currDragSize = q - currDragData; currDragData = (char*)realloc(currDragData, currDragSize + 1); GlobalUnlock( medium.hGlobal ); ReleaseStgMedium( &medium ); |
