[Libreoffice-commits] core.git: comphelper/qa comphelper/source compilerplugins/clang include/comphelper
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jul 20 12:13:21 UTC 2018
comphelper/qa/container/comphelper_ifcontainer.cxx | 2
comphelper/source/container/interfacecontainer2.cxx | 4 -
comphelper/source/eventattachermgr/eventattachermgr.cxx | 4 -
comphelper/source/misc/backupfilehelper.cxx | 4 -
comphelper/source/misc/hash.cxx | 2
comphelper/source/misc/profilezone.cxx | 4 -
comphelper/source/officeinstdir/officeinstallationdirectories.hxx | 4 -
comphelper/source/property/propertycontainerhelper.cxx | 2
comphelper/source/xml/ofopxmlhelper.cxx | 26 ++++----
compilerplugins/clang/unusedfields.cxx | 32 ++++++++++
compilerplugins/clang/unusedfields.py | 31 +++++++++
include/comphelper/ChainablePropertySet.hxx | 2
include/comphelper/MasterPropertySet.hxx | 2
include/comphelper/PropertyInfoHash.hxx | 10 +--
include/comphelper/asyncnotification.hxx | 2
include/comphelper/componentmodule.hxx | 8 +-
include/comphelper/enumhelper.hxx | 2
include/comphelper/flagguard.hxx | 2
include/comphelper/interaction.hxx | 2
include/comphelper/interfacecontainer2.hxx | 6 -
include/comphelper/profilezone.hxx | 2
include/comphelper/propmultiplex.hxx | 2
include/comphelper/seqstream.hxx | 4 -
include/comphelper/stl_types.hxx | 4 -
include/comphelper/string.hxx | 2
include/comphelper/threadpool.hxx | 2
include/comphelper/unique_disposing_ptr.hxx | 2
27 files changed, 116 insertions(+), 53 deletions(-)
New commits:
commit 12dce07aec980562fa449fa1884e0e8379d680fb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Jul 19 16:28:37 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jul 20 14:12:57 2018 +0200
loplugin:unusedfields - look for fields that can be const, in comphelper
idea from tml.
Extend the unusedfields plugin to find fields that are only assigned in
the constructor.
Change-Id: I258d3581afbe651d53ce730c9ba27a4598cd9248
Reviewed-on: https://gerrit.libreoffice.org/57733
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/comphelper/qa/container/comphelper_ifcontainer.cxx b/comphelper/qa/container/comphelper_ifcontainer.cxx
index cf38b4e45bfe..26a2bd9992d8 100644
--- a/comphelper/qa/container/comphelper_ifcontainer.cxx
+++ b/comphelper/qa/container/comphelper_ifcontainer.cxx
@@ -42,7 +42,7 @@ struct ContainerStats {
class ContainerListener : public cppu::WeakImplHelper< XEventListener >
{
- ContainerStats *m_pStats;
+ ContainerStats * const m_pStats;
public:
explicit ContainerListener(ContainerStats *pStats)
: m_pStats(pStats) { m_pStats->m_nAlive++; }
diff --git a/comphelper/source/container/interfacecontainer2.cxx b/comphelper/source/container/interfacecontainer2.cxx
index c22d1641eef0..aac2e6213098 100644
--- a/comphelper/source/container/interfacecontainer2.cxx
+++ b/comphelper/source/container/interfacecontainer2.cxx
@@ -39,13 +39,13 @@ namespace comphelper
{
OInterfaceIteratorHelper2::OInterfaceIteratorHelper2( OInterfaceContainerHelper2 & rCont_ )
- : rCont( rCont_ )
+ : rCont( rCont_ ),
+ bIsList( rCont_.bIsList )
{
MutexGuard aGuard( rCont.rMutex );
if( rCont.bInUse )
// worst case, two iterators at the same time
rCont.copyAndResetInUse();
- bIsList = rCont_.bIsList;
aData = rCont_.aData;
if( bIsList )
{
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 4e5cdb0e0e53..e613a92258ac 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -134,8 +134,8 @@ private:
class AttacherAllListener_Impl : public WeakImplHelper< XAllListener >
{
rtl::Reference<ImplEventAttacherManager> mxManager;
- OUString aScriptType;
- OUString aScriptCode;
+ OUString const aScriptType;
+ OUString const aScriptCode;
/// @throws CannotConvertException
void convertToEventReturn( Any & rRet, const Type & rRetType );
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index fc19da6d2570..8bb0804739d5 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -549,7 +549,7 @@ namespace
{
private:
ExtensionInfoEntryVector maEntries;
- OUString maRegPath;
+ OUString const maRegPath;
public:
ExtensionInfo()
@@ -998,7 +998,7 @@ namespace
sal_uInt32 mnOffset; // offset in File (zero identifies new file)
sal_uInt32 mnCrc32; // checksum
FileSharedPtr maFile; // file where to find the data (at offset)
- bool mbDoCompress; // flag if this file is scheduled to be compressed when written
+ bool const mbDoCompress; // flag if this file is scheduled to be compressed when written
bool copy_content_straight(oslFileHandle& rTargetHandle)
{
diff --git a/comphelper/source/misc/hash.cxx b/comphelper/source/misc/hash.cxx
index b07fd66c0628..b7eab08ce033 100644
--- a/comphelper/source/misc/hash.cxx
+++ b/comphelper/source/misc/hash.cxx
@@ -67,7 +67,7 @@ struct HashImpl
}
#endif
- HashType meType;
+ HashType const meType;
HashImpl(HashType eType):
meType(eType)
diff --git a/comphelper/source/misc/profilezone.cxx b/comphelper/source/misc/profilezone.cxx
index 12a6172af56d..7847246f09c0 100644
--- a/comphelper/source/misc/profilezone.cxx
+++ b/comphelper/source/misc/profilezone.cxx
@@ -92,9 +92,9 @@ css::uno::Sequence<OUString> getRecordingAndClear()
ProfileZone::ProfileZone(const char * sProfileId) :
- m_sProfileId(sProfileId)
+ m_sProfileId(sProfileId),
+ m_aCreateTime(ProfileRecording::addRecording(sProfileId, 0))
{
- m_aCreateTime = ProfileRecording::addRecording(sProfileId, 0);
}
ProfileZone::~ProfileZone()
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
index 4437951b7dec..e2b04a7687fb 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx
@@ -69,8 +69,8 @@ public:
private:
void initDirs();
- OUString m_aOfficeBrandDirMacro;
- OUString m_aUserDirMacro;
+ OUString const m_aOfficeBrandDirMacro;
+ OUString const m_aUserDirMacro;
css::uno::Reference< css::uno::XComponentContext > m_xCtx;
std::unique_ptr<OUString> m_pOfficeBrandDir;
std::unique_ptr<OUString> m_pUserDir;
diff --git a/comphelper/source/property/propertycontainerhelper.cxx b/comphelper/source/property/propertycontainerhelper.cxx
index c906c0d22b39..702a7a8e01dd 100644
--- a/comphelper/source/property/propertycontainerhelper.cxx
+++ b/comphelper/source/property/propertycontainerhelper.cxx
@@ -51,7 +51,7 @@ namespace
// comparing two property descriptions (by name)
struct PropertyDescriptionNameMatch
{
- OUString m_rCompare;
+ OUString const m_rCompare;
explicit PropertyDescriptionNameMatch( const OUString& _rCompare ) : m_rCompare( _rCompare ) { }
bool operator() (const PropertyDescription& x ) const
diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx
index bfb3dbdd0fa6..62cd50aba2ca 100644
--- a/comphelper/source/xml/ofopxmlhelper.cxx
+++ b/comphelper/source/xml/ofopxmlhelper.cxx
@@ -45,23 +45,23 @@ namespace comphelper {
class OFOPXMLHelper_Impl
: public cppu::WeakImplHelper< css::xml::sax::XDocumentHandler >
{
- sal_uInt16 m_nFormat; // which format to parse
+ sal_uInt16 const m_nFormat; // which format to parse
// Relations info related strings
- OUString m_aRelListElement;
- OUString m_aRelElement;
- OUString m_aIDAttr;
- OUString m_aTypeAttr;
- OUString m_aTargetModeAttr;
- OUString m_aTargetAttr;
+ OUString const m_aRelListElement;
+ OUString const m_aRelElement;
+ OUString const m_aIDAttr;
+ OUString const m_aTypeAttr;
+ OUString const m_aTargetModeAttr;
+ OUString const m_aTargetAttr;
// ContentType related strings
- OUString m_aTypesElement;
- OUString m_aDefaultElement;
- OUString m_aOverrideElement;
- OUString m_aExtensionAttr;
- OUString m_aPartNameAttr;
- OUString m_aContentTypeAttr;
+ OUString const m_aTypesElement;
+ OUString const m_aDefaultElement;
+ OUString const m_aOverrideElement;
+ OUString const m_aExtensionAttr;
+ OUString const m_aPartNameAttr;
+ OUString const m_aContentTypeAttr;
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > m_aResultSeq;
std::vector< OUString > m_aElementsSeq; // stack of elements being parsed
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index 8dca2f549933..94ad63a6f3a3 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -70,6 +70,7 @@ static std::set<MyFieldInfo> touchedFromOutsideSet;
static std::set<MyFieldInfo> touchedFromOutsideConstructorSet;
static std::set<MyFieldInfo> readFromSet;
static std::set<MyFieldInfo> writeToSet;
+static std::set<MyFieldInfo> writeToOutsideConstructorSet;
static std::set<MyFieldInfo> definitionSet;
/**
@@ -159,6 +160,7 @@ public:
private:
MyFieldInfo niceName(const FieldDecl*);
void checkTouchedFromOutside(const FieldDecl* fieldDecl, const Expr* memberExpr);
+ void checkWriteFromOutsideConstructor(const FieldDecl* fieldDecl, const Expr* memberExpr);
void checkWriteOnly(const FieldDecl* fieldDecl, const Expr* memberExpr);
void checkReadOnly(const FieldDecl* fieldDecl, const Expr* memberExpr);
bool isSomeKindOfZero(const Expr* arg);
@@ -193,6 +195,8 @@ void UnusedFields::run()
output += "read:\t" + s.parentClass + "\t" + s.fieldName + "\n";
for (const MyFieldInfo & s : writeToSet)
output += "write:\t" + s.parentClass + "\t" + s.fieldName + "\n";
+ for (const MyFieldInfo & s : writeToOutsideConstructorSet)
+ output += "write-outside-constructor:\t" + s.parentClass + "\t" + s.fieldName + "\n";
for (const MyFieldInfo & s : definitionSet)
output += "definition:\t" + s.access + "\t" + s.parentClass + "\t" + s.fieldName + "\t" + s.fieldType + "\t" + s.sourceLocation + "\n";
std::ofstream myfile;
@@ -671,7 +675,11 @@ void UnusedFields::checkReadOnly(const FieldDecl* fieldDecl, const Expr* memberE
RecordDecl const * cxxRecordDecl1 = fieldDecl->getParent();
// we don't care about writes to a field when inside the copy/move constructor/operator= for that field
if (cxxRecordDecl1 && (cxxRecordDecl1 == insideMoveOrCopyOrCloneDeclParent))
+ {
+ // ... but they matter to tbe can-be-const analysis
+ checkWriteFromOutsideConstructor(fieldDecl, memberExpr);
return;
+ }
}
// if we're inside a block that looks like
@@ -881,7 +889,10 @@ void UnusedFields::checkReadOnly(const FieldDecl* fieldDecl, const Expr* memberE
MyFieldInfo fieldInfo = niceName(fieldDecl);
if (bPotentiallyWrittenTo)
+ {
writeToSet.insert(fieldInfo);
+ checkWriteFromOutsideConstructor(fieldDecl, memberExpr);
+ }
}
bool UnusedFields::IsPassedByNonConst(const FieldDecl* fieldDecl, const Stmt * child, CallerWrapper callExpr,
@@ -1010,6 +1021,27 @@ void UnusedFields::checkTouchedFromOutside(const FieldDecl* fieldDecl, const Exp
}
}
+// For the const-field analysis.
+// Called when we have a write to a field, and we want to record that write only if it's writing from
+// outside the constructor.
+void UnusedFields::checkWriteFromOutsideConstructor(const FieldDecl* fieldDecl, const Expr* memberExpr) {
+ const FunctionDecl* memberExprParentFunction = getParentFunctionDecl(memberExpr);
+ bool doWrite = false;
+
+ if (!memberExprParentFunction)
+ // If we are not inside a function
+ doWrite = true;
+ else if (memberExprParentFunction->getParent() != fieldDecl->getParent())
+ // or we are inside a method from another class (than the one the field belongs to)
+ doWrite = true;
+ else if (!isa<CXXConstructorDecl>(memberExprParentFunction))
+ // or we are not inside constructor
+ doWrite = true;
+
+ if (doWrite)
+ writeToOutsideConstructorSet.insert(niceName(fieldDecl));
+}
+
llvm::Optional<CalleeWrapper> UnusedFields::getCallee(CallExpr const * callExpr)
{
FunctionDecl const * functionDecl = callExpr->getDirectCallee();
diff --git a/compilerplugins/clang/unusedfields.py b/compilerplugins/clang/unusedfields.py
index 072284576a6a..a7910bfd9768 100755
--- a/compilerplugins/clang/unusedfields.py
+++ b/compilerplugins/clang/unusedfields.py
@@ -13,6 +13,7 @@ touchedFromOutsideSet = set()
touchedFromOutsideConstructorSet = set()
readFromSet = set()
writeToSet = set()
+writeFromOutsideConstructorSet = set()
sourceLocationSet = set()
# clang does not always use exactly the same numbers in the type-parameter vars it generates
@@ -55,6 +56,8 @@ with io.open("workdir/loplugin.unusedfields.log", "rb", buffering=1024*1024) as
readFromSet.add(parseFieldInfo(tokens))
elif tokens[0] == "write:":
writeToSet.add(parseFieldInfo(tokens))
+ elif tokens[0] == "write-outside-constructor:":
+ writeFromOutsideConstructorSet.add(parseFieldInfo(tokens))
else:
print( "unknown line: " + line)
@@ -223,6 +226,29 @@ for d in protectedAndPublicDefinitionSet:
canBePrivateSet.add((clazz + " " + definitionToTypeMap[d], srcLoc))
+# Calculate can-be-const-field set
+canBeConstFieldSet = set()
+for d in definitionSet:
+ if d in writeFromOutsideConstructorSet:
+ continue
+ srcLoc = definitionToSourceLocationMap[d];
+ fieldType = definitionToTypeMap[d]
+ if fieldType.startswith("const "):
+ continue
+ if "std::unique_ptr" in fieldType:
+ continue
+ if "std::shared_ptr" in fieldType:
+ continue
+ if "Reference<" in fieldType:
+ continue
+ if "VclPtr<" in fieldType:
+ continue
+ if "osl::Mutex" in fieldType:
+ continue
+ if "::sfx2::sidebar::ControllerItem" in fieldType:
+ continue
+ canBeConstFieldSet.add((d[0] + " " + d[1] + " " + fieldType, srcLoc))
+
# sort the results using a "natural order" so sequences like [item1,item2,item10] sort nicely
def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
@@ -235,6 +261,7 @@ tmp2list = sorted(writeonlySet, key=lambda v: natural_sort_key(v[1]))
tmp3list = sorted(canBePrivateSet, key=lambda v: natural_sort_key(v[1]))
tmp4list = sorted(readonlySet, key=lambda v: natural_sort_key(v[1]))
tmp5list = sorted(onlyUsedInConstructorSet, key=lambda v: natural_sort_key(v[1]))
+tmp6list = sorted(canBeConstFieldSet, key=lambda v: natural_sort_key(v[1]))
# print out the results
with open("compilerplugins/clang/unusedfields.untouched.results", "wt") as f:
@@ -258,5 +285,9 @@ with open("compilerplugins/clang/unusedfields.only-used-in-constructor.results",
for t in tmp5list:
f.write( t[1] + "\n" )
f.write( " " + t[0] + "\n" )
+with open("compilerplugins/clang/unusedfields.can-be-const.results", "wt") as f:
+ for t in tmp6list:
+ f.write( t[1] + "\n" )
+ f.write( " " + t[0] + "\n" )
diff --git a/include/comphelper/ChainablePropertySet.hxx b/include/comphelper/ChainablePropertySet.hxx
index a306850caf18..e048883ada7c 100644
--- a/include/comphelper/ChainablePropertySet.hxx
+++ b/include/comphelper/ChainablePropertySet.hxx
@@ -68,7 +68,7 @@ namespace comphelper
{
friend class MasterPropertySet;
protected:
- SolarMutex* mpMutex;
+ SolarMutex* const mpMutex;
rtl::Reference < ChainablePropertySetInfo > mxInfo;
/// @throws css::beans::UnknownPropertyException
diff --git a/include/comphelper/MasterPropertySet.hxx b/include/comphelper/MasterPropertySet.hxx
index 4fe94ac90267..4a78c5ee7638 100644
--- a/include/comphelper/MasterPropertySet.hxx
+++ b/include/comphelper/MasterPropertySet.hxx
@@ -60,7 +60,7 @@ namespace comphelper
public css::beans::XMultiPropertySet
{
protected:
- SolarMutex* mpMutex;
+ SolarMutex* const mpMutex;
sal_uInt8 mnLastId;
std::map< sal_uInt8, comphelper::SlaveData* > maSlaveMap;
rtl::Reference< MasterPropertySetInfo > mxInfo;
diff --git a/include/comphelper/PropertyInfoHash.hxx b/include/comphelper/PropertyInfoHash.hxx
index 1e1374f317dc..3f1e4e084c97 100644
--- a/include/comphelper/PropertyInfoHash.hxx
+++ b/include/comphelper/PropertyInfoHash.hxx
@@ -28,14 +28,14 @@ namespace comphelper
{
struct PropertyInfo
{
- OUString maName;
- sal_Int32 mnHandle;
- css::uno::Type maType;
- sal_Int16 mnAttributes;
+ OUString const maName;
+ sal_Int32 const mnHandle;
+ css::uno::Type const maType;
+ sal_Int16 const mnAttributes;
};
struct PropertyData
{
- sal_uInt8 mnMapId;
+ sal_uInt8 const mnMapId;
PropertyInfo const *mpInfo;
PropertyData ( sal_uInt8 nMapId, PropertyInfo const *pInfo )
: mnMapId ( nMapId )
diff --git a/include/comphelper/asyncnotification.hxx b/include/comphelper/asyncnotification.hxx
index b08e3be3fc48..bc2ebf54f675 100644
--- a/include/comphelper/asyncnotification.hxx
+++ b/include/comphelper/asyncnotification.hxx
@@ -204,7 +204,7 @@ namespace comphelper
typedef EVENT_OBJECT EventObjectType;
private:
- EventObjectType m_aEvent;
+ EventObjectType const m_aEvent;
public:
EventHolder( const EventObjectType& _rEvent )
diff --git a/include/comphelper/componentmodule.hxx b/include/comphelper/componentmodule.hxx
index bc0292a667ca..1793953aaf49 100644
--- a/include/comphelper/componentmodule.hxx
+++ b/include/comphelper/componentmodule.hxx
@@ -53,13 +53,13 @@ namespace comphelper
struct COMPHELPER_DLLPUBLIC ComponentDescription
{
/// the implementation name of the component
- OUString sImplementationName;
+ OUString const sImplementationName;
/// the services supported by the component implementation
- css::uno::Sequence< OUString > aSupportedServices;
+ css::uno::Sequence< OUString > const aSupportedServices;
/// the function to create an instance of the component
- ::cppu::ComponentFactoryFunc pComponentCreationFunc;
+ ::cppu::ComponentFactoryFunc const pComponentCreationFunc;
/// the function to create a factory for the component (usually <code>::cppu::createSingleComponentFactory</code>)
- FactoryInstantiation pFactoryCreationFunc;
+ FactoryInstantiation const pFactoryCreationFunc;
ComponentDescription(
const OUString& _rImplementationName,
diff --git a/include/comphelper/enumhelper.hxx b/include/comphelper/enumhelper.hxx
index 67b21df92b0f..2de51f332782 100644
--- a/include/comphelper/enumhelper.hxx
+++ b/include/comphelper/enumhelper.hxx
@@ -45,7 +45,7 @@ class COMPHELPER_DLLPUBLIC OEnumerationByName : private OEnumerationLock
, public ::cppu::WeakImplHelper< css::container::XEnumeration ,
css::lang::XEventListener >
{
- css::uno::Sequence< OUString > m_aNames;
+ css::uno::Sequence< OUString > const m_aNames;
sal_Int32 m_nPos;
css::uno::Reference< css::container::XNameAccess > m_xAccess;
bool m_bListening;
diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx
index 96e721e7aa79..17c78ec5ddc6 100644
--- a/include/comphelper/flagguard.hxx
+++ b/include/comphelper/flagguard.hxx
@@ -45,7 +45,7 @@ namespace comphelper
struct RestoreFlag
{
bool & rFlag;
- bool originalValue;
+ bool const originalValue;
RestoreFlag(bool & i_flagRef)
: rFlag(i_flagRef), originalValue(i_flagRef) {}
void operator()()
diff --git a/include/comphelper/interaction.hxx b/include/comphelper/interaction.hxx
index 84c0b528067e..ec9f38e29436 100644
--- a/include/comphelper/interaction.hxx
+++ b/include/comphelper/interaction.hxx
@@ -112,7 +112,7 @@ namespace comphelper
*/
class COMPHELPER_DLLPUBLIC OInteractionRequest : public OInteractionRequest_Base
{
- css::uno::Any
+ css::uno::Any const
m_aRequest; /// the request we represent
std::vector< css::uno::Reference< css::task::XInteractionContinuation > >
m_aContinuations; /// all registered continuations
diff --git a/include/comphelper/interfacecontainer2.hxx b/include/comphelper/interfacecontainer2.hxx
index 269da31a6666..f0f79c3033df 100644
--- a/include/comphelper/interfacecontainer2.hxx
+++ b/include/comphelper/interfacecontainer2.hxx
@@ -105,7 +105,7 @@ public:
private:
OInterfaceContainerHelper2 & rCont;
- bool bIsList;
+ bool const bIsList;
detail::element_alias2 aData;
sal_Int32 nRemain;
@@ -262,8 +262,8 @@ private:
{
private:
typedef void ( SAL_CALL ListenerT::*NotificationMethod )( const EventT& );
- NotificationMethod m_pMethod;
- const EventT& m_rEvent;
+ NotificationMethod const m_pMethod;
+ const EventT& m_rEvent;
public:
NotifySingleListener( NotificationMethod method, const EventT& event ) : m_pMethod( method ), m_rEvent( event ) { }
diff --git a/include/comphelper/profilezone.hxx b/include/comphelper/profilezone.hxx
index 764601682f05..09b140748c33 100644
--- a/include/comphelper/profilezone.hxx
+++ b/include/comphelper/profilezone.hxx
@@ -36,7 +36,7 @@ class COMPHELPER_DLLPUBLIC ProfileZone
{
private:
const char * m_sProfileId;
- long long m_aCreateTime;
+ long long const m_aCreateTime;
public:
// Note that the char pointer is stored as such in the ProfileZone object and used in the
diff --git a/include/comphelper/propmultiplex.hxx b/include/comphelper/propmultiplex.hxx
index baa5103d5bd8..4407e39528ad 100644
--- a/include/comphelper/propmultiplex.hxx
+++ b/include/comphelper/propmultiplex.hxx
@@ -82,7 +82,7 @@ namespace comphelper
OPropertyChangeListener* m_pListener;
sal_Int32 m_nLockCount;
bool m_bListening : 1;
- bool m_bAutoSetRelease : 1;
+ bool const m_bAutoSetRelease : 1;
virtual ~OPropertyChangeMultiplexer() override;
diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
index 998c4a099d93..656b2a25899e 100644
--- a/include/comphelper/seqstream.hxx
+++ b/include/comphelper/seqstream.hxx
@@ -39,7 +39,7 @@ class COMPHELPER_DLLPUBLIC SequenceInputStream
: public ::cppu::WeakImplHelper< css::io::XInputStream, css::io::XSeekable >
{
::osl::Mutex m_aMutex;
- css::uno::Sequence<sal_Int8> m_aData;
+ css::uno::Sequence<sal_Int8> const m_aData;
sal_Int32 m_nPos;
public:
@@ -75,7 +75,7 @@ private:
void finalizeOutput();
css::uno::Sequence< sal_Int8 >& m_rSequence;
double m_nResizeFactor;
- sal_Int32 m_nMinimumResize;
+ sal_Int32 const m_nMinimumResize;
sal_Int32 m_nSize;
// the size of the virtual stream. This is not the size of the sequence, but the number of bytes written
// into the stream at a given moment.
diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx
index 011a4f9b7f0d..927a3d39df40 100644
--- a/include/comphelper/stl_types.hxx
+++ b/include/comphelper/stl_types.hxx
@@ -52,7 +52,7 @@ public:
class UStringMixEqual
{
- bool m_bCaseSensitive;
+ bool const m_bCaseSensitive;
public:
UStringMixEqual(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){}
@@ -121,7 +121,7 @@ public:
explicit mem_fun1_t(_fun_type pf) : M_f(pf) {}
void operator()(Tp* p, Arg x) const { (p->*M_f)(x); }
private:
- _fun_type M_f;
+ _fun_type const M_f;
};
template <class Tp, class Arg>
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
index 7934a6b6d7cf..c3d4ec178e92 100644
--- a/include/comphelper/string.hxx
+++ b/include/comphelper/string.hxx
@@ -339,7 +339,7 @@ COMPHELPER_DLLPUBLIC sal_Int32 compareNatural( const OUString &rLHS, const OUStr
class COMPHELPER_DLLPUBLIC NaturalStringSorter
{
private:
- css::lang::Locale m_aLocale;
+ css::lang::Locale const m_aLocale;
css::uno::Reference< css::i18n::XCollator > m_xCollator;
css::uno::Reference< css::i18n::XBreakIterator > m_xBI;
public:
diff --git a/include/comphelper/threadpool.hxx b/include/comphelper/threadpool.hxx
index ddca4d849245..fd5905edc821 100644
--- a/include/comphelper/threadpool.hxx
+++ b/include/comphelper/threadpool.hxx
@@ -92,7 +92,7 @@ private:
std::mutex maMutex;
std::condition_variable maTasksChanged;
bool mbTerminate;
- std::size_t mnWorkers;
+ std::size_t const mnWorkers;
std::vector< std::unique_ptr<ThreadTask> > maTasks;
std::vector< rtl::Reference< ThreadWorker > > maWorkers;
};
diff --git a/include/comphelper/unique_disposing_ptr.hxx b/include/comphelper/unique_disposing_ptr.hxx
index f2c3adcc2a2c..51a9710f606d 100644
--- a/include/comphelper/unique_disposing_ptr.hxx
+++ b/include/comphelper/unique_disposing_ptr.hxx
@@ -74,7 +74,7 @@ private:
private:
css::uno::Reference< css::lang::XComponent > m_xComponent;
unique_disposing_ptr<T>& m_rItem;
- bool mbComponentDLL;
+ bool const mbComponentDLL;
public:
TerminateListener(const css::uno::Reference< css::lang::XComponent > &rComponent,
unique_disposing_ptr<T>& rItem, bool bComponentDLL) :
More information about the Libreoffice-commits
mailing list