loplugin:unusedmethods unused return value in include/basic

Change-Id: Ib1a006adaa92e257d40a20ff0d8beeb37e7c2fe0
Reviewed-on: https://gerrit.libreoffice.org/21360
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin 2016-01-11 14:31:00 +02:00 committed by Noel Grandin
parent a7198d38f0
commit bbfeab3b13
12 changed files with 42 additions and 53 deletions

View File

@ -1185,10 +1185,10 @@ bool BasicManager::IsReference( sal_uInt16 nLib )
return false; return false;
} }
bool BasicManager::RemoveLib( sal_uInt16 nLib ) void BasicManager::RemoveLib( sal_uInt16 nLib )
{ {
// Only physical deletion if no reference // Only physical deletion if no reference
return RemoveLib( nLib, !IsReference( nLib ) ); RemoveLib( nLib, !IsReference( nLib ) );
} }
bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ) bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage )
@ -1343,9 +1343,8 @@ OUString BasicManager::GetLibName( sal_uInt16 nLib )
return OUString(); return OUString();
} }
bool BasicManager::LoadLib( sal_uInt16 nLib ) void BasicManager::LoadLib( sal_uInt16 nLib )
{ {
bool bDone = false;
DBG_ASSERT( nLib < mpImpl->aLibs.size() , "Lib?!" ); DBG_ASSERT( nLib < mpImpl->aLibs.size() , "Lib?!" );
if ( nLib < mpImpl->aLibs.size() ) if ( nLib < mpImpl->aLibs.size() )
{ {
@ -1355,11 +1354,11 @@ bool BasicManager::LoadLib( sal_uInt16 nLib )
{ {
OUString aLibName = rLibInfo.GetLibName(); OUString aLibName = rLibInfo.GetLibName();
xLibContainer->loadLibrary( aLibName ); xLibContainer->loadLibrary( aLibName );
bDone = xLibContainer->isLibraryLoaded( aLibName ); xLibContainer->isLibraryLoaded( aLibName );
} }
else else
{ {
bDone = ImpLoadLibrary( &rLibInfo, nullptr ); ImpLoadLibrary( &rLibInfo, nullptr );
StarBASIC* pLib = GetLib( nLib ); StarBASIC* pLib = GetLib( nLib );
if ( pLib ) if ( pLib )
{ {
@ -1373,7 +1372,6 @@ bool BasicManager::LoadLib( sal_uInt16 nLib )
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), ERRCODE_BUTTON_OK ); StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::LIBNOTFOUND, OUString::number(nLib))); aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::LIBNOTFOUND, OUString::number(nLib)));
} }
return bDone;
} }
StarBASIC* BasicManager::CreateLib( const OUString& rLibName ) StarBASIC* BasicManager::CreateLib( const OUString& rLibName )

View File

@ -1696,9 +1696,9 @@ bool StarBASIC::CError( SbError code, const OUString& rMsg,
return bRet; return bRet;
} }
bool StarBASIC::RTError( SbError code, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) void StarBASIC::RTError( SbError code, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )
{ {
return RTError( code, OUString(), l, c1, c2 ); RTError( code, OUString(), l, c1, c2 );
} }
bool StarBASIC::RTError( SbError code, const OUString& rMsg, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 ) bool StarBASIC::RTError( SbError code, const OUString& rMsg, sal_Int32 l, sal_Int32 c1, sal_Int32 c2 )

View File

@ -599,7 +599,7 @@ SbProperty* SbModule::GetProperty( const OUString& rName, SbxDataType t )
return pProp; return pProp;
} }
SbProcedureProperty* SbModule::GetProcedureProperty( const OUString& rName, SbxDataType t ) void SbModule::GetProcedureProperty( const OUString& rName, SbxDataType t )
{ {
SbxVariable* p = pProps->Find( rName, SbxCLASS_PROPERTY ); SbxVariable* p = pProps->Find( rName, SbxCLASS_PROPERTY );
SbProcedureProperty* pProp = p ? dynamic_cast<SbProcedureProperty*>( p ) : nullptr; SbProcedureProperty* pProp = p ? dynamic_cast<SbProcedureProperty*>( p ) : nullptr;
@ -615,10 +615,9 @@ SbProcedureProperty* SbModule::GetProcedureProperty( const OUString& rName, SbxD
pProps->Put( pProp, pProps->Count() ); pProps->Put( pProp, pProps->Count() );
StartListening( pProp->GetBroadcaster(), true ); StartListening( pProp->GetBroadcaster(), true );
} }
return pProp;
} }
SbIfaceMapperMethod* SbModule::GetIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth ) void SbModule::GetIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth )
{ {
SbxVariable* p = pMethods->Find( rName, SbxCLASS_METHOD ); SbxVariable* p = pMethods->Find( rName, SbxCLASS_METHOD );
SbIfaceMapperMethod* pMapperMethod = p ? dynamic_cast<SbIfaceMapperMethod*>( p ) : nullptr; SbIfaceMapperMethod* pMapperMethod = p ? dynamic_cast<SbIfaceMapperMethod*>( p ) : nullptr;
@ -634,7 +633,6 @@ SbIfaceMapperMethod* SbModule::GetIfaceMapperMethod( const OUString& rName, SbMe
pMethods->Put( pMapperMethod, pMethods->Count() ); pMethods->Put( pMapperMethod, pMethods->Count() );
} }
pMapperMethod->bInvalid = false; pMapperMethod->bInvalid = false;
return pMapperMethod;
} }
SbIfaceMapperMethod::~SbIfaceMapperMethod() SbIfaceMapperMethod::~SbIfaceMapperMethod()
@ -1791,7 +1789,7 @@ bool SbModule::HasExeCode()
} }
// Store only image, no source // Store only image, no source
bool SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer ) void SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer )
{ {
bool bRet = Compile(); bool bRet = Compile();
if( bRet ) if( bRet )
@ -1818,18 +1816,16 @@ bool SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer )
pImage->aOUSource = aOUSource; pImage->aOUSource = aOUSource;
} }
} }
return bRet;
} }
// Called for >= OO 1.0 passwd protected libraries only // Called for >= OO 1.0 passwd protected libraries only
bool SbModule::LoadBinaryData( SvStream& rStrm ) void SbModule::LoadBinaryData( SvStream& rStrm )
{ {
OUString aKeepSource = aOUSource; OUString aKeepSource = aOUSource;
bool bRet = LoadData( rStrm, 2 ); LoadData( rStrm, 2 );
LoadCompleted(); LoadCompleted();
aOUSource = aKeepSource; aOUSource = aKeepSource;
return bRet;
} }
bool SbModule::LoadCompleted() bool SbModule::LoadCompleted()

View File

@ -329,7 +329,7 @@ const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const
return m_Params[n - 1].get(); return m_Params[n - 1].get();
} }
bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer ) void SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{ {
m_Params.clear(); m_Params.clear();
sal_uInt16 nParam; sal_uInt16 nParam;
@ -352,10 +352,9 @@ bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer )
SbxParamInfo& p(*m_Params.back()); SbxParamInfo& p(*m_Params.back());
p.nUserData = nUserData; p.nUserData = nUserData;
} }
return true;
} }
bool SbxInfo::StoreData( SvStream& rStrm ) const void SbxInfo::StoreData( SvStream& rStrm ) const
{ {
write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aComment, write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aComment,
RTL_TEXTENCODING_ASCII_US ); RTL_TEXTENCODING_ASCII_US );
@ -370,7 +369,6 @@ bool SbxInfo::StoreData( SvStream& rStrm ) const
.WriteUInt16( static_cast<sal_uInt16>(i->nFlags) ) .WriteUInt16( static_cast<sal_uInt16>(i->nFlags) )
.WriteUInt32( i->nUserData ); .WriteUInt32( i->nUserData );
} }
return true;
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -466,7 +466,7 @@ OUString SbxBasicFormater::GetNullFormatString( const OUString& sFormatStrg, boo
} }
// returns value <> 0 in case of an error // returns value <> 0 in case of an error
short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg, void SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
short& nNoOfDigitsLeft, short& nNoOfDigitsRight, short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
short& nNoOfOptionalDigitsLeft, short& nNoOfOptionalDigitsLeft,
short& nNoOfExponentDigits, short& nNoOfOptionalExponentDigits, short& nNoOfExponentDigits, short& nNoOfOptionalExponentDigits,
@ -528,7 +528,7 @@ short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
if( c=='0' ) if( c=='0' )
{ {
// ERROR: 0 after # in the exponent is NOT allowed!! // ERROR: 0 after # in the exponent is NOT allowed!!
return -4; return;
} }
nNoOfOptionalExponentDigits++; nNoOfOptionalExponentDigits++;
nNoOfExponentDigits++; nNoOfExponentDigits++;
@ -538,7 +538,7 @@ short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
nState++; nState++;
if( nState>1 ) if( nState>1 )
{ {
return -1; // ERROR: too many decimal points return; // ERROR: too many decimal points
} }
break; break;
case '%': case '%':
@ -577,7 +577,6 @@ short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
break; break;
} }
} }
return 0;
} }
// the flag bCreateSign says that at the mantissa a leading sign // the flag bCreateSign says that at the mantissa a leading sign

View File

@ -578,7 +578,7 @@ bool SbxValue::Put( const SbxValues& rVal )
// if Float were declared with ',' as the decimal separator or BOOl // if Float were declared with ',' as the decimal separator or BOOl
// explicit with "TRUE" or "FALSE". // explicit with "TRUE" or "FALSE".
// Implementation in ImpConvStringExt (SBXSCAN.CXX) // Implementation in ImpConvStringExt (SBXSCAN.CXX)
bool SbxValue::PutStringExt( const OUString& r ) void SbxValue::PutStringExt( const OUString& r )
{ {
// Copy; if it is Unicode convert it immediately // Copy; if it is Unicode convert it immediately
OUString aStr( r ); OUString aStr( r );
@ -621,7 +621,6 @@ bool SbxValue::PutStringExt( const OUString& r )
ResetError(); ResetError();
SetFlags( nFlags_ ); SetFlags( nFlags_ );
return bRet;
} }
bool SbxValue::PutBool( bool b ) bool SbxValue::PutBool( bool b )
@ -640,35 +639,31 @@ bool SbxValue::PutEmpty()
return bRet; return bRet;
} }
bool SbxValue::PutNull() void SbxValue::PutNull()
{ {
bool bRet = SetType( SbxNULL ); bool bRet = SetType( SbxNULL );
if( bRet ) if( bRet )
SetModified( true ); SetModified( true );
return bRet;
} }
// Special decimal methods // Special decimal methods
bool SbxValue::PutDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ) void SbxValue::PutDecimal( css::bridge::oleautomation::Decimal& rAutomationDec )
{ {
SbxValue::Clear(); SbxValue::Clear();
aData.pDecimal = new SbxDecimal( rAutomationDec ); aData.pDecimal = new SbxDecimal( rAutomationDec );
aData.pDecimal->addRef(); aData.pDecimal->addRef();
aData.eType = SbxDECIMAL; aData.eType = SbxDECIMAL;
return true;
} }
bool SbxValue::fillAutomationDecimal void SbxValue::fillAutomationDecimal
( css::bridge::oleautomation::Decimal& rAutomationDec ) const ( css::bridge::oleautomation::Decimal& rAutomationDec ) const
{ {
SbxDecimal* pDecimal = GetDecimal(); SbxDecimal* pDecimal = GetDecimal();
if( pDecimal != nullptr ) if( pDecimal != nullptr )
{ {
pDecimal->fillAutomationDecimal( rAutomationDec ); pDecimal->fillAutomationDecimal( rAutomationDec );
return true;
} }
return false;
} }
@ -686,12 +681,15 @@ bool SbxValue::PutString( const OUString& r )
bool SbxValue::p( t n ) \ bool SbxValue::p( t n ) \
{ SbxValues aRes(e); aRes.m = n; Put( aRes ); return !IsError(); } { SbxValues aRes(e); aRes.m = n; Put( aRes ); return !IsError(); }
void SbxValue::PutDate( double n )
{ SbxValues aRes(SbxDATE); aRes.nDouble = n; Put( aRes ); }
void SbxValue::PutErr( sal_uInt16 n )
{ SbxValues aRes(SbxERROR); aRes.nUShort = n; Put( aRes ); }
PUT( PutByte, SbxBYTE, sal_uInt8, nByte ) PUT( PutByte, SbxBYTE, sal_uInt8, nByte )
PUT( PutChar, SbxCHAR, sal_Unicode, nChar ) PUT( PutChar, SbxCHAR, sal_Unicode, nChar )
PUT( PutCurrency, SbxCURRENCY, const sal_Int64&, nInt64 ) PUT( PutCurrency, SbxCURRENCY, const sal_Int64&, nInt64 )
PUT( PutDate, SbxDATE, double, nDouble )
PUT( PutDouble, SbxDOUBLE, double, nDouble ) PUT( PutDouble, SbxDOUBLE, double, nDouble )
PUT( PutErr, SbxERROR, sal_uInt16, nUShort )
PUT( PutInteger, SbxINTEGER, sal_Int16, nInteger ) PUT( PutInteger, SbxINTEGER, sal_Int16, nInteger )
PUT( PutLong, SbxLONG, sal_Int32, nLong ) PUT( PutLong, SbxLONG, sal_Int32, nLong )
PUT( PutObject, SbxOBJECT, SbxBase*, pObj ) PUT( PutObject, SbxOBJECT, SbxBase*, pObj )

