sfx2/source/control/objface.cxx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
New commits: commit b866f86191653a689ce74a3c13e93e3bc34947b7 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Aug 8 17:43:01 2014 +0200 qsort and bsearch need different kinds of callback functions Change-Id: I4a661434c3a51169ec14336bb39a1d2ceeb139ad diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index 32c7e8e..6c26370 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -35,20 +35,23 @@ #include <sfx2/objsh.hxx> #include <rtl/strbuf.hxx> -extern "C" -#ifdef WNT -int _cdecl -#else -int -#endif +extern "C" { -SfxCompareSlots_Impl( const void* pSmaller, const void* pBigger ) +static int SAL_CALL +SfxCompareSlots_qsort( const void* pSmaller, const void* pBigger ) { return ( (int) ((SfxSlot*)pSmaller)->GetSlotId() ) - ( (int) ((SfxSlot*)pBigger)->GetSlotId() ); } +static int SAL_CALL +SfxCompareSlots_bsearch( const void* pSmaller, const void* pBigger ) +{ + return ( (int) *((sal_uInt16*)pSmaller) ) - + ( (int) ((SfxSlot*)pBigger)->GetSlotId() ); +} +} struct SfxObjectUI_Impl { @@ -148,7 +151,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) if ( !pIter->pNextSlot ) { // sort the SfxSlots by id - qsort( pSlots, nCount, sizeof(SfxSlot), SfxCompareSlots_Impl ); + qsort( pSlots, nCount, sizeof(SfxSlot), SfxCompareSlots_qsort ); // link masters and slaves sal_uInt16 nIter = 1; @@ -311,7 +314,7 @@ const SfxSlot* SfxInterface::GetSlot( sal_uInt16 nFuncId ) const // find the id using binary search void* p = bsearch( &nFuncId, pSlots, nCount, sizeof(SfxSlot), - SfxCompareSlots_Impl ); + SfxCompareSlots_bsearch ); if ( !p && pGenoType ) return pGenoType->GetSlot( nFuncId ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits