[Libreoffice-commits] core.git: compilerplugins/clang desktop/unx idlc/inc idlc/source include/registry include/sot include/store include/svl include/vcl registry/source sot/source store/source svl/source ucb/source vcl/inc vcl/source vcl/unx

Noel Grandin noel.grandin at collabora.co.uk
Thu Nov 2 09:45:27 UTC 2017


 compilerplugins/clang/constparams.cxx       |  250 ++++++++++++++++++----------
 compilerplugins/clang/test/constparams.cxx  |    9 -
 desktop/unx/source/splashx.c                |    4 
 desktop/unx/source/start.c                  |    8 
 idlc/inc/errorhandler.hxx                   |    2 
 idlc/source/errorhandler.cxx                |    2 
 include/registry/registry.hxx               |    6 
 include/registry/writer.h                   |    4 
 include/sot/stg.hxx                         |    4 
 include/store/store.h                       |   12 -
 include/svl/zforlist.hxx                    |    2 
 include/vcl/toolbox.hxx                     |    2 
 registry/source/keyimpl.cxx                 |    2 
 registry/source/keyimpl.hxx                 |    2 
 registry/source/reflwrit.cxx                |    8 
 registry/source/regkey.cxx                  |    2 
 registry/source/regkey.hxx                  |    2 
 sot/source/sdstor/stg.cxx                   |    4 
 store/source/storbios.cxx                   |   18 +-
 store/source/store.cxx                      |   12 -
 svl/source/numbers/zforlist.cxx             |    2 
 ucb/source/sorter/sortresult.cxx            |    8 
 ucb/source/sorter/sortresult.hxx            |    8 
 vcl/inc/salgdi.hxx                          |    2 
 vcl/inc/sft.hxx                             |    8 
 vcl/inc/unx/fontmanager.hxx                 |    2 
 vcl/inc/unx/i18n_ic.hxx                     |    2 
 vcl/source/filter/sgfbram.cxx               |    2 
 vcl/source/filter/sgvtext.cxx               |   12 -
 vcl/source/fontsubset/sft.cxx               |   14 -
 vcl/source/fontsubset/ttcr.cxx              |    2 
 vcl/source/gdi/salgdilayout.cxx             |    2 
 vcl/source/window/toolbox.cxx               |    2 
 vcl/unx/generic/app/i18n_ic.cxx             |    2 
 vcl/unx/generic/dtrans/X11_selection.cxx    |    2 
 vcl/unx/generic/dtrans/X11_selection.hxx    |    2 
 vcl/unx/generic/fontmanager/fontconfig.cxx  |    2 
 vcl/unx/generic/fontmanager/fontmanager.cxx |    4 
 38 files changed, 252 insertions(+), 181 deletions(-)

New commits:
commit 455e4011f7052c5d1fb4693a573e0998cf6badc8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Nov 1 15:54:13 2017 +0200

    improve constparam loplugin
    
    lots of little fixes to make the logic less pessimistic
    
    Change-Id: If368822984250b11b98c56f5890177a1402e8660
    Reviewed-on: https://gerrit.libreoffice.org/44168
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 8396f2dad6ec..603e9fb4b5f6 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -61,76 +61,124 @@ public:
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
 
         for (const ParmVarDecl *pParmVarDecl : interestingParamSet) {
-            if (paramCannotBeConstSet.find(pParmVarDecl) == paramCannotBeConstSet.end()) {
-                auto functionDecl = parmToFunction[pParmVarDecl];
-                auto canonicalDecl = functionDecl->getCanonicalDecl();
-                if (getFunctionsWithAddressTaken().find(canonicalDecl)
-                    != getFunctionsWithAddressTaken().end())
-                {
-                    continue;
-                }
+            auto functionDecl = parmToFunction[pParmVarDecl];
+            auto canonicalDecl = functionDecl->getCanonicalDecl();
+            if (getFunctionsWithAddressTaken().find(canonicalDecl)
+                != getFunctionsWithAddressTaken().end())
+            {
+                continue;
+            }
+            report(
+                DiagnosticsEngine::Warning,
+                "this parameter can be const",
+                pParmVarDecl->getLocStart())
+                << pParmVarDecl->getSourceRange();
+            if (canonicalDecl->getLocation() != functionDecl->getLocation()) {
+                unsigned idx = pParmVarDecl->getFunctionScopeIndex();
+                const ParmVarDecl* pOther = canonicalDecl->getParamDecl(idx);
                 report(
-                    DiagnosticsEngine::Warning,
-                    "this parameter can be const",
-                    pParmVarDecl->getLocStart())
-                    << pParmVarDecl->getSourceRange();
-                if (canonicalDecl->getLocation() != functionDecl->getLocation()) {
-                    unsigned idx = pParmVarDecl->getFunctionScopeIndex();
-                    const ParmVarDecl* pOther = canonicalDecl->getParamDecl(idx);
-                    report(
-                        DiagnosticsEngine::Note,
-                        "canonical parameter declaration here",
-                        pOther->getLocStart())
-                        << pOther->getSourceRange();
-                }
+                    DiagnosticsEngine::Note,
+                    "canonical parameter declaration here",
+                    pOther->getLocStart())
+                    << pOther->getSourceRange();
             }
+            //functionDecl->dump();
         }
     }
 
-    bool VisitFunctionDecl(const FunctionDecl *);
+    bool TraverseFunctionDecl(FunctionDecl *);
+    bool TraverseCXXMethodDecl(CXXMethodDecl * f);
+    bool TraverseCXXConstructorDecl(CXXConstructorDecl * f);
     bool VisitDeclRefExpr(const DeclRefExpr *);
 
 private:
+    bool CheckTraverseFunctionDecl(FunctionDecl *);
     bool checkIfCanBeConst(const Stmt*, const ParmVarDecl*);
-    bool isPointerOrReferenceToConst(const QualType& qt);
+    // integral or enumeration or const * or const &
+    bool isOkForParameter(const QualType& qt);
+    bool isPointerOrReferenceToNonConst(const QualType& qt);
 
     std::unordered_set<const ParmVarDecl*> interestingParamSet;
     std::unordered_map<const ParmVarDecl*, const FunctionDecl*> parmToFunction;
-    std::unordered_set<const ParmVarDecl*> paramCannotBeConstSet;
+    FunctionDecl* currentFunctionDecl = nullptr;
 };
 
-bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
+bool ConstParams::TraverseFunctionDecl(FunctionDecl * functionDecl)
+{
+    // We cannot short-circuit the traverse here entirely without breaking the
+    // loplugin::FunctionAddress stuff.
+    auto prev = currentFunctionDecl;
+    if (CheckTraverseFunctionDecl(functionDecl))
+        currentFunctionDecl = functionDecl;
+    auto rv = loplugin::FunctionAddress<ConstParams>::TraverseFunctionDecl(functionDecl);
+    currentFunctionDecl = prev;
+    return rv;
+}
+bool ConstParams::TraverseCXXMethodDecl(CXXMethodDecl * f)
+{
+    auto prev = currentFunctionDecl;
+    if (CheckTraverseFunctionDecl(f))
+        currentFunctionDecl = f;
+    auto rv = loplugin::FunctionAddress<ConstParams>::TraverseCXXMethodDecl(f);
+    currentFunctionDecl = prev;
+    return rv;
+}
+bool ConstParams::TraverseCXXConstructorDecl(CXXConstructorDecl * f)
+{
+    auto prev = currentFunctionDecl;
+    if (CheckTraverseFunctionDecl(f))
+        currentFunctionDecl = f;
+    auto rv = loplugin::FunctionAddress<ConstParams>::TraverseCXXConstructorDecl(f);
+    currentFunctionDecl = prev;
+    return rv;
+}
+
+bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl)
 {
     if (ignoreLocation(functionDecl) || !functionDecl->isThisDeclarationADefinition()) {
-        return true;
+        return false;
     }
     // ignore stuff that forms part of the stable URE interface
     if (isInUnoIncludeFile(functionDecl)) {
-        return true;
+        return false;
     }
     // TODO ignore template stuff for now
     if (functionDecl->getTemplatedKind() != FunctionDecl::TK_NonTemplate) {
-        return true;
+        return false;
     }
     if (functionDecl->isDeleted())
-        return true;
+        return false;
     if (isa<CXXMethodDecl>(functionDecl)
         && dyn_cast<CXXMethodDecl>(functionDecl)->getParent()->getDescribedClassTemplate() != nullptr ) {
-        return true;
+        return false;
     }
     // ignore virtual methods
     if (isa<CXXMethodDecl>(functionDecl)
         && dyn_cast<CXXMethodDecl>(functionDecl)->isVirtual() ) {
-        return true;
+        return false;
     }
     // ignore C main
     if (functionDecl->isMain()) {
-        return true;
+        return false;
+    }
+
+    // ignore the macros from include/tools/link.hxx
+    auto canonicalDecl = functionDecl->getCanonicalDecl();
+    if (compiler.getSourceManager().isMacroBodyExpansion(canonicalDecl->getLocStart())
+        || compiler.getSourceManager().isMacroArgExpansion(canonicalDecl->getLocStart())) {
+        StringRef name { Lexer::getImmediateMacroName(
+                canonicalDecl->getLocStart(), compiler.getSourceManager(), compiler.getLangOpts()) };
+        if (name.startswith("DECL_LINK") || name.startswith("DECL_STATIC_LINK"))
+            return false;
+        auto loc2 = compiler.getSourceManager().getImmediateExpansionRange(canonicalDecl->getLocStart()).first;
+        if (compiler.getSourceManager().isMacroBodyExpansion(loc2))
+        {
+            StringRef name2 { Lexer::getImmediateMacroName(
+                    loc2, compiler.getSourceManager(), compiler.getLangOpts()) };
+            if (name2.startswith("DECL_DLLPRIVATE_LINK"))
+                return false;
+        }
     }
-    // ignore macro expansions so we can ignore the IMPL_LINK macros from include/tools/link.hxx
-    // TODO make this more precise
-    if (functionDecl->getLocation().isMacroID())
-        return true;
 
     if (functionDecl->getIdentifier())
     {
@@ -147,10 +195,11 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
             || name == "etiGraphicExport"
             || name == "epsGraphicExport"
             )
-                return true;
+            return false;
     }
 
     // calculate the ones we want to check
+    bool foundInterestingParam = false;
     for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
         // ignore unused params
         if (pParmVarDecl->getName().empty()
@@ -177,30 +226,22 @@ bool ConstParams::VisitFunctionDecl(const FunctionDecl * functionDecl)
             continue;
         interestingParamSet.insert(pParmVarDecl);
         parmToFunction[pParmVarDecl] = functionDecl;
+        foundInterestingParam = true;
     }
-
-    return true;
+    return foundInterestingParam;
 }
 
 bool ConstParams::VisitDeclRefExpr( const DeclRefExpr* declRefExpr )
 {
-    if (ignoreLocation(declRefExpr)) {
+    if (!currentFunctionDecl)
         return true;
-    }
-    // ignore stuff that forms part of the stable URE interface
-    if (isInUnoIncludeFile(declRefExpr->getLocStart())) {
-        return true;
-    }
     const ParmVarDecl* parmVarDecl = dyn_cast_or_null<ParmVarDecl>(declRefExpr->getDecl());
-    if (!parmVarDecl) {
+    if (!parmVarDecl)
         return true;
-    }
-    // no need to check again if we have already eliminated this one
-    if (paramCannotBeConstSet.find(parmVarDecl) != paramCannotBeConstSet.end())
+    if (interestingParamSet.find(parmVarDecl) == interestingParamSet.end())
         return true;
     if (!checkIfCanBeConst(declRefExpr, parmVarDecl))
-        paramCannotBeConstSet.insert(parmVarDecl);
-
+        interestingParamSet.erase(parmVarDecl);
     return true;
 }
 
@@ -213,31 +254,36 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
     {
         // check if we're inside a CXXCtorInitializer
         auto parentsRange = compiler.getASTContext().getParents(*stmt);
-        if ( parentsRange.begin() == parentsRange.end())
-            return true;
-        auto cxxConstructorDecl = dyn_cast_or_null<CXXConstructorDecl>(parentsRange.begin()->get<Decl>());
-        if (!cxxConstructorDecl)
-            return true;
-        for ( auto cxxCtorInitializer : cxxConstructorDecl->inits())
+        if ( parentsRange.begin() != parentsRange.end())
         {
-            if (cxxCtorInitializer->isAnyMemberInitializer() && cxxCtorInitializer->getInit() == stmt)
+            if (auto cxxConstructorDecl = dyn_cast_or_null<CXXConstructorDecl>(parentsRange.begin()->get<Decl>()))
+            {
+                for ( auto cxxCtorInitializer : cxxConstructorDecl->inits())
+                {
+                    if (cxxCtorInitializer->isAnyMemberInitializer() && cxxCtorInitializer->getInit() == stmt)
+                    {
+                        // if the member is not pointer or ref to-const, we cannot make the param const
+                        auto fieldDecl = cxxCtorInitializer->getAnyMember();
+                        auto tc = loplugin::TypeCheck(fieldDecl->getType());
+                        return tc.Pointer().Const() || tc.LvalueReference().Const();
+                    }
+                }
+            }
+            if (auto varDecl = dyn_cast_or_null<VarDecl>(parentsRange.begin()->get<Decl>()))
             {
-                // if the member is not pointer or ref to-const, we cannot make the param const
-                auto fieldDecl = cxxCtorInitializer->getAnyMember();
-                auto tc = loplugin::TypeCheck(fieldDecl->getType());
-                return tc.Pointer().Const() || tc.LvalueReference().Const();
+                return isOkForParameter(varDecl->getType());
             }
         }
         parmVarDecl->dump();
         stmt->dump();
-        cxxConstructorDecl->dump();
         report(
              DiagnosticsEngine::Warning,
-             "couldn't find the CXXCtorInitializer?",
+             "no parent?",
               stmt->getLocStart())
               << stmt->getSourceRange();
         return false;
     }
