Author: AlbrechtS
Date: 2010-12-14 11:46:55 -0800 (Tue, 14 Dec 2010)
New Revision: 8028
Log:
Windows: Fixed off-by-one error when dropping Unicode text
and wrong data size value.
Modified:
branches/branch-1.3/src/fl_dnd_win32.cxx
Modified: branches/branch-1.3/src/fl_dnd_win32.cxx
===================================================================
--- branches/branch-1.3/src/fl_dnd_win32.cxx 2010-12-14 17:07:45 UTC (rev
8027)
+++ branches/branch-1.3/src/fl_dnd_win32.cxx 2010-12-14 19:46:55 UTC (rev
8028)
@@ -216,7 +216,7 @@
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 @@
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 @@
q += len;
}
*q = 0;
- currDragSize = q - Fl::e_text;
+ currDragSize = q - currDragData;
currDragData = (char*)realloc(currDragData, currDragSize + 1);
GlobalUnlock( medium.hGlobal );
ReleaseStgMedium( &medium );
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit