diff options
author | Noel Grandin <noel@peralex.com> | 2016-09-14 09:01:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-14 08:47:06 +0000 |
commit | 20a9e101d909cb1953101e5962b74731e1265400 (patch) | |
tree | 4e2516dcb7a5e19efb36fc4c2560b9211af83ce9 | |
parent | 0761f97525b3f3ce2cd73f8db28bf389a3c44f57 (diff) |
loplugin:constantparam
clean up the plugin a little, and try to catch params which are default
constructed, which doesn't seem to be working yet
Change-Id: Ife45f18502a45cd26306424b7432c55fcbb0fd12
Reviewed-on: https://gerrit.libreoffice.org/28861
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
30 files changed, 116 insertions, 185 deletions
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 1696e66eebf4..58e683438814 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -427,7 +427,7 @@ SbxBase* SbiFactory::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator ) case SBXID_JSCRIPTMOD: return new SbJScriptModule( "" ); case SBXID_JSCRIPTMETH: - return new SbJScriptMethod( "", SbxVARIANT, nullptr ); + return new SbJScriptMethod( "", SbxVARIANT ); } } return nullptr; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 0082d9f15d1b..d4b7e3750b5b 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2168,8 +2168,8 @@ void SbMethod::Broadcast( sal_uInt32 nHintId ) // Implementation of SbJScriptMethod (method class as a wrapper for JavaScript-functions) -SbJScriptMethod::SbJScriptMethod( const OUString& r, SbxDataType t, SbModule* p ) - : SbMethod( r, t, p ) +SbJScriptMethod::SbJScriptMethod( const OUString& r, SbxDataType t ) + : SbMethod( r, t, nullptr ) { } diff --git a/basic/source/inc/sbjsmeth.hxx b/basic/source/inc/sbjsmeth.hxx index 0c7ce3432b51..3403b392986d 100644 --- a/basic/source/inc/sbjsmeth.hxx +++ b/basic/source/inc/sbjsmeth.hxx @@ -30,7 +30,7 @@ class SbJScriptMethod : public SbMethod { public: - SbJScriptMethod( const OUString&, SbxDataType, SbModule* ); + SbJScriptMethod( const OUString&, SbxDataType ); virtual ~SbJScriptMethod() override; SBX_DECL_PERSIST_NODATA(SBXID_JSCRIPTMETH,2); diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx index 784e9d11aa36..908c88f4d2c4 100644 --- a/basic/source/sbx/sbxvar.cxx +++ b/basic/source/sbx/sbxvar.cxx @@ -116,7 +116,7 @@ void SbxEnsureParentVariable::SetParent(SbxObject* p) assert(GetParent() == xParent.get()); } -SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p ) +SbxVariable::SbxVariable( SbxDataType t ) : SbxValue( t, nullptr ) { pCst = nullptr; pParent = nullptr; diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 4f28f5dc9010..c5e341951279 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -1088,14 +1088,12 @@ namespace cairocanvas void CanvasHelper::doPolyPolygonPath( const uno::Reference< rendering::XPolyPolygon2D >& xPolyPolygon, Operation aOperation, bool bNoLineJoin, - const uno::Sequence< rendering::Texture >* pTextures, - cairo_t* pCairo ) const + const uno::Sequence< rendering::Texture >* pTextures ) const { const ::basegfx::B2DPolyPolygon& rPolyPoly( ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(xPolyPolygon) ); - if( !pCairo ) - pCairo = mpCairo.get(); + cairo_t* pCairo = mpCairo.get(); if(bNoLineJoin && Stroke == aOperation) { diff --git a/canvas/source/cairo/cairo_canvashelper.hxx b/canvas/source/cairo/cairo_canvashelper.hxx index a5f60d763f76..1482d2bd8d5d 100644 --- a/canvas/source/cairo/cairo_canvashelper.hxx +++ b/canvas/source/cairo/cairo_canvashelper.hxx @@ -221,8 +221,7 @@ namespace cairocanvas void doPolyPolygonPath( const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon, Operation aOperation, bool bNoLineJoin = false, - const css::uno::Sequence< css::rendering::Texture >* pTextures=nullptr, - cairo_t* pCairo=nullptr ) const; + const css::uno::Sequence< css::rendering::Texture >* pTextures=nullptr ) const; css::uno::Reference< css::rendering::XCachedPrimitive > implDrawBitmapSurface( const css::rendering::XCanvas* pCanvas, diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx index 58a2c212eead..61428ac60dff 100644 --- a/compilerplugins/clang/constantparam.cxx +++ b/compilerplugins/clang/constantparam.cxx @@ -33,6 +33,7 @@ struct MyCallSiteInfo std::string returnType; std::string nameAndParams; std::string paramName; + std::string paramType; int paramIndex; // because in some declarations the names are empty std::string callValue; std::string sourceLocation; @@ -55,27 +56,6 @@ public: virtual void run() override { - // there is a crash here that I can't seem to workaround - // clang-3.8: /home/noel/clang/src/tools/clang/lib/AST/Type.cpp:1878: bool clang::Type::isConstantSizeType() const: Assertion `!isDependentType() && "This doesn't make sense for dependent types"' failed. - FileID mainFileID = compiler.getSourceManager().getMainFileID(); - static const char* prefix = SRCDIR "/oox/source"; - const FileEntry * fe = compiler.getSourceManager().getFileEntryForID(mainFileID); - if (strncmp(prefix, fe->getDir()->getName(), strlen(prefix)) == 0) { - return; - } - if (strcmp(fe->getDir()->getName(), SRCDIR "/sw/source/filter/ww8") == 0) - { - return; - } - if (strcmp(fe->getDir()->getName(), SRCDIR "/sc/source/filter/oox") == 0) - { - return; - } - if (strcmp(fe->getDir()->getName(), SRCDIR "/sd/source/filter/eppt") == 0) - { - return; - } - TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); // dump all our output in one write call - this is to try and limit IO "crosstalk" between multiple processes @@ -84,7 +64,7 @@ public: std::string output; for (const MyCallSiteInfo & s : callSet) output += s.returnType + "\t" + s.nameAndParams + "\t" + s.sourceLocation + "\t" - + s.paramName + "\t" + s.callValue + "\n"; + + s.paramName + "\t" + s.paramType + "\t" + s.callValue + "\n"; ofstream myfile; myfile.open( SRCDIR "/loplugin.constantparam.log", ios::app | ios::out); myfile << output; @@ -98,11 +78,11 @@ public: bool VisitDeclRefExpr( const DeclRefExpr* ); bool VisitCXXConstructExpr( const CXXConstructExpr* ); private: - MyCallSiteInfo niceName(const FunctionDecl* functionDecl, int paramIndex, llvm::StringRef paramName, const std::string& callValue); + void addToCallSet(const FunctionDecl* functionDecl, int paramIndex, llvm::StringRef paramName, const std::string& callValue); std::string getCallValue(const Expr* arg); }; -MyCallSiteInfo ConstantParam::niceName(const FunctionDecl* functionDecl, int paramIndex, llvm::StringRef paramName, const std::string& callValue) +void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramIndex, llvm::StringRef paramName, const std::string& callValue) { if (functionDecl->getInstantiatedFromMemberFunction()) functionDecl = functionDecl->getInstantiatedFromMemberFunction(); @@ -114,6 +94,21 @@ MyCallSiteInfo ConstantParam::niceName(const FunctionDecl* functionDecl, int par functionDecl = functionDecl->getTemplateInstantiationPattern(); #endif + + if (!functionDecl->getNameInfo().getLoc().isValid()) + return; + if (ignoreLocation(functionDecl)) + return; + // ignore stuff that forms part of the stable URE interface + if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(functionDecl->getLocation()))) + return; + SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( functionDecl->getLocation() ); + StringRef filename = compiler.getSourceManager().getFilename(expansionLoc); + if (!filename.startswith(SRCDIR)) + return; + filename = filename.substr(strlen(SRCDIR)+1); + + MyCallSiteInfo aInfo; aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString(); @@ -137,13 +132,13 @@ MyCallSiteInfo ConstantParam::niceName(const FunctionDecl* functionDecl, int par } aInfo.paramName = paramName; aInfo.paramIndex = paramIndex; + if (paramIndex < (int)functionDecl->getNumParams()) + aInfo.paramType = functionDecl->getParamDecl(paramIndex)->getType().getCanonicalType().getAsString(); aInfo.callValue = callValue; - SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( functionDecl->getLocation() ); - StringRef name = compiler.getSourceManager().getFilename(expansionLoc); - aInfo.sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc)); + aInfo.sourceLocation = filename.str() + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc)); - return aInfo; + callSet.insert(aInfo); } std::string ConstantParam::getCallValue(const Expr* arg) @@ -165,6 +160,15 @@ std::string ConstantParam::getCallValue(const Expr* arg) if (isa<CXXNullPtrLiteralExpr>(arg)) { return "0"; } + if (isa<MaterializeTemporaryExpr>(arg)) + { + const CXXBindTemporaryExpr* strippedArg = dyn_cast_or_null<CXXBindTemporaryExpr>(arg->IgnoreParenCasts()); + if (strippedArg && isa<CXXTemporaryObjectExpr>(strippedArg->getSubExpr()) + && dyn_cast<CXXTemporaryObjectExpr>(strippedArg->getSubExpr())->getNumArgs() == 0) + { + return "defaultConstruct"; + } + } return "unknown2"; } @@ -202,15 +206,6 @@ bool ConstantParam::VisitCallExpr(const CallExpr * callExpr) { functionDecl = functionDecl->getTemplateInstantiationPattern(); #endif - if (!functionDecl->getNameInfo().getLoc().isValid() || ignoreLocation(functionDecl)) { - return true; - } - // ignore stuff that forms part of the stable URE interface - if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc( - functionDecl->getNameInfo().getLoc()))) { - return true; - } - unsigned len = std::max(callExpr->getNumArgs(), functionDecl->getNumParams()); for (unsigned i = 0; i < len; ++i) { const Expr* valExpr; @@ -225,8 +220,7 @@ bool ConstantParam::VisitCallExpr(const CallExpr * callExpr) { std::string paramName = i < functionDecl->getNumParams() ? functionDecl->getParamDecl(i)->getName() : llvm::StringRef("###" + std::to_string(i)); - MyCallSiteInfo funcInfo = niceName(functionDecl, i, paramName, callValue); - callSet.insert(funcInfo); + addToCallSet(functionDecl, i, paramName, callValue); } return true; } @@ -241,8 +235,7 @@ bool ConstantParam::VisitDeclRefExpr( const DeclRefExpr* declRefExpr ) const FunctionDecl* functionDecl = dyn_cast<FunctionDecl>(decl); for (unsigned i = 0; i < functionDecl->getNumParams(); ++i) { - MyCallSiteInfo funcInfo = niceName(functionDecl, i, functionDecl->getParamDecl(i)->getName(), "unknown3"); - callSet.insert(funcInfo); + addToCallSet(functionDecl, i, functionDecl->getParamDecl(i)->getName(), "unknown3"); } return true; } @@ -252,15 +245,6 @@ bool ConstantParam::VisitCXXConstructExpr( const CXXConstructExpr* constructExpr const CXXConstructorDecl* constructorDecl = constructExpr->getConstructor(); constructorDecl = constructorDecl->getCanonicalDecl(); - // ignore stuff that forms part of the stable URE interface - if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc( - constructorDecl->getNameInfo().getLoc()))) { - return true; - } - if (!constructorDecl->getNameInfo().getLoc().isValid() || ignoreLocation(constructorDecl)) { - return true; - } - unsigned len = std::max(constructExpr->getNumArgs(), constructorDecl->getNumParams()); for (unsigned i = 0; i < len; ++i) { const Expr* valExpr; @@ -275,8 +259,7 @@ bool ConstantParam::VisitCXXConstructExpr( const CXXConstructExpr* constructExpr std::string paramName = i < constructorDecl->getNumParams() ? constructorDecl->getParamDecl(i)->getName() : llvm::StringRef("###" + std::to_string(i)); - MyCallSiteInfo funcInfo = niceName(constructorDecl, i, paramName, callValue); - callSet.insert(funcInfo); + addToCallSet(constructorDecl, i, paramName, callValue); } return true; } diff --git a/compilerplugins/clang/constantparam.py b/compilerplugins/clang/constantparam.py index ae2b2433ae54..ed5acc449968 100755 --- a/compilerplugins/clang/constantparam.py +++ b/compilerplugins/clang/constantparam.py @@ -4,9 +4,7 @@ import sys import re import io -definitionSet = set() -definitionToSourceLocationMap = dict() -callParamSet = dict() +callDict = dict() # clang does not always use exactly the same numbers in the type-parameter vars it generates # so I need to substitute them to ensure we can match correctly. @@ -17,23 +15,20 @@ def normalizeTypeParams( line ): # reading as binary (since we known it is pure ascii) is much faster than reading as unicode with io.open("loplugin.constantparam.log", "rb", buffering=1024*1024) as txt: for line in txt: - idx1 = line.find("\t") - idx2 = line.find("\t",idx1+1) - idx3 = line.find("\t",idx2+1) - idx4 = line.find("\t",idx3+1) - returnType = normalizeTypeParams(line[:idx1]) - nameAndParams = normalizeTypeParams(line[idx1+1:idx2]) - sourceLocation = line[idx2+1:idx3] - paramName = line[idx3+1:idx4] - callValue = line[idx4+1:].strip() - callInfo = (returnType, nameAndParams, paramName) - if not callInfo in callParamSet: - callParamSet[callInfo] = set() - callParamSet[callInfo].add(callValue) - definitionToSourceLocationMap[callInfo] = sourceLocation + tokens = line.strip().split("\t") + returnType = normalizeTypeParams(tokens[0]) + nameAndParams = normalizeTypeParams(tokens[1]) + sourceLocation = tokens[2] + paramName = tokens[3] + paramType = normalizeTypeParams(tokens[4]) + callValue = tokens[5] + callInfo = (returnType, nameAndParams, paramName, paramType, sourceLocation) + if not callInfo in callDict: + callDict[callInfo] = set() + callDict[callInfo].add(callValue) tmp1list = list() -for callInfo, callValues in callParamSet.iteritems(): +for callInfo, callValues in callDict.iteritems(): nameAndParams = callInfo[1] if len(callValues) != 1: continue @@ -43,22 +38,22 @@ for callInfo, callValues in callParamSet.iteritems(): # try and ignore setter methods if ("," not in nameAndParams) and (("::set" in nameAndParams) or ("::Set" in nameAndParams)): continue - v0 = callInfo[0] + " " + callInfo[1] - v1 = callInfo[2] + " " + callValue - v2 = definitionToSourceLocationMap[callInfo] + v0 = callInfo[4] + v1 = callInfo[0] + " " + callInfo[1] + v2 = callInfo[3] + " " + callInfo[2] + " " + callValue tmp1list.append((v0,v1,v2)) # sort results by filename:lineno def natural_sort_key(s, _nsre=re.compile('([0-9]+)')): return [int(text) if text.isdigit() else text.lower() for text in re.split(_nsre, s)] -tmp1list.sort(key=lambda v: natural_sort_key(v[2])) +tmp1list.sort(key=lambda v: natural_sort_key(v[0])) # print out the results with open("loplugin.constantparam.report", "wt") as f: for v in tmp1list: - f.write(v[2] + "\n") - f.write(" " + v[0] + "\n") + f.write(v[0] + "\n") f.write(" " + v[1] + "\n") + f.write(" " + v[2] + "\n") diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx index 4a625d1b8c8e..60ab190a7a8a 100644 --- a/include/basic/sbxvar.hxx +++ b/include/basic/sbxvar.hxx @@ -242,7 +242,7 @@ protected: public: SBX_DECL_PERSIST_NODATA(SBXID_VARIABLE,2); SbxVariable(); - SbxVariable( SbxDataType, void* = nullptr ); + SbxVariable( SbxDataType ); SbxVariable( const SbxVariable& ); SbxVariable& operator=( const SbxVariable& ); diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 98c53cfe3150..8067adda06c9 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -101,7 +101,7 @@ private: /// simple ActionChildInserted forwarder to have it on a central place static void impChildInserted(SdrObject& rChild); public: - SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewUpList=nullptr); + SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage); virtual ~SdrObjList(); virtual SdrObjList* Clone() const; diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 71b803b7af0a..f5693916465c 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -453,7 +453,7 @@ public: bool EqualEntries( const ScConditionalFormat& r ) const; - void DoRepaint( const ScRange* pModified ); + void DoRepaint(); sal_uInt32 GetKey() const { return nKey; } void SetKey(sal_uInt32 nNew) { nKey = nNew; } // only if not inserted! diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 68fb54d2b577..e9440a09fa4d 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -168,7 +168,7 @@ void ScConditionEntry::StartListening() start_listen_to(*mpListener, pFormula1, rRanges); start_listen_to(*mpListener, pFormula2, rRanges); - mpListener->setCallback([&]() { pCondFormat->DoRepaint(nullptr);}); + mpListener->setCallback([&]() { pCondFormat->DoRepaint();}); } void ScConditionEntry::SetParent(ScConditionalFormat* pParent) @@ -1593,7 +1593,7 @@ ScCondFormatEntry::~ScCondFormatEntry() void ScCondFormatEntry::DataChanged() const { if ( pCondFormat ) - pCondFormat->DoRepaint( nullptr ); + pCondFormat->DoRepaint(); } ScFormatEntry* ScCondFormatEntry::Clone( ScDocument* pDoc ) const @@ -1820,7 +1820,7 @@ void ScConditionalFormat::RemoveEntry(size_t n) if (n < maEntries.size()) { maEntries.erase(maEntries.begin() + n); - DoRepaint(nullptr); + DoRepaint(); } } @@ -1903,18 +1903,10 @@ ScCondFormatData ScConditionalFormat::GetData( ScRefCellValue& rCell, const ScAd return aData; } -void ScConditionalFormat::DoRepaint( const ScRange* pModified ) +void ScConditionalFormat::DoRepaint() { - if(pModified) - { - if(maRanges.Intersects(*pModified)) - pDoc->RepaintRange(*pModified); - } - else - { - // all conditional format cells - pDoc->RepaintRange( maRanges ); - } + // all conditional format cells + pDoc->RepaintRange( maRanges ); } void ScConditionalFormat::CompileAll() diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index a8d8b63db6a1..f076c54946e0 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -142,17 +142,15 @@ public: static void GlobalExit(); // called by ScGlobal::Clear() /// Could string be a regular expression? - /// If pDoc!=NULL the document options are taken into account and if - /// RegularExpressions are disabled the function returns false regardless + /// if regularExpressions are disabled the function returns false regardless /// of the string content. - static bool MayBeRegExp( const OUString& rStr, const ScDocument* pDoc, bool bIgnoreWildcards = false ); + static bool MayBeRegExp( const OUString& rStr, bool bIgnoreWildcards = false ); /** Could string be a wildcard (*,?,~) expression? - If pDoc!=NULL the document options are taken into account and if - Wildcards are disabled the function returns false regardless of the + If wildcards are disabled the function returns false regardless of the string content. */ - static bool MayBeWildcard( const OUString& rStr, const ScDocument* pDoc ); + static bool MayBeWildcard( const OUString& rStr ); /** Detect if string should be used as regular expression or wildcard expression or literal string. diff --git a/sc/source/core/tool/bulkdatahint.cxx b/sc/source/core/tool/bulkdatahint.cxx index 134c50809d28..e21df7615f8f 100644 --- a/sc/source/core/tool/bulkdatahint.cxx +++ b/sc/source/core/tool/bulkdatahint.cxx @@ -16,13 +16,13 @@ struct BulkDataHint::Impl ScDocument& mrDoc; const ColumnSpanSet* mpSpans; - Impl( ScDocument& rDoc, const ColumnSpanSet* pSpans ) : + Impl( ScDocument& rDoc ) : mrDoc(rDoc), - mpSpans(pSpans) {} + mpSpans(nullptr) {} }; BulkDataHint::BulkDataHint( ScDocument& rDoc ) : - SfxSimpleHint(SC_HINT_BULK_DATACHANGED), mpImpl(new Impl(rDoc, nullptr)) {} + SfxSimpleHint(SC_HINT_BULK_DATACHANGED), mpImpl(new Impl(rDoc)) {} BulkDataHint::~BulkDataHint() { diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index f65a2d32690e..0c380dcd1211 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8601,10 +8601,8 @@ void ScInterpreter::ScErrorType_ODF() PushNA(); } -bool ScInterpreter::MayBeRegExp( const OUString& rStr, const ScDocument* pDoc, bool bIgnoreWildcards ) +bool ScInterpreter::MayBeRegExp( const OUString& rStr, bool bIgnoreWildcards ) { - if ( pDoc && !pDoc->GetDocOptions().IsFormulaRegexEnabled() ) - return false; if ( rStr.isEmpty() || (rStr.getLength() == 1 && !rStr.startsWith(".")) ) return false; // single meta characters can not be a regexp // First two characters are wildcard '?' and '*' characters. @@ -8624,11 +8622,8 @@ bool ScInterpreter::MayBeRegExp( const OUString& rStr, const ScDocument* pDoc, b return false; } -bool ScInterpreter::MayBeWildcard( const OUString& rStr, const ScDocument* pDoc ) +bool ScInterpreter::MayBeWildcard( const OUString& rStr ) { - if ( pDoc && !pDoc->GetDocOptions().IsFormulaWildcardsEnabled() ) - return false; - // Wildcards with '~' escape, if there are no wildcards then an escaped // character does not make sense, but it modifies the search pattern in an // Excel compatible wildcard search.. @@ -8652,16 +8647,16 @@ utl::SearchParam::SearchType ScInterpreter::DetectSearchType( const OUString& rS if (pDoc) { if (pDoc->GetDocOptions().IsFormulaWildcardsEnabled()) - return MayBeWildcard( rStr, nullptr) ? utl::SearchParam::SRCH_WILDCARD : utl::SearchParam::SRCH_NORMAL; + return MayBeWildcard( rStr ) ? utl::SearchParam::SRCH_WILDCARD : utl::SearchParam::SRCH_NORMAL; if (pDoc->GetDocOptions().IsFormulaRegexEnabled()) - return MayBeRegExp( rStr, nullptr) ? utl::SearchParam::SRCH_REGEXP : utl::SearchParam::SRCH_NORMAL; + return MayBeRegExp( rStr ) ? utl::SearchParam::SRCH_REGEXP : utl::SearchParam::SRCH_NORMAL; } else { /* TODO: obtain the global config for this rare case? */ - if (MayBeRegExp( rStr, nullptr, true)) + if (MayBeRegExp( rStr, true)) return utl::SearchParam::SRCH_REGEXP; - if (MayBeWildcard( rStr, nullptr)) + if (MayBeWildcard( rStr )) return utl::SearchParam::SRCH_WILDCARD; } return utl::SearchParam::SRCH_NORMAL; diff --git a/sd/source/ui/inc/ShellFactory.hxx b/sd/source/ui/inc/ShellFactory.hxx index af410037a300..9b8d5f8258ac 100644 --- a/sd/source/ui/inc/ShellFactory.hxx +++ b/sd/source/ui/inc/ShellFactory.hxx @@ -47,10 +47,7 @@ public: Return the new view shell or NULL when a creation is not possible. */ - virtual ShellType* CreateShell ( - ShellId nId, - vcl::Window* pParentWindow, - FrameView* pFrameView) = 0; + virtual ShellType* CreateShell(ShellId nId) = 0; /** Tell the factory that a shell is no longer in use. It may destroy it or put it for future use in a cache. diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx index d978012620e1..373e72a1c3cd 100644 --- a/sd/source/ui/view/FormShellManager.cxx +++ b/sd/source/ui/view/FormShellManager.cxx @@ -37,7 +37,7 @@ class FormShellManagerFactory { public: FormShellManagerFactory (ViewShell& rViewShell, FormShellManager& rManager); - virtual FmFormShell* CreateShell (ShellId nId, vcl::Window* pParentWindow, FrameView* pFrameView) override; + virtual FmFormShell* CreateShell (ShellId nId) override; virtual void ReleaseShell (SfxShell* pShell) override; private: @@ -291,10 +291,7 @@ FormShellManagerFactory::FormShellManagerFactory ( { } -FmFormShell* FormShellManagerFactory::CreateShell ( - ::sd::ShellId nId, - vcl::Window*, - ::sd::FrameView*) +FmFormShell* FormShellManagerFactory::CreateShell( ::sd::ShellId nId ) { FmFormShell* pShell = nullptr; diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index 2eb56764739f..66a589cdcd68 100644 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -1041,7 +1041,7 @@ ShellDescriptor ViewShellManager::Implementation::CreateSubShell ( { SharedShellFactory pFactory = iFactory->second; if (pFactory != nullptr) - aResult.mpShell = pFactory->CreateShell(nShellId, nullptr, nullptr); + aResult.mpShell = pFactory->CreateShell(nShellId); // Exit the loop when the shell has been successfully created. if (aResult.mpShell != nullptr) diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 71319f90ff80..169e751d947d 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -102,10 +102,7 @@ class ViewShellObjectBarFactory public: explicit ViewShellObjectBarFactory (::sd::ViewShell& rViewShell); virtual ~ViewShellObjectBarFactory() override; - virtual SfxShell* CreateShell ( - ::sd::ShellId nId, - vcl::Window* pParentWindow, - ::sd::FrameView* pFrameView) override; + virtual SfxShell* CreateShell( ::sd::ShellId nId ) override; virtual void ReleaseShell (SfxShell* pShell) override; private: ::sd::ViewShell& mrViewShell; @@ -1630,10 +1627,7 @@ ViewShellObjectBarFactory::~ViewShellObjectBarFactory() } } -SfxShell* ViewShellObjectBarFactory::CreateShell ( - ::sd::ShellId nId, - vcl::Window*, - ::sd::FrameView* ) +SfxShell* ViewShellObjectBarFactory::CreateShell( ::sd::ShellId nId ) { SfxShell* pShell = nullptr; diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 2823776cd7fc..e5078b682d73 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -507,7 +507,7 @@ public: bool Revert(); bool Insert( ::ucbhelper::Content *pContent ); UCBStorage_Impl* OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect ); - void OpenStream( UCBStorageElement_Impl*, StreamMode, bool, const OString* pKey ); + void OpenStream( UCBStorageElement_Impl*, StreamMode, bool ); void SetProps( const Sequence < Sequence < PropertyValue > >& rSequence, const OUString& ); void GetProps( sal_Int32&, Sequence < Sequence < PropertyValue > >& rSequence, const OUString& ); sal_Int32 GetObjectCount(); @@ -1815,7 +1815,7 @@ void UCBStorage_Impl::ReadContent() else if ( aMediaType.isEmpty() ) { // older files didn't have that special content type, so they must be detected - OpenStream( pElement, StreamMode::STD_READ, m_bDirect, nullptr ); + OpenStream( pElement, StreamMode::STD_READ, m_bDirect ); if ( Storage::IsStorageFile( pElement->m_xStream ) ) pElement->m_bIsStorage = true; else @@ -2672,7 +2672,7 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode } // stream is opened the first time - pImp->OpenStream( pElement, nMode, bDirect, nullptr ); + pImp->OpenStream( pElement, nMode, bDirect ); // if name has been changed before creating the stream: set name! pElement->m_xStream->m_aName = rEleName; @@ -2682,12 +2682,12 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode return nullptr; } -void UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect, const OString* pKey ) +void UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect ) { OUString aName( m_aURL ); aName += "/"; aName += pElement->m_aOriginalName; - pElement->m_xStream = new UCBStorageStream_Impl( aName, nMode, nullptr, bDirect, pKey, m_bRepairPackage, m_xProgressHandler ); + pElement->m_xStream = new UCBStorageStream_Impl( aName, nMode, nullptr, bDirect, nullptr, m_bRepairPackage, m_xProgressHandler ); } BaseStorage* UCBStorage::OpenUCBStorage( const OUString& rEleName, StreamMode nMode, bool bDirect ) diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx index dddf64352b21..0f2749a9051a 100644 --- a/svl/source/misc/inettype.cxx +++ b/svl/source/misc/inettype.cxx @@ -44,7 +44,6 @@ struct TypeIDMapEntry { OUString m_aTypeName; OUString m_aPresentation; - OUString m_aSystemFileType; }; struct TypeNameMapEntry @@ -88,8 +87,7 @@ public: static INetContentType RegisterContentType(OUString const & rTypeName, OUString const & rPresentation, - OUString const * pExtension, - OUString const * pSystemFileType); + OUString const * pExtension); static INetContentType GetContentType(OUString const & rTypeName); @@ -421,8 +419,7 @@ TypeNameMapEntry * Registration::getExtensionEntry(OUString const & rTypeName) // static INetContentType Registration::RegisterContentType(OUString const & rTypeName, OUString const & rPresentation, - OUString const * pExtension, - OUString const * pSystemFileType) + OUString const * pExtension) { Registration &rRegistration = theRegistration::get(); @@ -435,8 +432,6 @@ INetContentType Registration::RegisterContentType(OUString const & rTypeName, TypeIDMapEntry * pTypeIDMapEntry = new TypeIDMapEntry; pTypeIDMapEntry->m_aTypeName = aTheTypeName; pTypeIDMapEntry->m_aPresentation = rPresentation; - if (pSystemFileType) - pTypeIDMapEntry->m_aSystemFileType = *pSystemFileType; rRegistration.m_aTypeIDMap.insert( ::std::make_pair( eTypeID, pTypeIDMapEntry ) ); rRegistration.m_aTypeNameMap.insert(std::make_pair(aTheTypeName, @@ -542,8 +537,7 @@ INetContentType INetContentTypes::RegisterContentType(OUString const & rTypeName INetContentType eTypeID = GetContentType(rTypeName); if (eTypeID == CONTENT_TYPE_UNKNOWN) eTypeID = Registration::RegisterContentType(rTypeName, rPresentation, - pExtension, - nullptr/*pSystemFileType*/); + pExtension); else if (eTypeID > CONTENT_TYPE_LAST) { TypeIDMapEntry * pTypeEntry = Registration::getEntry(eTypeID); diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index c7a7d93e4f10..54b0b429fe36 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -85,7 +85,7 @@ using namespace com::sun::star; E3dObjList::E3dObjList() -: SdrObjList(nullptr, nullptr, nullptr) +: SdrObjList(nullptr, nullptr) { } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index cbac68bbfbbc..9b987a725659 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -71,7 +71,7 @@ public: static const sal_Int32 InitialObjectContainerCapacity (64); -SdrObjList::SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewUpList): +SdrObjList::SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage): maList(), mxNavigationOrder(), mbIsNavigationOrderDirty(false) @@ -79,7 +79,7 @@ SdrObjList::SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewU maList.reserve(InitialObjectContainerCapacity); pModel=pNewModel; pPage=pNewPage; - pUpList=pNewUpList; + pUpList=nullptr; bObjOrdNumsDirty=false; bRectsDirty=false; pOwnerObj=nullptr; diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 1c17dcf2293e..4ee0a6a60391 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -570,9 +570,7 @@ public: void Insert(const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, - const SfxItemSet* pFlyAttrSet = nullptr, - const SfxItemSet* pGrfAttrSet = nullptr, - SwFrameFormat* = nullptr ); + const SfxItemSet* pFlyAttrSet = nullptr ); /// Insertion of a drawing object which have to be already inserted in the DrawModel. void InsertDrawObj( SdrObject& rDrawObj, @@ -624,8 +622,7 @@ public: bool GetPageNumber( long nYPos, bool bAtCursorPos, sal_uInt16& rPhyNum, sal_uInt16& rVirtNum, OUString &rDisplay ) const; SwFlyFrameFormat* InsertObject( const svt::EmbeddedObjectRef&, - const SfxItemSet* pFlyAttrSet, - SwFrameFormat* = nullptr ); + const SfxItemSet* pFlyAttrSet ); bool FinishOLEObj(); ///< Shutdown server. void GetTableAttr( SfxItemSet & ) const; diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx index 585130cdcd19..3c5af525c25a 100644 --- a/sw/inc/ftninfo.hxx +++ b/sw/inc/ftninfo.hxx @@ -63,7 +63,7 @@ public: SwEndNoteInfo & operator=(const SwEndNoteInfo&); bool operator==( const SwEndNoteInfo &rInf ) const; - SwEndNoteInfo( SwTextFormatColl *pTextColl = nullptr); + SwEndNoteInfo(); SwEndNoteInfo(const SwEndNoteInfo&); const OUString& GetPrefix() const { return sPrefix; } diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 522a90839c5c..d2896ac69ad3 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -106,8 +106,8 @@ SwEndNoteInfo::SwEndNoteInfo(const SwEndNoteInfo& rInfo) : &aAnchorCharFormatDep ); } -SwEndNoteInfo::SwEndNoteInfo(SwTextFormatColl *pFormat) : - SwClient(pFormat), +SwEndNoteInfo::SwEndNoteInfo() : + SwClient(nullptr), aPageDescDep( this, nullptr ), aCharFormatDep( this, nullptr ), aAnchorCharFormatDep( this, nullptr ), @@ -240,7 +240,7 @@ SwFootnoteInfo::SwFootnoteInfo(const SwFootnoteInfo& rInfo) : } SwFootnoteInfo::SwFootnoteInfo() : - SwEndNoteInfo( nullptr ), + SwEndNoteInfo(), ePos( FTNPOS_PAGE ), eNum( FTNNUM_DOC ) { diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index b10233f058f4..5c1179ac10ef 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -767,9 +767,7 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName, const Graphic* pGraphic, - const SfxItemSet* pFlyAttrSet, - const SfxItemSet* pGrfAttrSet, - SwFrameFormat* pFrameFormat ) + const SfxItemSet* pFlyAttrSet ) { SwFlyFrameFormat* pFormat = nullptr; SET_CURR_SHELL( this ); @@ -821,7 +819,7 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName, pFormat = GetDoc()->getIDocumentContentOperations().Insert(*pCursor, rGrfName, rFltName, pGraphic, pFlyAttrSet, - pGrfAttrSet, pFrameFormat ); + nullptr, nullptr ); OSL_ENSURE( pFormat, "Doc->getIDocumentContentOperations().Insert(notxt) failed." ); pCursor = dynamic_cast<SwShellCursor*>(pCursor->GetNext()); @@ -850,8 +848,7 @@ void SwFEShell::Insert( const OUString& rGrfName, const OUString& rFltName, } SwFlyFrameFormat* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj, - const SfxItemSet* pFlyAttrSet, - SwFrameFormat* pFrameFormat ) + const SfxItemSet* pFlyAttrSet ) { SwFlyFrameFormat* pFormat = nullptr; SET_CURR_SHELL( this ); @@ -859,7 +856,7 @@ SwFlyFrameFormat* SwFEShell::InsertObject( const svt::EmbeddedObjectRef& xObj, for(SwPaM& rPaM : GetCursor()->GetRingContainer()) { pFormat = GetDoc()->getIDocumentContentOperations().Insert(rPaM, xObj, - pFlyAttrSet, nullptr, pFrameFormat ); + pFlyAttrSet, nullptr, nullptr ); OSL_ENSURE( pFormat, "Doc->getIDocumentContentOperations().Insert(notxt) failed." ); } diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index 7ad69c20429c..bd669dd5ce0a 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -235,15 +235,12 @@ public: sal_uInt16 nAutorNo_, const DateTime& rStamp_, RedlineType_t eTypePrev_ = nsRedlineType_t::REDLINE_INSERT, - sal_uInt16 nAutorNoPrev_ = USHRT_MAX, - const DateTime* pStampPrev_ = nullptr) + sal_uInt16 nAutorNoPrev_ = USHRT_MAX) : SfxPoolItem(RES_FLTR_REDLINE), aStamp(rStamp_), aStampPrev( DateTime::EMPTY ), eType(eType_), eTypePrev(eTypePrev_), nAutorNo(nAutorNo_), nAutorNoPrev(nAutorNoPrev_) { - if( pStampPrev_ ) - aStampPrev = *pStampPrev_; } SwFltRedline(const SwFltRedline& rCpy): diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 0f4889460241..d05762cfdeb6 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1495,9 +1495,9 @@ void PDFWriterImpl::PDFPage::appendPolygon( const basegfx::B2DPolygon& rPoly, OS basegfx::B2DPoint aBL( aRange.getMinX(), aRange.getMaxY() ); appendPixelPoint( aBL, rBuffer ); rBuffer.append( ' ' ); - appendMappedLength( aRange.getWidth(), rBuffer, false, nullptr, nLog10Divisor ); + appendMappedLength( aRange.getWidth(), rBuffer, false, nLog10Divisor ); rBuffer.append( ' ' ); - appendMappedLength( aRange.getHeight(), rBuffer, true, nullptr, nLog10Divisor ); + appendMappedLength( aRange.getHeight(), rBuffer, true, nLog10Divisor ); rBuffer.append( " re\n" ); return; } @@ -1590,14 +1590,12 @@ void PDFWriterImpl::PDFPage::appendMappedLength( sal_Int32 nLength, OStringBuffe appendFixedInt( nValue, rBuffer ); } -void PDFWriterImpl::PDFPage::appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical, sal_Int32* pOutLength, sal_Int32 nPrecision ) const +void PDFWriterImpl::PDFPage::appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical, sal_Int32 nPrecision ) const { Size aSize( lcl_convert( m_pWriter->m_aGraphicsStack.front().m_aMapMode, m_pWriter->m_aMapMode, m_pWriter->getReferenceDevice(), Size( 1000, 1000 ) ) ); - if( pOutLength ) - *pOutLength = (sal_Int32)(fLength*(double)(bVertical ? aSize.Height() : aSize.Width())/1000.0); fLength *= pixelToPoint((double)(bVertical ? aSize.Height() : aSize.Width()) / 1000.0); appendDouble( fLength, rBuffer, nPrecision ); } diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index 4eb9a187e755..a49b6200eaa8 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -158,7 +158,7 @@ public: // (in PDF map mode, that is 10th of point) void appendMappedLength( sal_Int32 nLength, OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = nullptr ) const; // the same for double values - void appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical = true, sal_Int32* pOutLength = nullptr, sal_Int32 nPrecision = 5 ) const; + void appendMappedLength( double fLength, OStringBuffer& rBuffer, bool bVertical = true, sal_Int32 nPrecision = 5 ) const; // appends LineInfo // returns false if too many dash array entry were created for // the implementation limits of some PDF readers |