Hi,
please find attached a patch to remove most of the unused functions in basic/.
The patch is contributed under the LGPLv3+ / MPL.
Thanks,
Julien
From 2e65408accabe86f9b2b47666fea43910e30f845 Mon Sep 17 00:00:00 2001
From: Julien Chaffraix <julien.chaffraix@gmail.com>
Date: Sun, 13 Nov 2011 22:35:28 -0800
Subject: [PATCH 1/2] FDO#39446 [EasyHack] Bloat Removal. Removing uncallable
code with callcatcher
Removed most unused symbols in basic/. The remaining symbols (SdxDecimal) are
Windows specific and thus should be double-checked on a Windows machine prior
to removal.
---
basic/inc/basic/sbx.hxx | 7 ---
basic/inc/basic/sbxobj.hxx | 9 ---
basic/inc/basic/sbxvar.hxx | 10 ----
basic/source/sbx/sbxarray.cxx | 30 -----------
basic/source/sbx/sbxbase.cxx | 7 ---
basic/source/sbx/sbxobj.cxx | 109 -----------------------------------------
basic/source/sbx/sbxvalue.cxx | 45 -----------------
basic/source/sbx/sbxvar.cxx | 10 ----
unusedcode.easy | 23 ---------
9 files changed, 0 insertions(+), 250 deletions(-)
diff --git a/basic/inc/basic/sbx.hxx b/basic/inc/basic/sbx.hxx
index efe4297..7a74e25 100644
--- a/basic/inc/basic/sbx.hxx
+++ b/basic/inc/basic/sbx.hxx
@@ -100,7 +100,6 @@ public:
SbxInfo( const String&, sal_uInt32 );
void AddParam( const String&, SbxDataType, sal_uInt16=SBX_READ );
- void AddParam( const SbxParamInfo& );
const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1!
const String& GetComment() const { return aComment; }
const String& GetHelpFile() const { return aHelpFile; }
@@ -139,7 +138,6 @@ class BASIC_DLLPUBLIC SbxAlias : public SbxVariable, public SfxListener
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType );
public:
- SbxAlias( const String& rName, SbxVariable* pOriginal );
SbxAlias( const SbxAlias& );
SbxAlias& operator=( const SbxAlias& );
};
@@ -227,7 +225,6 @@ class BASIC_DLLPUBLIC SbxDimArray : public SbxArray
protected:
sal_uInt16 Offset( const short* );
sal_uInt32 Offset32( const sal_Int32* );
- sal_uInt16 Offset( SbxArray* );
sal_uInt32 Offset32( SbxArray* );
virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
virtual sal_Bool StoreData( SvStream& ) const;
@@ -240,14 +237,11 @@ public:
SbxDimArray& operator=( const SbxDimArray& );
virtual void Clear();
using SbxArray::GetRef;
- SbxVariableRef& GetRef( const short* );
using SbxArray::Get;
SbxVariable* Get( const short* );
using SbxArray::Put;
void Put( SbxVariable*, const short* );
- SbxVariableRef& GetRef( SbxArray* );
SbxVariable* Get( SbxArray* );
- void Put( SbxVariable*, SbxArray* );
short GetDims() const;
void AddDim( short, short );
@@ -255,7 +249,6 @@ public:
sal_Bool GetDim( short, short&, short& ) const;
using SbxArray::GetRef32;
- SbxVariableRef& GetRef32( const sal_Int32* );
using SbxArray::Get32;
SbxVariable* Get32( const sal_Int32* );
using SbxArray::Put32;
diff --git a/basic/inc/basic/sbxobj.hxx b/basic/inc/basic/sbxobj.hxx
index 0a4e875..653437e 100644
--- a/basic/inc/basic/sbxobj.hxx
+++ b/basic/inc/basic/sbxobj.hxx
@@ -44,8 +44,6 @@ class BASIC_DLLPUBLIC SbxObject : public SbxVariable, public SfxListener
SbxObjectImpl* mpSbxObjectImpl; // Impl data
BASIC_DLLPRIVATE SbxArray* FindVar( SbxVariable*, sal_uInt16& );
- // AB 23.3.1997, special method for VCPtrRemove (see below)
- BASIC_DLLPRIVATE SbxArray* VCPtrFindVar( SbxVariable*, sal_uInt16& );
protected:
SbxArrayRef pMethods; // Methods
SbxArrayRef pProps; // Properties
@@ -91,13 +89,8 @@ public:
// AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and
// without Broadcasts, only used in SO2/auto.cxx
void QuickInsert( SbxVariable* );
- // AB 23.3.1997, Special-Method, allow corresponding controls
- void VCPtrInsert( SbxVariable* );
virtual void Remove( const String&, SbxClassType );
virtual void Remove( SbxVariable* );
- // AB 23.3.1997, deletion per pointer for controls (duplicate names!)
- void VCPtrRemove( SbxVariable* );
- void SetPos( SbxVariable*, sal_uInt16 );
// Macro-Recording
virtual String GenerateSource( const String &rLinePrefix,
@@ -110,8 +103,6 @@ public:
virtual SvDispatch* GetSvDispatch();
// Debugging
void Dump( SvStream&, sal_Bool bDumpAll=sal_False );
-
- static void GarbageCollection( sal_uIntPtr nObjects = 0 /* ::= all */ );
};
#ifndef __SBX_SBXOBJECTREF_HXX
diff --git a/basic/inc/basic/sbxvar.hxx b/basic/inc/basic/sbxvar.hxx
index 350dcf6..485c33e 100644
--- a/basic/inc/basic/sbxvar.hxx
+++ b/basic/inc/basic/sbxvar.hxx
@@ -164,7 +164,6 @@ public:
sal_Bool SetType( SbxDataType );
virtual sal_Bool Get( SbxValues& ) const;
- sal_Bool GetNoBroadcast( SbxValues& );
const SbxValues& GetValues_Impl() const { return aData; }
virtual sal_Bool Put( const SbxValues& );
@@ -184,18 +183,14 @@ public:
double GetDate() const;
sal_Bool GetBool() const;
- sal_uInt16 GetErr() const;
const String& GetString() const;
const String& GetCoreString() const;
rtl::OUString GetOUString() const;
SbxBase* GetObject() const;
- sal_Bool HasObject() const;
- void* GetData() const;
sal_uInt8 GetByte() const;
sal_uInt16 GetUShort() const;
sal_uInt32 GetULong() const;
- int GetInt() const;
sal_Bool PutInteger( sal_Int16 );
sal_Bool PutLong( sal_Int32 );
@@ -208,26 +203,21 @@ public:
sal_Bool PutInt64( sal_Int64 );
sal_Bool PutUInt64( sal_uInt64 );
sal_Bool PutString( const ::rtl::OUString& );
- sal_Bool PutString( const sal_Unicode* ); // Type = SbxSTRING
- sal_Bool PutpChar( const sal_Unicode* ); // Type = SbxLPSTR
sal_Bool PutChar( sal_Unicode );
sal_Bool PutByte( sal_uInt8 );
sal_Bool PutUShort( sal_uInt16 );
sal_Bool PutULong( sal_uInt32 );
- sal_Bool PutInt( int );
sal_Bool PutEmpty();
sal_Bool PutNull();
// Special methods
sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec
);
- sal_Bool PutDecimal( SbxDecimal* pDecimal );
sal_Bool PutCurrency( const sal_Int64& );
// Interface for CDbl in Basic
static SbxError ScanNumIntnl( const String& rSrc, double& nVal, sal_Bool bSingle = sal_False );
sal_Bool PutObject( SbxBase* );
- sal_Bool PutData( void* );
virtual sal_Bool Convert( SbxDataType );
virtual sal_Bool Compute( SbxOperator, const SbxValue& );
diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index d21f106..9a45bbb 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -744,11 +744,6 @@ sal_uInt16 SbxDimArray::Offset( const short* pIdx )
return (sal_uInt16) nPos;
}
-SbxVariableRef& SbxDimArray::GetRef( const short* pIdx )
-{
- return SbxArray::GetRef( Offset( pIdx ) );
-}
-
SbxVariable* SbxDimArray::Get( const short* pIdx )
{
return SbxArray::Get( Offset( pIdx ) );
@@ -759,11 +754,6 @@ void SbxDimArray::Put( SbxVariable* p, const short* pIdx )
SbxArray::Put( p, Offset( pIdx ) );
}
-SbxVariableRef& SbxDimArray::GetRef32( const sal_Int32* pIdx )
-{
- return SbxArray::GetRef32( Offset32( pIdx ) );
-}
-
SbxVariable* SbxDimArray::Get32( const sal_Int32* pIdx )
{
return SbxArray::Get32( Offset32( pIdx ) );
@@ -801,31 +791,11 @@ sal_uInt32 SbxDimArray::Offset32( SbxArray* pPar )
return nPos;
}
-sal_uInt16 SbxDimArray::Offset( SbxArray* pPar )
-{
- sal_uInt32 nPos = Offset32( pPar );
- if( nPos > (long) SBX_MAXINDEX )
- {
- SetError( SbxERR_BOUNDS ); nPos = 0;
- }
- return (sal_uInt16) nPos;
-}
-
-SbxVariableRef& SbxDimArray::GetRef( SbxArray* pPar )
-{
- return SbxArray::GetRef32( Offset32( pPar ) );
-}
-
SbxVariable* SbxDimArray::Get( SbxArray* pPar )
{
return SbxArray::Get32( Offset32( pPar ) );
}
-void SbxDimArray::Put( SbxVariable* p, SbxArray* pPar )
-{
- SbxArray::Put32( p, Offset32( pPar ) );
-}
-
sal_Bool SbxDimArray::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
short nDimension;
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 1ca523c..1520c43 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -388,13 +388,6 @@ void SbxInfo::AddParam
aParams.Insert( p, aParams.Count() );
}
-void SbxInfo::AddParam( const SbxParamInfo& r )
-{
- const SbxParamInfo* p = new SbxParamInfo
- ( r.aName, r.eType, r.nFlags, r.aTypeRef );
- aParams.Insert( p, aParams.Count() );
-}
-
const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const
{
if( n < 1 || n > aParams.Count() )
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index cfac255..5bfa429 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -541,33 +541,6 @@ void SbxObject::QuickInsert( SbxVariable* pVar )
}
}
-// special method, allow controls of the same name
-void SbxObject::VCPtrInsert( SbxVariable* pVar )
-{
- SbxArray* pArray = NULL;
- if( pVar )
- {
- switch( pVar->GetClass() )
- {
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
- default:
- DBG_ASSERT( !this, "Ungueltige SBX-Klasse" );
- }
- }
- if( pArray )
- {
- StartListening( pVar->GetBroadcaster(), sal_True );
- pArray->Put( pVar, pArray->Count() );
- if( pVar->GetParent() != this )
- pVar->SetParent( this );
- SetModified( sal_True );
- Broadcast( SBX_HINT_OBJECTCHANGED );
- }
-}
-
void SbxObject::Remove( const XubString& rName, SbxClassType t )
{
Remove( SbxObject::Find( rName, t ) );
@@ -599,74 +572,6 @@ void SbxObject::Remove( SbxVariable* pVar )
}
}
-// cleanup per Pointer for Controls (double names!)
-void SbxObject::VCPtrRemove( SbxVariable* pVar )
-{
- sal_uInt16 nIdx;
- // New FindVar-Method, otherwise identical with the normal method
- SbxArray* pArray = VCPtrFindVar( pVar, nIdx );
- if( pArray && nIdx < pArray->Count() )
- {
- SbxVariableRef xVar = pArray->Get( nIdx );
- if( xVar->IsBroadcaster() )
- EndListening( xVar->GetBroadcaster(), sal_True );
- if( (SbxVariable*) xVar == pDfltProp )
- pDfltProp = NULL;
- pArray->Remove( nIdx );
- if( xVar->GetParent() == this )
- xVar->SetParent( NULL );
- SetModified( sal_True );
- Broadcast( SBX_HINT_OBJECTCHANGED );
- }
-}
-
-// associated special method, search only by Pointer
-SbxArray* SbxObject::VCPtrFindVar( SbxVariable* pVar, sal_uInt16& nArrayIdx )
-{
- SbxArray* pArray = NULL;
- if( pVar ) switch( pVar->GetClass() )
- {
- case SbxCLASS_VARIABLE:
- case SbxCLASS_PROPERTY: pArray = pProps; break;
- case SbxCLASS_METHOD: pArray = pMethods; break;
- case SbxCLASS_OBJECT: pArray = pObjs; break;
- default:
- DBG_ASSERT( !this, "Ungueltige SBX-Klasse" );
- }
- if( pArray )
- {
- nArrayIdx = pArray->Count();
- for( sal_uInt16 i = 0; i < pArray->Count(); i++ )
- {
- SbxVariableRef& rRef = pArray->GetRef( i );
- if( (SbxVariable*) rRef == pVar )
- {
- nArrayIdx = i; break;
- }
- }
- }
- return pArray;
-}
-
-
-
-void SbxObject::SetPos( SbxVariable* pVar, sal_uInt16 nPos )
-{
- sal_uInt16 nIdx;
- SbxArray* pArray = FindVar( pVar, nIdx );
- if( pArray )
- {
- if( nPos >= pArray->Count() )
- nPos = pArray->Count() - 1;
- if( nIdx < ( pArray->Count() - 1 ) )
- {
- SbxVariableRef refVar = pArray->Get( nIdx );
- pArray->Remove( nIdx );
- pArray->Insert( refVar, nPos );
- }
- }
-}
-
static sal_Bool LoadArray( SvStream& rStrm, SbxObject* pThis, SbxArray* pArray )
{
SbxArrayRef p = (SbxArray*) SbxBase::Load( rStrm );
@@ -1030,18 +935,4 @@ SbxClassType SbxProperty::GetClass() const
return SbxCLASS_PROPERTY;
}
-void SbxObject::GarbageCollection( sal_uIntPtr /* nObjects */ )
-
-/* [Description]
-
- This statistic method browse the next 'nObjects' of the currently existing
- <SbxObject>-Instances for cyclic references, which keep only themselfes alive
- If there is 'nObjects==0', then all existing will be browsed.
-
- currently only implemented: Object -> Parent-Property -> Parent -> Object
-*/
-
-{
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 7ca1d9c..f279374 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -465,15 +465,6 @@ sal_Bool SbxValue::Get( SbxValues& rRes ) const
return bRes;
}
-sal_Bool SbxValue::GetNoBroadcast( SbxValues& rRes )
-{
- sal_uInt16 nFlags_ = GetFlags();
- SetFlag( SBX_NO_BROADCAST );
- sal_Bool bRes = Get( rRes );
- SetFlags( nFlags_ );
- return bRes;
-}
-
const XubString& SbxValue::GetString() const
{
SbxValues aRes;
@@ -509,16 +500,6 @@ const XubString& SbxValue::GetCoreString() const
return aResult;
}
-sal_Bool SbxValue::HasObject() const
-{
- ErrCode eErr = GetError();
- SbxValues aRes;
- aRes.eType = SbxOBJECT;
- Get( aRes );
- SetError( eErr );
- return 0 != aRes.pObj;
-}
-
sal_Bool SbxValue::GetBool() const
{
SbxValues aRes;
@@ -534,10 +515,7 @@ GET( GetByte, SbxBYTE, sal_uInt8, nByte )
GET( GetChar, SbxCHAR, xub_Unicode, nChar )
GET( GetCurrency, SbxCURRENCY, sal_Int64, nInt64 )
GET( GetDate, SbxDATE, double, nDouble )
-GET( GetData, SbxDATAOBJECT, void*, pData )
GET( GetDouble, SbxDOUBLE, double, nDouble )
-GET( GetErr, SbxERROR, sal_uInt16, nUShort )
-GET( GetInt, SbxINT, int, nInt )
GET( GetInteger, SbxINTEGER, sal_Int16, nInteger )
GET( GetLong, SbxLONG, sal_Int32, nLong )
GET( GetObject, SbxOBJECT, SbxBase*, pObj )
@@ -715,16 +693,6 @@ sal_Bool SbxValue::PutStringExt( const ::rtl::OUString& r )
return bRet;
}
-sal_Bool SbxValue::PutString( const xub_Unicode* p )
-{
- ::rtl::OUString aVal( p );
- SbxValues aRes;
- aRes.eType = SbxSTRING;
- aRes.pOUString = &aVal;
- Put( aRes );
- return sal_Bool( !IsError() );
-}
-
sal_Bool SbxValue::PutBool( sal_Bool b )
{
SbxValues aRes;
@@ -773,16 +741,6 @@ sal_Bool SbxValue::fillAutomationDecimal
}
-sal_Bool SbxValue::PutpChar( const xub_Unicode* p )
-{
- ::rtl::OUString aVal( p );
- SbxValues aRes;
- aRes.eType = SbxLPSTR;
- aRes.pOUString = &aVal;
- Put( aRes );
- return sal_Bool( !IsError() );
-}
-
sal_Bool SbxValue::PutString( const ::rtl::OUString& r )
{
SbxValues aRes;
@@ -801,10 +759,8 @@ PUT( PutByte, SbxBYTE, sal_uInt8, nByte )
PUT( PutChar, SbxCHAR, sal_Unicode, nChar )
PUT( PutCurrency, SbxCURRENCY, const sal_Int64&, nInt64 )
PUT( PutDate, SbxDATE, double, nDouble )
-PUT( PutData, SbxDATAOBJECT, void*, pData )
PUT( PutDouble, SbxDOUBLE, double, nDouble )
PUT( PutErr, SbxERROR, sal_uInt16, nUShort )
-PUT( PutInt, SbxINT, int, nInt )
PUT( PutInteger, SbxINTEGER, sal_Int16, nInteger )
PUT( PutLong, SbxLONG, sal_Int32, nLong )
PUT( PutObject, SbxOBJECT, SbxBase*, pObj )
@@ -813,7 +769,6 @@ PUT( PutULong, SbxULONG, sal_uInt32, nULong )
PUT( PutUShort, SbxUSHORT, sal_uInt16, nUShort )
PUT( PutInt64, SbxSALINT64, sal_Int64, nInt64 )
PUT( PutUInt64, SbxSALUINT64, sal_uInt64, uInt64 )
-PUT( PutDecimal, SbxDECIMAL, SbxDecimal*, pDecimal )
////////////////////////// Setting of the data type ///////////////////////////
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index f70cb39..457ae4f 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -590,16 +590,6 @@ SbxInfo::SbxInfo( const String& r, sal_uInt32 n )
////////////////////////////// SbxAlias //////////////////////////////////
-SbxAlias::SbxAlias( const XubString& rName, SbxVariable* p )
- : SbxVariable(), xAlias( p )
-{
- SetName( rName );
- SetFlags( p->GetFlags() );
- SetFlag( SBX_DONTSTORE );
- aData.eType = p->GetType();
- StartListening( p->GetBroadcaster() );
-}
-
SbxAlias::SbxAlias( const SbxAlias& r )
: SvRefBase( r ), SbxVariable( r ),
SfxListener( r ), xAlias( r.xAlias )
diff --git a/unusedcode.easy b/unusedcode.easy
index d2be88e..7d60f1f 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -342,9 +342,6 @@ SbiImage::Load(SvStream&)
SbiIoSystem::NextChannel()
SbiRuntime::GetParams()
SbiSymPool::Clear()
-SbxAlias::SbxAlias(String const&, SbxVariable*)
-SbxDecimal::SbxDecimal()
-SbxDecimal::getByte(unsigned char&)
SbxDecimal::getChar(unsigned short&)
SbxDecimal::getInt(int&)
SbxDecimal::getLong(int&)
@@ -356,26 +353,6 @@ SbxDecimal::getUShort(unsigned short&)
SbxDecimal::setShort(short)
SbxDecimal::setString(rtl::OUString*)
SbxDecimal::setUShort(unsigned short)
-SbxDimArray::GetRef(SbxArray*)
-SbxDimArray::GetRef(short const*)
-SbxDimArray::GetRef32(int const*)
-SbxDimArray::Offset(SbxArray*)
-SbxDimArray::Put(SbxVariable*, SbxArray*)
-SbxInfo::AddParam(SbxParamInfo const&)
-SbxObject::GarbageCollection(unsigned long)
-SbxObject::SetPos(SbxVariable*, unsigned short)
-SbxObject::VCPtrInsert(SbxVariable*)
-SbxObject::VCPtrRemove(SbxVariable*)
-SbxValue::GetData() const
-SbxValue::GetErr() const
-SbxValue::GetInt() const
-SbxValue::GetNoBroadcast(SbxValues&)
-SbxValue::HasObject() const
-SbxValue::PutData(void*)
-SbxValue::PutDecimal(SbxDecimal*)
-SbxValue::PutInt(int)
-SbxValue::PutString(unsigned short const*)
-SbxValue::PutpChar(unsigned short const*)
ScAddInAsyncs::Insert(ScAddInAsync* const&, unsigned short&)
ScAddInAsyncs::Insert(ScAddInAsync* const*, unsigned short)
ScAddInAsyncs::Insert(ScAddInAsyncs const*, unsigned short, unsigned short)
--
1.7.7.1
Context
- [Libreoffice] [PATCH] FDO#39446 - Remove uncallable code in basic/ · Julien Chaffraix
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.