View File

@ -171,7 +171,7 @@ public:
const css::uno::Reference< css::script::XPersistentLibraryContainer >& const css::uno::Reference< css::script::XPersistentLibraryContainer >&
GetScriptLibraryContainer() const; GetScriptLibraryContainer() const;
bool LoadLib( sal_uInt16 nLib ); void LoadLib( sal_uInt16 nLib );
bool RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ); bool RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage );
// Modify-Flag will be reset only during save. // Modify-Flag will be reset only during save.
@ -208,7 +208,7 @@ private:
BASIC_DLLPRIVATE StarBASIC* GetStdLib() const; BASIC_DLLPRIVATE StarBASIC* GetStdLib() const;
BASIC_DLLPRIVATE StarBASIC* AddLib( SotStorage& rStorage, const OUString& rLibName, bool bReference ); BASIC_DLLPRIVATE StarBASIC* AddLib( SotStorage& rStorage, const OUString& rLibName, bool bReference );
BASIC_DLLPRIVATE bool RemoveLib( sal_uInt16 nLib ); BASIC_DLLPRIVATE void RemoveLib( sal_uInt16 nLib );
BASIC_DLLPRIVATE bool HasLib( const OUString& rName ) const; BASIC_DLLPRIVATE bool HasLib( const OUString& rName ) const;
BASIC_DLLPRIVATE StarBASIC* CreateLibForLibContainer( const OUString& rLibName, BASIC_DLLPRIVATE StarBASIC* CreateLibForLibContainer( const OUString& rLibName,

View File

@ -75,8 +75,8 @@ protected:
void StartDefinitions(); void StartDefinitions();
SbMethod* GetMethod( const OUString&, SbxDataType ); SbMethod* GetMethod( const OUString&, SbxDataType );
SbProperty* GetProperty( const OUString&, SbxDataType ); SbProperty* GetProperty( const OUString&, SbxDataType );
SbProcedureProperty* GetProcedureProperty( const OUString&, SbxDataType ); void GetProcedureProperty( const OUString&, SbxDataType );
SbIfaceMapperMethod* GetIfaceMapperMethod( const OUString&, SbMethod* ); void GetIfaceMapperMethod( const OUString&, SbMethod* );
void EndDefinitions( bool=false ); void EndDefinitions( bool=false );
void Run( SbMethod* ); void Run( SbMethod* );
void RunInit(); void RunInit();
@ -116,8 +116,8 @@ public:
void ClearAllBP(); void ClearAllBP();
// Store only image, no source (needed for new password protection) // Store only image, no source (needed for new password protection)
bool StoreBinaryData( SvStream&, sal_uInt16 nVer ); void StoreBinaryData( SvStream&, sal_uInt16 nVer );
bool LoadBinaryData( SvStream& ); void LoadBinaryData( SvStream& );
bool ExceedsLegacyModuleSize(); bool ExceedsLegacyModuleSize();
void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = nullptr ) const; void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = nullptr ) const;
bool HasExeCode(); bool HasExeCode();

View File