+
     if (auto unaryOperator = dyn_cast<UnaryOperator>(parent)) {
         UnaryOperator::Opcode op = unaryOperator->getOpcode();
         if (op == UO_AddrOf || op == UO_PreInc || op == UO_PostInc
@@ -250,9 +296,8 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
         return true;
     } else if (auto binaryOp = dyn_cast<BinaryOperator>(parent)) {
         BinaryOperator::Opcode op = binaryOp->getOpcode();
-        // TODO could do better, but would require tracking the LHS
         if (binaryOp->getRHS() == stmt && op == BO_Assign) {
-            return false;
+            return isOkForParameter(binaryOp->getLHS()->getType());
         }
         if (binaryOp->getRHS() == stmt) {
             return true;
@@ -272,27 +317,44 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
         const CXXConstructorDecl * constructorDecl = constructExpr->getConstructor();
         for (unsigned i = 0; i < constructExpr->getNumArgs(); ++i) {
             if (constructExpr->getArg(i) == stmt) {
-                return isPointerOrReferenceToConst(constructorDecl->getParamDecl(i)->getType());
+                return isOkForParameter(constructorDecl->getParamDecl(i)->getType());
             }
         }
-        return false; // TODO ??
     } else if (auto operatorCallExpr = dyn_cast<CXXOperatorCallExpr>(parent)) {
         const CXXMethodDecl* calleeMethodDecl = dyn_cast_or_null<CXXMethodDecl>(operatorCallExpr->getDirectCallee());
         if (calleeMethodDecl) {
             // unary operator
-            if (calleeMethodDecl->getNumParams() == 0) {
+            if (calleeMethodDecl->getNumParams() == 0)
                 return calleeMethodDecl->isConst();
+            // Same logic as CXXOperatorCallExpr::isAssignmentOp(), which our supported clang
+            // doesn't have yet.
+            auto Opc = operatorCallExpr->getOperator();
+            if (Opc == OO_Equal || Opc == OO_StarEqual ||
+                Opc == OO_SlashEqual || Opc == OO_PercentEqual ||
+                Opc == OO_PlusEqual || Opc == OO_MinusEqual ||
+                Opc == OO_LessLessEqual || Opc == OO_GreaterGreaterEqual ||
+                Opc == OO_AmpEqual || Opc == OO_CaretEqual ||
+                Opc == OO_PipeEqual)
+            {
+                if (operatorCallExpr->getArg(0) == stmt) // assigning to the param
+                    return false;
+                // not all operator= take a const&
+                return isOkForParameter(calleeMethodDecl->getParamDecl(0)->getType());
             }
+            if (operatorCallExpr->getOperator() == OO_Subscript && operatorCallExpr->getArg(1) == stmt)
+                return true;
+            if (operatorCallExpr->getOperator() == OO_EqualEqual || operatorCallExpr->getOperator() == OO_ExclaimEqual)
+                return true;
             // binary operator
-            if (operatorCallExpr->getArg(0) == stmt) {
+            if (operatorCallExpr->getArg(0) == stmt)
                 return calleeMethodDecl->isConst();
-            }
             unsigned const n = std::min(
                 operatorCallExpr->getNumArgs(),
-                calleeMethodDecl->getNumParams());
+                calleeMethodDecl->getNumParams() + 1);
             for (unsigned i = 1; i < n; ++i)
                 if (operatorCallExpr->getArg(i) == stmt) {
-                    return isPointerOrReferenceToConst(calleeMethodDecl->getParamDecl(i - 1)->getType());
+                    auto qt = calleeMethodDecl->getParamDecl(i - 1)->getType();
+                    return isOkForParameter(qt);
                 }
         } else {
             const Expr* callee = operatorCallExpr->getCallee()->IgnoreParenImpCasts();
@@ -304,12 +366,11 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
             if (calleeFunctionDecl) {
                 for (unsigned i = 0; i < operatorCallExpr->getNumArgs(); ++i) {
                     if (operatorCallExpr->getArg(i) == stmt) {
-                        return isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType());
+                        return isOkForParameter(calleeFunctionDecl->getParamDecl(i)->getType());
                     }
                 }
             }
         }
-        return false; // TODO ???
     } else if (auto callExpr = dyn_cast<CallExpr>(parent)) {
         QualType functionType = callExpr->getCallee()->getType();
         if (functionType->isFunctionPointerType()) {
@@ -325,7 +386,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
             }
             for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
                 if (callExpr->getArg(i) == stmt) {
-                    return isPointerOrReferenceToConst(prototype->getParamType(i));
+                    return isOkForParameter(prototype->getParamType(i));
                 }
             }
         }
@@ -351,11 +412,10 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
                 if (i >= calleeFunctionDecl->getNumParams()) // can happen in template code
                     return false;
                 if (callExpr->getArg(i) == stmt) {
-                    return isPointerOrReferenceToConst(calleeFunctionDecl->getParamDecl(i)->getType());
+                    return isOkForParameter(calleeFunctionDecl->getParamDecl(i)->getType());
                 }
             }
         }
