UnoControls/source/inc/progressmonitor.hxx | 4 basebmp/source/bitmapdevice.cxx | 4 basegfx/source/inc/hommatrixtemplate.hxx | 2 basegfx/source/matrix/b2dhommatrix.cxx | 5 basegfx/source/matrix/b3dhommatrix.cxx | 5 basegfx/source/polygon/b2dpolypolygoncutter.cxx | 2 basegfx/source/range/b2drangeclipper.cxx | 2 codemaker/source/cppumaker/cpputype.cxx | 2 comphelper/source/misc/componentbase.cxx | 2 comphelper/source/property/MasterPropertySet.cxx | 16 +- compilerplugins/clang/compat.hxx | 10 + compilerplugins/clang/literaltoboolconversion.cxx | 15 -- compilerplugins/clang/staticmethods.cxx | 141 ++++++++++++++++++++++ cppuhelper/source/typemanager.hxx | 4 dtrans/source/cnttype/mcnttype.hxx | 2 i18nlangtag/source/languagetag/languagetag.cxx | 2 idlc/inc/idlc/errorhandler.hxx | 32 ++-- idlc/inc/idlc/options.hxx | 2 idlc/source/astexpression.cxx | 10 - idlc/source/astscope.cxx | 6 idlc/source/fehelper.cxx | 8 - idlc/source/parser.y | 122 +++++++++---------- include/basebmp/accessoradapters.hxx | 8 - include/comphelper/ChainablePropertySet.hxx | 10 - include/comphelper/MasterPropertySet.hxx | 10 - include/comphelper/accessibletexthelper.hxx | 6 include/comphelper/componentbase.hxx | 4 include/comphelper/numberedcollection.hxx | 4 include/comphelper/propertycontainer.hxx | 2 include/comphelper/propstate.hxx | 2 include/sax/fshelper.hxx | 2 jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx | 2 jvmfwk/source/elements.cxx | 2 jvmfwk/source/elements.hxx | 2 l10ntools/inc/cfgmerge.hxx | 4 l10ntools/inc/export.hxx | 16 +- l10ntools/inc/helpmerge.hxx | 2 l10ntools/inc/lngmerge.hxx | 6 l10ntools/inc/xrmmerge.hxx | 4 oox/source/export/drawingml.cxx | 19 +- oox/source/export/vmlexport.cxx | 14 +- registry/source/regimpl.hxx | 4 rsc/inc/rsccont.hxx | 2 rsc/inc/rscdb.hxx | 4 rsc/inc/rscerror.h | 2 rsc/inc/rscrange.hxx | 2 rsc/inc/rscrsc.hxx | 2 sal/cppunittester/cppunittester.cxx | 6 sal/osl/unx/file.cxx | 2 sal/qa/osl/process/osl_process.cxx | 2 sax/inc/xml2utf.hxx | 4 sc/source/filter/excel/xepage.cxx | 2 sw/source/filter/ww8/docxattributeoutput.cxx | 48 +++---- sw/source/filter/ww8/docxexport.cxx | 12 - sw/source/filter/ww8/docxexport.hxx | 2 sw/source/filter/ww8/docxsdrexport.cxx | 19 +- sw/source/filter/ww8/docxtablestyleexport.cxx | 23 +-- 57 files changed, 398 insertions(+), 255 deletions(-)
New commits: commit 1a08ce70788fe3d8938627aa21bde1861cd94181 Author: Noel Grandin <[email protected]> Date: Fri Mar 27 10:50:38 2015 +0200 loplugin:staticfunction Change-Id: I10c30ef28e7321882a720d1e7869a75a89febfc5 diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx index 293b0be..b86e9de 100644 --- a/include/sax/fshelper.hxx +++ b/include/sax/fshelper.hxx @@ -135,7 +135,7 @@ public: ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > getOutputStream(); - FastAttributeList *createAttrList(); + static FastAttributeList *createAttrList(); void mark( const ::com::sun::star::uno::Sequence< sal_Int32 >& aOrder = ::com::sun::star::uno::Sequence< sal_Int32 >() ); diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx index 1262651..de65fac 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx @@ -112,7 +112,7 @@ protected: "ea" is passed then Rel_EA is returned. If the string is no pre release then Rel_NONE is returned. */ - PreRelease getPreRelease(const char *szRel); + static PreRelease getPreRelease(const char *szRel); }; } diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx index 8b4ab9e..4604c07 100644 --- a/jvmfwk/source/elements.cxx +++ b/jvmfwk/source/elements.cxx @@ -658,7 +658,7 @@ void NodeJava::addJRELocation(rtl_uString * sLocation) m_JRELocations->push_back(OUString(sLocation)); } -jfw::FileStatus NodeJava::checkSettingsFileStatus(OUString const & sURL) const +jfw::FileStatus NodeJava::checkSettingsFileStatus(OUString const & sURL) { jfw::FileStatus ret = FILE_DOES_NOT_EXIST; diff --git a/jvmfwk/source/elements.hxx b/jvmfwk/source/elements.hxx index d04827b..2fc9a3f 100644 --- a/jvmfwk/source/elements.hxx +++ b/jvmfwk/source/elements.hxx @@ -145,7 +145,7 @@ private: /** Verifies if the respective settings file exist. */ - jfw::FileStatus checkSettingsFileStatus(OUString const & sURL) const; + static jfw::FileStatus checkSettingsFileStatus(OUString const & sURL); /** Determines the layer for which the instance the loads and writes the data. diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx index 868b01d..c61ff03 100644 --- a/l10ntools/inc/cfgmerge.hxx +++ b/l10ntools/inc/cfgmerge.hxx @@ -112,7 +112,7 @@ protected: virtual void Output(const OString & rOutput)=0; - void Error(const OString &rError); + static void Error(const OString &rError); private: int ExecuteAnalyzedToken( int nToken, char *pToken ); @@ -121,7 +121,7 @@ private: const OString &rIsoLang, const OString &rResTyp ); - bool IsTokenClosed(const OString &rToken); + static bool IsTokenClosed(const OString &rToken); public: CfgParser(); diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index c7ceb9b..b868c7a 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -152,23 +152,23 @@ private: OString FullId(); ///< creates cur. GID - OString GetPairedListID(const OString & rText); - OString GetPairedListString(const OString& rText); - OString StripList(const OString& rText); + static OString GetPairedListID(const OString & rText); + static OString GetPairedListString(const OString& rText); + static OString StripList(const OString& rText); void InsertListEntry(const OString &rLine); - void CleanValue( OString &rValue ); - OString GetText(const OString &rSource, int nToken); + static void CleanValue( OString &rValue ); + static OString GetText(const OString &rSource, int nToken); void ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OString& rTextType ); void MergeRest( ResData *pResData ); - void ConvertMergeContent( OString &rText ); - void ConvertExportContent( OString &rText ); + static void ConvertMergeContent( OString &rText ); + static void ConvertExportContent( OString &rText ); void WriteToMerged(const OString &rText , bool bSDFContent); void SetChildWithText(); - void CutComment( OString &rText ); + static void CutComment( OString &rText ); void WriteUTF8ByteOrderMarkToOutput() { *aOutput.mSimple << '\xEF' << '\xBB' << '\xBF'; } diff --git a/l10ntools/inc/helpmerge.hxx b/l10ntools/inc/helpmerge.hxx index 9787d18..89c8543 100644 --- a/l10ntools/inc/helpmerge.hxx +++ b/l10ntools/inc/helpmerge.hxx @@ -56,7 +56,7 @@ public: private: bool MergeSingleFile( XMLFile* file , MergeDataFile* pMergeDataFile , const OString& sLanguage , OString const & sPath ); - void ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResData *pResData , MergeDataFile* pMergeDataFile ); + static void ProcessHelp( LangHashMap* aLangHM , const OString& sCur , ResData *pResData , MergeDataFile* pMergeDataFile ); }; #endif // INCLUDED_L10NTOOLS_INC_HELPMERGE_HXX diff --git a/l10ntools/inc/lngmerge.hxx b/l10ntools/inc/lngmerge.hxx index 278910c..beab0c9 100644 --- a/l10ntools/inc/lngmerge.hxx +++ b/l10ntools/inc/lngmerge.hxx @@ -48,10 +48,10 @@ private: OString sSource; std::vector<OString> aLanguages; - bool isNextGroup(OString &sGroup_out, const OString &sLine_in); - void ReadLine(const OString &rLine_in, + static bool isNextGroup(OString &sGroup_out, const OString &sLine_in); + static void ReadLine(const OString &rLine_in, OStringHashMap &rText_inout); - void WritePO(PoOfstream &aPOStream, OStringHashMap &rText_inout, + static void WritePO(PoOfstream &aPOStream, OStringHashMap &rText_inout, const OString &rActFileName, const OString &rID); public: LngParser(const OString &rLngFile); diff --git a/l10ntools/inc/xrmmerge.hxx b/l10ntools/inc/xrmmerge.hxx index 96997f0..13fb191 100644 --- a/l10ntools/inc/xrmmerge.hxx +++ b/l10ntools/inc/xrmmerge.hxx @@ -39,8 +39,8 @@ private: OString sCurrentCloseTag; OString sCurrentText; protected: - OString GetAttribute( const OString &rToken, const OString &rAttribute ); - void Error( const OString &rError ); + static OString GetAttribute( const OString &rToken, const OString &rAttribute ); + static void Error( const OString &rError ); virtual void Output( const OString& rOutput )=0; virtual void WorkOnDesc( diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 0c732fd..05a95e6 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -93,6 +93,7 @@ using namespace ::css::text; using ::css::geometry::IntegerRectangle2D; using ::css::io::XOutputStream; using ::sax_fastparser::FSHelperPtr; +using ::sax_fastparser::FastSerializerHelper; namespace oox { namespace drawingml { @@ -2341,7 +2342,7 @@ void DrawingML::WriteShapeEffect( const OUString& sName, const Sequence< Propert sal_uInt32 nRgbClr = 0; sal_Int32 nAlpha = MAX_PERCENT; Sequence< PropertyValue > aTransformations; - sax_fastparser::FastAttributeList *aOuterShdwAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aOuterShdwAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xOuterShdwAttrList( aOuterShdwAttrList ); for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i ) { @@ -2577,9 +2578,9 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet ) return; bool bCameraRotationPresent = false; - sax_fastparser::FastAttributeList *aCameraAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aCameraAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xCameraAttrList( aCameraAttrList ); - sax_fastparser::FastAttributeList *aCameraRotationAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aCameraRotationAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xRotAttrList( aCameraRotationAttrList ); for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i ) { @@ -2619,9 +2620,9 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet ) } bool bLightRigRotationPresent = false; - sax_fastparser::FastAttributeList *aLightRigAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aLightRigAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xLightAttrList( aLightRigAttrList ); - sax_fastparser::FastAttributeList *aLightRigRotationAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aLightRigRotationAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xLightRotAttrList( aLightRigRotationAttrList ); for( sal_Int32 i=0; i < aLightRigProps.getLength(); ++i ) { @@ -2692,11 +2693,11 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet ) bool bBevelTPresent = false, bBevelBPresent = false; Sequence< PropertyValue > aExtrusionColorProps, aContourColorProps; - sax_fastparser::FastAttributeList *aBevelTAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aBevelTAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xBevelTAttrList( aBevelTAttrList ); - sax_fastparser::FastAttributeList *aBevelBAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aBevelBAttrList = FastSerializerHelper::createAttrList(); sax_fastparser::XFastAttributeListRef xBevelBAttrList( aBevelBAttrList ); - sax_fastparser::FastAttributeList *aShape3DAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aShape3DAttrList = FastSerializerHelper::createAttrList(); for( sal_Int32 i=0; i < aShape3DProps.getLength(); ++i ) { if( aShape3DProps[i].Name == "extrusionH" || aShape3DProps[i].Name == "contourW" || aShape3DProps[i].Name == "z" ) @@ -2853,7 +2854,7 @@ void DrawingML::WriteArtisticEffect( Reference< XPropertySet > rXPropSet ) Sequence< PropertyValue > aAttrs; aEffect.Value >>= aAttrs; - sax_fastparser::FastAttributeList *aAttrList = mpFS->createAttrList(); + sax_fastparser::FastAttributeList *aAttrList = FastSerializerHelper::createAttrList(); OString sRelId; for( sal_Int32 i=0; i < aAttrs.getLength(); ++i ) { diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 067697e..d3e8291 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -89,7 +89,7 @@ void VMLExport::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance ) fprintf( stderr, "Warning! VMLExport::OpenContainer(): opening shape inside a shape.\n" ); #endif m_nShapeType = ESCHER_ShpInst_Nil; - m_pShapeAttrList = m_pSerializer->createAttrList(); + m_pShapeAttrList = FastSerializerHelper::createAttrList(); if ( !m_pShapeStyle->isEmpty() ) m_pShapeStyle->makeStringAndClear(); @@ -126,7 +126,7 @@ sal_uInt32 VMLExport::EnterGroup( const OUString& rShapeName, const Rectangle* p sal_uInt32 nShapeId = GenerateShapeId(); OStringBuffer aStyle( 200 ); - FastAttributeList *pAttrList = m_pSerializer->createAttrList(); + FastAttributeList *pAttrList = FastSerializerHelper::createAttrList(); pAttrList->add( XML_id, ShapeIdString( nShapeId ) ); @@ -560,7 +560,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect case ESCHER_Prop_fillOpacity: // 386 { sal_uInt32 nValue; - sax_fastparser::FastAttributeList *pAttrList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList *pAttrList = FastSerializerHelper::createAttrList(); if ( rProps.GetOpt( ESCHER_Prop_fillType, nValue ) ) { @@ -643,7 +643,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect case ESCHER_Prop_lineEndCapStyle: // 471 { sal_uInt32 nValue; - sax_fastparser::FastAttributeList *pAttrList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList *pAttrList = FastSerializerHelper::createAttrList(); if ( rProps.GetOpt( ESCHER_Prop_lineColor, nValue ) ) impl_AddColor( pAttrList, XML_color, nValue ); @@ -748,7 +748,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect } if ( bShadow ) { - sax_fastparser::FastAttributeList *pAttrList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList *pAttrList = FastSerializerHelper::createAttrList(); impl_AddBool( pAttrList, XML_on, bShadow ); impl_AddBool( pAttrList, XML_obscured, bObscured ); @@ -777,7 +777,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect XML_textpathok, "t", FSEND ); - sax_fastparser::FastAttributeList* pAttrList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttrList = FastSerializerHelper::createAttrList(); pAttrList->add(XML_on, "t"); pAttrList->add(XML_fitshape, "t"); pAttrList->add(XML_string, OUStringToOString(aTextPathString, RTL_TEXTENCODING_UTF8)); @@ -1168,7 +1168,7 @@ void VMLExport::EndShape( sal_Int32 nShapeElement ) { uno::Reference<beans::XPropertySet> xPropertySet(const_cast<SdrObject*>(m_pSdrObject)->getUnoShape(), uno::UNO_QUERY); comphelper::SequenceAsHashMap aCustomShapeProperties(xPropertySet->getPropertyValue("CustomShapeGeometry")); - sax_fastparser::FastAttributeList* pTextboxAttrList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pTextboxAttrList = FastSerializerHelper::createAttrList(); if (aCustomShapeProperties.find("TextPreRotateAngle") != aCustomShapeProperties.end()) { sal_Int32 nTextRotateAngle = aCustomShapeProperties["TextPreRotateAngle"].get<sal_Int32>(); diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx index f05dd1e..3dc8898 100644 --- a/registry/source/regimpl.hxx +++ b/registry/source/regimpl.hxx @@ -131,13 +131,13 @@ private: bool bWarnings=false, bool bReport=false); - RegError checkBlop(store::OStoreStream& rValue, + static RegError checkBlop(store::OStoreStream& rValue, const OUString& sTargetPath, sal_uInt32 srcValueSize, sal_uInt8* pSrcBuffer, bool bReport=false); - RegError mergeModuleValue(store::OStoreStream& rTargetValue, + static RegError mergeModuleValue(store::OStoreStream& rTargetValue, RegistryTypeReader& reader, RegistryTypeReader& reader2); diff --git a/rsc/inc/rsccont.hxx b/rsc/inc/rsccont.hxx index 2cc1988..a2530b3 100644 --- a/rsc/inc/rsccont.hxx +++ b/rsc/inc/rsccont.hxx @@ -46,7 +46,7 @@ protected: sal_uInt32 nSize; // Groesse der Instanzdaten dieser Klasse // mit Superklassen sal_uInt32 nOffInstData;// Offset auf eigen Instanzdaten - void DestroyElements( RscBaseContInst * pClassData ); + static void DestroyElements( RscBaseContInst * pClassData ); RSCINST SearchElePos( const RSCINST & rInst, const RscId & rEleName, RscTop * pClass, sal_uInt32 nPos ); protected: diff --git a/rsc/inc/rscdb.hxx b/rsc/inc/rscdb.hxx index 6ddfe7d..4cd9b41 100644 --- a/rsc/inc/rscdb.hxx +++ b/rsc/inc/rscdb.hxx @@ -168,8 +168,8 @@ class RscTypCont RscArray * InitLangStringList( RscCont * pStrLst ); RscTupel * InitStringTupel(); RscTupel * InitStringLongTupel(); - RscCont * InitStringTupelList( RscTupel * pStringTupel ); - RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel ); + static RscCont * InitStringTupelList( RscTupel * pStringTupel ); + static RscCont * InitStringLongTupelList( RscTupel * pStringLongTupel ); RscArray * InitLangStringTupelList( RscCont * pStrTupelLst ); RscArray * InitLangStringLongTupelList( RscCont * pStrLongTupelLst ); diff --git a/rsc/inc/rscerror.h b/rsc/inc/rscerror.h index a3e0013..2f6a6a7 100644 --- a/rsc/inc/rscerror.h +++ b/rsc/inc/rscerror.h @@ -135,7 +135,7 @@ public: FILE * GetListFile(){ return fListing; } RscVerbosity GetVerbosity() const { return m_verbosity; } void StdOut( const char *, const RscVerbosity _verbosityLevel = RscVerbosityNormal ); - void StdErr( const char * ); + static void StdErr( const char * ); void LstOut( const char * ); void Error( const ERRTYPE& rError, RscTop* pClass, const RscId &aId, const char * pMessage = NULL ); diff --git a/rsc/inc/rscrange.hxx b/rsc/inc/rscrange.hxx index 738b0f8..0efe0d9 100644 --- a/rsc/inc/rscrange.hxx +++ b/rsc/inc/rscrange.hxx @@ -157,7 +157,7 @@ public: RscBool( Atom nId, sal_uInt32 nTypId ); virtual RSCCLASS_TYPE GetClassType() const SAL_OVERRIDE; // Der zulaessige Bereich wird gesetzt - ERRTYPE SetRange( sal_Int32, sal_Int32 ){ return ERR_UNKNOWN_METHOD; } + static ERRTYPE SetRange( sal_Int32, sal_Int32 ){ return ERR_UNKNOWN_METHOD; } ERRTYPE SetBool( const RSCINST & rInst, bool b ) SAL_OVERRIDE { return SetNumber( rInst, (sal_Int32)b ); diff --git a/rsc/inc/rscrsc.hxx b/rsc/inc/rscrsc.hxx index f0cc6e0..5d982d2 100644 --- a/rsc/inc/rscrsc.hxx +++ b/rsc/inc/rscrsc.hxx @@ -69,7 +69,7 @@ class RscCompiler private: void CreateResFile( const char * pRc ); - bool GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile, + static bool GetImageFilePath( const RscCmdLine::OutputFile& rOutputFile, const WriteRcContext& rContext, const OString& rBaseFileName, OString& rImagePath, diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index 2e791f2..ffad4d4 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -141,7 +141,7 @@ public: } private: - void printFailureLocation( const CppUnit::SourceLine &sourceLine ) + static void printFailureLocation( const CppUnit::SourceLine &sourceLine ) { if ( !sourceLine.isValid() ) std::cerr << "unknown:0:"; @@ -149,12 +149,12 @@ private: std::cerr << sourceLine.fileName() << ":" << sourceLine.lineNumber() << ":"; } - void printFailedTestName( const CppUnit::TestFailure &failure ) + static void printFailedTestName( const CppUnit::TestFailure &failure ) { std::cerr << failure.failedTestName() << std::endl; } - void printFailureMessage( const CppUnit::TestFailure &failure ) + static void printFailureMessage( const CppUnit::TestFailure &failure ) { std::cerr << failure.thrownException()->message().shortDescription() << std::endl; std::cerr << failure.thrownException()->message().details() << std::endl; diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index d3c3f95..5b3f830 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -139,7 +139,7 @@ struct FileHandle_Impl sal_Sequence ** ppSequence, sal_uInt64 * pBytesRead); - oslFileError writeSequence_Impl ( + static oslFileError writeSequence_Impl ( sal_Sequence ** ppSequence, size_t * pnOffset, const void * pBuffer, diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index a1e5a20..b053f9f 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -122,7 +122,7 @@ private: // extract the name from an environment variable // that is given in the form "NAME=VALUE" - OString env_var_name(const OString& env_var) const + static OString env_var_name(const OString& env_var) { sal_Int32 pos_equal_sign = env_var.indexOf('='); diff --git a/sax/inc/xml2utf.hxx b/sax/inc/xml2utf.hxx index 526dd13..b9ffee3 100644 --- a/sax/inc/xml2utf.hxx +++ b/sax/inc/xml2utf.hxx @@ -116,10 +116,10 @@ private: // if enough data is available to scan encoding // @return TRUE, when encoding is retrievable // @return FALSE, when more data is needed - bool isEncodingRecognizable( const ::com::sun::star::uno::Sequence< sal_Int8 > & seq ); + static bool isEncodingRecognizable( const ::com::sun::star::uno::Sequence< sal_Int8 > & seq ); // When encoding attribute is within the text (in the first line), it is removed. - void removeEncoding( ::com::sun::star::uno::Sequence<sal_Int8> &seq ); + static void removeEncoding( ::com::sun::star::uno::Sequence<sal_Int8> &seq ); // Initializes decoding depending on m_sEncoding setting void initializeDecoding(); diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 69e9b11..d352025 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -84,7 +84,7 @@ XclExpSetup::XclExpSetup( const XclPageData& rPageData ) : void XclExpSetup::SaveXml( XclExpXmlStream& rStrm ) { - sax_fastparser::FastAttributeList* pAttrList=rStrm.GetCurrentStream()->createAttrList(); + sax_fastparser::FastAttributeList* pAttrList = sax_fastparser::FastSerializerHelper::createAttrList(); if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 || mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER ) { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 66d1da9..ae09151 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -339,7 +339,7 @@ static void lcl_deleteAndResetTheLists( std::unique_ptr<sax_fastparser::FastAttr void DocxAttributeOutput::PopulateFrameProperties(const SwFrmFmt* pFrmFmt, const Size& rSize) { - sax_fastparser::FastAttributeList* attrList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* attrList = FastSerializerHelper::createAttrList(); awt::Point aPos(pFrmFmt->GetHoriOrient().GetPos(), pFrmFmt->GetVertOrient().GetPos()); @@ -1809,7 +1809,7 @@ boost::optional<sal_Int32> lclGetElementIdForName(const OUString& rName) void lclProcessRecursiveGrabBag(sal_Int32 aElementId, const css::uno::Sequence<css::beans::PropertyValue>& rElements, sax_fastparser::FSHelperPtr pSerializer) { css::uno::Sequence<css::beans::PropertyValue> aAttributes; - FastAttributeList* pAttributes = pSerializer->createAttrList(); + FastAttributeList* pAttributes = FastSerializerHelper::createAttrList(); for (sal_Int32 j=0; j < rElements.getLength(); ++j) { @@ -2206,7 +2206,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge else { // Output a hyperlink XML element - m_pHyperlinkAttrList.reset(m_pSerializer->createAttrList()); + m_pHyperlinkAttrList.reset(FastSerializerHelper::createAttrList()); if ( !bBookmarkOnly ) { @@ -2557,7 +2557,7 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) ) return; - FastAttributeList* pAttr = pSerializer->createAttrList(); + FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); pAttr->add( FSNS( XML_w, XML_val ), OString( pVal ) ); if ( pBorderLine && !pBorderLine->isEmpty() ) @@ -3157,7 +3157,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t m_aTableStyleConf[ BOX_LINE_RIGHT ] = aGrabBagElement->second.get<table::BorderLine2>(); else if (aGrabBagElement->first == "TableStyleLook") { - FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); uno::Sequence<beans::PropertyValue> aAttributeList = aGrabBagElement->second.get< uno::Sequence<beans::PropertyValue> >(); for (sal_Int32 i = 0; i < aAttributeList.getLength(); ++i) @@ -3187,7 +3187,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t } else if (aGrabBagElement->first == "TablePosition" ) { - FastAttributeList *attrListTablePos = m_pSerializer->createAttrList( ); + FastAttributeList *attrListTablePos = FastSerializerHelper::createAttrList( ); uno::Sequence<beans::PropertyValue> aTablePosition = aGrabBagElement->second.get<uno::Sequence<beans::PropertyValue> >(); for (sal_Int32 i = 0; i < aTablePosition.getLength(); ++i) { @@ -3699,7 +3699,7 @@ void DocxAttributeOutput::LatentStyles() return; // Extract default attributes first. - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); uno::Sequence<beans::PropertyValue> aLsdExceptions; for (sal_Int32 i = 0; i < aLatentStyles.getLength(); ++i) { @@ -3716,7 +3716,7 @@ void DocxAttributeOutput::LatentStyles() // Then handle the exceptions. for (sal_Int32 i = 0; i < aLsdExceptions.getLength(); ++i) { - pAttributeList = m_pSerializer->createAttrList(); + pAttributeList = FastSerializerHelper::createAttrList(); uno::Sequence<beans::PropertyValue> aAttributes; aLsdExceptions[i].Value >>= aAttributes; @@ -4087,7 +4087,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size m_rExport.SdrExporter().startDMLAnchorInline(pFrmFmt, rSize); // picture description (used for pic:cNvPr later too) - ::sax_fastparser::FastAttributeList* docPrattrList = m_pSerializer->createAttrList(); + ::sax_fastparser::FastAttributeList* docPrattrList = FastSerializerHelper::createAttrList(); docPrattrList->add( XML_id, OString::number( m_anchorId++).getStr()); docPrattrList->add( XML_name, OUStringToOString( pFrmFmt->GetName(), RTL_TEXTENCODING_UTF8 ) ); docPrattrList->add( XML_descr, OUStringToOString( pGrfNode ? pGrfNode->GetDescription() : pOLEFrmFmt->GetObjDescription(), RTL_TEXTENCODING_UTF8 ).getStr()); @@ -5112,7 +5112,7 @@ void DocxAttributeOutput::StartStyle( const OUString& rName, StyleType eType, { bool bQFormat = false, bUnhideWhenUsed = false, bSemiHidden = false, bLocked = false, bDefault = false, bCustomStyle = false; OUString aLink, aRsid, aUiPriority; - FastAttributeList* pStyleAttributeList = m_pSerializer->createAttrList(); + FastAttributeList* pStyleAttributeList = FastSerializerHelper::createAttrList(); uno::Any aAny; if (eType == STYLE_TYPE_PARA || eType == STYLE_TYPE_CHAR) { @@ -5409,7 +5409,7 @@ void DocxAttributeOutput::SectionFormProtection( bool bProtected ) void DocxAttributeOutput::SectionLineNumbering( sal_uLong nRestartNo, const SwLineNumberInfo& rLnNumInfo ) { - FastAttributeList* pAttr = m_pSerializer->createAttrList(); + FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); pAttr->add( FSNS( XML_w, XML_countBy ), OString::number(rLnNumInfo.GetCountBy()).getStr()); pAttr->add( FSNS( XML_w, XML_restart ), rLnNumInfo.IsRestartEachPage() ? "newPage" : "continuous" ); if( rLnNumInfo.GetPosFromLeft()) @@ -5569,7 +5569,7 @@ void DocxAttributeOutput::SectionPageNumbering( sal_uInt16 nNumType, const ::boo { // FIXME Not called properly with page styles like "First Page" - FastAttributeList* pAttr = m_pSerializer->createAttrList(); + FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); // boost::none means no restart: then don't output that attribute if it is negative if ( oPageRestartNumber ) @@ -5629,7 +5629,7 @@ void DocxAttributeOutput::FontAlternateName( const OUString& rName ) const void DocxAttributeOutput::FontCharset( sal_uInt8 nCharSet, rtl_TextEncoding nEncoding ) const { - FastAttributeList* pAttr = m_pSerializer->createAttrList(); + FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); OString aCharSet( OString::number( nCharSet, 16 ) ); if ( aCharSet.getLength() == 1 ) @@ -6686,7 +6686,7 @@ void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes ) sal_Int32 nBody = bFootnotes? XML_footnotes: XML_endnotes; sal_Int32 nItem = bFootnotes? XML_footnote: XML_endnote; - m_pSerializer->startElementNS( XML_w, nBody, m_rExport.MainXmlNamespaces(m_pSerializer) ); + m_pSerializer->startElementNS( XML_w, nBody, m_rExport.MainXmlNamespaces() ); sal_Int32 nIndex = 0; @@ -6905,7 +6905,7 @@ void DocxAttributeOutput::ParaWidows( const SvxWidowsItem& rWidows ) static void impl_WriteTabElement( FSHelperPtr pSerializer, const SvxTabStop& rTab, long /* nCurrentLeft */ ) { - FastAttributeList *pTabElementAttrList = pSerializer->createAttrList(); + FastAttributeList *pTabElementAttrList = FastSerializerHelper::createAttrList(); switch (rTab.GetAdjustment()) { @@ -7076,7 +7076,7 @@ void DocxAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize ) } else if ( m_rExport.bOutPageDescs ) { - FastAttributeList *attrList = m_pSerializer->createAttrList( ); + FastAttributeList *attrList = FastSerializerHelper::createAttrList( ); if ( m_rExport.pAktPageDesc->GetLandscape( ) ) attrList->add( FSNS( XML_w, XML_orient ), "landscape" ); @@ -7136,7 +7136,7 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) } else { - FastAttributeList *pLRSpaceAttrList = m_pSerializer->createAttrList(); + FastAttributeList *pLRSpaceAttrList = FastSerializerHelper::createAttrList(); if((0 != rLRSpace.GetTxtLeft()) || ((0 == rLRSpace.GetTxtLeft()) && rLRSpace.IsExplicitZeroMarginValLeft())) { pLRSpaceAttrList->add( FSNS( XML_w, ( bEcma ? XML_left : XML_start ) ), OString::number( rLRSpace.GetTxtLeft() ) ); @@ -7282,7 +7282,7 @@ void DocxAttributeOutput::FormatSurround( const SwFmtSurround& rSurround ) } if (!sType.isEmpty() || !sSide.isEmpty()) { - m_rExport.SdrExporter().setFlyWrapAttrList(m_pSerializer->createAttrList()); + m_rExport.SdrExporter().setFlyWrapAttrList(FastSerializerHelper::createAttrList()); if (!sType.isEmpty()) m_rExport.SdrExporter().getFlyWrapAttrList()->add(XML_type, sType); if (!sSide.isEmpty()) @@ -7518,14 +7518,14 @@ void DocxAttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) if( !m_pBackgroundAttrList ) { - m_pBackgroundAttrList.reset(m_pSerializer->createAttrList()); + m_pBackgroundAttrList.reset(FastSerializerHelper::createAttrList()); m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() ); m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" ); } else if ( sOriginalFill != sColor ) { // fill was modified during edition, theme fill attribute must be dropped - m_pBackgroundAttrList.reset(m_pSerializer->createAttrList()); + m_pBackgroundAttrList.reset(FastSerializerHelper::createAttrList()); m_pBackgroundAttrList->add( FSNS( XML_w, XML_fill ), sColor.getStr() ); m_pBackgroundAttrList->add( FSNS( XML_w, XML_val ), "clear" ); } @@ -7747,7 +7747,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol& rCol, bool bEven, SwTwips nPageSize ) { // Get the columns attributes - FastAttributeList *pColsAttrList = m_pSerializer->createAttrList(); + FastAttributeList *pColsAttrList = FastSerializerHelper::createAttrList(); pColsAttrList->add( FSNS( XML_w, XML_num ), OString::number( nCols ). getStr( ) ); @@ -7777,7 +7777,7 @@ void DocxAttributeOutput::FormatColumns_Impl( sal_uInt16 nCols, const SwFmtCol& { for ( sal_uInt16 n = 0; n < nCols; ++n ) { - FastAttributeList *pColAttrList = m_pSerializer->createAttrList(); + FastAttributeList *pColAttrList = FastSerializerHelper::createAttrList(); sal_uInt16 nWidth = rCol.CalcPrtColWidth( n, ( sal_uInt16 ) nPageSize ); pColAttrList->add( FSNS( XML_w, XML_w ), OString::number( nWidth ).getStr( ) ); @@ -7803,7 +7803,7 @@ void DocxAttributeOutput::FormatKeep( const SvxFmtKeepItem& ) void DocxAttributeOutput::FormatTextGrid( const SwTextGridItem& rGrid ) { - FastAttributeList *pGridAttrList = m_pSerializer->createAttrList(); + FastAttributeList *pGridAttrList = FastSerializerHelper::createAttrList(); OString sGridType; switch ( rGrid.GetGridType( ) ) @@ -8389,7 +8389,7 @@ void DocxAttributeOutput::AddToAttrList( std::unique_ptr<sax_fastparser::FastAtt void DocxAttributeOutput::AddToAttrList( std::unique_ptr<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrs, ... ) { if( !pAttrList ) - pAttrList.reset(m_pSerializer->createAttrList()); + pAttrList.reset(FastSerializerHelper::createAttrList()); va_list args; va_start( args, nAttrs ); diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index c800a8d..96c8c7c 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -626,7 +626,7 @@ void DocxExport::WritePostitFields() m_pFilter->openFragmentStreamWithSerializer( "word/comments.xml", "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml" ); - pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces( pPostitFS )); + pPostitFS->startElementNS( XML_w, XML_comments, MainXmlNamespaces()); m_pAttrOutput->SetSerializer( pPostitFS ); m_pAttrOutput->WritePostitFields(); m_pAttrOutput->SetSerializer( m_pDocumentFS ); @@ -684,7 +684,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(), "application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" ); - pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces( pFS )); + pFS->startElementNS( XML_w, XML_hdr, MainXmlNamespaces()); } else { @@ -697,7 +697,7 @@ void DocxExport::WriteHeaderFooter( const SwFmt& rFmt, bool bHeader, const char* pFS = m_pFilter->openFragmentStreamWithSerializer( OUStringBuffer().append("word/").append( aName ).makeStringAndClear(), "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" ); - pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces( pFS )); + pFS->startElementNS( XML_w, XML_ftr, MainXmlNamespaces()); } // switch the serializer to redirect the output to word/styles.xml @@ -1303,7 +1303,7 @@ boost::optional<SvxBrushItem> DocxExport::getBackground() void DocxExport::WriteMainText() { // setup the namespaces - m_pDocumentFS->startElementNS( XML_w, XML_document, MainXmlNamespaces( m_pDocumentFS )); + m_pDocumentFS->startElementNS( XML_w, XML_document, MainXmlNamespaces()); // Write background page color if (boost::optional<SvxBrushItem> oBrush = getBackground()) @@ -1333,9 +1333,9 @@ void DocxExport::WriteMainText() m_pDocumentFS->endElementNS( XML_w, XML_document ); } -XFastAttributeListRef DocxExport::MainXmlNamespaces( FSHelperPtr serializer ) +XFastAttributeListRef DocxExport::MainXmlNamespaces() { - FastAttributeList* pAttr = serializer->createAttrList(); + FastAttributeList* pAttr = FastSerializerHelper::createAttrList(); pAttr->add( FSNS( XML_xmlns, XML_o ), "urn:schemas-microsoft-com:office:office" ); pAttr->add( FSNS( XML_xmlns, XML_r ), "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ); pAttr->add( FSNS( XML_xmlns, XML_v ), "urn:schemas-microsoft-com:vml" ); diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index df9251d..ac1bbb3 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -253,7 +253,7 @@ private: public: /// All xml namespaces to be used at the top of any text .xml file (main doc, headers, footers,...) - sax_fastparser::XFastAttributeListRef MainXmlNamespaces( sax_fastparser::FSHelperPtr serializer ); + sax_fastparser::XFastAttributeListRef MainXmlNamespaces(); /// FIXME this is temporary, remotely reminding the method of the same /// name in WW8Export. diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index dbf2031..5d5766a 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -35,6 +35,7 @@ using namespace com::sun::star; using namespace oox; +using namespace sax_fastparser; namespace { @@ -357,7 +358,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS if (isAnchor) { - sax_fastparser::FastAttributeList* attrList = m_pImpl->m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* attrList = FastSerializerHelper::createAttrList(); bool bOpaque = pFrmFmt->GetOpaque().GetValue(); awt::Point aPos(pFrmFmt->GetHoriOrient().GetPos(), pFrmFmt->GetVertOrient().GetPos()); const SdrObject* pObj = pFrmFmt->FindRealSdrObject(); @@ -546,7 +547,7 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS } else { - sax_fastparser::FastAttributeList* aAttrList = m_pImpl->m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* aAttrList = FastSerializerHelper::createAttrList(); aAttrList->add(XML_distT, OString::number(TwipsToEMU(pULSpaceItem.GetUpper())).getStr()); aAttrList->add(XML_distB, OString::number(TwipsToEMU(pULSpaceItem.GetLower())).getStr()); aAttrList->add(XML_distL, OString::number(TwipsToEMU(pLRSpaceItem.GetLeft())).getStr()); @@ -807,7 +808,7 @@ void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrmFmt* Size aSize(pSdrObject->GetLogicRect().GetWidth(), pSdrObject->GetLogicRect().GetHeight()); startDMLAnchorInline(pFrmFmt, aSize); - sax_fastparser::FastAttributeList* pDocPrAttrList = pFS->createAttrList(); + sax_fastparser::FastAttributeList* pDocPrAttrList = FastSerializerHelper::createAttrList(); pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr()); pDocPrAttrList->add(XML_name, OUStringToOString(pSdrObject->GetName(), RTL_TEXTENCODING_UTF8).getStr()); if (!pSdrObject->GetTitle().isEmpty()) @@ -1144,7 +1145,7 @@ void DocxSdrExport::writeDiagram(const SdrObject* sdrObject, const SwFrmFmt& rFr startDMLAnchorInline(&rFrmFmt, aSize); // generate an unique id - sax_fastparser::FastAttributeList* pDocPrAttrList = pFS->createAttrList(); + sax_fastparser::FastAttributeList* pDocPrAttrList = FastSerializerHelper::createAttrList(); pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr()); OUString sName = "Diagram" + OUString::number(nAnchorId); pDocPrAttrList->add(XML_name, OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr()); @@ -1295,7 +1296,7 @@ void DocxSdrExport::writeOnlyTextOfFrame(sw::Frame* pParentFrame) //Save data here and restore when out of scope ExportDataSaveRestore aDataGuard(m_pImpl->m_rExport, nStt, nEnd, pParentFrame); - m_pImpl->m_pBodyPrAttrList = pFS->createAttrList(); + m_pImpl->m_pBodyPrAttrList = FastSerializerHelper::createAttrList(); m_pImpl->m_bFrameBtLr = checkFrameBtlr(m_pImpl->m_rExport.pDoc->GetNodes()[nStt], 0); m_pImpl->m_bFlyFrameGraphic = true; m_pImpl->m_rExport.WriteText(); @@ -1354,7 +1355,7 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo if (xPropertySet.is()) xPropSetInfo = xPropertySet->getPropertySetInfo(); - m_pImpl->m_pBodyPrAttrList = pFS->createAttrList(); + m_pImpl->m_pBodyPrAttrList = FastSerializerHelper::createAttrList(); { drawing::TextVerticalAdjust eAdjust = drawing::TextVerticalAdjust_TOP; if (xPropSetInfo.is() && xPropSetInfo->hasPropertyByName("TextVerticalAdjust")) @@ -1366,7 +1367,7 @@ void DocxSdrExport::writeDMLTextFrame(sw::Frame* pParentFrame, int nAnchorId, bo { startDMLAnchorInline(&rFrmFmt, aSize); - sax_fastparser::FastAttributeList* pDocPrAttrList = pFS->createAttrList(); + sax_fastparser::FastAttributeList* pDocPrAttrList = FastSerializerHelper::createAttrList(); pDocPrAttrList->add(XML_id, OString::number(nAnchorId).getStr()); pDocPrAttrList->add(XML_name, OUStringToOString(rFrmFmt.GetName(), RTL_TEXTENCODING_UTF8).getStr()); sax_fastparser::XFastAttributeListRef xDocPrAttrListRef(pDocPrAttrList); @@ -1583,8 +1584,8 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* pParentFrame, bool bTextBoxOnly m_pImpl->m_pFlyFrameSize = &aSize; m_pImpl->m_bTextFrameSyntax = true; - m_pImpl->m_pFlyAttrList.reset(pFS->createAttrList()); - m_pImpl->m_pTextboxAttrList = pFS->createAttrList(); + m_pImpl->m_pFlyAttrList.reset(FastSerializerHelper::createAttrList()); + m_pImpl->m_pTextboxAttrList = FastSerializerHelper::createAttrList(); m_pImpl->m_aTextFrameStyle = "position:absolute"; if (!bTextBoxOnly) { diff --git a/sw/source/filter/ww8/docxtablestyleexport.cxx b/sw/source/filter/ww8/docxtablestyleexport.cxx index f3113e9..9641a5e 100644 --- a/sw/source/filter/ww8/docxtablestyleexport.cxx +++ b/sw/source/filter/ww8/docxtablestyleexport.cxx @@ -16,6 +16,7 @@ using namespace com::sun::star; using namespace oox; +using namespace sax_fastparser; /// Methods in this class handle values in a table style. struct DocxTableStyleExport::Impl @@ -67,7 +68,7 @@ void DocxTableStyleExport::CharFormat(css::uno::Sequence<css::beans::PropertyVal void DocxTableStyleExport::CnfStyle(uno::Sequence<beans::PropertyValue>& rAttributeList) { - sax_fastparser::FastAttributeList* pAttributeList = m_pImpl->m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 j = 0; j < rAttributeList.getLength(); ++j) { @@ -177,7 +178,7 @@ void DocxTableStyleExport::Impl::tableStyleTcBorder(sal_Int32 nToken, const uno: if (!rTcBorder.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rTcBorder.getLength(); ++i) if (sal_Int32 nAttrToken = DocxStringGetToken(aTcBorderTokens, rTcBorder[i].Name)) pAttributeList->add(FSNS(XML_w, nAttrToken), rTcBorder[i].Value.get<OUString>().toUtf8()); @@ -218,7 +219,7 @@ void DocxTableStyleExport::Impl::tableStyleShd(uno::Sequence<beans::PropertyValu if (!rShd.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rShd.getLength(); ++i) { if (rShd[i].Name == "val") @@ -243,7 +244,7 @@ void DocxTableStyleExport::Impl::tableStyleRColor(uno::Sequence<beans::PropertyV if (!rColor.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rColor.getLength(); ++i) { if (rColor[i].Name == "val") @@ -264,7 +265,7 @@ void DocxTableStyleExport::Impl::tableStyleRLang(uno::Sequence<beans::PropertyVa if (!rLang.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rLang.getLength(); ++i) { if (rLang[i].Name == "eastAsia") @@ -283,7 +284,7 @@ void DocxTableStyleExport::Impl::tableStyleRRFonts(uno::Sequence<beans::Property if (!rRFonts.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rRFonts.getLength(); ++i) { if (rRFonts[i].Name == "eastAsiaTheme") @@ -304,7 +305,7 @@ void DocxTableStyleExport::Impl::tableStylePSpacing(uno::Sequence<beans::Propert if (!rSpacing.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rSpacing.getLength(); ++i) { if (rSpacing[i].Name == "after") @@ -335,7 +336,7 @@ void DocxTableStyleExport::Impl::tableStylePInd(uno::Sequence<beans::PropertyVal if (!rInd.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rInd.getLength(); ++i) { if (rInd[i].Name == "rightChars") @@ -352,7 +353,7 @@ void DocxTableStyleExport::Impl::tableStyleTblInd(uno::Sequence<beans::PropertyV if (!rTblInd.hasElements()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); for (sal_Int32 i = 0; i < rTblInd.getLength(); ++i) { if (rTblInd[i].Name == "w") @@ -368,7 +369,7 @@ void DocxTableStyleExport::Impl::handleBoolean(const OUString& aValue, sal_Int32 { if (aValue.isEmpty()) return; - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); if (aValue != "1") pAttributeList->add(FSNS(XML_w, XML_val), aValue.toUtf8()); sax_fastparser::XFastAttributeListRef xAttributeList(pAttributeList); @@ -633,7 +634,7 @@ void DocxTableStyleExport::Impl::TableStyle(uno::Sequence<beans::PropertyValue>& aTblStylePrs.push_back(rStyle[i].Value.get< uno::Sequence<beans::PropertyValue> >()); } - sax_fastparser::FastAttributeList* pAttributeList = m_pSerializer->createAttrList(); + sax_fastparser::FastAttributeList* pAttributeList = FastSerializerHelper::createAttrList(); pAttributeList->add(FSNS(XML_w, XML_type), "table"); if (bDefault) pAttributeList->add(FSNS(XML_w, XML_default), "1"); commit aa7a829e7df30a5356fca2bae0bb7eb51367f08d Author: Noel Grandin <[email protected]> Date: Fri Mar 27 08:44:52 2015 +0200 loplugin:staticfunction Change-Id: Id796b799f8e2fcc3eae98d43800c5e31fec27fef diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 64ac18b..d8e3ea7 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -1046,7 +1046,7 @@ private: virtual sal_uInt32 checkInheritedMemberCount() const SAL_OVERRIDE { return BaseOffset(m_typeMgr, entity_).get(); } - void dumpExceptionSpecification( + static void dumpExceptionSpecification( FileStream & out, std::vector< OUString > const & exceptions, bool runtimeException); diff --git a/cppuhelper/source/typemanager.hxx b/cppuhelper/source/typemanager.hxx index 8b55b27..d6dfbc0 100644 --- a/cppuhelper/source/typemanager.hxx +++ b/cppuhelper/source/typemanager.hxx @@ -134,11 +134,11 @@ private: rtl::OUString const & name, rtl::Reference< unoidl::Entity > const & entity); - css::uno::Any getEnumMember( + static css::uno::Any getEnumMember( rtl::Reference< unoidl::EnumTypeEntity > const & entity, rtl::OUString const & member); - css::uno::Any getConstant( + static css::uno::Any getConstant( rtl::OUString const & constantGroupName, rtl::Reference< unoidl::ConstantGroupEntity > const & entity, rtl::OUString const & member); diff --git a/dtrans/source/cnttype/mcnttype.hxx b/dtrans/source/cnttype/mcnttype.hxx index 4812bc5..b766302 100644 --- a/dtrans/source/cnttype/mcnttype.hxx +++ b/dtrans/source/cnttype/mcnttype.hxx @@ -62,7 +62,7 @@ private: OUString SAL_CALL quotedPValue( ); OUString SAL_CALL nonquotedPValue( ); void SAL_CALL comment( void ); - bool SAL_CALL isInRange( const OUString& aChr, const OUString& aRange ); + static bool SAL_CALL isInRange( const OUString& aChr, const OUString& aRange ); private: ::osl::Mutex m_aMutex; diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index e7989f1..d346148 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -175,7 +175,7 @@ private: void setupDataPath(); void setup(); - void teardown(); + static void teardown(); }; namespace { diff --git a/idlc/inc/idlc/errorhandler.hxx b/idlc/inc/idlc/errorhandler.hxx index 1e7e728..ff176a0 100644 --- a/idlc/inc/idlc/errorhandler.hxx +++ b/idlc/inc/idlc/errorhandler.hxx @@ -90,41 +90,41 @@ class ErrorHandler { public: // Report errors with varying numbers of arguments - void error0(ErrorCode e); - void error1(ErrorCode e, AstDeclaration const * d); - void error2( + static void error0(ErrorCode e); + static void error1(ErrorCode e, AstDeclaration const * d); + static void error2( ErrorCode e, AstDeclaration const * d1, AstDeclaration const * d2); - void error3(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2, AstDeclaration* d3); + static void error3(ErrorCode e, AstDeclaration* d1, AstDeclaration* d2, AstDeclaration* d3); // Warning - void warning0(WarningCode e, const sal_Char* warningmsg); + static void warning0(WarningCode e, const sal_Char* warningmsg); // Report a syntax error in IDL input - void syntaxError(ParseState state, sal_Int32 lineNumber, const sal_Char* errmsg); + static void syntaxError(ParseState state, sal_Int32 lineNumber, const sal_Char* errmsg); // Report an unsuccessful coercion attempt - void coercionError(AstExpression *pExpr, ExprType et); + static void coercionError(AstExpression *pExpr, ExprType et); // Report a failed name lookup attempt - void lookupError(const OString& n); + static void lookupError(const OString& n); // Report a failed name lookup attempt - void lookupError(ErrorCode e, const OString& n, AstDeclaration* pScope); + static void lookupError(ErrorCode e, const OString& n, AstDeclaration* pScope); // Report a type error - void noTypeError(AstDeclaration const * pDecl); + static void noTypeError(AstDeclaration const * pDecl); - void inheritanceError(NodeType nodeType, const OString* name, AstDeclaration* pDecl); + static void inheritanceError(NodeType nodeType, const OString* name, AstDeclaration* pDecl); - void flagError(ErrorCode e, sal_uInt32 flag); + static void flagError(ErrorCode e, sal_uInt32 flag); - void forwardLookupError(const AstDeclaration* pForward, const OString& name); + static void forwardLookupError(const AstDeclaration* pForward, const OString& name); - void constantExpected(AstDeclaration* pDecl, const OString& name); + static void constantExpected(AstDeclaration* pDecl, const OString& name); - void evalError(AstExpression* pExpr); + static void evalError(AstExpression* pExpr); - bool checkPublished(AstDeclaration const * decl, bool bOptiional=false); + static bool checkPublished(AstDeclaration const * decl, bool bOptiional=false); }; #endif // INCLUDED_IDLC_INC_IDLC_ERRORHANDLER_HXX diff --git a/idlc/inc/idlc/options.hxx b/idlc/inc/idlc/options.hxx index ccd2d01..2f4c02d 100644 --- a/idlc/inc/idlc/options.hxx +++ b/idlc/inc/idlc/options.hxx @@ -47,7 +47,7 @@ public: bool initOptions(std::vector< std::string > & rArgs) throw(IllegalArgument); - bool badOption(char const * reason, std::string const & rArg) + static bool badOption(char const * reason, std::string const & rArg) throw(IllegalArgument); bool setOption(char const * option, std::string const & rArg); diff --git a/idlc/source/astexpression.cxx b/idlc/source/astexpression.cxx index bb01c0a..f076f95 100644 --- a/idlc/source/astexpression.cxx +++ b/idlc/source/astexpression.cxx @@ -1088,7 +1088,7 @@ AstExprValue* AstExpression::eval_symbol(EvalKind ek) */ if (m_pSymbolicName == NULL) { - idlc()->error()->evalError(this); + ErrorHandler::evalError(this); return NULL; } /* @@ -1098,7 +1098,7 @@ AstExprValue* AstExpression::eval_symbol(EvalKind ek) pScope = idlc()->scopes()->topNonNull(); if ( !pScope ) { - idlc()->error()->lookupError(*m_pSymbolicName); + ErrorHandler::lookupError(*m_pSymbolicName); return NULL; } /* @@ -1107,7 +1107,7 @@ AstExprValue* AstExpression::eval_symbol(EvalKind ek) pDecl = pScope->lookupByName(*m_pSymbolicName); if (pDecl == NULL) { - idlc()->error()->lookupError(*m_pSymbolicName); + ErrorHandler::lookupError(*m_pSymbolicName); return NULL; } /* @@ -1116,10 +1116,10 @@ AstExprValue* AstExpression::eval_symbol(EvalKind ek) if (pDecl->getNodeType() != NT_const && pDecl->getNodeType() != NT_enum_val) { - idlc()->error()->constantExpected(pDecl, *m_pSymbolicName); + ErrorHandler::constantExpected(pDecl, *m_pSymbolicName); return NULL; } - if (!idlc()->error()->checkPublished(pDecl)) + if (!ErrorHandler::checkPublished(pDecl)) { return NULL; } diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx index e7f030e..c4a84c4 100644 --- a/idlc/source/astscope.cxx +++ b/idlc/source/astscope.cxx @@ -48,7 +48,7 @@ AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl) { if ( pDecl->hasAncestor(pDeclaration) ) { - idlc()->error()->error2(EIDL_REDEF_SCOPE, pDecl, pDeclaration); + ErrorHandler::error2(EIDL_REDEF_SCOPE, pDecl, pDeclaration); return NULL; } if ( (pDecl->getNodeType() == pDeclaration->getNodeType()) && @@ -75,7 +75,7 @@ AstDeclaration* AstScope::addDeclaration(AstDeclaration* pDecl) return pDecl; } - idlc()->error()->error2(EIDL_REDEF_SCOPE, scopeAsDecl(this), pDecl); + ErrorHandler::error2(EIDL_REDEF_SCOPE, scopeAsDecl(this), pDecl); return NULL; } @@ -221,7 +221,7 @@ AstDeclaration* AstScope::lookupInInherited(const OString& scopedName) const // Can't look in an interface which was not yet defined if ( !pInterface->getScope() ) { - idlc()->error()->forwardLookupError(pInterface, scopedName); + ErrorHandler::forwardLookupError(pInterface, scopedName); } // OK, loop through inherited interfaces. Stop when you find it diff --git a/idlc/source/fehelper.cxx b/idlc/source/fehelper.cxx index 8cf1a74..2a5fb1d3 100644 --- a/idlc/source/fehelper.cxx +++ b/idlc/source/fehelper.cxx @@ -55,7 +55,7 @@ AstType const * FeDeclarator::compose(AstDeclaration const * pDecl) } if ( !pDecl->isType() ) { - idlc()->error()->noTypeError(pDecl); + ErrorHandler::noTypeError(pDecl); return NULL; } pType = static_cast<const AstType*>(pDecl); @@ -92,20 +92,20 @@ void FeInheritanceHeader::initializeInherits(OString* pInherits) || static_cast< AstInterface const * >( resolved)->isDefined()) ) { - if ( idlc()->error()->checkPublished( pDecl ) ) + if ( ErrorHandler::checkPublished( pDecl ) ) { m_pInherits = pDecl; } } else { - idlc()->error()->inheritanceError( + ErrorHandler::inheritanceError( getNodeType(), getName(), pDecl); } } else { - idlc()->error()->lookupError(*pInherits); + ErrorHandler::lookupError(*pInherits); } } } diff --git a/idlc/source/parser.y b/idlc/source/parser.y index e041de7..c55c7c2 100644 --- a/idlc/source/parser.y +++ b/idlc/source/parser.y @@ -86,12 +86,12 @@ void checkIdentifier(::rtl::OString* id) msg.append("mismatched identifier '"); msg.append(*id); msg.append("'"); - idlc()->error()->syntaxError(idlc()->getParseState(), + ErrorHandler::syntaxError(idlc()->getParseState(), idlc()->getLineNumber(), msg.getStr()); } else - idlc()->error()->warning0(WIDL_WRONG_NAMING_CONV, id->getStr()); + ErrorHandler::warning0(WIDL_WRONG_NAMING_CONV, id->getStr()); } } @@ -102,7 +102,7 @@ void reportDoubleMemberDeclarations( doubleMembers.begin()); i != doubleMembers.end(); ++i) { - idlc()->error()->error2(EIDL_DOUBLE_MEMBER, i->first, i->second); + ErrorHandler::error2(EIDL_DOUBLE_MEMBER, i->first, i->second); } } @@ -113,9 +113,9 @@ void addInheritedInterface( AstDeclaration * decl = ifc->lookupByName(name); AstDeclaration const * resolved = resolveTypedefs(decl); if (resolved != 0 && resolved->getNodeType() == NT_interface) { - if (idlc()->error()->checkPublished(decl)) { + if (ErrorHandler::checkPublished(decl)) { if (!static_cast< AstInterface const * >(resolved)->isDefined()) { - idlc()->error()->inheritanceError( + ErrorHandler::inheritanceError( NT_interface, &ifc->getScopedName(), decl); } else { AstInterface::DoubleDeclarations doubleDecls( @@ -133,7 +133,7 @@ void addInheritedInterface( doubleDecls.interfaces.begin()); i != doubleDecls.interfaces.end(); ++i) { - idlc()->error()->error1( + ErrorHandler::error1( EIDL_DOUBLE_INHERITANCE, *i); } reportDoubleMemberDeclarations(doubleDecls.members); @@ -141,7 +141,7 @@ void addInheritedInterface( } } } else { - idlc()->error()->lookupError( + ErrorHandler::lookupError( EIDL_INTERFACEMEMBER_LOOKUP, name, scopeAsDecl(ifc)); } } @@ -153,14 +153,14 @@ AstDeclaration const * createNamedType( *scopedName); AstDeclaration const * resolved = resolveTypedefs(decl); if (decl == 0) { - idlc()->error()->lookupError(*scopedName); - } else if (!idlc()->error()->checkPublished(decl)) { + ErrorHandler::lookupError(*scopedName); + } else if (!ErrorHandler::checkPublished(decl)) { decl = 0; } else if (resolved->getNodeType() == NT_struct) { if (static_cast< AstStruct const * >(resolved)->getTypeParameterCount() != (typeArgs == 0 ? 0 : typeArgs->size())) { - idlc()->error()->error0(EIDL_WRONG_NUMBER_OF_TYPE_ARGUMENTS); + ErrorHandler::error0(EIDL_WRONG_NUMBER_OF_TYPE_ARGUMENTS); decl = 0; } else if (typeArgs != 0) { AstScope * global = idlc()->scopes()->bottom(); @@ -173,11 +173,11 @@ AstDeclaration const * createNamedType( } } else if (decl->isType()) { if (typeArgs != 0) { - idlc()->error()->error0(EIDL_WRONG_NUMBER_OF_TYPE_ARGUMENTS); + ErrorHandler::error0(EIDL_WRONG_NUMBER_OF_TYPE_ARGUMENTS); decl = 0; } } else { - idlc()->error()->noTypeError(decl); + ErrorHandler::noTypeError(decl); decl = 0; } delete scopedName; @@ -534,7 +534,7 @@ forward_dcl : delete pForward; } else { - idlc()->error()->error2(EIDL_REDEF_SCOPE, scopeAsDecl(pScope), pDecl); + ErrorHandler::error2(EIDL_REDEF_SCOPE, scopeAsDecl(pScope), pDecl); } } else { @@ -583,14 +583,14 @@ interface_dcl : { if ( pForward->getScopedName() != pInterface->getScopedName() ) { - idlc()->error()->error3(EIDL_SCOPE_CONFLICT, + ErrorHandler::error3(EIDL_SCOPE_CONFLICT, pInterface, pForward, scopeAsDecl(pScope)); } } else if ( !pInterface->isPublished() && pForward->isPublished() ) { - idlc()->error()->error0(EIDL_PUBLISHED_FORWARD); + ErrorHandler::error0(EIDL_PUBLISHED_FORWARD); } /* * All OK, set full definition @@ -728,7 +728,7 @@ attribute : { idlc()->setParseState(PS_AttrCompleted); if (($1 & ~(AF_BOUND | AF_READONLY)) != AF_ATTRIBUTE) { - idlc()->error()->flagError(EIDL_BAD_ATTRIBUTE_FLAGS, $1); + ErrorHandler::flagError(EIDL_BAD_ATTRIBUTE_FLAGS, $1); } AstInterface * scope = static_cast< AstInterface * >( idlc()->scopes()->top()); @@ -769,7 +769,7 @@ opt_attrflags : opt_attrflags ',' opt_attrflag { if ( ($1 & $3) == $3 ) - idlc()->error()->flagError(EIDL_DEFINED_ATTRIBUTEFLAG, $3); + ErrorHandler::flagError(EIDL_DEFINED_ATTRIBUTEFLAG, $3); $$ = $1 | $3; } @@ -914,7 +914,7 @@ attribute_set_raises: if (static_cast< AstAttribute * >(idlc()->scopes()->top())-> isReadonly()) { - idlc()->error()->error0(EIDL_READONLY_ATTRIBUTE_SET_EXCEPTIONS); + ErrorHandler::error0(EIDL_READONLY_ATTRIBUTE_SET_EXCEPTIONS); } } raises ';' @@ -1057,10 +1057,10 @@ parameter : if ( pType ) { if (pScope->isConstructor() && $2 != DIR_IN) { - idlc()->error()->error0(EIDL_CONSTRUCTOR_PARAMETER_NOT_IN); + ErrorHandler::error0(EIDL_CONSTRUCTOR_PARAMETER_NOT_IN); } if (pScope->isVariadic()) { - idlc()->error()->error0(EIDL_REST_PARAMETER_NOT_LAST); + ErrorHandler::error0(EIDL_REST_PARAMETER_NOT_LAST); } if ($7) { AstDeclaration const * type = resolveTypedefs(pType); @@ -1068,17 +1068,17 @@ parameter : || (static_cast< AstBaseType const * >(type)-> getExprType() != ET_any)) { - idlc()->error()->error0(EIDL_REST_PARAMETER_NOT_ANY); + ErrorHandler::error0(EIDL_REST_PARAMETER_NOT_ANY); } if (pScope->isConstructor()) { if (pScope->getIteratorBegin() != pScope->getIteratorEnd()) { - idlc()->error()->error0( + ErrorHandler::error0( EIDL_CONSTRUCTOR_REST_PARAMETER_NOT_FIRST); } } else { - idlc()->error()->error0(EIDL_METHOD_HAS_REST_PARAMETER); + ErrorHandler::error0(EIDL_METHOD_HAS_REST_PARAMETER); } } @@ -1176,11 +1176,11 @@ exception_name: AstDeclaration * decl = idlc()->scopes()->nextToTop()->lookupByName( *$1); if (decl == 0) { - idlc()->error()->lookupError(*$1); - } else if (!idlc()->error()->checkPublished(decl)) { + ErrorHandler::lookupError(*$1); + } else if (!ErrorHandler::checkPublished(decl)) { decl = 0; } else if (decl->getNodeType() != NT_exception) { - idlc()->error()->error1(EIDL_ILLEGAL_RAISES, decl); + ErrorHandler::error1(EIDL_ILLEGAL_RAISES, decl); decl = 0; } delete $1; @@ -1199,7 +1199,7 @@ interface_inheritance_decl: AstInterface * ifc = static_cast< AstInterface * >( idlc()->scopes()->top()); if (ifc->usesSingleInheritance()) { - idlc()->error()->error0(EIDL_MIXED_INHERITANCE); + ErrorHandler::error0(EIDL_MIXED_INHERITANCE); } else { addInheritedInterface( ifc, *$4, $1, @@ -1249,7 +1249,7 @@ constants_export : { if ( !$9->coerce($3) ) { - idlc()->error()->coercionError($9, $3); + ErrorHandler::coercionError($9, $3); } else { pConstant = new AstConstant($3, $9, *$5, pScope); @@ -1440,7 +1440,7 @@ positive_int_expr : $1->evaluate(EK_const); if ( !$1->coerce(ET_ulong) ) { - idlc()->error()->coercionError($1, ET_ulong); + ErrorHandler::coercionError($1, ET_ulong); delete $1; $$ = NULL; } @@ -1462,7 +1462,7 @@ const_type : * to a scalar constant type */ if ( pScope && (type = pScope->lookupByName(*$1)) ) { - if (!idlc()->error()->checkPublished(type)) + if (!ErrorHandler::checkPublished(type)) { type = 0; $$ = ET_none; @@ -1556,14 +1556,14 @@ property : if ( pScope->getScopeNodeType() == NT_singleton ) { - idlc()->error()->error0(EIDL_ILLEGAL_ADD); + ErrorHandler::error0(EIDL_ILLEGAL_ADD); } else { if ( ($1 & AF_ATTRIBUTE) == AF_ATTRIBUTE ) - idlc()->error()->flagError(EIDL_WRONGATTRIBUTEKEYWORD, AF_ATTRIBUTE); + ErrorHandler::flagError(EIDL_WRONGATTRIBUTEKEYWORD, AF_ATTRIBUTE); if ( ($1 & AF_PROPERTY) != AF_PROPERTY ) - idlc()->error()->flagError(EIDL_MISSINGATTRIBUTEKEYWORD, AF_PROPERTY); + ErrorHandler::flagError(EIDL_MISSINGATTRIBUTEKEYWORD, AF_PROPERTY); /* * Create nodes representing attributes and add them to the @@ -1628,7 +1628,7 @@ service_export : if ( pScope->getScopeNodeType() == NT_singleton ) { - idlc()->error()->error0(EIDL_ILLEGAL_ADD); + ErrorHandler::error0(EIDL_ILLEGAL_ADD); } else { /* @@ -1649,7 +1649,7 @@ service_export : * interfaces if they are optional */ bool bOptional = (($1 & AF_OPTIONAL) == AF_OPTIONAL); - if ( idlc()->error()->checkPublished(pDecl, bOptional) ) + if ( ErrorHandler::checkPublished(pDecl, bOptional) ) { pIMember = new AstInterfaceMember( $1, (AstInterface*)pDecl, *iter, pScope); @@ -1657,8 +1657,7 @@ service_export : } } else { - idlc()->error()-> - lookupError(EIDL_INTERFACEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); + ErrorHandler::lookupError(EIDL_INTERFACEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); } iter++; } @@ -1691,8 +1690,8 @@ service_export : if ( pDecl && (pDecl->getNodeType() == NT_service) ) { if ( static_cast< AstService * >(pDecl)->isSingleInterfaceBasedService() || (pScope->getScopeNodeType() == NT_singleton && pScope->nMembers() > 0) ) - idlc()->error()->error0(EIDL_ILLEGAL_ADD); - else if ( idlc()->error()->checkPublished(pDecl) ) + ErrorHandler::error0(EIDL_ILLEGAL_ADD); + else if ( ErrorHandler::checkPublished(pDecl) ) { pSMember = new AstServiceMember( $1, (AstService*)pDecl, *iter, pScope); @@ -1700,8 +1699,7 @@ service_export : } } else { - idlc()->error()-> - lookupError(EIDL_SERVICEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); + ErrorHandler::lookupError(EIDL_SERVICEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); } iter++; } @@ -1720,7 +1718,7 @@ service_export : if ( pScope->getScopeNodeType() == NT_singleton ) { - idlc()->error()->error0(EIDL_ILLEGAL_ADD); + ErrorHandler::error0(EIDL_ILLEGAL_ADD); } else { /* @@ -1741,8 +1739,7 @@ service_export : pScope->addDeclaration(pObserves); } else { - idlc()->error()-> - lookupError(EIDL_INTERFACEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); + ErrorHandler::lookupError(EIDL_INTERFACEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); } iter++; } @@ -1762,7 +1759,7 @@ service_export : if ( pScope->getScopeNodeType() == NT_singleton ) { - idlc()->error()->error0(EIDL_ILLEGAL_ADD); + ErrorHandler::error0(EIDL_ILLEGAL_ADD); } else { /* @@ -1783,8 +1780,7 @@ service_export : pScope->addDeclaration(pNeeds); } else { - idlc()->error()-> - lookupError(EIDL_SERVICEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); + ErrorHandler::lookupError(EIDL_SERVICEMEMBER_LOOKUP, *iter, scopeAsDecl(pScope)); } iter++; } @@ -1810,7 +1806,7 @@ service_interface_header : { idlc()->setParseState(PS_ServiceIFHeadSeen); if ( (AF_OPTIONAL != $1) && ( AF_INVALID != $1) ) - idlc()->error()->flagError(EIDL_OPTIONALEXPECTED, $1); + ErrorHandler::flagError(EIDL_OPTIONALEXPECTED, $1); $$ = $1; } ; @@ -1826,7 +1822,7 @@ service_service_header : { idlc()->setParseState(PS_ServiceSHeadSeen); if ( (AF_OPTIONAL != $1) && ( AF_INVALID != $1) ) - idlc()->error()->flagError(EIDL_OPTIONALEXPECTED, $1); + ErrorHandler::flagError(EIDL_OPTIONALEXPECTED, $1); $$ = $1; } ; @@ -1877,11 +1873,11 @@ service_interface_dfn: // skip the scope pushed by service_dcl AstDeclaration * decl = scope->lookupByName(*$2); if (decl != 0 && resolveTypedefs(decl)->getNodeType() == NT_interface) { - if (idlc()->error()->checkPublished(decl)) { + if (ErrorHandler::checkPublished(decl)) { idlc()->scopes()->top()->addDeclaration(decl); } } else { - idlc()->error()->lookupError( + ErrorHandler::lookupError( EIDL_INTERFACEMEMBER_LOOKUP, *$2, scopeAsDecl(scope)); } delete $2; @@ -1934,7 +1930,7 @@ constructor: if (static_cast< AstService * >(idlc()->scopes()->top())-> checkLastConstructor()) { - idlc()->error()->error0(EIDL_SIMILAR_CONSTRUCTORS); + ErrorHandler::error0(EIDL_SIMILAR_CONSTRUCTORS); } } ';' @@ -1986,11 +1982,11 @@ singleton_interface_dfn: // skip the scope (needlessly) pushed by singleton_dcl AstDeclaration * decl = scope->lookupByName(*$2); if (decl != 0 && resolveTypedefs(decl)->getNodeType() == NT_interface) { - if (idlc()->error()->checkPublished(decl)) { + if (ErrorHandler::checkPublished(decl)) { idlc()->scopes()->top()->addDeclaration(decl); } } else { - idlc()->error()->lookupError( + ErrorHandler::lookupError( EIDL_INTERFACEMEMBER_LOOKUP, *$2, scopeAsDecl(scope)); } delete $2; @@ -2033,7 +2029,7 @@ type_declarator : { idlc()->setParseState(PS_TypeSpecSeen); if ($1 != 0 && $1->getNodeType() == NT_instantiated_struct) { - idlc()->error()->error0(EIDL_INSTANTIATED_STRUCT_TYPE_TYPEDEF); + ErrorHandler::error0(EIDL_INSTANTIATED_STRUCT_TYPE_TYPEDEF); } } at_least_one_declarator @@ -2265,7 +2261,7 @@ type_arg: simple_type_spec { if ($1 != 0 && static_cast< AstType const * >($1)->isUnsigned()) { - idlc()->error()->error0(EIDL_UNSIGNED_TYPE_ARGUMENT); + ErrorHandler::error0(EIDL_UNSIGNED_TYPE_ARGUMENT); } $$ = $1; } @@ -2500,7 +2496,7 @@ structure_header : // type bases, which might also cause problems in language bindings, are // already rejected on a syntactic level.) if ($5 != 0 && $6 != 0) { - idlc()->error()->error0(EIDL_STRUCT_TYPE_TEMPLATE_WITH_BASE); + ErrorHandler::error0(EIDL_STRUCT_TYPE_TEMPLATE_WITH_BASE); } $$ = new FeInheritanceHeader(NT_struct, $3, $6, $5); @@ -2524,7 +2520,7 @@ type_params: | type_params ',' identifier { if (std::find($1->begin(), $1->end(), *$3) != $1->end()) { - idlc()->error()->error0(EIDL_IDENTICAL_TYPE_PARAMETERS); + ErrorHandler::error0(EIDL_IDENTICAL_TYPE_PARAMETERS); } $1->push_back(*$3); delete $3; @@ -2617,7 +2613,7 @@ type_or_parameter: } else { decl = createNamedType($1, $2); if (scope != 0 && includes(decl, scopeAsDecl(scope))) { - idlc()->error()->error1( + ErrorHandler::error1( EIDL_RECURSIVE_TYPE, scopeAsDecl(scope)); decl = 0; } @@ -2718,7 +2714,7 @@ enumerator : pExpr, *$1, pScope); } if ( pEnum->checkValue(pEnumVal->getConstValue()) ) - idlc()->error()->error1(EIDL_EVAL_ERROR, pEnum); + ErrorHandler::error1(EIDL_EVAL_ERROR, pEnum); pScope->addDeclaration(pEnumVal); } @@ -2746,12 +2742,12 @@ enumerator : $3, *$1, pScope); } if ( pEnum->checkValue(pEnumVal->getConstValue()) ) - idlc()->error()->error1(EIDL_EVAL_ERROR, pEnum); + ErrorHandler::error1(EIDL_EVAL_ERROR, pEnum); pScope->addDeclaration(pEnumVal); } else { - idlc()->error()->coercionError($3, ET_long); + ErrorHandler::coercionError($3, ET_long); delete $3; } } @@ -2773,7 +2769,7 @@ identifier: */ void yyerror(char const *errmsg) { - idlc()->error()->syntaxError(idlc()->getParseState(), idlc()->getLineNumber(), errmsg); + ErrorHandler::syntaxError(idlc()->getParseState(), idlc()->getLineNumber(), errmsg); idlc()->setParseState(PS_NoState); } commit 44790193a74923d42228277ed46723ba9e225136 Author: Noel Grandin <[email protected]> Date: Fri Mar 27 08:29:36 2015 +0200 loplugin:staticfunction Change-Id: I982ba552579019e4902ae59fddf14a6b34ba5954 diff --git a/UnoControls/source/inc/progressmonitor.hxx b/UnoControls/source/inc/progressmonitor.hxx index 4ac928d..e31492a 100644 --- a/UnoControls/source/inc/progressmonitor.hxx +++ b/UnoControls/source/inc/progressmonitor.hxx @@ -403,8 +403,8 @@ private: #ifdef DBG_UTIL - bool impl_debug_checkParameter( const OUString& sTopic, const OUString& sText, bool bbeforeProgress ); // addText, updateText - bool impl_debug_checkParameter( const OUString& rTopic, bool bbeforeProgress ); // removeText + static bool impl_debug_checkParameter( const OUString& sTopic, const OUString& sText, bool bbeforeProgress ); // addText, updateText + static bool impl_debug_checkParameter( const OUString& rTopic, bool bbeforeProgress ); // removeText #endif diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 117d814..71a2e85 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -373,7 +373,7 @@ namespace damaged( basegfx::B2IBox( rDamagePoint, aEnd ) ); } - boost::shared_ptr<BitmapRenderer> getCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) const + static boost::shared_ptr<BitmapRenderer> getCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) { return boost::dynamic_pointer_cast< BitmapRenderer >( bmp ); } @@ -405,7 +405,7 @@ namespace return boost::dynamic_pointer_cast<mask_bitmap_type>( bmp ).get() != NULL; } - boost::shared_ptr<alphamask_bitmap_type> getCompatibleAlphaMask( const BitmapDeviceSharedPtr& bmp ) const + static boost::shared_ptr<alphamask_bitmap_type> getCompatibleAlphaMask( const BitmapDeviceSharedPtr& bmp ) { return boost::dynamic_pointer_cast<alphamask_bitmap_type>( bmp ); } diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx index 2e1be87..3992268 100644 --- a/basegfx/source/inc/hommatrixtemplate.hxx +++ b/basegfx/source/inc/hommatrixtemplate.hxx @@ -141,7 +141,7 @@ namespace basegfx } } - sal_uInt16 getEdgeLength() const { return RowSize; } + static sal_uInt16 getEdgeLength() { return RowSize; } double get(sal_uInt16 nRow, sal_uInt16 nColumn) const { diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index 88409d5..b1fe9b4 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -27,7 +27,8 @@ namespace basegfx { - class Impl2DHomMatrix : public ::basegfx::internal::ImplHomMatrixTemplate< 3 > + typedef ::basegfx::internal::ImplHomMatrixTemplate< 3 > Impl2DHomMatrix_Base; + class Impl2DHomMatrix : public Impl2DHomMatrix_Base { }; @@ -111,7 +112,7 @@ namespace basegfx bool B2DHomMatrix::invert() { Impl2DHomMatrix aWork(*mpImpl); - sal_uInt16* pIndex = new sal_uInt16[mpImpl->getEdgeLength()]; + sal_uInt16* pIndex = new sal_uInt16[Impl2DHomMatrix_Base::getEdgeLength()]; sal_Int16 nParity; if(aWork.ludcmp(pIndex, nParity)) diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index 75ba78f..dac62a9 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -24,7 +24,8 @@ namespace basegfx { - class Impl3DHomMatrix : public ::basegfx::internal::ImplHomMatrixTemplate< 4 > + typedef ::basegfx::internal::ImplHomMatrixTemplate< 4 >Impl3DHomMatrix_Base; + class Impl3DHomMatrix : public Impl3DHomMatrix_Base { }; @@ -82,7 +83,7 @@ namespace basegfx bool B3DHomMatrix::invert() { Impl3DHomMatrix aWork(*mpImpl); - sal_uInt16* pIndex = new sal_uInt16[mpImpl->getEdgeLength()]; + sal_uInt16* pIndex = new sal_uInt16[Impl3DHomMatrix_Base::getEdgeLength()]; sal_Int16 nParity; if(aWork.ludcmp(pIndex, nParity)) diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index d9eea58..5f13852 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -137,7 +137,7 @@ namespace basegfx } } - bool impLeftOfEdges(const B2DVector& rVecA, const B2DVector& rVecB, const B2DVector& rTest) + static bool impLeftOfEdges(const B2DVector& rVecA, const B2DVector& rVecB, const B2DVector& rTest) { // tests if rTest is left of both directed line segments along the line -rVecA, rVecB. Test is // with border. diff --git a/basegfx/source/range/b2drangeclipper.cxx b/basegfx/source/range/b2drangeclipper.cxx index 60100be..edbb128 100644 --- a/basegfx/source/range/b2drangeclipper.cxx +++ b/basegfx/source/range/b2drangeclipper.cxx @@ -484,7 +484,7 @@ namespace basegfx } /// True when sweep line hits our own active edge - bool metOwnEdge(const SweepLineEvent& rEvent, + static bool metOwnEdge(const SweepLineEvent& rEvent, ActiveEdge& rActiveEdge) { const bool bHitOwnEdge=&rEvent.getRect() == &rActiveEdge.getRect(); diff --git a/include/basebmp/accessoradapters.hxx b/include/basebmp/accessoradapters.hxx index e325339..0d0122e 100644 --- a/include/basebmp/accessoradapters.hxx +++ b/include/basebmp/accessoradapters.hxx @@ -208,9 +208,9 @@ public: - typename SetterFunctor::result_type setter( + static typename SetterFunctor::result_type setter( typename SetterFunctor::first_argument_type v1, - argument_type v2 ) const + argument_type v2 ) { return maSetterFunctor(v1,v2); } @@ -343,10 +343,10 @@ public: - typename Functor::result_type setter( + static typename Functor::result_type setter( typename Functor::first_argument_type v1, typename Functor::second_argument_type v2, - argument_type v3 ) const + argument_type v3 ) { return maSetterFunctor(v1,v2,v3); } commit c4a9241f72e3b7bf84eaadc51dbaa2accc7b920c Author: Noel Grandin <[email protected]> Date: Wed Mar 25 15:37:53 2015 +0200 new clang plugin: staticmethods Genius suggestion from Tor Lillqvist, write a clang plugin that finds methods that can be static. Change-Id: Ie6684cc95d088e8750b300a028b49f763da00345 diff --git a/comphelper/source/misc/componentbase.cxx b/comphelper/source/misc/componentbase.cxx index aa23f9d5..7b0b820 100644 --- a/comphelper/source/misc/componentbase.cxx +++ b/comphelper/source/misc/componentbase.cxx @@ -51,7 +51,7 @@ namespace comphelper } - Reference< XInterface > ComponentBase::getComponent() const + Reference< XInterface > ComponentBase::getComponent() { return NULL; } diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 8c5a220..f5e9cba 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -370,9 +370,13 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const OUString& Prop if (pSlave->mpMutex) xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) ); - pSlave->_preGetPropertyState(); - pSlave->_getPropertyState( *((*aIter).second->mpInfo), aState ); - pSlave->_postGetPropertyState(); + // FIXME: Each of these three methods does OSL_FAIL( "you have + // to implement this yourself!") and nothing else, so this + // can't make much sense. Is this whole else branch in fact + // dead code? + ChainablePropertySet::_preGetPropertyState(); + ChainablePropertySet::_getPropertyState( *((*aIter).second->mpInfo), aState ); + ChainablePropertySet::_postGetPropertyState(); } return aState; @@ -404,10 +408,10 @@ Sequence< PropertyState > SAL_CALL MasterPropertySet::getPropertyStates( const S SlaveData * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]; if (!pSlave->IsInit()) { - pSlave->mpSlave->_preGetPropertyState(); + comphelper::ChainablePropertySet::_preGetPropertyState(); pSlave->SetInit ( true ); } - pSlave->mpSlave->_getPropertyState( *((*aIter).second->mpInfo), *pState ); + comphelper::ChainablePropertySet::_getPropertyState( *((*aIter).second->mpInfo), *pState ); } } _postGetPropertyState(); @@ -416,7 +420,7 @@ Sequence< PropertyState > SAL_CALL MasterPropertySet::getPropertyStates( const S { if ( (*aSlaveIter).second->IsInit()) { - (*aSlaveIter).second->mpSlave->_postGetPropertyState(); + comphelper::ChainablePropertySet::_postGetPropertyState(); (*aSlaveIter).second->SetInit ( false ); } ++aSlaveIter; diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx index 78acb54..64e0b04 100644 --- a/compilerplugins/clang/compat.hxx +++ b/compilerplugins/clang/compat.hxx @@ -224,6 +224,16 @@ inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::Sourc } +inline bool isMacroBodyExpansion(clang::CompilerInstance& compiler, clang::SourceLocation location) +{ +#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 + return compiler.getSourceManager().isMacroBodyExpansion(location); +#else + return location.isMacroID() + && !compiler.getSourceManager().isMacroArgExpansion(location); +#endif +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx index 65fe53c..00ecdd8 100644 --- a/compilerplugins/clang/literaltoboolconversion.cxx +++ b/compilerplugins/clang/literaltoboolconversion.cxx @@ -29,8 +29,6 @@ public: private: bool isFromCIncludeFile(SourceLocation spellingLocation) const; - - bool isMacroBodyExpansion(SourceLocation location) const; }; bool LiteralToBoolConversion::VisitImplicitCastExpr( @@ -64,7 +62,7 @@ bool LiteralToBoolConversion::VisitImplicitCastExpr( while (compiler.getSourceManager().isMacroArgExpansion(loc)) { loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc); } - if (isMacroBodyExpansion(loc)) { + if (isMacroBodyExpansion(compiler, loc)) { StringRef name { Lexer::getImmediateMacroName( loc, compiler.getSourceManager(), compiler.getLangOpts()) }; if (name == "sal_False" || name == "sal_True") { @@ -166,17 +164,6 @@ bool LiteralToBoolConversion::isFromCIncludeFile( .endswith(".h")); } -bool LiteralToBoolConversion::isMacroBodyExpansion(SourceLocation location) - const -{ -#if (__clang_major__ == 3 && __clang_minor__ >= 3) || __clang_major__ > 3 - return compiler.getSourceManager().isMacroBodyExpansion(location); -#else - return location.isMacroID() - && !compiler.getSourceManager().isMacroArgExpansion(location); -#endif -} - loplugin::Plugin::Registration<LiteralToBoolConversion> X( "literaltoboolconversion", true); diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx new file mode 100644 index 0000000..b5b2a9d --- /dev/null +++ b/compilerplugins/clang/staticmethods.cxx @@ -0,0 +1,141 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "plugin.hxx" +#include "compat.hxx" + +/* + Look for member functions that can be static +*/ +namespace { + +class StaticMethods: + public RecursiveASTVisitor<StaticMethods>, public loplugin::Plugin +{ +private: + bool bVisitedThis; +public: + explicit StaticMethods(InstantiationData const & data): Plugin(data) {} + + void run() override + { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } + + bool TraverseCXXMethodDecl(const CXXMethodDecl * decl); + + bool VisitCXXThisExpr(const CXXThisExpr *) { bVisitedThis = true; return true; } + // these two indicate that we hit something that makes our analysis unreliable + bool VisitUnresolvedMemberExpr(const UnresolvedMemberExpr *) { bVisitedThis = true; return true; } + bool VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *) { bVisitedThis = true; return true; } +private: + std::string getFilename(SourceLocation loc); +}; + +bool BaseCheckNotTestFixtureSubclass(const CXXRecordDecl *BaseDefinition, void *) { + if (BaseDefinition->getQualifiedNameAsString().compare("CppUnit::TestFixture") == 0) { + return false; + } + return true; +} + +bool isDerivedFromTestFixture(const CXXRecordDecl *decl) { + if (!decl->hasDefinition()) + return false; + if (// not sure what hasAnyDependentBases() does, + // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1 + !decl->hasAnyDependentBases() && + !decl->forallBases(BaseCheckNotTestFixtureSubclass, nullptr, true)) { + return true; + } + return false; +} + +std::string StaticMethods::getFilename(SourceLocation loc) +{ + SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc); + return compiler.getSourceManager().getFilename(spellingLocation); +} + + +bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl) { + if (ignoreLocation(pCXXMethodDecl)) { + return true; + } + if (!pCXXMethodDecl->isInstance() || pCXXMethodDecl->isVirtual() || !pCXXMethodDecl->hasBody()) { + return true; + } + if (pCXXMethodDecl->getOverloadedOperator() != OverloadedOperatorKind::OO_None || pCXXMethodDecl->hasAttr<OverrideAttr>()) { + return true; + } + if (isa<CXXConstructorDecl>(pCXXMethodDecl) || isa<CXXDestructorDecl>(pCXXMethodDecl) || isa<CXXConversionDecl>(pCXXMethodDecl)) { + return true; + } + if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(pCXXMethodDecl->getCanonicalDecl()->getLocStart()))) { + return true; + } + if ( pCXXMethodDecl != pCXXMethodDecl->getCanonicalDecl() ) { + return true; + } + + // leave these alone for now, it is possible to fix them, but I don't understand how + SourceLocation canonicalLoc = pCXXMethodDecl->getCanonicalDecl()->getLocStart(); + if (isMacroBodyExpansion(compiler, canonicalLoc) ) { + StringRef name { Lexer::getImmediateMacroName( + canonicalLoc, compiler.getSourceManager(), compiler.getLangOpts()) }; + if (name == "DECL_LINK") { + return true; + } + } + // the CppUnit stuff uses macros and methods that can't be changed + if (isDerivedFromTestFixture(pCXXMethodDecl->getParent())) { + return true; + } + // don't mess with the backwards compatibility stuff + if (getFilename(pCXXMethodDecl->getLocStart()) == SRCDIR "/cppuhelper/source/compat.cxx") { + 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") { + return true; + } + std::string aParentName = pCXXMethodDecl->getParent()->getQualifiedNameAsString(); + // special case having something to do with static initialisation + // sal/osl/all/utility.cxx + if (aParentName == "osl::OGlobalTimer") { + return true; + } + // can't change it because in debug mode it can't be static + // sal/cpprt/operators_new_delete.cxx + if (aParentName == "(anonymous namespace)::AllocatorTraits") { + return true; + } + // in this case, the code is taking the address of the member function + // shell/source/unix/sysshell/recently_used_file_handler.cxx + if (aParentName == "(anonymous namespace)::recently_used_item") { + return true; + } + + bVisitedThis = false; + TraverseStmt(pCXXMethodDecl->getBody()); + if (bVisitedThis) { + return true; + } + + report( + DiagnosticsEngine::Warning, + "this method can be declared static " + aParentName, + pCXXMethodDecl->getCanonicalDecl()->getLocStart()) + << pCXXMethodDecl->getCanonicalDecl()->getSourceRange(); + return true; +} + +loplugin::Plugin::Registration<StaticMethods> X("staticmethods", false); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/comphelper/ChainablePropertySet.hxx b/include/comphelper/ChainablePropertySet.hxx index 31e1de7..07210be 100644 --- a/include/comphelper/ChainablePropertySet.hxx +++ b/include/comphelper/ChainablePropertySet.hxx @@ -96,16 +96,16 @@ namespace comphelper virtual void _postGetValues () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0; - void _preGetPropertyState () + static void _preGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); - void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState ) + static void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException ); - void _postGetPropertyState () + static void _postGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); - void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry ) + static void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry ) throw(::com::sun::star::beans::UnknownPropertyException ); - ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry ) + static ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); public: diff --git a/include/comphelper/MasterPropertySet.hxx b/include/comphelper/MasterPropertySet.hxx index b2cb4d9..bff7835 100644 --- a/include/comphelper/MasterPropertySet.hxx +++ b/include/comphelper/MasterPropertySet.hxx @@ -84,16 +84,16 @@ namespace comphelper virtual void _postGetValues () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0; - void _preGetPropertyState () + static void _preGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); - void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState ) + static void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState ) throw(::com::sun::star::beans::UnknownPropertyException ); - void _postGetPropertyState () + static void _postGetPropertyState () throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ); - void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry ) + static void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry ) throw(::com::sun::star::beans::UnknownPropertyException ); - ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry ) + static ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ); public: diff --git a/include/comphelper/accessibletexthelper.hxx b/include/comphelper/accessibletexthelper.hxx index 6edef5b..af4d690 100644 --- a/include/comphelper/accessibletexthelper.hxx +++ b/include/comphelper/accessibletexthelper.hxx @@ -52,9 +52,9 @@ namespace comphelper ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
