[Libreoffice-commits] core.git: basic/source include/basic

Noel Grandin noel at peralex.com
Mon Jan 11 22:40:27 PST 2016


 basic/source/basmgr/basmgr.cxx  |   12 +++++-------
 basic/source/classes/sb.cxx     |    4 ++--
 basic/source/classes/sbxmod.cxx |   14 +++++---------
 basic/source/sbx/sbxbase.cxx    |    6 ++----
 basic/source/sbx/sbxform.cxx    |    7 +++----
 basic/source/sbx/sbxvalue.cxx   |   20 +++++++++-----------
 include/basic/basmgr.hxx        |    4 ++--
 include/basic/sbmod.hxx         |    8 ++++----
 include/basic/sbstar.hxx        |    2 +-
 include/basic/sbx.hxx           |    4 ++--
 include/basic/sbxform.hxx       |    2 +-
 include/basic/sbxvar.hxx        |   12 ++++++------
 12 files changed, 42 insertions(+), 53 deletions(-)

New commits:
commit bbfeab3b13b48c99cfa2f94c8c34bc3efef7faa9
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jan 11 14:31:00 2016 +0200

    loplugin:unusedmethods unused return value in include/basic
    
    Change-Id: Ib1a006adaa92e257d40a20ff0d8beeb37e7c2fe0
    Reviewed-on: https://gerrit.libreoffice.org/21360
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 8b1eced..ac45383 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1185,10 +1185,10 @@ bool BasicManager::IsReference( sal_uInt16 nLib )
     return false;
 }
 
-bool BasicManager::RemoveLib( sal_uInt16 nLib )
+void BasicManager::RemoveLib( sal_uInt16 nLib )
 {
     // Only physical deletion if no reference
-    return RemoveLib( nLib, !IsReference( nLib ) );
+    RemoveLib( nLib, !IsReference( nLib ) );
 }
 
 bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage )
@@ -1343,9 +1343,8 @@ OUString BasicManager::GetLibName( sal_uInt16 nLib )
     return OUString();
 }
 
-bool BasicManager::LoadLib( sal_uInt16 nLib )
+void BasicManager::LoadLib( sal_uInt16 nLib )
 {
-    bool bDone = false;
     DBG_ASSERT( nLib < mpImpl->aLibs.size() , "Lib?!" );
     if ( nLib < mpImpl->aLibs.size() )
     {
@@ -1355,11 +1354,11 @@ bool BasicManager::LoadLib( sal_uInt16 nLib )
         {
             OUString aLibName = rLibInfo.GetLibName();
             xLibContainer->loadLibrary( aLibName );
-            bDone = xLibContainer->isLibraryLoaded( aLibName );
+            xLibContainer->isLibraryLoaded( aLibName );
         }
         else
         {
-            bDone = ImpLoadLibrary( &rLibInfo, nullptr );
+            ImpLoadLibrary( &rLibInfo, nullptr );
             StarBASIC* pLib = GetLib( nLib );
             if ( pLib )
             {
@@ -1373,7 +1372,6 @@ bool BasicManager::LoadLib( sal_uInt16 nLib )
         StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), ERRCODE_BUTTON_OK );
         aErrors.push_back(BasicError(*pErrInf, BasicErrorReason::LIBNOTFOUND, OUString::number(nLib)));
     }
-    return bDone;
 }
 
 StarBASIC* BasicManager::CreateLib( const OUString& rLibName )
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index cd713e4..90f4a50 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1696,9 +1696,9 @@ bool StarBASIC::CError( SbError code, const OUString& rMsg,
     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 )
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index c025a9c..7244c8b 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -599,7 +599,7 @@ SbProperty* SbModule::GetProperty( const OUString& rName, SbxDataType t )
     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 );
     SbProcedureProperty* pProp = p ? dynamic_cast<SbProcedureProperty*>( p ) : nullptr;
@@ -615,10 +615,9 @@ SbProcedureProperty* SbModule::GetProcedureProperty( const OUString& rName, SbxD
         pProps->Put( pProp, pProps->Count() );
         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 );
     SbIfaceMapperMethod* pMapperMethod = p ? dynamic_cast<SbIfaceMapperMethod*>( p ) : nullptr;
@@ -634,7 +633,6 @@ SbIfaceMapperMethod* SbModule::GetIfaceMapperMethod( const OUString& rName, SbMe
         pMethods->Put( pMapperMethod, pMethods->Count() );
     }
     pMapperMethod->bInvalid = false;
-    return pMapperMethod;
 }
 
 SbIfaceMapperMethod::~SbIfaceMapperMethod()
@@ -1791,7 +1789,7 @@ bool SbModule::HasExeCode()
 }
 
 // Store only image, no source
-bool SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer )
+void SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer )
 {
     bool bRet = Compile();
     if( bRet )
@@ -1818,18 +1816,16 @@ bool SbModule::StoreBinaryData( SvStream& rStrm, sal_uInt16 nVer )
             pImage->aOUSource = aOUSource;
         }
     }