-        return false; // TODO ????
     } else if (auto callExpr = dyn_cast<ObjCMessageExpr>(parent)) {
         if (callExpr->getInstanceReceiver() == stmt) {
             return true;
@@ -368,12 +428,11 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
             assert(method->param_size() == callExpr->getNumArgs());
             for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
                 if (callExpr->getArg(i) == stmt) {
-                    return isPointerOrReferenceToConst(
+                    return isOkForParameter(
                         method->param_begin()[i]->getType());
                 }
             }
         }
-        return false; // TODO ????
     } else if (isa<CXXReinterpretCastExpr>(parent)) {
         return false;
     } else if (isa<CXXConstCastExpr>(parent)) {
@@ -384,24 +443,25 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
                 if (auto const sub = dyn_cast<DeclRefExpr>(
                         e->getSubExpr()->IgnoreParenImpCasts()))
                 {
-                    if (sub->getDecl() == parmVarDecl) {
+                    if (sub->getDecl() == parmVarDecl)
                         return false;
-                    }
                 }
             }
         }
         return checkIfCanBeConst(parent, parmVarDecl);
     } else if (isa<MemberExpr>(parent)) {
         return checkIfCanBeConst(parent, parmVarDecl);
-    } else if (isa<ArraySubscriptExpr>(parent)) {
+    } else if (auto arraySubscriptExpr = dyn_cast<ArraySubscriptExpr>(parent)) {
+        if (arraySubscriptExpr->getIdx() == stmt)
+            return true;
         return checkIfCanBeConst(parent, parmVarDecl);
     } else if (isa<ParenExpr>(parent)) {
         return checkIfCanBeConst(parent, parmVarDecl);
     } else if (isa<DeclStmt>(parent)) {
         // TODO could do better here, but would require tracking the target(s)
-        return false;
+        //return false;
     } else if (isa<ReturnStmt>(parent)) {
-        return isPointerOrReferenceToConst(dyn_cast<Expr>(stmt)->getType());
+        return !isPointerOrReferenceToNonConst(currentFunctionDecl->getReturnType());
     } else if (isa<InitListExpr>(parent)) {
         return false;
     } else if (isa<IfStmt>(parent)) {
@@ -431,10 +491,10 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
     } else if (isa<UnaryExprOrTypeTraitExpr>(parent)) {
         return false; // ???
     } else if (auto cxxNewExpr = dyn_cast<CXXNewExpr>(parent)) {
-        for (auto pa : cxxNewExpr->placement_arguments())
-            if (pa == stmt)
+        for (unsigned i = 0; i < cxxNewExpr->getNumPlacementArgs(); ++i)
+            if (cxxNewExpr->getPlacementArg(i) == stmt)
                 return false;
-        return true; // because the ParamVarDecl must be a parameter to the expression, probably an array length
+        return true; // ???
     } else if (auto lambdaExpr = dyn_cast<LambdaExpr>(parent)) {
         for (auto it = lambdaExpr->capture_begin(); it != lambdaExpr->capture_end(); ++it)
         {
@@ -473,7 +533,9 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
     return true;
 }
 
-bool ConstParams::isPointerOrReferenceToConst(const QualType& qt) {
+bool ConstParams::isOkForParameter(const QualType& qt) {
+    if (qt->isIntegralOrEnumerationType())
+        return true;
     auto const type = loplugin::TypeCheck(qt);
     if (type.Pointer()) {
         return bool(type.Pointer().Const());
@@ -489,6 +551,16 @@ bool ConstParams::isPointerOrReferenceToConst(const QualType& qt) {
     return false;
 }
 
+bool ConstParams::isPointerOrReferenceToNonConst(const QualType& qt) {
+    auto const type = loplugin::TypeCheck(qt);
+    if (type.Pointer()) {
+        return !bool(type.Pointer().Const());
+    } else if (type.LvalueReference()) {
+        return !bool(type.LvalueReference().Const());
+    }
+    return false;
+}
+
 loplugin::Plugin::Registration< ConstParams > X("constparams", false);
 
 }
diff --git a/compilerplugins/clang/test/constparams.cxx b/compilerplugins/clang/test/constparams.cxx
index feb07f1b6066..9390ce2dec17 100644
--- a/compilerplugins/clang/test/constparams.cxx
+++ b/compilerplugins/clang/test/constparams.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <string>
+
 struct Class1
 {
     int const * m_f1;
@@ -39,11 +41,8 @@ void g() {
 int const * f1(int * p) { // expected-error {{this parameter can be const [loplugin:constparams]}}
     return p;
 }
-int const * f2(int * p) {
-    return p;
-}
-int const * f3(int * p) {
-    return p;
+void f4(std::string * p) {
+    *p = std::string("xxx");
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c
index aa01d44b6c61..6bb98f965a91 100644
--- a/desktop/unx/source/splashx.c
+++ b/desktop/unx/source/splashx.c
@@ -117,7 +117,7 @@ static int splash_load_bmp( struct splash* splash, const char *filename )
     return 1;
 }
 
-static void setup_color( int val[3], color_t *col )
+static void setup_color( int const val[3], color_t *col )
 {
     if ( val[0] < 0 || val[1] < 0 || val[2] < 0 )
         return;
@@ -160,7 +160,7 @@ static void get_bootstrap_value( int *array, int size, rtlBootstrapHandle handle
 }
 
 // setup
-static void splash_setup( struct splash* splash, int barc[3], int framec[3], int posx, int posy, int w, int h )
+static void splash_setup( struct splash* splash, int const barc[3], int const framec[3], int posx, int posy, int w, int h )
 {
     if ( splash->width <= 500 )
     {
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index b1c769075075..54fbbcadb532 100644
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -68,7 +68,7 @@ typedef struct {
 } ChildInfo;
 
 static int
-child_info_get_status_fd(ChildInfo *info)
+child_info_get_status_fd(ChildInfo const *info)
 {
     return info->status_fd;
 }
@@ -365,7 +365,7 @@ static int connect_pipe(rtl_uString *pPipePath)
 }
 
 /* Escape: "," -> "\\,", "\0" -> "\\0", "\\" -> "\\\\" */
-static rtl_uString *escape_path(rtl_uString *pToEscape)
+static rtl_uString *escape_path(rtl_uString const *pToEscape)
 {
     rtl_uString *pBuffer = NULL;
     sal_Int32 nCapacity = 1000;
@@ -405,7 +405,7 @@ static rtl_uString *escape_path(rtl_uString *pToEscape)
 }
 
 /* Send args to the LO instance (using the 'fd' file descriptor) */
-static sal_Bool send_args(int fd, rtl_uString *pCwdPath)
+static sal_Bool send_args(int fd, rtl_uString const *pCwdPath)
 {
     rtl_uString *pBuffer = NULL, *pTmp = NULL;
     sal_Int32 nCapacity = 1000;
@@ -497,7 +497,7 @@ static sal_Bool send_args(int fd, rtl_uString *pCwdPath)
 #define BUFFER_LEN 255
 
 /* Read the percent to show in splash. */
-static ProgressStatus read_percent(ChildInfo *info, int *pPercent)
+static ProgressStatus read_percent(ChildInfo const *info, int *pPercent)
 {
     static char pBuffer[BUFFER_LEN + 1];
     static char *pNext = pBuffer;
diff --git a/idlc/inc/errorhandler.hxx b/idlc/inc/errorhandler.hxx
index a1e1a8729ba4..1700bdbf8060 100644
--- a/idlc/inc/errorhandler.hxx
+++ b/idlc/inc/errorhandler.hxx
@@ -94,7 +94,7 @@ public:
     // Report a failed name lookup attempt
     static void lookupError(const OString& n);
     // Report a failed name lookup attempt
-    static void lookupError(ErrorCode e, const OString& n, AstDeclaration* pScope);
+    static void lookupError(ErrorCode e, const OString& n, AstDeclaration const * pScope);
 
 
     // Report a type error
diff --git a/idlc/source/errorhandler.cxx b/idlc/source/errorhandler.cxx
index 53339318ec91..3700b576703d 100644
--- a/idlc/source/errorhandler.cxx
+++ b/idlc/source/errorhandler.cxx
@@ -487,7 +487,7 @@ void ErrorHandler::lookupError(const OString& n)
     idlc()->incErrorCount();
 }
 
-void ErrorHandler::lookupError(ErrorCode e, const OString& n, AstDeclaration* pScope)
+void ErrorHandler::lookupError(ErrorCode e, const OString& n, AstDeclaration const * pScope)
 {
     errorHeader(e);
     fprintf(stderr, "'%s' in '%s'\n", n.getStr(), pScope->getFullName().getStr());
diff --git a/include/registry/registry.hxx b/include/registry/registry.hxx
index 2036c730fa9e..c36a57f9986a 100644
--- a/include/registry/registry.hxx
+++ b/include/registry/registry.hxx
@@ -53,7 +53,7 @@ struct Registry_Api
     RegError    (REGISTRY_CALLTYPE *deleteKey)          (RegKeyHandle, rtl_uString*);
     RegError    (REGISTRY_CALLTYPE *closeKey)           (RegKeyHandle);
     RegError    (REGISTRY_CALLTYPE *setValue)           (RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
-    RegError    (REGISTRY_CALLTYPE *setLongListValue)   (RegKeyHandle, rtl_uString*, sal_Int32*, sal_uInt32);
+    RegError    (REGISTRY_CALLTYPE *setLongListValue)   (RegKeyHandle, rtl_uString*, sal_Int32 const *, sal_uInt32);
     RegError    (REGISTRY_CALLTYPE *setStringListValue) (RegKeyHandle, rtl_uString*, sal_Char**, sal_uInt32);
     RegError    (REGISTRY_CALLTYPE *setUnicodeListValue)(RegKeyHandle, rtl_uString*, sal_Unicode**, sal_uInt32);
     RegError    (REGISTRY_CALLTYPE *getValueInfo)       (RegKeyHandle, rtl_uString*, RegValueType*, sal_uInt32*);
@@ -448,7 +448,7 @@ public:
         @return RegError::NO_ERROR if succeeds else an error code.
     */
     inline RegError setLongListValue(const rtl::OUString& keyName,
-                                         sal_Int32* pValueList,
+                                         sal_Int32 const * pValueList,
                                          sal_uInt32 len);
 
     /** sets an ascii list value of a key.
@@ -824,7 +824,7 @@ inline RegError RegistryKey::setValue(const rtl::OUString& keyName,
     }
 
 inline RegError RegistryKey::setLongListValue(const rtl::OUString& keyName,
-                                                  sal_Int32* pValueList,
+                                                  sal_Int32 const * pValueList,
                                                   sal_uInt32 len)
     {
         if (m_registry.isValid())
diff --git a/include/registry/writer.h b/include/registry/writer.h
index 56ab9c925bf7..741c9451932f 100644
--- a/include/registry/writer.h
+++ b/include/registry/writer.h
@@ -95,7 +95,7 @@ REG_DLLPUBLIC void SAL_CALL typereg_writer_destroy(void * handle) SAL_THROW_EXTE
    @since UDK 3.2.0
  */
 REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setSuperTypeName(
-    void * handle, sal_uInt16 index, rtl_uString const * typeName)
+    void const * handle, sal_uInt16 index, rtl_uString const * typeName)
         SAL_THROW_EXTERN_C();
 
 /**
@@ -208,7 +208,7 @@ REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setMethodParameterData(
    @since UDK 3.2.0
  */
 REG_DLLPUBLIC sal_Bool SAL_CALL typereg_writer_setMethodExceptionTypeName(
-    void * handle, sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+    void const * handle, sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
     rtl_uString const * typeName)
     SAL_THROW_EXTERN_C();
 
diff --git a/include/sot/stg.hxx b/include/sot/stg.hxx
index f0d8ee70ff1b..4f2b19c0255e 100644
--- a/include/sot/stg.hxx
+++ b/include/sot/stg.hxx
@@ -129,7 +129,7 @@ protected:
                     OLEStorageBase( StgIo*, StgDirEntry*, StreamMode& );
                     ~OLEStorageBase();
     bool            Validate_Impl( bool ) const;
-    static bool     ValidateMode_Impl( StreamMode, StgDirEntry* p = nullptr );
+    static bool     ValidateMode_Impl( StreamMode, StgDirEntry const * p = nullptr );
 };
 
 class StorageStream : public BaseStorageStream, public OLEStorageBase
@@ -207,7 +207,7 @@ public:
     virtual bool                ValidateFAT() override;
     virtual bool                Validate( bool=false ) const override;
     virtual bool                ValidateMode( StreamMode ) const override;
-    bool                        ValidateMode( StreamMode, StgDirEntry* p ) const;
+    bool                        ValidateMode( StreamMode, StgDirEntry const * p ) const;
     virtual bool                Equals( const BaseStorage& rStream ) const override;
 };
 
diff --git a/include/store/store.h b/include/store/store.h
index 2e606e565856..3f6177a1af47 100644
--- a/include/store/store.h
+++ b/include/store/store.h
@@ -117,8 +117,8 @@ typedef void* storeDirectoryHandle;
  */
 STORE_DLLPUBLIC storeError SAL_CALL store_openDirectory (
     storeFileHandle       hFile,
-    rtl_uString          *pPath,
-    rtl_uString          *pName,
+    rtl_uString const    *pPath,
+    rtl_uString const    *pName,
     storeAccessMode       eAccessMode,
     storeDirectoryHandle *phDirectory
 ) SAL_THROW_EXTERN_C();
@@ -161,8 +161,8 @@ typedef void* storeStreamHandle;
  */
 STORE_DLLPUBLIC storeError SAL_CALL store_openStream (
     storeFileHandle    hFile,
-    rtl_uString       *pPath,
-    rtl_uString       *pName,
+    rtl_uString const *pPath,
+    rtl_uString const *pName,
     storeAccessMode    eMode,
     storeStreamHandle *phStrm
 ) SAL_THROW_EXTERN_C();
@@ -207,8 +207,8 @@ STORE_DLLPUBLIC storeError SAL_CALL store_writeStream (
  */
 STORE_DLLPUBLIC storeError SAL_CALL store_remove (
     storeFileHandle hFile,
-    rtl_uString    *pPath,
-    rtl_uString    *pName
+    rtl_uString const *pPath,
+    rtl_uString const *pName
 ) SAL_THROW_EXTERN_C();
 
 #ifdef __cplusplus
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index 969d0007380a..9c809bf30e8c 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -586,7 +586,7 @@ public:
 
     /** Return the corresponding edit format of a format. */
     sal_uInt32 GetEditFormat( double fNumber, sal_uInt32 nFIndex, short eType,
-                              LanguageType eLnge, SvNumberformat* pFormat );
+                              LanguageType eLnge, SvNumberformat const * pFormat );
 
     /// Return the reference date
     const Date& GetNullDate() const;
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index d5dc93a63770..92cac89f4e13 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -189,7 +189,7 @@ private:
     SAL_DLLPRIVATE void            ImplUpdateItem( ImplToolItems::size_type nIndex = ITEM_NOTFOUND );
     SAL_DLLPRIVATE bool            ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat = false );
     SAL_DLLPRIVATE bool            ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel = false );
-    SAL_DLLPRIVATE void            ImplChangeHighlight( ImplToolItem* pItem, bool bNoGrabFocus = false );
+    SAL_DLLPRIVATE void            ImplChangeHighlight( ImplToolItem const * pItem, bool bNoGrabFocus = false );
     SAL_DLLPRIVATE bool            ImplChangeHighlightUpDn( bool bUp, bool bNoCycle = false );
     SAL_DLLPRIVATE ImplToolItems::size_type ImplGetItemLine( ImplToolItem const * pCurrentItem );
     SAL_DLLPRIVATE ImplToolItem*   ImplGetFirstValidItem( ImplToolItems::size_type nLine );
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index 68b6794f1c28..371290ca9b6b 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -356,7 +356,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
 
 //  setLongListValue
 
-RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueList, sal_uInt32 len)
+RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const * pValueList, sal_uInt32 len)
 {
     OStoreStream    rValue;
     sal_uInt8*      pBuffer;
diff --git a/registry/source/keyimpl.hxx b/registry/source/keyimpl.hxx
index f8f90e86407a..27043d2cc223 100644
--- a/registry/source/keyimpl.hxx
+++ b/registry/source/keyimpl.hxx
@@ -65,7 +65,7 @@ public:
                          sal_uInt32 vSize);
 
     RegError    setLongListValue(const OUString& valueName,
-                                  sal_Int32* pValueList,
+                                 sal_Int32 const * pValueList,
                                  sal_uInt32 len);
 
     RegError    setStringListValue(const OUString& valueName,
diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx
index fd57ebc2047a..45c5ae474a2c 100644
--- a/registry/source/reflwrit.cxx
+++ b/registry/source/reflwrit.cxx
@@ -1190,12 +1190,12 @@ sal_Bool TYPEREG_CALLTYPE typereg_writer_setMethodParameterData(
 }
 
 sal_Bool TYPEREG_CALLTYPE typereg_writer_setMethodExceptionTypeName(
-    void * handle, sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
+    void const * handle, sal_uInt16 methodIndex, sal_uInt16 exceptionIndex,
     rtl_uString const * typeName)
     SAL_THROW_EXTERN_C()
 {
     try {
-        static_cast< TypeWriter * >(handle)->m_methods[methodIndex].setExcName(
+        static_cast< TypeWriter const * >(handle)->m_methods[methodIndex].setExcName(
             exceptionIndex, toByteString(typeName));
     } catch (std::bad_alloc &) {
         return false;
@@ -1268,11 +1268,11 @@ void TYPEREG_CALLTYPE typereg_writer_destroy(void * handle) SAL_THROW_EXTERN_C()
 }
 
 sal_Bool TYPEREG_CALLTYPE typereg_writer_setSuperTypeName(
-    void * handle, sal_uInt16 index, rtl_uString const * typeName)
+    void const * handle, sal_uInt16 index, rtl_uString const * typeName)
     SAL_THROW_EXTERN_C()
 {
     try {
-        static_cast< TypeWriter * >(handle)->setSuperType(
+        static_cast< TypeWriter const * >(handle)->setSuperType(
             index, toByteString(typeName));
     } catch (std::bad_alloc &) {
         return false;
diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx
index bc97dffce11b..bf4f464d7b52 100644
--- a/registry/source/regkey.cxx
+++ b/registry/source/regkey.cxx
@@ -238,7 +238,7 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey,
 
 RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey,
                                                   rtl_uString* keyName,
-                                                  sal_Int32* pValueList,
+                                                  sal_Int32 const * pValueList,
                                                   sal_uInt32 len)
 {
     ORegKey* pKey = static_cast< ORegKey* >(hKey);
diff --git a/registry/source/regkey.hxx b/registry/source/regkey.hxx
index e45bc50f1976..45c55cee93a7 100644
--- a/registry/source/regkey.hxx
+++ b/registry/source/regkey.hxx
@@ -41,7 +41,7 @@ RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle);
 RegError REGISTRY_CALLTYPE setValue(
     RegKeyHandle, rtl_uString*, RegValueType, RegValue, sal_uInt32);
 RegError REGISTRY_CALLTYPE setLongListValue(
-    RegKeyHandle, rtl_uString*, sal_Int32*, sal_uInt32);
+    RegKeyHandle, rtl_uString*, sal_Int32 const *, sal_uInt32);
 RegError REGISTRY_CALLTYPE setStringListValue(
     RegKeyHandle, rtl_uString*, sal_Char**, sal_uInt32);
 RegError REGISTRY_CALLTYPE setUnicodeListValue(
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index fc004e6df9aa..313d2c893840 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -123,7 +123,7 @@ bool OLEStorageBase::Validate_Impl( bool bWrite ) const
         &&  ( !bWrite || !pEntry->m_bDirect || ( nStreamMode & StreamMode::WRITE ) );
 }
 
-bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry* p )
+bool OLEStorageBase::ValidateMode_Impl( StreamMode m, StgDirEntry const * p )
 {
     if( m == INTERNAL_MODE )
         return true;
@@ -927,7 +927,7 @@ bool Storage::ValidateMode( StreamMode nMode ) const
     return bRet;
 }
 
-bool Storage::ValidateMode( StreamMode nMode, StgDirEntry* p ) const
+bool Storage::ValidateMode( StreamMode nMode, StgDirEntry const * p ) const
 {
     bool bRet = ValidateMode_Impl( nMode, p );
     if ( !bRet )
diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx
index a4935d3930bf..5d42354b6a62 100644
--- a/store/source/storbios.cxx
+++ b/store/source/storbios.cxx
@@ -195,7 +195,7 @@ struct SuperBlockPage
 
     /** save.
      */
-    storeError save (OStorePageBIOS & rBIOS, sal_uInt32 nSize = theSize)
+    storeError save (OStorePageBIOS const & rBIOS, sal_uInt32 nSize = theSize)
     {
         m_aSuperOne.guard();
         m_aSuperTwo = m_aSuperOne;
@@ -205,20 +205,20 @@ struct SuperBlockPage
     /** Page allocation.
      */
     storeError unusedHead (
-        OStorePageBIOS & rBIOS,
+        OStorePageBIOS const & rBIOS,
         PageData &       rPageHead);
 
     storeError unusedPop (
-        OStorePageBIOS & rBIOS,
+        OStorePageBIOS const & rBIOS,
         PageData const & rPageHead);
 
     storeError unusedPush (
-        OStorePageBIOS & rBIOS,
+        OStorePageBIOS const & rBIOS,
         sal_uInt32       nAddr);
 
     /** verify (with repair).
      */
-    storeError verify (OStorePageBIOS & rBIOS);
+    storeError verify (OStorePageBIOS const & rBIOS);
 };
 
 } // namespace store
@@ -231,7 +231,7 @@ struct SuperBlockPage
 /*
  * unusedHead(): get freelist head (alloc page, step 1).
  */
-storeError SuperBlockPage::unusedHead (OStorePageBIOS & rBIOS, PageData & rPageHead)
+storeError SuperBlockPage::unusedHead (OStorePageBIOS const & rBIOS, PageData & rPageHead)
 {
     storeError eErrCode = verify (rBIOS);
     if (eErrCode != store_E_None)
@@ -274,7 +274,7 @@ storeError SuperBlockPage::unusedHead (OStorePageBIOS & rBIOS, PageData & rPageH
 /*
  * unusedPop(): pop freelist head (alloc page, step 2).
  */
-storeError SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead)
+storeError SuperBlockPage::unusedPop (OStorePageBIOS const & rBIOS, PageData const & rPageHead)
 {
     sal_uInt32 const nAddr = rPageHead.m_aUnused.location();
     OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free");
@@ -290,7 +290,7 @@ storeError SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & r
 /*
  * unusedPush(): push new freelist head.
  */
-storeError SuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr)
+storeError SuperBlockPage::unusedPush (OStorePageBIOS const & rBIOS, sal_uInt32 nAddr)
 {
     storeError eErrCode = verify (rBIOS);
     if (eErrCode != store_E_None)
@@ -320,7 +320,7 @@ storeError SuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr)
 /*
  * verify (with repair).
  */
-storeError SuperBlockPage::verify (OStorePageBIOS & rBIOS)
+storeError SuperBlockPage::verify (OStorePageBIOS const & rBIOS)
 {
     // Verify 1st copy.
     storeError eErrCode = m_aSuperOne.verify();
diff --git a/store/source/store.cxx b/store/source/store.cxx
index e967bb0f0c3b..558d8ff0eae0 100644
--- a/store/source/store.cxx
+++ b/store/source/store.cxx
@@ -210,8 +210,8 @@ storeError SAL_CALL store_flushFile (
  */
 storeError SAL_CALL store_openDirectory (
     storeFileHandle       hFile,
-    rtl_uString          *pPath,
-    rtl_uString          *pName,
+    rtl_uString const    *pPath,
+    rtl_uString const    *pName,
     storeAccessMode       eAccessMode,
     storeDirectoryHandle *phDirectory
 ) SAL_THROW_EXTERN_C()
@@ -304,8 +304,8 @@ storeError SAL_CALL store_findNext (
  */
 storeError SAL_CALL store_openStream (
     storeFileHandle    hFile,
-    rtl_uString       *pPath,
-    rtl_uString       *pName,
+    rtl_uString const *pPath,
+    rtl_uString const *pName,
     storeAccessMode    eAccessMode,
     storeStreamHandle *phStream
 ) SAL_THROW_EXTERN_C()
@@ -388,8 +388,8 @@ storeError SAL_CALL store_writeStream (
  */
 storeError SAL_CALL store_remove (
     storeFileHandle Handle,
-    rtl_uString    *pPath,
-    rtl_uString    *pName
+    rtl_uString const *pPath,
+    rtl_uString const *pName
 ) SAL_THROW_EXTERN_C()
 {
     storeError eErrCode = store_E_None;
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 655dabc6613a..c9026ac11969 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -1401,7 +1401,7 @@ sal_uInt32 SvNumberFormatter::GuessDateTimeFormat( short& rType, double fNumber,
 
 sal_uInt32 SvNumberFormatter::GetEditFormat( double fNumber, sal_uInt32 nFIndex,
                                              short eType, LanguageType eLang,
-                                             SvNumberformat* pFormat )
+                                             SvNumberformat const * pFormat )
 {
     sal_uInt32 nKey = nFIndex;
     switch ( eType )
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index cd7ee4aab6f0..6c5e99226e40 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -871,7 +871,7 @@ void SAL_CALL SortedResultSet::removeVetoableChangeListener(
 sal_IntPtr SortedResultSet::CompareImpl( const Reference < XResultSet >& xResultOne,
                                    const Reference < XResultSet >& xResultTwo,
                                    sal_IntPtr nIndexOne, sal_IntPtr nIndexTwo,
-                                   SortInfo* pSortInfo )
+                                   SortInfo const * pSortInfo )
 {
     Reference < XRow > xRowOne( xResultOne, UNO_QUERY );
     Reference < XRow > xRowTwo( xResultTwo, UNO_QUERY );
@@ -1122,8 +1122,8 @@ sal_IntPtr SortedResultSet::CompareImpl( const Reference < XResultSet >& xResult
 }
 
 
-sal_IntPtr SortedResultSet::Compare( SortListData *pOne,
-                               SortListData *pTwo )
+sal_IntPtr SortedResultSet::Compare( SortListData const *pOne,
+                               SortListData const *pTwo )
 {
     sal_IntPtr nIndexOne;
     sal_IntPtr nIndexTwo;
@@ -1160,7 +1160,7 @@ sal_IntPtr SortedResultSet::Compare( SortListData *pOne,
 }
 
 
-sal_IntPtr SortedResultSet::FindPos( SortListData *pEntry,
+sal_IntPtr SortedResultSet::FindPos( SortListData const *pEntry,
                                sal_IntPtr _nStart, sal_IntPtr _nEnd )
 {
     if ( _nStart > _nEnd )
diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx
index 9547bb827e1a..80b6df0c566a 100644
--- a/ucb/source/sorter/sortresult.hxx
+++ b/ucb/source/sorter/sortresult.hxx
@@ -120,11 +120,11 @@ class SortedResultSet: public cppu::WeakImplHelper <
 private:
     /// @throws css::sdbc::SQLException
     /// @throws css::uno::RuntimeException
-    sal_IntPtr          FindPos( SortListData *pEntry, sal_IntPtr nStart, sal_IntPtr nEnd );
+    sal_IntPtr          FindPos( SortListData const *pEntry, sal_IntPtr nStart, sal_IntPtr nEnd );
     /// @throws css::sdbc::SQLException
     /// @throws css::uno::RuntimeException
-    sal_IntPtr          Compare( SortListData *pOne,
-                                 SortListData *pTwo );
+    sal_IntPtr          Compare( SortListData const *pOne,
+                                 SortListData const *pTwo );
     void                BuildSortInfo( const css::uno::Reference< css::sdbc::XResultSet >& aResult,
                                        const css::uno::Sequence < css::ucb::NumberedSortingInfo > &xSortInfo,
                                        const css::uno::Reference< css::ucb::XAnyCompareFactory > &xCompFac );
@@ -133,7 +133,7 @@ private:
     static sal_IntPtr   CompareImpl( const css::uno::Reference < css::sdbc::XResultSet >& xResultOne,
                                      const css::uno::Reference < css::sdbc::XResultSet >& xResultTwo,
                                      sal_IntPtr nIndexOne, sal_IntPtr nIndexTwo,
-                                     SortInfo* pSortInfo );
+                                     SortInfo const * pSortInfo );
     /// @throws css::sdbc::SQLException
     /// @throws css::uno::RuntimeException
     sal_IntPtr          CompareImpl( const css::uno::Reference < css::sdbc::XResultSet >& xResultOne,
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 675e131451a7..1a9157ca9747 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -223,7 +223,7 @@ public:
 
     void                        DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev );
 
-    void                        DrawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry, const OutputDevice *pOutDev );
+    void                        DrawPolyLine( sal_uInt32 nPoints, SalPoint const * pPtAry, const OutputDevice *pOutDev );
 
     void                        DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev );
 
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 04ec36d0e813..80225dc04fd6 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -315,7 +315,7 @@ namespace vcl
  * @ingroup sft
  */
 
-    int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr);
+    int GetTTNameRecords(TrueTypeFont const *ttf, NameRecord **nr);
 
 /**
  * Deallocates previously allocated array of NameRecords.
@@ -411,7 +411,7 @@ namespace vcl
  * @ingroup sft
  *
  */
-    TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical);
+    TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical);
 
 #if defined(_WIN32) || defined(MACOSX) || defined(IOS)
 /**
@@ -454,12 +454,12 @@ namespace vcl
 /**
  * returns the number of glyphs in a font
  */
- int GetTTGlyphCount( TrueTypeFont* ttf );
+ int GetTTGlyphCount( TrueTypeFont const * ttf );
 
 /**
  * provide access to the raw data of a SFNT-container's subtable
  */
- bool GetSfntTable( TrueTypeFont* ttf, int nSubtableIndex,
+ bool GetSfntTable( TrueTypeFont const * ttf, int nSubtableIndex,
      const sal_uInt8** ppRawBytes, int* pRawLength );
 
 /*- private definitions */
diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index 80c8de172943..03d033e8c7e0 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -150,7 +150,7 @@ class VCL_PLUGIN_PUBLIC PrintFontManager
 
     std::vector<std::unique_ptr<PrintFont>> analyzeFontFile(int nDirID, const OString& rFileName, const char *pFormat=nullptr) const;
     static OUString convertSfntName( void* pNameRecord ); // actually a NameRecord* format font subsetting code
-    static void analyzeSfntFamilyName( void* pTTFont, std::vector< OUString >& rnames ); // actually a TrueTypeFont* from font subsetting code
+    static void analyzeSfntFamilyName( void const * pTTFont, std::vector< OUString >& rnames ); // actually a TrueTypeFont* from font subsetting code
     bool analyzeSfntFile(PrintFont* pFont) const;
     // finds the font id for the nFaceIndex face in this font file
     // There may be multiple font ids for font collections
diff --git a/vcl/inc/unx/i18n_ic.hxx b/vcl/inc/unx/i18n_ic.hxx
index b3f8b2c59b09..6a36f48d0804 100644
--- a/vcl/inc/unx/i18n_ic.hxx
+++ b/vcl/inc/unx/i18n_ic.hxx
@@ -50,7 +50,7 @@ private:
     XVaNestedList mpStatusAttributes;
     XVaNestedList mpPreeditAttributes;
 
-    bool         SupportInputMethodStyle( XIMStyles *pIMStyles );
+    bool         SupportInputMethodStyle( XIMStyles const *pIMStyles );
     static unsigned int GetWeightingOfIMStyle(   XIMStyle n_style );
     Bool         IsSupportedIMStyle(      XIMStyle n_style ) const;
 
diff --git a/vcl/source/filter/sgfbram.cxx b/vcl/source/filter/sgfbram.cxx
index 8dcda618c817..e71fa944afeb 100644
--- a/vcl/source/filter/sgfbram.cxx
+++ b/vcl/source/filter/sgfbram.cxx
@@ -185,7 +185,7 @@ sal_uInt8 PcxExpand::GetByte(SvStream& rInp)
     return Data;
 }
 
-bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader& rHead)
+bool SgfFilterBMap(SvStream& rInp, SvStream& rOut, SgfHeader const & rHead)
 {
     BmpFileHeader  aBmpHead;
     BmpInfoHeader  aBmpInfo;
diff --git a/vcl/source/filter/sgvtext.cxx b/vcl/source/filter/sgvtext.cxx
index 9558f6fe1ebe..692a960aa559 100644
--- a/vcl/source/filter/sgvtext.cxx
+++ b/vcl/source/filter/sgvtext.cxx
@@ -248,7 +248,7 @@ void ChgSchnittBit(sal_uInt16 Bit, sal_uInt16 Radio1, sal_uInt16 Radio2, sal_uIn
     }
 }
 
-UCHAR GetNextChar(UCHAR* TBuf, sal_uInt16 Index)
+UCHAR GetNextChar(UCHAR const * TBuf, sal_uInt16 Index)
 {
     sal_uInt16 Cnt;
     while (TBuf[Index]==Escape) {
@@ -348,7 +348,7 @@ UCHAR ProcessOne(const UCHAR* TBuf, sal_uInt16& Index,
     return c;
 } // end of ProcessOne
 
-UCHAR GetTextChar(UCHAR* TBuf, sal_uInt16& Index,
+UCHAR GetTextChar(UCHAR const * TBuf, sal_uInt16& Index,
                   ObjTextType& Atr0, ObjTextType& AktAtr,
                   sal_uInt16 Rest, bool ScanEsc)
 {
@@ -381,7 +381,7 @@ UCHAR GetTextChar(UCHAR* TBuf, sal_uInt16& Index,
   // is 3x present in TextBuf, e.g.: "schiff-fahrt".   }
   // If not separated then, "-f" is removed.        }
 
-UCHAR GetTextCharConv(UCHAR* TBuf, sal_uInt16& Index,
+UCHAR GetTextCharConv(UCHAR const * TBuf, sal_uInt16& Index,
                       ObjTextType& Atr0, ObjTextType& AktAtr,
                       sal_uInt16 Rest)
 {
@@ -402,7 +402,7 @@ UCHAR GetTextCharConv(UCHAR* TBuf, sal_uInt16& Index,
 //
 // Required line spacing in SGF-Units. ChrVPos is taken into account.
 // ======================================================================
-sal_uInt16 GetLineFeed(UCHAR* TBuf, sal_uInt16 Index, ObjTextType Atr0, ObjTextType AktAtr,
+sal_uInt16 GetLineFeed(UCHAR const * TBuf, sal_uInt16 Index, ObjTextType Atr0, ObjTextType AktAtr,
                    sal_uInt16 nChar, sal_uInt16& LF, sal_uInt16& MaxGrad)
 {
     bool   AbsEnd=false;
@@ -614,7 +614,7 @@ sal_uInt16 GetCharWidth(OutputDevice const & rOut, UCHAR c)
     return ChrWidth;
 }
 
-UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& Atr0,
+UCHAR ProcessChar(OutputDevice& rOut, UCHAR const * TBuf, ProcChrSta& R, ObjTextType& Atr0,
                   sal_uInt16& nChars, sal_uInt16 Rest,
                   short* Line, UCHAR* cLine)
 {
@@ -649,7 +649,7 @@ UCHAR ProcessChar(OutputDevice& rOut, UCHAR* TBuf, ProcChrSta& R, ObjTextType& A
     return c;
 }
 
-void FormatLine(UCHAR* TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& AktAtr,
+void FormatLine(UCHAR const * TBuf, sal_uInt16& Index, ObjTextType& Atr0, ObjTextType& AktAtr,
                 sal_uInt16 UmbWdt, sal_uInt16 AdjWdt,
                 short* Line, sal_uInt16& nChars,
                 UCHAR* cLine, bool TextFit)
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index ea5b2d6ce8ce..19e40cb6d61c 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -267,7 +267,7 @@ static const sal_uInt8* getTable( TrueTypeFont const *ttf, sal_uInt32 ord)
     return ttf->tables[ord];
 }
 
-static sal_uInt32 getTableSize(TrueTypeFont *ttf, sal_uInt32 ord)
+static sal_uInt32 getTableSize(TrueTypeFont const *ttf, sal_uInt32 ord)
 {
     return ttf->tlens[ord];
 }
@@ -367,7 +367,7 @@ static void GetMetrics(TrueTypeFont const *ttf, sal_uInt32 glyphID, TTGlyphMetri
 static int GetTTGlyphOutline(TrueTypeFont *, sal_uInt32 , ControlPoint **, TTGlyphMetrics *, std::vector< sal_uInt32 >* );
 
 /* returns the number of control points, allocates the pointArray */
-static int GetSimpleTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics)
+static int GetSimpleTTOutline(TrueTypeFont const *ttf, sal_uInt32 glyphID, ControlPoint **pointArray, TTGlyphMetrics *metrics)
 {
     const sal_uInt8* table = getTable(ttf, O_glyf);
     const sal_uInt32 nTableSize = getTableSize(ttf, O_glyf);
@@ -693,7 +693,7 @@ static int GetTTGlyphOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPoint
 
 /*- returns the number of items in the path -*/
 
-static int BSplineToPSPath(ControlPoint *srcA, int srcCount, PSPathElement **path)
+static int BSplineToPSPath(ControlPoint const *srcA, int srcCount, PSPathElement **path)
 {
     std::vector< PSPathElement > aPathList;
     int nPathCount = 0;
@@ -2314,12 +2314,12 @@ sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch)
 #endif
 
 
-int GetTTGlyphCount( TrueTypeFont* ttf )
+int GetTTGlyphCount( TrueTypeFont const * ttf )
 {
     return ttf->nglyphs;
 }
 
-bool GetSfntTable( TrueTypeFont* ttf, int nSubtableIndex,
+bool GetSfntTable( TrueTypeFont const * ttf, int nSubtableIndex,
     const sal_uInt8** ppRawBytes, int* pRawLength )
 {
     if( (nSubtableIndex < 0) || (nSubtableIndex >= NUM_TAGS) )
@@ -2330,7 +2330,7 @@ bool GetSfntTable( TrueTypeFont* ttf, int nSubtableIndex,
     return bOk;
 }
 
-TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical)
+TTSimpleGlyphMetrics *GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical)
 {
     const sal_uInt8* pTable;
     sal_uInt32 n;
@@ -2539,7 +2539,7 @@ GlyphData *GetTTRawGlyphData(TrueTypeFont *ttf, sal_uInt32 glyphID)
     return d;
 }
 
-int GetTTNameRecords(TrueTypeFont *ttf, NameRecord **nr)
+int GetTTNameRecords(TrueTypeFont const *ttf, NameRecord **nr)
 {
     const sal_uInt8* table = getTable(ttf, O_name);
     int nTableSize = getTableSize(ttf, O_name );
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index e8c1b744054e..2b30cb35ebc5 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -591,7 +591,7 @@ static int GetRawData_glyf(TrueTypeTable *_this, sal_uInt8 **ptr, sal_uInt32 *le
 }
 
 /* cmap packers */
-static sal_uInt8 *PackCmapType0(CmapSubTable *s, sal_uInt32 *length)
+static sal_uInt8 *PackCmapType0(CmapSubTable const *s, sal_uInt32 *length)
 {
     sal_uInt8* ptr = static_cast<sal_uInt8*>(smalloc(262));
     sal_uInt8 *p = ptr + 6;
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 7412ed7bb429..1c99d4d2ac1a 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -391,7 +391,7 @@ void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, const O
     drawRect( nX, nY, nWidth, nHeight );
 }
 
-void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, SalPoint* pPtAry, const OutputDevice *pOutDev )
+void SalGraphics::DrawPolyLine( sal_uInt32 nPoints, SalPoint const * pPtAry, const OutputDevice *pOutDev )
 {
     if( (m_nLayout & SalLayoutFlags::BiDiRtl) || (pOutDev && pOutDev->IsRTLEnabled()) )
     {
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index fa0129bdba53..4200cdbc02d0 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -4838,7 +4838,7 @@ void ToolBox::ChangeHighlight( ImplToolItems::size_type nPos )
     }
 }
 
-void ToolBox::ImplChangeHighlight( ImplToolItem* pItem, bool bNoGrabFocus )
+void ToolBox::ImplChangeHighlight( ImplToolItem const * pItem, bool bNoGrabFocus )
 {
     // avoid recursion due to focus change
     if( mbChangingHighlight )
diff --git a/vcl/unx/generic/app/i18n_ic.cxx b/vcl/unx/generic/app/i18n_ic.cxx
index 52e47a91af93..408a828ba2b0 100644
--- a/vcl/unx/generic/app/i18n_ic.cxx
+++ b/vcl/unx/generic/app/i18n_ic.cxx
@@ -477,7 +477,7 @@ SalI18N_InputContext::IsSupportedIMStyle( XIMStyle nStyle ) const
 }
 
 bool
-SalI18N_InputContext::SupportInputMethodStyle( XIMStyles *pIMStyles )
+SalI18N_InputContext::SupportInputMethodStyle( XIMStyles const *pIMStyles )
 {
     mnPreeditStyle = 0;
     mnStatusStyle  = 0;
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index fe8e6e2d0365..67eb8c4a7b8a 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -2066,7 +2066,7 @@ bool SelectionManager::handleSelectionNotify( XSelectionEvent& rNotify )
     return bHandled;
 }
 
-bool SelectionManager::handleDropEvent( XClientMessageEvent& rMessage )
+bool SelectionManager::handleDropEvent( XClientMessageEvent const & rMessage )
 {
     osl::ResettableMutexGuard aGuard(m_aMutex);
 
diff --git a/vcl/unx/generic/dtrans/X11_selection.hxx b/vcl/unx/generic/dtrans/X11_selection.hxx
index e6910f330a33..13d119b9ec0a 100644
--- a/vcl/unx/generic/dtrans/X11_selection.hxx
+++ b/vcl/unx/generic/dtrans/X11_selection.hxx
@@ -373,7 +373,7 @@ namespace x11 {
         bool handleReceivePropertyNotify( XPropertyEvent& rNotify );
         bool handleSelectionNotify( XSelectionEvent& rNotify );
         bool handleDragEvent( XEvent& rMessage );
-        bool handleDropEvent( XClientMessageEvent& rMessage );
+        bool handleDropEvent( XClientMessageEvent const & rMessage );
 
         // dnd helpers
         void sendDragStatus( Atom nDropAction );
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx
index 409a34133daf..f093f0e8d097 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -179,7 +179,7 @@ namespace
     //See if this font is a duplicate with equal attributes which has already been
     //inserted, or if it an older version of an inserted fonts. Depends on FcFontSet
     //on being sorted with SortFont
-    bool isPreviouslyDuplicateOrObsoleted(FcFontSet *pFSet, int i)
+    bool isPreviouslyDuplicateOrObsoleted(FcFontSet const *pFSet, int i)
     {
         const FcPattern *a = pFSet->fonts[i];
 
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index b83ff5899d47..c956345e6fd1 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -497,7 +497,7 @@ namespace
     }
 }
 
-void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::vector< OUString >& rNames )
+void PrintFontManager::analyzeSfntFamilyName( void const * pTTFont, ::std::vector< OUString >& rNames )
 {
     OUString aFamily;
 
@@ -505,7 +505,7 @@ void PrintFontManager::analyzeSfntFamilyName( void* pTTFont, ::std::vector< OUSt
     ::std::set< OUString > aSet;
 
     NameRecord* pNameRecords = nullptr;
-    int nNameRecords = GetTTNameRecords( static_cast<TrueTypeFont*>(pTTFont), &pNameRecords );
+    int nNameRecords = GetTTNameRecords( static_cast<TrueTypeFont const *>(pTTFont), &pNameRecords );
     if( nNameRecords && pNameRecords )
     {
         LanguageTag aSystem("");


More information about the Libreoffice-commits mailing list