From d018f3f761fa5e8a366255ecad817169ed3d1756 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 16 Jul 2012 19:09:34 +0000 Subject: [PATCH] correct handling of order of preference of formats git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/dataobj.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/osx/carbon/dataobj.cpp b/src/osx/carbon/dataobj.cpp index db8e5dd548..4b5f17969e 100644 --- a/src/osx/carbon/dataobj.cpp +++ b/src/osx/carbon/dataobj.cpp @@ -394,10 +394,11 @@ bool wxDataObject::IsFormatInPasteboard( void * pb, const wxDataFormat &dataForm bool wxDataObject::GetFromPasteboard( void * pb ) { PasteboardRef pasteboard = (PasteboardRef) pb; - size_t formatcount = GetFormatCount() + 1; + + size_t formatcount = GetFormatCount(wxDataObject::Set); wxDataFormat *array = new wxDataFormat[ formatcount ]; - array[0] = GetPreferredFormat(); - GetAllFormats( &array[1] ); + GetAllFormats(array, wxDataObject::Set); + ItemCount itemCount = 0; wxString filenamesPassed; bool transferred = false; @@ -538,10 +539,9 @@ bool wxDataObject::GetFromPasteboard( void * pb ) bool wxDataObject::HasDataInPasteboard( void * pb ) { PasteboardRef pasteboard = (PasteboardRef) pb; - size_t formatcount = GetFormatCount() + 1; + size_t formatcount = GetFormatCount(wxDataObject::Set); wxDataFormat *array = new wxDataFormat[ formatcount ]; - array[0] = GetPreferredFormat(); - GetAllFormats( &array[1] ); + GetAllFormats(array, wxDataObject::Set); ItemCount itemCount = 0; bool hasData = false; @@ -598,10 +598,11 @@ bool wxDataObject::HasDataInPasteboard( void * pb ) void wxDataObject::AddSupportedTypes( void* cfarray) { - wxDataFormat *array = new wxDataFormat[ GetFormatCount() ]; - GetAllFormats( array ); + size_t nFormats = GetFormatCount(wxDataObject::Set); + wxDataFormat *array = new wxDataFormat[nFormats]; + GetAllFormats(array, wxDataObject::Set); - for (size_t i = 0; i < GetFormatCount(); i++) + for (size_t i = 0; i < nFormats; i++) { wxDataFormat dataFormat = array[ i ];