diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-05 11:52:10 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-02-07 06:54:39 +0000 |
commit | 0b7337bfa049f4e3a8b87f7628025e40f5b3e825 (patch) | |
tree | f729413968d640829f92ddda0d0292cf456754af /idl/source | |
parent | e90f4e18fd53bd85cc953eb2e796d593ae3f79df (diff) |
remove some dead code, found using LCOV
Change-Id: Ibdca0a70722290bbb560726c88e9821c3ae0af14
Reviewed-on: https://gerrit.libreoffice.org/22151
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'idl/source')
-rw-r--r-- | idl/source/objects/basobj.cxx | 25 | ||||
-rw-r--r-- | idl/source/objects/bastype.cxx | 22 | ||||
-rw-r--r-- | idl/source/objects/module.cxx | 12 | ||||
-rw-r--r-- | idl/source/objects/object.cxx | 6 | ||||
-rw-r--r-- | idl/source/objects/slot.cxx | 9 | ||||
-rw-r--r-- | idl/source/objects/types.cxx | 107 | ||||
-rw-r--r-- | idl/source/prj/database.cxx | 36 |
7 files changed, 36 insertions, 181 deletions
diff --git a/idl/source/objects/basobj.cxx b/idl/source/objects/basobj.cxx index 9d52d9326b20..a9ddcf8de4e7 100644 --- a/idl/source/objects/basobj.cxx +++ b/idl/source/objects/basobj.cxx @@ -66,22 +66,22 @@ SvMetaObject::SvMetaObject() { } -bool SvMetaObject::SetName( const OString& rName, SvIdlDataBase * ) +void SvMetaObject::SetName( const OString& rName ) { aName.setString(rName); - return true; } -bool SvMetaObject::ReadNameSvIdl( SvIdlDataBase & rBase, - SvTokenStream & rInStm ) +bool SvMetaObject::ReadNameSvIdl( SvTokenStream & rInStm ) { sal_uInt32 nTokPos = rInStm.Tell(); SvToken * pTok = rInStm.GetToken_Next(); // read module name if( pTok->IsIdentifier() ) - if( SetName( pTok->GetString(), &rBase ) ) - return true; + { + SetName( pTok->GetString() ); + return true; + } rInStm.Seek( nTokPos ); return false; @@ -94,17 +94,14 @@ void SvMetaObject::ReadAttributesSvIdl( SvIdlDataBase & rBase, } void SvMetaObject::DoReadContextSvIdl( SvIdlDataBase & rBase, - SvTokenStream & rInStm, char cDel ) + SvTokenStream & rInStm ) { sal_uInt32 nBeginPos = 0; // can not happen with Tell while( nBeginPos != rInStm.Tell() ) { nBeginPos = rInStm.Tell(); ReadContextSvIdl( rBase, rInStm ); - if( cDel == '\0' ) - rInStm.ReadDelemiter(); - else - (void)rInStm.Read( cDel ); + rInStm.ReadDelemiter(); } } @@ -158,12 +155,6 @@ SvMetaExtern::SvMetaExtern() { } -SvMetaModule * SvMetaExtern::GetModule() const -{ - DBG_ASSERT( pModule != nullptr, "module not set" ); - return pModule; -} - void SvMetaExtern::SetModule( SvIdlDataBase & rBase ) { pModule = static_cast<SvMetaModule *>(rBase.GetStack().Get( checkSvMetaObject<SvMetaModule> )); diff --git a/idl/source/objects/bastype.cxx b/idl/source/objects/bastype.cxx index becefb80074b..ced082f00708 100644 --- a/idl/source/objects/bastype.cxx +++ b/idl/source/objects/bastype.cxx @@ -86,28 +86,6 @@ bool SvIdentifier::ReadSvIdl( SvStringHashEntry * pName, SvTokenStream & rInStm } void SvIdentifier::ReadSvIdl( SvIdlDataBase & rBase, - SvStringHashEntry * pName, - SvTokenStream & rInStm ) -{ - if( SvIdentifier::ReadSvIdl( pName, rInStm ) ) - { - sal_uLong n; - if( rBase.FindId( getString(), &n ) ) - { - nValue = n; - return; - } - else - { - OStringBuffer aStr("no value for identifier <"); - aStr.append(getString()).append("> "); - rBase.SetError( aStr.makeStringAndClear(), rInStm.GetToken() ); - rBase.WriteError( rInStm ); - } - } -} - -void SvIdentifier::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) { sal_uInt32 nTokPos = rInStm.Tell(); diff --git a/idl/source/objects/module.cxx b/idl/source/objects/module.cxx index 470f768ef8d9..c4d510d89249 100644 --- a/idl/source/objects/module.cxx +++ b/idl/source/objects/module.cxx @@ -33,16 +33,6 @@ SvMetaModule::SvMetaModule( bool bImp ) { } -bool SvMetaModule::SetName( const OString& rName, SvIdlDataBase * pBase ) -{ - if( pBase ) - { - if( pBase->GetModule( rName ) ) - return false; - } - return SvMetaExtern::SetName( rName ); -} - void SvMetaModule::ReadAttributesSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) { @@ -202,7 +192,7 @@ bool SvMetaModule::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) { rBase.Push( this ); // onto the context stack - if( ReadNameSvIdl( rBase, rInStm ) ) + if( ReadNameSvIdl( rInStm ) ) { // set pointer to itself SetModule( rBase ); diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx index d27b5ac3ae05..eba6cb5b6a26 100644 --- a/idl/source/objects/object.cxx +++ b/idl/source/objects/object.cxx @@ -39,12 +39,6 @@ SvMetaClass::SvMetaClass() { } -void SvMetaClass::ReadAttributesSvIdl( SvIdlDataBase & rBase, - SvTokenStream & rInStm ) -{ - SvMetaType::ReadAttributesSvIdl( rBase, rInStm ); -} - void SvMetaClass::ReadContextSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) { diff --git a/idl/source/objects/slot.cxx b/idl/source/objects/slot.cxx index 16a1d79cfc23..1a3f65caf393 100644 --- a/idl/source/objects/slot.cxx +++ b/idl/source/objects/slot.cxx @@ -104,11 +104,6 @@ const OString& SvMetaSlot::GetDisableFlags() const if( !aDisableFlags.getString().isEmpty() || !GetRef() ) return aDisableFlags.getString(); return static_cast<SvMetaSlot *>(GetRef())->GetDisableFlags(); } -const OString& SvMetaSlot::GetConfigId() const -{ - if( !aConfigId.getString().isEmpty() || !GetRef() ) return aConfigId.getString(); - return static_cast<SvMetaSlot *>(GetRef())->GetConfigId(); -} const OString& SvMetaSlot::GetExecMethod() const { if( !aExecMethod.getString().isEmpty() || !GetRef() ) return aExecMethod.getString(); @@ -342,7 +337,7 @@ bool SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) if( pKnownSlot ) { SetRef( pKnownSlot ); - SetName( pKnownSlot->GetName().getString(), &rBase ); + SetName( pKnownSlot->GetName().getString() ); bOk = SvMetaObject::ReadSvIdl( rBase, rInStm ); } else @@ -376,7 +371,7 @@ bool SvMetaSlot::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) return false; } - SetName( pKnownSlot->GetName().getString(), &rBase ); + SetName( pKnownSlot->GetName().getString() ); } else { diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index fd8d1d722a4a..84371cb0558d 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -32,7 +32,6 @@ SvMetaAttribute::SvMetaAttribute() : aExport( true, false ) , aReadOnlyDoc ( true, false ) - , bNewAttr( false ) { } @@ -40,7 +39,6 @@ SvMetaAttribute::SvMetaAttribute( SvMetaType * pType ) : aType( pType ) , aExport( true, false ) , aReadOnlyDoc ( true, false) - , bNewAttr( false ) { } @@ -120,7 +118,7 @@ bool SvMetaAttribute::ReadSvIdl( SvIdlDataBase & rBase, bool bOk = false; if( GetType() ) { - ReadNameSvIdl( rBase, rInStm ); + ReadNameSvIdl( rInStm ); aSlotId.ReadSvIdl( rBase, rInStm ); bOk = true; @@ -192,26 +190,13 @@ SvMetaType::SvMetaType() { } -SvMetaType::SvMetaType( const OString& rName, char cPC, - const OString& rCName ) - CTOR -{ - SetName( rName ); - cParserChar = cPC; - aCName.setString(rCName); -} - SvMetaType::SvMetaType( const OString& rName, char cPc, - const OString& rCName, - const OString& rBasicName, const OString& rBasicPostfix ) CTOR { SetName( rName ); cParserChar = cPc; - aCName.setString(rCName); - aBasicName.setString(rBasicName); aBasicPostfix.setString(rBasicPostfix); } @@ -233,7 +218,6 @@ void SvMetaType::SetType( MetaTypeType nT ) { OStringBuffer aTmp(C_PREF); aTmp.append("Object *"); - aCName.setString(aTmp.makeStringAndClear()); } } @@ -251,28 +235,6 @@ SvMetaType * SvMetaType::GetReturnType() const return static_cast<SvMetaType *>(GetRef()); } -const OString& SvMetaType::GetBasicName() const -{ - if( aBasicName.IsSet() || !GetRef() ) - return aBasicName.getString(); - else - return static_cast<SvMetaType*>(GetRef())->GetBasicName(); -} - -const OString& SvMetaType::GetCName() const -{ - if( aCName.IsSet() || !GetRef() ) - return aCName.getString(); - else - return static_cast<SvMetaType *>(GetRef())->GetCName(); -} - -bool SvMetaType::SetName( const OString& rName, SvIdlDataBase * pBase ) -{ - aCName.setString(rName); - return SvMetaReference::SetName( rName, pBase ); -} - bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm ) { @@ -286,18 +248,18 @@ bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase, if( pTok->Is( SvHash_shell() ) ) bIsShell = true; SetType( MetaTypeType::Class ); - bOk = ReadNamesSvIdl( rBase, rInStm ); + bOk = ReadNamesSvIdl( rInStm ); } else if( pTok->Is( SvHash_struct() ) ) { SetType( MetaTypeType::Struct ); - bOk = ReadNamesSvIdl( rBase, rInStm ); + bOk = ReadNamesSvIdl( rInStm ); } else if( pTok->Is( SvHash_enum() ) ) { SetType( MetaTypeType::Enum ); - bOk = ReadNameSvIdl( rBase, rInStm ); + bOk = ReadNameSvIdl( rInStm ); } else if( pTok->Is( SvHash_item() ) ) { @@ -308,22 +270,7 @@ bool SvMetaType::ReadHeaderSvIdl( SvIdlDataBase & rBase, if( pType ) { SetRef( pType ); - if( ReadNameSvIdl( rBase, rInStm ) ) - { - if( rInStm.Read( '(' ) ) - { - DoReadContextSvIdl( rBase, rInStm ); - if( rInStm.Read( ')' ) ) - { - SetType( MetaTypeType::Method ); - bOk = true; - } - } - else - { - bOk = true; - } - } + bOk = ReadNameSvIdl( rInStm ); } else { @@ -350,12 +297,9 @@ bool SvMetaType::ReadSvIdl( SvIdlDataBase & rBase, return false; } -bool SvMetaType::ReadNamesSvIdl( SvIdlDataBase & rBase, - SvTokenStream & rInStm ) +bool SvMetaType::ReadNamesSvIdl( SvTokenStream & rInStm ) { - bool bOk = ReadNameSvIdl( rBase, rInStm ); - - return bOk; + return ReadNameSvIdl( rInStm ); } void SvMetaType::ReadContextSvIdl( SvIdlDataBase & rBase, @@ -427,8 +371,6 @@ void SvMetaType::WriteSfxItem( rOutStm.WriteCharPtr( "#if !defined(_WIN32) && ((defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS))) || STATIC_LINKING)" ) << endl; rOutStm.WriteCharPtr( "__attribute__((__weak__))" ) << endl; rOutStm.WriteCharPtr( "#endif" ) << endl; - if (bExport) - rOutStm.WriteCharPtr( "SFX2_DLLPUBLIC " ); rOutStm.WriteCharPtr( aTypeName.getStr() ).WriteCharPtr( aVarName.getStr() ) .WriteCharPtr( " = " ) << endl; rOutStm.WriteChar( '{' ) << endl; @@ -476,32 +418,8 @@ bool SvMetaType::ReadMethodArgs( SvIdlDataBase & rBase, return false; } -OString SvMetaType::GetParserString() const -{ - SvMetaType * pBT = GetBaseType(); - if( pBT != this ) - return pBT->GetParserString(); - - MetaTypeType type = GetType(); - OString aPStr; - - if( MetaTypeType::Method == type || MetaTypeType::Struct == type ) - { - sal_uLong nAttrCount = GetAttrCount(); - // write the single attributes - for( sal_uLong n = 0; n < nAttrCount; n++ ) - { - SvMetaAttribute * pT = (*pAttrList)[n]; - aPStr += pT->GetType()->GetParserString(); - } - } - else - aPStr = OString(GetParserChar()); - return aPStr; -} - SvMetaTypeString::SvMetaTypeString() - : SvMetaType( "String", 's', "char *", "String", "$" ) + : SvMetaType( "String", 's', "$" ) { } @@ -509,17 +427,14 @@ SvMetaEnumValue::SvMetaEnumValue() { } -bool SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase, +bool SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & , SvTokenStream & rInStm ) { - if( !ReadNameSvIdl( rBase, rInStm ) ) - return false; - return true; + return ReadNameSvIdl( rInStm ); } SvMetaTypeEnum::SvMetaTypeEnum() { - SetBasicName("Integer"); } namespace @@ -577,7 +492,7 @@ bool SvMetaTypeEnum::ReadSvIdl( SvIdlDataBase & rBase, } SvMetaTypevoid::SvMetaTypevoid() - : SvMetaType( "void", 'v', "void", "", "" ) + : SvMetaType( "void", 'v', "" ) { } diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 3e69e54ae54c..58fcc64ca320 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -45,9 +45,9 @@ SvIdlDataBase::~SvIdlDataBase() delete pIdTable; } -#define ADD_TYPE( Name, ParserChar, CName, BasName, BasPost ) \ +#define ADD_TYPE( Name, ParserChar, BasPost ) \ aTypeList.push_back( new SvMetaType( SvHash_##Name()->GetName(), \ - ParserChar, CName, BasName, BasPost ) ); + ParserChar, BasPost ) ); SvRefMemberList<SvMetaType *>& SvIdlDataBase::GetTypeList() { @@ -57,15 +57,15 @@ SvRefMemberList<SvMetaType *>& SvIdlDataBase::GetTypeList() aTypeList.push_back( new SvMetaTypevoid() ); // MI: IDispatch::Invoke can not unsigned - ADD_TYPE( UINT16, 'h', "unsigned short", "Long", "&" ); - ADD_TYPE( INT16, 'h', "short", "Integer", "%" ); - ADD_TYPE( UINT32, 'l', "unsigned long", "Long", "&" ); - ADD_TYPE( INT32, 'l', "long", "Long", "&" ); - ADD_TYPE( BOOL, 'b', "unsigned char", "Boolean", "" ); - ADD_TYPE( BYTE, 'c', "unsigned char", "Integer", "%" ); - ADD_TYPE( float, 'f', "float", "Single", "!" ); - ADD_TYPE( double, 'F', "double", "Double", "#" ); - ADD_TYPE( SbxObject, 'o', "C_Object", "Object", "" ); + ADD_TYPE( UINT16, 'h', "&" ); + ADD_TYPE( INT16, 'h', "%" ); + ADD_TYPE( UINT32, 'l', "&" ); + ADD_TYPE( INT32, 'l', "&" ); + ADD_TYPE( BOOL, 'b', "" ); + ADD_TYPE( BYTE, 'c', "%" ); + ADD_TYPE( float, 'f', "!" ); + ADD_TYPE( double, 'F', "#" ); + ADD_TYPE( SbxObject, 'o', "" ); // Attention! When adding types all binary data bases get incompatible @@ -73,14 +73,6 @@ SvRefMemberList<SvMetaType *>& SvIdlDataBase::GetTypeList() return aTypeList; } -SvMetaModule * SvIdlDataBase::GetModule( const OString& rName ) -{ - for( sal_uLong n = 0; n < aModuleList.size(); n++ ) - if( aModuleList[n]->GetName().getString().equals(rName) ) - return aModuleList[n]; - return nullptr; -} - void SvIdlDataBase::SetError( const OString& rError, SvToken& rTok ) { if( rTok.GetLine() > 10000 ) @@ -577,14 +569,14 @@ bool SvIdlWorkingBase::WriteSfx( SvStream & rOutStm ) void SvIdlDataBase::StartNewFile( const OUString& rName ) { - bExport = ( aExportFile.equalsIgnoreAsciiCase( rName ) ); + bExport = aExportFile.equalsIgnoreAsciiCase( rName ); + assert ( !bExport ); } void SvIdlDataBase::AppendAttr( SvMetaAttribute *pAttr ) { aAttrList.push_back( pAttr ); - if ( bExport ) - pAttr->SetNewAttribute( true ); + assert ( !bExport ); } void SvIdlDataBase::AddDepFile(OUString const& rFileName) |