-    return bRet;
 }
 
 // Called for >= OO 1.0 passwd protected libraries only
 
-bool SbModule::LoadBinaryData( SvStream& rStrm )
+void SbModule::LoadBinaryData( SvStream& rStrm )
 {
     OUString aKeepSource = aOUSource;
-    bool bRet = LoadData( rStrm, 2 );
+    LoadData( rStrm, 2 );
     LoadCompleted();
     aOUSource = aKeepSource;
-    return bRet;
 }
 
 bool SbModule::LoadCompleted()
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 12bb9b7..2e75329 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -329,7 +329,7 @@ const SbxParamInfo* SbxInfo::GetParam( sal_uInt16 n ) const
         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();
     sal_uInt16 nParam;
@@ -352,10 +352,9 @@ bool SbxInfo::LoadData( SvStream& rStrm, sal_uInt16 nVer )
         SbxParamInfo& p(*m_Params.back());
         p.nUserData = nUserData;
     }
-    return true;
 }
 
-bool SbxInfo::StoreData( SvStream& rStrm ) const
+void SbxInfo::StoreData( SvStream& rStrm ) const
 {
     write_uInt16_lenPrefixed_uInt8s_FromOUString(rStrm, aComment,
         RTL_TEXTENCODING_ASCII_US );
@@ -370,7 +369,6 @@ bool SbxInfo::StoreData( SvStream& rStrm ) const
              .WriteUInt16( static_cast<sal_uInt16>(i->nFlags) )
              .WriteUInt32( i->nUserData );
     }
-    return true;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 26e9aa5..1eff210 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -466,7 +466,7 @@ OUString SbxBasicFormater::GetNullFormatString( const OUString& sFormatStrg, boo
 }
 
 // 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& nNoOfOptionalDigitsLeft,
                 short& nNoOfExponentDigits, short& nNoOfOptionalExponentDigits,
@@ -528,7 +528,7 @@ short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
                 if( c=='0' )
                 {
                     // ERROR: 0 after # in the exponent is NOT allowed!!
-                    return -4;
+                    return;
                 }
                 nNoOfOptionalExponentDigits++;
                 nNoOfExponentDigits++;
@@ -538,7 +538,7 @@ short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
             nState++;
             if( nState>1 )
             {
-                return -1;  // ERROR: too many decimal points
+                return;  // ERROR: too many decimal points
             }
             break;
         case '%':
@@ -577,7 +577,6 @@ short SbxBasicFormater::AnalyseFormatString( const OUString& sFormatStrg,
             break;
         }
     }
-    return 0;
 }
 
 // the flag bCreateSign says that at the mantissa a leading sign
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index dc1a144..e8816a7 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -578,7 +578,7 @@ bool SbxValue::Put( const SbxValues& rVal )
 // if Float were declared with ',' as the decimal separator or BOOl
 // explicit with "TRUE" or "FALSE".
 // 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
     OUString aStr( r );
@@ -621,7 +621,6 @@ bool SbxValue::PutStringExt( const OUString& r )
         ResetError();
 
     SetFlags( nFlags_ );
-    return bRet;
 }
 
 bool SbxValue::PutBool( bool b )
@@ -640,35 +639,31 @@ bool SbxValue::PutEmpty()
     return bRet;
 }
 
-bool SbxValue::PutNull()
+void SbxValue::PutNull()
 {
     bool bRet = SetType( SbxNULL );
     if( bRet )
         SetModified( true );
-    return bRet;
 }
 
 
 // Special decimal methods
-bool SbxValue::PutDecimal( css::bridge::oleautomation::Decimal& rAutomationDec )
+void SbxValue::PutDecimal( css::bridge::oleautomation::Decimal& rAutomationDec )
 {
     SbxValue::Clear();
     aData.pDecimal = new SbxDecimal( rAutomationDec );
     aData.pDecimal->addRef();
     aData.eType = SbxDECIMAL;
-    return true;
 }
 
-bool SbxValue::fillAutomationDecimal
+void SbxValue::fillAutomationDecimal
     ( css::bridge::oleautomation::Decimal& rAutomationDec ) const
 {
     SbxDecimal* pDecimal = GetDecimal();
     if( pDecimal != nullptr )
     {
         pDecimal->fillAutomationDecimal( rAutomationDec );
-        return true;
     }
-    return false;
 }
 
 
@@ -686,12 +681,15 @@ bool SbxValue::PutString( const OUString& r )
 bool SbxValue::p( t n ) \
 { 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( PutChar,     SbxCHAR,       sal_Unicode,      nChar )
 PUT( PutCurrency, SbxCURRENCY,   const sal_Int64&, nInt64 )
-PUT( PutDate,     SbxDATE,       double,           nDouble )
 PUT( PutDouble,   SbxDOUBLE,     double,           nDouble )
-PUT( PutErr,      SbxERROR,      sal_uInt16,       nUShort )
 PUT( PutInteger,  SbxINTEGER,    sal_Int16,        nInteger )
 PUT( PutLong,     SbxLONG,       sal_Int32,        nLong )
 PUT( PutObject,   SbxOBJECT,     SbxBase*,         pObj )
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
index 8900f09..dac109f 100644
--- a/include/basic/basmgr.hxx
+++ b/include/basic/basmgr.hxx
@@ -171,7 +171,7 @@ public:
     const css::uno::Reference< css::script::XPersistentLibraryContainer >&
                     GetScriptLibraryContainer()  const;
 
-    bool            LoadLib( sal_uInt16 nLib );
+    void            LoadLib( sal_uInt16 nLib );
     bool            RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage );
 
     // Modify-Flag will be reset only during save.
@@ -208,7 +208,7 @@ private:
 
     BASIC_DLLPRIVATE StarBASIC* GetStdLib() const;
     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 StarBASIC* CreateLibForLibContainer( const OUString& rLibName,
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
index 95e1bdb..dc07ba7 100644
--- a/include/basic/sbmod.hxx
+++ b/include/basic/sbmod.hxx
@@ -75,8 +75,8 @@ protected:
     void            StartDefinitions();
     SbMethod*       GetMethod( const OUString&, SbxDataType );
     SbProperty*     GetProperty( const OUString&, SbxDataType );
-    SbProcedureProperty* GetProcedureProperty( const OUString&, SbxDataType );
-    SbIfaceMapperMethod* GetIfaceMapperMethod( const OUString&, SbMethod* );
+    void            GetProcedureProperty( const OUString&, SbxDataType );
+    void            GetIfaceMapperMethod( const OUString&, SbMethod* );
     void            EndDefinitions( bool=false );
     void            Run( SbMethod* );
     void            RunInit();
@@ -116,8 +116,8 @@ public:
     void ClearAllBP();
 
     // Store only image, no source (needed for new password protection)
-    bool     StoreBinaryData( SvStream&, sal_uInt16 nVer );
-    bool     LoadBinaryData( SvStream& );
+    void     StoreBinaryData( SvStream&, sal_uInt16 nVer );
+    void     LoadBinaryData( SvStream& );
     bool     ExceedsLegacyModuleSize();
     void     fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = nullptr ) const;
     bool     HasExeCode();
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
index 0f59a5c..5df1f1f 100644
--- a/include/basic/sbstar.hxx
+++ b/include/basic/sbstar.hxx
@@ -71,7 +71,7 @@ class BASIC_DLLPUBLIC StarBASIC : public SbxObject
 protected:
     bool                                CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
 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 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 );
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
index 20249ed..96dc1ac 100644
--- a/include/basic/sbx.hxx
+++ b/include/basic/sbx.hxx
@@ -74,8 +74,8 @@ class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
     void operator=(SbxInfo const&) = delete;
 
 protected:
-    bool LoadData( SvStream&, sal_uInt16 );
-    bool StoreData( SvStream& ) const;
+    void LoadData( SvStream&, sal_uInt16 );
+    void StoreData( SvStream& ) const;
     virtual ~SbxInfo();
 public:
     SbxInfo();
diff --git a/include/basic/sbxform.hxx b/include/basic/sbxform.hxx
index 4a2f044..ff32b37 100644
--- a/include/basic/sbxform.hxx
+++ b/include/basic/sbxform.hxx
@@ -133,7 +133,7 @@ class BASIC_DLLPUBLIC SbxBasicFormater {
     BASIC_DLLPRIVATE OUString GetNegFormatString( 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 short  AnalyseFormatString( const OUString& sFormatStrg,
+    BASIC_DLLPRIVATE void     AnalyseFormatString( const OUString& sFormatStrg,
                                                  short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
                                                  short& nNoOfOptionalDigitsLeft,
                                                  short& nNoOfExponentDigits,
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
index 46092c7..2f56372 100644
--- a/include/basic/sbxvar.hxx
+++ b/include/basic/sbxvar.hxx
@@ -158,10 +158,10 @@ public:
     bool PutLong( sal_Int32 );
     bool PutSingle( float );
     bool PutDouble( double );
-    bool PutDate( double );
+    void PutDate( double );
     bool PutBool( bool );
-    bool PutErr( sal_uInt16 );
-    bool PutStringExt( const OUString& );     // with extended analysis (International, "sal_True"/"sal_False")
+    void PutErr( sal_uInt16 );
+    void PutStringExt( const OUString& );     // with extended analysis (International, "sal_True"/"sal_False")
     bool PutInt64( sal_Int64 );
     bool PutUInt64( sal_uInt64 );
     bool PutString( const OUString& );
@@ -170,12 +170,12 @@ public:
     bool PutUShort( sal_uInt16 );
     bool PutULong( sal_uInt32 );
     bool PutEmpty();
-    bool PutNull();
+    void PutNull();
 
             // 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 fillAutomationDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ) const;
+    void fillAutomationDecimal( css::bridge::oleautomation::Decimal& rAutomationDec ) const;
     bool PutCurrency( const sal_Int64& );
             // Interface for CDbl in Basic
     static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );


More information about the Libreoffice-commits mailing list