diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-10 11:07:36 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-04-13 09:37:12 +0200 |
commit | ee094bd46f55118993c72af719dc046476f9f311 (patch) | |
tree | d4658be34517150ec7881e7929e38f533ff0b393 | |
parent | 26ec80f47df1b32c5e1ae8c96d597ef8c90fee86 (diff) |
loplugin:staticmethods
Change-Id: If97f01a05294fa7efd59a8934c7b6f65cda5084a
25 files changed, 61 insertions, 49 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 5253ea982794..64c1343796c6 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -284,7 +284,7 @@ void ModulWindow::CheckCompileBasic() bool bWasModified = GetBasic()->IsModified(); - bDone = GetBasic()->Compile( xModule ); + bDone = StarBASIC::Compile( xModule ); if ( !bWasModified ) GetBasic()->SetModified(false); diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 72888568ff68..a27aa8ebead9 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -628,9 +628,9 @@ void EditorWindow::HandleAutoCorrect() if( r.tokenType == TT_KEYWORDS ) { sStr = sStr.toAsciiLowerCase(); - if( !rModulWindow.GetSbModule()->GetKeywordCase(sStr).isEmpty() ) + if( !SbModule::GetKeywordCase(sStr).isEmpty() ) // if it is a keyword, get its correct case - sStr = rModulWindow.GetSbModule()->GetKeywordCase(sStr); + sStr = SbModule::GetKeywordCase(sStr); else // else capitalize first letter/select the correct one, and replace sStr = sStr.replaceAt( 0, 1, OUString(sStr[0]).toAsciiUpperCase() ); diff --git a/basic/inc/sbstdobj.hxx b/basic/inc/sbstdobj.hxx index ae7ab2dc7368..40cd961400de 100644 --- a/basic/inc/sbstdobj.hxx +++ b/basic/inc/sbstdobj.hxx @@ -109,12 +109,12 @@ protected: virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ) SAL_OVERRIDE; - void MethClear( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); - void MethGetData( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); - void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); - void MethGetText( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); - void MethSetData( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); - void MethSetText( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); + static void MethClear( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); + static void MethGetData( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); + static void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); + static void MethGetText( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); + static void MethSetData( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); + static void MethSetText( SbxVariable* pVar, SbxArray* pPar_, bool bWrite ); public: TYPEINFO_OVERRIDE(); diff --git a/basic/qa/cppunit/basictest.hxx b/basic/qa/cppunit/basictest.hxx index 684da80cdc90..8bb5992705dc 100644 --- a/basic/qa/cppunit/basictest.hxx +++ b/basic/qa/cppunit/basictest.hxx @@ -126,7 +126,7 @@ class MacroSnippet DECL_LINK( BasicErrorHdl, StarBASIC * ); - ErrorDetail GetError() + static ErrorDetail GetError() { ErrorDetail aErr; aErr.sErrorText = StarBASIC::GetErrorText(); diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index 45b63f2fcaa3..9da674b4c603 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -148,7 +148,7 @@ namespace basic <arg>_out_rStorage</arg> might or might not be <NULL/>), <FALSE/> otherwise. In the latter case, processing this document should stop. */ - bool impl_getDocumentStorage_nothrow( const Reference< XModel >& _rxDocument, Reference< XStorage >& _out_rStorage ); + static bool impl_getDocumentStorage_nothrow( const Reference< XModel >& _rxDocument, Reference< XStorage >& _out_rStorage ); /** retrieves the containers for Basic and Dialog libraries for a given document @@ -164,7 +164,7 @@ namespace basic @return <TRUE/> if and only if both containers exist, and could successfully be retrieved */ - bool impl_getDocumentLibraryContainers_nothrow( + static bool impl_getDocumentLibraryContainers_nothrow( const Reference< XModel >& _rxDocument, Reference< XPersistentLibraryContainer >& _out_rxBasicLibraries, Reference< XPersistentLibraryContainer >& _out_rxDialogLibraries @@ -172,7 +172,7 @@ namespace basic /** initializes the given library containers, which belong to a document */ - void impl_initDocLibraryContainers_nothrow( + static void impl_initDocLibraryContainers_nothrow( const Reference< XPersistentLibraryContainer >& _rxBasicLibraries, const Reference< XPersistentLibraryContainer >& _rxDialogLibraries ); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 6d491e3f394e..795b97207ef4 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -1059,7 +1059,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora return false; } -bool BasicManager::ImplEncryptStream( SvStream& rStrm ) const +bool BasicManager::ImplEncryptStream( SvStream& rStrm ) { sal_Size nPos = rStrm.Tell(); sal_uInt32 nCreator; @@ -1114,7 +1114,7 @@ bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) con return bLoaded; } -void BasicManager::CheckModules( StarBASIC* pLib, bool bReference ) const +void BasicManager::CheckModules( StarBASIC* pLib, bool bReference ) { if ( !pLib ) { @@ -1128,7 +1128,7 @@ void BasicManager::CheckModules( StarBASIC* pLib, bool bReference ) const DBG_ASSERT( pModule, "Module not received!" ); if ( !pModule->IsCompiled() && !StarBASIC::GetErrorCode() ) { - pLib->Compile( pModule ); + StarBASIC::Compile( pModule ); } } diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index c2b0e793df8a..36c852042847 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -466,7 +466,7 @@ public: return dInst; } - void QuitApplication() + static void QuitApplication() { uno::Reference< frame::XDesktop2 > xDeskTop = frame::Desktop::create( comphelper::getProcessComponentContext() ); xDeskTop->terminate(); @@ -1784,7 +1784,7 @@ void SbModule::GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache) } -OUString SbModule::GetKeywordCase( const OUString& sKeyword ) const +OUString SbModule::GetKeywordCase( const OUString& sKeyword ) { return SbiParser::GetKeywordCase( sKeyword ); } diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index 8b199c4faa4d..691fd9a79e64 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -408,7 +408,7 @@ class PCodeBufferWalker private: T m_nBytes; sal_uInt8* m_pCode; - T readParam( sal_uInt8*& pCode ) + static T readParam( sal_uInt8*& pCode ) { short nBytes = sizeof( T ); T nOp1=0; diff --git a/basic/source/inc/basiccharclass.hxx b/basic/source/inc/basiccharclass.hxx index e6fea6545eee..d625ae312b37 100644 --- a/basic/source/inc/basiccharclass.hxx +++ b/basic/source/inc/basiccharclass.hxx @@ -33,7 +33,7 @@ public: BasicCharClass(); bool isLetter( sal_Unicode c ); - bool isLetterUnicode( sal_Unicode c ); + static bool isLetterUnicode( sal_Unicode c ); bool isAlpha( sal_Unicode c, bool bCompatible ); bool isAlphaNumeric( sal_Unicode c, bool bCompatible ); static bool isWhitespace( sal_Unicode c ); diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx index c7258f5337fb..9e20a0865363 100644 --- a/basic/source/inc/namecont.hxx +++ b/basic/source/inc/namecont.hxx @@ -389,7 +389,7 @@ public: } void enterMethod(); - void leaveMethod(); + static void leaveMethod(); bool isDisposed() const { return rBHelper.bInDispose || rBHelper.bDisposed; } void checkDisposed() const; @@ -540,18 +540,15 @@ public: class LibraryContainerMethodGuard { -private: - SfxLibraryContainer& m_rContainer; public: LibraryContainerMethodGuard( SfxLibraryContainer& _rContainer ) - :m_rContainer( _rContainer ) { - m_rContainer.enterMethod(); + _rContainer.enterMethod(); } ~LibraryContainerMethodGuard() { - m_rContainer.leaveMethod(); + basic::SfxLibraryContainer::leaveMethod(); } }; @@ -732,7 +729,7 @@ class ScriptSubPackageIterator sal_Int32 m_nSubPkgCount; sal_Int32 m_iNextSubPkg; - com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > + static com::sun::star::uno::Reference< com::sun::star::deployment::XPackage > implDetectScriptPackage( const com::sun::star::uno::Reference < com::sun::star::deployment::XPackage >& rPackage, bool& rbPureDialogLib ); diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx index 0e39423b48c4..018b8955a2e2 100644 --- a/basic/source/inc/parser.hxx +++ b/basic/source/inc/parser.hxx @@ -58,7 +58,7 @@ class SbiParser : public SbiTokenizer void DefEnum( bool bPrivate ); // Parse enum declaration void DefDeclare( bool bPrivate ); void EnableCompatibility(); - bool IsUnoInterface( const OUString& sTypeName ); + static bool IsUnoInterface( const OUString& sTypeName ); public: SbxArrayRef rTypeArray; SbxArrayRef rEnumArray; diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx index 4c8e99df7458..33758e30d252 100644 --- a/basic/source/inc/runtime.hxx +++ b/basic/source/inc/runtime.hxx @@ -330,7 +330,7 @@ class SbiRuntime // #56204 swap out DIM-functionality into help method (step0.cxx) void DimImpl( SbxVariableRef refVar ); - bool implIsClass( SbxObject* pObj, const OUString& aClass ); + static bool implIsClass( SbxObject* pObj, const OUString& aClass ); void StepSETCLASS_impl( sal_uInt32 nOp1, bool bHandleDflt = false ); @@ -380,7 +380,7 @@ class SbiRuntime void StepDCREATE_REDIMP(sal_uInt32,sal_uInt32), StepDCREATE_IMPL(sal_uInt32,sal_uInt32); void StepFIND_CM( sal_uInt32, sal_uInt32 ); void StepFIND_STATIC( sal_uInt32, sal_uInt32 ); - void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 ); + static void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt32 nOp2 ); public: void SetVBAEnabled( bool bEnabled ); bool IsImageFlag( SbiImageFlags n ) const; diff --git a/basic/source/inc/stdobj.hxx b/basic/source/inc/stdobj.hxx index 52b144196607..ccd4d70f4ca2 100644 --- a/basic/source/inc/stdobj.hxx +++ b/basic/source/inc/stdobj.hxx @@ -29,9 +29,9 @@ class SbiStdObject : public SbxObject { SbStdFactory* pStdFactory; - virtual ~SbiStdObject(); + virtual ~SbiStdObject(); using SbxVariable::GetInfo; - SbxInfo* GetInfo( short ); + static SbxInfo* GetInfo( short ); virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, const SfxHint& rHint, const TypeId& rHintType ) SAL_OVERRIDE; public: diff --git a/basic/source/runtime/ddectrl.hxx b/basic/source/runtime/ddectrl.hxx index 1f0a9624cb24..0bcfd32d94d5 100644 --- a/basic/source/runtime/ddectrl.hxx +++ b/basic/source/runtime/ddectrl.hxx @@ -30,7 +30,7 @@ class SbiDdeControl { private: DECL_LINK( Data, DdeData* ); - SbError GetLastErr( DdeConnection* ); + static SbError GetLastErr( DdeConnection* ); size_t GetFreeChannel(); std::vector<DdeConnection*> aConvList; OUString aData; diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx index e59a48f60072..aaa4f6b798d6 100644 --- a/compilerplugins/clang/staticmethods.cxx +++ b/compilerplugins/clang/staticmethods.cxx @@ -103,7 +103,8 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl) return true; } // the DDE has a dummy implementation on Linux and a real one on Windows - if (getFilename(pCXXMethodDecl->getCanonicalDecl()->getLocStart()) == SRCDIR "/include/svl/svdde.hxx") { + std::string aFilename = getFilename(pCXXMethodDecl->getCanonicalDecl()->getLocStart()); + if (aFilename == SRCDIR "/include/svl/svdde.hxx") { return true; } std::string aParentName = pCXXMethodDecl->getParent()->getQualifiedNameAsString(); @@ -127,10 +128,17 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl) return true; } // the unotools and svl config code stuff is doing weird stuff with a reference-counted statically allocated pImpl class - if (startsWith(getFilename(pCXXMethodDecl->getCanonicalDecl()->getLocStart()), SRCDIR "/include/unotools")) { + if (startsWith(aFilename, SRCDIR "/include/unotools")) { return true; } - if (startsWith(getFilename(pCXXMethodDecl->getCanonicalDecl()->getLocStart()), SRCDIR "/include/svl")) { + if (startsWith(aFilename, SRCDIR "/include/svl")) { + return true; + } + if (startsWith(aFilename, SRCDIR "/include/framework") || startsWith(aFilename, SRCDIR "/framework")) { + return true; + } + // there is some odd stuff happening here I don't fully understand, leave it for now + if (startsWith(aFilename, SRCDIR "/include/canvas") || startsWith(aFilename, SRCDIR "/canvas")) { return true; } // classes that have static data and some kind of weird reference-counting trick in it's constructor @@ -145,7 +153,14 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl) std::string fqn = aParentName + "::" + pCXXMethodDecl->getNameAsString(); // only empty on Linux, not on windows if (fqn == "OleEmbeddedObject::GetVisualRepresentationInNativeFormat_Impl" - || fqn == "OleEmbeddedObject::GetRidOfComponent") { + || fqn == "OleEmbeddedObject::GetRidOfComponent" + || fqn == "connectivity::mozab::ProfileAccess::isProfileLocked" + || startsWith(fqn, "SbxDecimal::") + || fqn == "SbiDllMgr::Call" || fqn == "SbiDllMgr::FreeDll") { + return true; + } + // used in a function-pointer-table + if (startsWith(fqn, "SbiRuntime::Step")) { return true; } diff --git a/filter/source/graphicfilter/idxf/dxf2mtf.hxx b/filter/source/graphicfilter/idxf/dxf2mtf.hxx index 354cd09734ab..3adc4eee9aff 100644 --- a/filter/source/graphicfilter/idxf/dxf2mtf.hxx +++ b/filter/source/graphicfilter/idxf/dxf2mtf.hxx @@ -53,7 +53,7 @@ private: Color aActFillColor; vcl::Font aActFont; - sal_uLong CountEntities(const DXFEntities & rEntities); + static sal_uLong CountEntities(const DXFEntities & rEntities); Color ConvertColor(sal_uInt8 nColor); diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index 4a77e38f1c3b..874f62717462 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -399,7 +399,7 @@ private: sal_uLong ReadLittleEndian3BytesLong(); long ReadCoord(bool b32); Point ReadPoint( const bool bAdjustBoundRect = true ); - RasterOp OS2MixToRasterOp(sal_uInt8 nMix); + static RasterOp OS2MixToRasterOp(sal_uInt8 nMix); void ReadLine(bool bGivenPos, sal_uInt16 nOrderLen); void ReadRelLine(bool bGivenPos, sal_uInt16 nOrderLen); void ReadBox(bool bGivenPos); diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx index fdad8f5e1056..156d6ecaf8b2 100644 --- a/include/basic/basmgr.hxx +++ b/include/basic/basmgr.hxx @@ -138,9 +138,9 @@ protected: void LoadBasicManager( SotStorage& rStorage, const OUString& rBaseURL, bool bLoadBasics = true ); void LoadOldBasicManager( SotStorage& rStorage ); bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const; - bool ImplEncryptStream( SvStream& rStream ) const; + static bool ImplEncryptStream( SvStream& rStream ); BasicLibInfo* FindLibInfo( StarBASIC* pBasic ); - void CheckModules( StarBASIC* pBasic, bool bReference ) const; + static void CheckModules( StarBASIC* pBasic, bool bReference ); virtual ~BasicManager(); public: diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx index 5aaafa73ea3b..9f2a5d82af03 100644 --- a/include/basic/sbmod.hxx +++ b/include/basic/sbmod.hxx @@ -137,7 +137,7 @@ public: bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ); void GetCodeCompleteDataFromParse(CodeCompleteDataCache& aCache); SbxArrayRef GetMethods() { return pMethods;} - OUString GetKeywordCase( const OUString& sKeyword ) const; + static OUString GetKeywordCase( const OUString& sKeyword ); }; typedef tools::SvRef<SbModule> SbModuleRef; diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx index 105bf944c419..327027bee041 100644 --- a/include/basic/sbstar.hxx +++ b/include/basic/sbstar.hxx @@ -109,7 +109,7 @@ public: SbModule* MakeModule( const OUString& rName, const OUString& rSrc ); SbModule* MakeModule32( const OUString& rName, const OUString& rSrc ); SbModule* MakeModule32( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, const OUString& rSrc ); - bool Compile( SbModule* ); + static bool Compile( SbModule* ); static void Stop(); static void Error( SbError ); static void Error( SbError, const OUString& rMsg ); diff --git a/scripting/source/provider/MasterScriptProvider.hxx b/scripting/source/provider/MasterScriptProvider.hxx index e321a2cac131..74523bbae442 100644 --- a/scripting/source/provider/MasterScriptProvider.hxx +++ b/scripting/source/provider/MasterScriptProvider.hxx @@ -112,7 +112,7 @@ public: OUString getContextString() { return m_sCtxString; } private: - OUString parseLocationName( const OUString& location ); + static OUString parseLocationName( const OUString& location ); void createPkgProvider(); bool isValid() { return m_bIsValid;} OUString getURLForModel(); diff --git a/scripting/source/provider/URIHelper.hxx b/scripting/source/provider/URIHelper.hxx index 199038431094..e4162e82ca14 100644 --- a/scripting/source/provider/URIHelper.hxx +++ b/scripting/source/provider/URIHelper.hxx @@ -53,7 +53,7 @@ private: bool initBaseURI(); OUString getLanguagePart(const OUString& rStorageURI); - OUString getLanguagePath(const OUString& rLanguagePart); + static OUString getLanguagePath(const OUString& rLanguagePart); public: diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx index ff750bdda48b..3054da7840cd 100644 --- a/scripting/source/stringresource/stringresource.hxx +++ b/scripting/source/stringresource/stringresource.hxx @@ -261,8 +261,8 @@ protected: virtual void implLoadAllLocales( void ) SAL_OVERRIDE; void implScanLocaleNames( const ::com::sun::star::uno::Sequence< OUString >& aContentSeq ); - OUString implGetFileNameForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase ); - OUString implGetPathForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase, + static OUString implGetFileNameForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase ); + static OUString implGetPathForLocaleItem( LocaleItem* pLocaleItem, const OUString& aNameBase, const OUString& aLocation, bool bDefaultFile=false ); bool implReadPropertiesFile( LocaleItem* pLocaleItem, diff --git a/shell/source/tools/lngconvex/cmdline.cxx b/shell/source/tools/lngconvex/cmdline.cxx index ba6bed4c3140..ae7c82d883d8 100644 --- a/shell/source/tools/lngconvex/cmdline.cxx +++ b/shell/source/tools/lngconvex/cmdline.cxx @@ -82,7 +82,7 @@ std::string CommandLine::get_arg(const std::string& ArgumentName) const /** Returns whether a given argument is an argument name */ -bool CommandLine::is_arg_name(const std::string& Argument) const +bool CommandLine::is_arg_name(const std::string& Argument) { return (Argument.length() > 0 && Argument[0] == '-'); } diff --git a/shell/source/tools/lngconvex/cmdline.hxx b/shell/source/tools/lngconvex/cmdline.hxx index 99fc7b2d7e03..cd1b2f3d1bd7 100644 --- a/shell/source/tools/lngconvex/cmdline.hxx +++ b/shell/source/tools/lngconvex/cmdline.hxx @@ -66,7 +66,7 @@ private: /** Returns whether a given argument is an argument name */ - bool is_arg_name(const std::string& Argument) const; + static bool is_arg_name(const std::string& Argument); private: size_t m_argc; |