diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-08-08 17:43:01 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-08-08 17:43:01 +0200 |
commit | b866f86191653a689ce74a3c13e93e3bc34947b7 (patch) | |
tree | b4f4ad3a474f66535e96e2ecf01d4e6aac6ddb2a /sfx2/source | |
parent | 5631661e1fa122d84d1b5fc780c7bea1b7a97d34 (diff) |
qsort and bsearch need different kinds of callback functions
Change-Id: I4a661434c3a51169ec14336bb39a1d2ceeb139ad
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/control/objface.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index 32c7e8e78a4e..6c263701cebc 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 ); |