@ -71,7 +71,7 @@ class BASIC_DLLPUBLIC StarBASIC : public SbxObject
protected: protected:
bool CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 ); bool CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
private: private:
BASIC_DLLPRIVATE bool RTError( SbError, sal_Int32, sal_Int32, sal_Int32 ); BASIC_DLLPRIVATE void RTError( SbError, sal_Int32, sal_Int32, sal_Int32 );
BASIC_DLLPRIVATE bool RTError( SbError, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 ); BASIC_DLLPRIVATE bool RTError( SbError, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
BASIC_DLLPRIVATE sal_uInt16 BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 ); BASIC_DLLPRIVATE sal_uInt16 BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
BASIC_DLLPRIVATE sal_uInt16 StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 ); BASIC_DLLPRIVATE sal_uInt16 StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );

View File

@ -74,8 +74,8 @@ class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
void operator=(SbxInfo const&) = delete; void operator=(SbxInfo const&) = delete;
protected: protected:
bool LoadData( SvStream&, sal_uInt16 ); void LoadData( SvStream&, sal_uInt16 );
bool StoreData( SvStream& ) const; void StoreData( SvStream& ) const;
virtual ~SbxInfo(); virtual ~SbxInfo();
public: public:
SbxInfo(); SbxInfo();

View File

@ -133,7 +133,7 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
BASIC_DLLPRIVATE OUString GetNegFormatString( const OUString& sFormatStrg, bool & bFound ); BASIC_DLLPRIVATE OUString GetNegFormatString( const OUString& sFormatStrg, bool & bFound );
BASIC_DLLPRIVATE OUString Get0FormatString( const OUString& sFormatStrg, bool & bFound ); BASIC_DLLPRIVATE OUString Get0FormatString( const OUString& sFormatStrg, bool & bFound );
BASIC_DLLPRIVATE OUString GetNullFormatString( const OUString& sFormatStrg, bool & bFound ); BASIC_DLLPRIVATE OUString GetNullFormatString( const OUString& sFormatStrg, bool & bFound );
BASIC_DLLPRIVATE short AnalyseFormatString( const OUString& sFormatStrg, BASIC_DLLPRIVATE void AnalyseFormatString( const OUString& sFormatStrg,
short& nNoOfDigitsLeft, short& nNoOfDigitsRight, short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
short& nNoOfOptionalDigitsLeft, short& nNoOfOptionalDigitsLeft,
short& nNoOfExponentDigits, short& nNoOfExponentDigits,

View File

@ -158,10 +158,10 @@ public:
bool PutLong( sal_Int32 ); bool PutLong( sal_Int32 );
bool PutSingle( float ); bool PutSingle( float );
bool PutDouble( double ); bool PutDouble( double );
bool PutDate( double ); void PutDate( double );
bool PutBool( bool ); bool PutBool( bool );
bool PutErr( sal_uInt16 ); void PutErr( sal_uInt16 );
bool PutStringExt( const OUString& ); // with extended analysis (International, "sal_True"/"sal_False") void PutStringExt( const OUString& ); // with extended analysis (International, "sal_True"/"sal_False")
bool PutInt64( sal_Int64 ); bool PutInt64( sal_Int64 );
bool PutUInt64( sal_uInt64 ); bool PutUInt64( sal_uInt64 );
bool PutString( const OUString& ); bool PutString( const OUString& );
@ -170,12 +170,12 @@ public:
bool PutUShort( sal_uInt16 ); bool PutUShort( sal_uInt16 );
bool PutULong( sal_uInt32 ); bool PutULong( sal_uInt32 );
bool PutEmpty(); bool PutEmpty();
bool PutNull(); void PutNull();
// Special methods // Special methods
bool PutDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ); void PutDecimal( css::bridge::oleautomation::Decimal& rAutomationDec );
bool PutDecimal( SbxDecimal* pDecimal ); // This function is needed for Windows build, don't remove bool PutDecimal( SbxDecimal* pDecimal ); // This function is needed for Windows build, don't remove
bool fillAutomationDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ) const; void fillAutomationDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ) const;
bool PutCurrency( const sal_Int64& ); bool PutCurrency( const sal_Int64& );
// Interface for CDbl in Basic // Interface for CDbl in Basic
static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false ); static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );