Kaydet (Commit) b866f861 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

qsort and bsearch need different kinds of callback functions

Change-Id: I4a661434c3a51169ec14336bb39a1d2ceeb139ad
üst 5631661e
...@@ -35,20 +35,23 @@ ...@@ -35,20 +35,23 @@
#include <sfx2/objsh.hxx> #include <sfx2/objsh.hxx>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
extern "C" extern "C" {
#ifdef WNT
int _cdecl
#else
int
#endif
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() ) - return ( (int) ((SfxSlot*)pSmaller)->GetSlotId() ) -
( (int) ((SfxSlot*)pBigger)->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 struct SfxObjectUI_Impl
{ {
...@@ -148,7 +151,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) ...@@ -148,7 +151,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount )
if ( !pIter->pNextSlot ) if ( !pIter->pNextSlot )
{ {
// sort the SfxSlots by id // sort the SfxSlots by id
qsort( pSlots, nCount, sizeof(SfxSlot), SfxCompareSlots_Impl ); qsort( pSlots, nCount, sizeof(SfxSlot), SfxCompareSlots_qsort );
// link masters and slaves // link masters and slaves
sal_uInt16 nIter = 1; sal_uInt16 nIter = 1;
...@@ -311,7 +314,7 @@ const SfxSlot* SfxInterface::GetSlot( sal_uInt16 nFuncId ) const ...@@ -311,7 +314,7 @@ const SfxSlot* SfxInterface::GetSlot( sal_uInt16 nFuncId ) const
// find the id using binary search // find the id using binary search
void* p = bsearch( &nFuncId, pSlots, nCount, sizeof(SfxSlot), void* p = bsearch( &nFuncId, pSlots, nCount, sizeof(SfxSlot),
SfxCompareSlots_Impl ); SfxCompareSlots_bsearch );
if ( !p && pGenoType ) if ( !p && pGenoType )
return pGenoType->GetSlot( nFuncId ); return pGenoType->GetSlot( nFuncId );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment