From 6ac23e25b85468c7885f6ab43ca0a45f6458af2e Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 22 Aug 2005 08:49:38 +0000 Subject: [PATCH] correcting Drag Data handling for 'TEXT' and 'utxt' git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/dnd.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index d2b1702e91..52b0cbbf90 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -315,13 +315,18 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags)) Ptr dataPtr = new char[dataSize] ; m_data->GetDataHere( formats[i] , dataPtr ) ; OSType type = formats[i].GetFormatId() ; - if ( type == 'TEXT' ) + if ( type == 'TEXT' || type == 'utxt' ) { - dataSize-- ; + if ( dataSize > 0 ) + dataSize-- ; dataPtr[ dataSize ] = 0 ; - wxString st( (wxChar*) dataPtr ) ; - wxCharBuffer buf = st.mb_str( wxConvLocal) ; - AddDragItemFlavor(theDrag, theItem, type , buf.data(), strlen(buf), 0); + if ( type == 'utxt' ) + { + if ( dataSize > 0 ) + dataSize-- ; + dataPtr[ dataSize ] = 0 ; + } + AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0); } else if (type == kDragFlavorTypeHFS ) { -- 2.45.2