From 14d45665433eec974acd96f813f2bf314bdb3eba Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 19 Oct 2017 11:09:13 +0200 Subject: loplugin:constmethod in codemaker,registry,store Change-Id: Ie75875974f054ff79bd64b1c261e79e2b78eb7fc Reviewed-on: https://gerrit.libreoffice.org/43540 Tested-by: Jenkins Reviewed-by: Noel Grandin --- registry/source/keyimpl.cxx | 4 +- registry/source/keyimpl.hxx | 4 +- registry/source/reflread.cxx | 144 +++++++++++++++++++++---------------------- registry/source/reflwrit.cxx | 12 ++-- 4 files changed, 82 insertions(+), 82 deletions(-) (limited to 'registry') diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index 944226234a5a..94378ad2a5bb 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -970,7 +970,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode*** RegError ORegKey::getResolvedKeyName(const OUString& keyName, - OUString& resolvedName) + OUString& resolvedName) const { if (keyName.isEmpty()) return RegError::INVALID_KEYNAME; @@ -1004,7 +1004,7 @@ sal_uInt32 ORegKey::countSubKeys() return count; } -OStoreDirectory ORegKey::getStoreDir() +OStoreDirectory ORegKey::getStoreDir() const { OStoreDirectory rStoreDir; OUString fullPath; diff --git a/registry/source/keyimpl.hxx b/registry/source/keyimpl.hxx index 2b3880e9e70e..f8f90e86407a 100644 --- a/registry/source/keyimpl.hxx +++ b/registry/source/keyimpl.hxx @@ -91,7 +91,7 @@ public: sal_uInt32* pLen) const; RegError getResolvedKeyName(const OUString& keyName, - OUString& resolvedName); + OUString& resolvedName) const; bool isDeleted() const { return m_bDeleted; } @@ -116,7 +116,7 @@ public: const store::OStoreFile& getStoreFile() const { return m_pRegistry->getStoreFile(); } - store::OStoreDirectory getStoreDir(); + store::OStoreDirectory getStoreDir() const; const OUString& getName() const { return m_name; } diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx index a93602ffda47..61ce0d3ed94a 100644 --- a/registry/source/reflread.cxx +++ b/registry/source/reflread.cxx @@ -192,7 +192,7 @@ public: explicit StringCache(sal_uInt16 size); // throws std::bad_alloc ~StringCache(); - const sal_Unicode* getString(sal_uInt16 index); + const sal_Unicode* getString(sal_uInt16 index) const; sal_uInt16 createString(const sal_uInt8* buffer); // throws std::bad_alloc }; @@ -222,7 +222,7 @@ StringCache::~StringCache() } } -const sal_Unicode* StringCache::getString(sal_uInt16 index) +const sal_Unicode* StringCache::getString(sal_uInt16 index) const { if ((index > 0) && (index <= m_stringsCopied)) return m_stringTable[index - 1]; @@ -269,20 +269,20 @@ public: sal_uInt32 parseIndex(); // throws std::bad_alloc - CPInfoTag readTag(sal_uInt16 index); - - const sal_Char* readUTF8NameConstant(sal_uInt16 index); - bool readBOOLConstant(sal_uInt16 index); - sal_Int8 readBYTEConstant(sal_uInt16 index); - sal_Int16 readINT16Constant(sal_uInt16 index); - sal_uInt16 readUINT16Constant(sal_uInt16 index); - sal_Int32 readINT32Constant(sal_uInt16 index); - sal_uInt32 readUINT32Constant(sal_uInt16 index); - sal_Int64 readINT64Constant(sal_uInt16 index); - sal_uInt64 readUINT64Constant(sal_uInt16 index); - float readFloatConstant(sal_uInt16 index); - double readDoubleConstant(sal_uInt16 index); - const sal_Unicode* readStringConstant(sal_uInt16 index); + CPInfoTag readTag(sal_uInt16 index) const; + + const sal_Char* readUTF8NameConstant(sal_uInt16 index) const; + bool readBOOLConstant(sal_uInt16 index) const; + sal_Int8 readBYTEConstant(sal_uInt16 index) const; + sal_Int16 readINT16Constant(sal_uInt16 index) const; + sal_uInt16 readUINT16Constant(sal_uInt16 index) const; + sal_Int32 readINT32Constant(sal_uInt16 index) const; + sal_uInt32 readUINT32Constant(sal_uInt16 index) const; + sal_Int64 readINT64Constant(sal_uInt16 index) const; + sal_uInt64 readUINT64Constant(sal_uInt16 index) const; + float readFloatConstant(sal_uInt16 index) const; + double readDoubleConstant(sal_uInt16 index) const; + const sal_Unicode* readStringConstant(sal_uInt16 index) const; // throws std::bad_alloc }; @@ -323,7 +323,7 @@ sal_uInt32 ConstantPool::parseIndex() return offset; } -CPInfoTag ConstantPool::readTag(sal_uInt16 index) +CPInfoTag ConstantPool::readTag(sal_uInt16 index) const { CPInfoTag tag = CP_TAG_INVALID; @@ -335,7 +335,7 @@ CPInfoTag ConstantPool::readTag(sal_uInt16 index) return tag; } -const sal_Char* ConstantPool::readUTF8NameConstant(sal_uInt16 index) +const sal_Char* ConstantPool::readUTF8NameConstant(sal_uInt16 index) const { const sal_Char* aName = NULL_STRING; @@ -355,7 +355,7 @@ const sal_Char* ConstantPool::readUTF8NameConstant(sal_uInt16 index) return aName; } -bool ConstantPool::readBOOLConstant(sal_uInt16 index) +bool ConstantPool::readBOOLConstant(sal_uInt16 index) const { bool aBool = false; @@ -370,7 +370,7 @@ bool ConstantPool::readBOOLConstant(sal_uInt16 index) return aBool; } -sal_Int8 ConstantPool::readBYTEConstant(sal_uInt16 index) +sal_Int8 ConstantPool::readBYTEConstant(sal_uInt16 index) const { sal_Int8 aByte = 0; @@ -386,7 +386,7 @@ sal_Int8 ConstantPool::readBYTEConstant(sal_uInt16 index) return aByte; } -sal_Int16 ConstantPool::readINT16Constant(sal_uInt16 index) +sal_Int16 ConstantPool::readINT16Constant(sal_uInt16 index) const { sal_Int16 aINT16 = 0; @@ -401,7 +401,7 @@ sal_Int16 ConstantPool::readINT16Constant(sal_uInt16 index) return aINT16; } -sal_uInt16 ConstantPool::readUINT16Constant(sal_uInt16 index) +sal_uInt16 ConstantPool::readUINT16Constant(sal_uInt16 index) const { sal_uInt16 asal_uInt16 = 0; @@ -416,7 +416,7 @@ sal_uInt16 ConstantPool::readUINT16Constant(sal_uInt16 index) return asal_uInt16; } -sal_Int32 ConstantPool::readINT32Constant(sal_uInt16 index) +sal_Int32 ConstantPool::readINT32Constant(sal_uInt16 index) const { sal_Int32 aINT32 = 0; @@ -431,7 +431,7 @@ sal_Int32 ConstantPool::readINT32Constant(sal_uInt16 index) return aINT32; } -sal_uInt32 ConstantPool::readUINT32Constant(sal_uInt16 index) +sal_uInt32 ConstantPool::readUINT32Constant(sal_uInt16 index) const { sal_uInt32 aUINT32 = 0; @@ -446,7 +446,7 @@ sal_uInt32 ConstantPool::readUINT32Constant(sal_uInt16 index) return aUINT32; } -sal_Int64 ConstantPool::readINT64Constant(sal_uInt16 index) +sal_Int64 ConstantPool::readINT64Constant(sal_uInt16 index) const { sal_Int64 aINT64 = 0; @@ -461,7 +461,7 @@ sal_Int64 ConstantPool::readINT64Constant(sal_uInt16 index) return aINT64; } -sal_uInt64 ConstantPool::readUINT64Constant(sal_uInt16 index) +sal_uInt64 ConstantPool::readUINT64Constant(sal_uInt16 index) const { sal_uInt64 aUINT64 = 0; @@ -476,7 +476,7 @@ sal_uInt64 ConstantPool::readUINT64Constant(sal_uInt16 index) return aUINT64; } -float ConstantPool::readFloatConstant(sal_uInt16 index) +float ConstantPool::readFloatConstant(sal_uInt16 index) const { union { @@ -499,7 +499,7 @@ float ConstantPool::readFloatConstant(sal_uInt16 index) return x.v; } -double ConstantPool::readDoubleConstant(sal_uInt16 index) +double ConstantPool::readDoubleConstant(sal_uInt16 index) const { union { @@ -533,7 +533,7 @@ double ConstantPool::readDoubleConstant(sal_uInt16 index) return x.v; } -const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index) +const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index) const { const sal_Unicode* aString = NULL_WSTRING; @@ -593,19 +593,19 @@ public: } } - sal_uInt32 parseIndex() { return ((m_numOfEntries ? sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_FIELD_ENTRY_SIZE));} + sal_uInt32 parseIndex() const { return ((m_numOfEntries ? sizeof(sal_uInt16) : 0) + (m_numOfEntries * m_FIELD_ENTRY_SIZE));} - const sal_Char* getFieldName(sal_uInt16 index); - const sal_Char* getFieldType(sal_uInt16 index); - RTFieldAccess getFieldAccess(sal_uInt16 index); - RTValueType getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value); + const sal_Char* getFieldName(sal_uInt16 index) const; + const sal_Char* getFieldType(sal_uInt16 index) const; + RTFieldAccess getFieldAccess(sal_uInt16 index) const; + RTValueType getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value) const; // throws std::bad_alloc - const sal_Char* getFieldDoku(sal_uInt16 index); - const sal_Char* getFieldFileName(sal_uInt16 index); + const sal_Char* getFieldDoku(sal_uInt16 index) const; + const sal_Char* getFieldFileName(sal_uInt16 index) const; }; -const sal_Char* FieldList::getFieldName(sal_uInt16 index) +const sal_Char* FieldList::getFieldName(sal_uInt16 index) const { const sal_Char* aName = nullptr; @@ -621,7 +621,7 @@ const sal_Char* FieldList::getFieldName(sal_uInt16 index) return aName; } -const sal_Char* FieldList::getFieldType(sal_uInt16 index) +const sal_Char* FieldList::getFieldType(sal_uInt16 index) const { const sal_Char* aName = nullptr; @@ -637,7 +637,7 @@ const sal_Char* FieldList::getFieldType(sal_uInt16 index) return aName; } -RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index) +RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index) const { RTFieldAccess aAccess = RTFieldAccess::INVALID; @@ -653,7 +653,7 @@ RTFieldAccess FieldList::getFieldAccess(sal_uInt16 index) return aAccess; } -RTValueType FieldList::getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value) +RTValueType FieldList::getFieldConstValue(sal_uInt16 index, RTConstValueUnion* value) const { RTValueType ret = RT_TYPE_NONE; try { @@ -716,7 +716,7 @@ RTValueType FieldList::getFieldConstValue(sal_uInt16 index, RTConstValueUnion* v return ret; } -const sal_Char* FieldList::getFieldDoku(sal_uInt16 index) +const sal_Char* FieldList::getFieldDoku(sal_uInt16 index) const { const sal_Char* aDoku = nullptr; @@ -732,7 +732,7 @@ const sal_Char* FieldList::getFieldDoku(sal_uInt16 index) return aDoku; } -const sal_Char* FieldList::getFieldFileName(sal_uInt16 index) +const sal_Char* FieldList::getFieldFileName(sal_uInt16 index) const { const sal_Char* aFileName = nullptr; @@ -779,14 +779,14 @@ public: } } - const sal_Char* getReferenceName(sal_uInt16 index); - RTReferenceType getReferenceType(sal_uInt16 index); - const sal_Char* getReferenceDoku(sal_uInt16 index); - RTFieldAccess getReferenceAccess(sal_uInt16 index); + const sal_Char* getReferenceName(sal_uInt16 index) const; + RTReferenceType getReferenceType(sal_uInt16 index) const; + const sal_Char* getReferenceDoku(sal_uInt16 index) const; + RTFieldAccess getReferenceAccess(sal_uInt16 index) const; }; -const sal_Char* ReferenceList::getReferenceName(sal_uInt16 index) +const sal_Char* ReferenceList::getReferenceName(sal_uInt16 index) const { const sal_Char* aName = nullptr; @@ -802,7 +802,7 @@ const sal_Char* ReferenceList::getReferenceName(sal_uInt16 index) return aName; } -RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index) +RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index) const { RTReferenceType refType = RTReferenceType::INVALID; @@ -818,7 +818,7 @@ RTReferenceType ReferenceList::getReferenceType(sal_uInt16 index) return refType; } -const sal_Char* ReferenceList::getReferenceDoku(sal_uInt16 index) +const sal_Char* ReferenceList::getReferenceDoku(sal_uInt16 index) const { const sal_Char* aDoku = nullptr; @@ -834,7 +834,7 @@ const sal_Char* ReferenceList::getReferenceDoku(sal_uInt16 index) return aDoku; } -RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index) +RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index) const { RTFieldAccess aAccess = RTFieldAccess::INVALID; @@ -885,22 +885,22 @@ public: sal_uInt32 parseIndex(); // throws std::bad_alloc - const sal_Char* getMethodName(sal_uInt16 index); - sal_uInt16 getMethodParamCount(sal_uInt16 index); - const sal_Char* getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex); - const sal_Char* getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex); - RTParamMode getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex); - sal_uInt16 getMethodExcCount(sal_uInt16 index); - const sal_Char* getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex); - const sal_Char* getMethodReturnType(sal_uInt16 index); - RTMethodMode getMethodMode(sal_uInt16 index); - const sal_Char* getMethodDoku(sal_uInt16 index); + const sal_Char* getMethodName(sal_uInt16 index) const; + sal_uInt16 getMethodParamCount(sal_uInt16 index) const; + const sal_Char* getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex) const; + const sal_Char* getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex) const; + RTParamMode getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex) const; + sal_uInt16 getMethodExcCount(sal_uInt16 index) const; + const sal_Char* getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex) const; + const sal_Char* getMethodReturnType(sal_uInt16 index) const; + RTMethodMode getMethodMode(sal_uInt16 index) const; + const sal_Char* getMethodDoku(sal_uInt16 index) const; private: - sal_uInt16 calcMethodParamIndex( const sal_uInt16 index ); + sal_uInt16 calcMethodParamIndex( const sal_uInt16 index ) const; }; -sal_uInt16 MethodList::calcMethodParamIndex( const sal_uInt16 index ) +sal_uInt16 MethodList::calcMethodParamIndex( const sal_uInt16 index ) const { return (METHOD_OFFSET_PARAM_COUNT + sizeof(sal_uInt16) + (index * m_PARAM_ENTRY_SIZE)); } @@ -927,7 +927,7 @@ sal_uInt32 MethodList::parseIndex() return offset; } -const sal_Char* MethodList::getMethodName(sal_uInt16 index) +const sal_Char* MethodList::getMethodName(sal_uInt16 index) const { const sal_Char* aName = nullptr; @@ -943,7 +943,7 @@ const sal_Char* MethodList::getMethodName(sal_uInt16 index) return aName; } -sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index) +sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index) const { sal_uInt16 aCount = 0; @@ -959,7 +959,7 @@ sal_uInt16 MethodList::getMethodParamCount(sal_uInt16 index) return aCount; } -const sal_Char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex) +const sal_Char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 paramIndex) const { const sal_Char* aName = nullptr; try { @@ -979,7 +979,7 @@ const sal_Char* MethodList::getMethodParamType(sal_uInt16 index, sal_uInt16 para return aName; } -const sal_Char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex) +const sal_Char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 paramIndex) const { const sal_Char* aName = nullptr; try { @@ -999,7 +999,7 @@ const sal_Char* MethodList::getMethodParamName(sal_uInt16 index, sal_uInt16 para return aName; } -RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex) +RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramIndex) const { RTParamMode aMode = RT_PARAM_INVALID; try { @@ -1022,7 +1022,7 @@ RTParamMode MethodList::getMethodParamMode(sal_uInt16 index, sal_uInt16 paramInd extern "C" void __coverity_tainted_data_sanitize__(void *); #endif -sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index) +sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index) const { sal_uInt16 aCount = 0; @@ -1041,7 +1041,7 @@ sal_uInt16 MethodList::getMethodExcCount(sal_uInt16 index) return aCount; } -const sal_Char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex) +const sal_Char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excIndex) const { const sal_Char* aName = nullptr; @@ -1065,7 +1065,7 @@ const sal_Char* MethodList::getMethodExcType(sal_uInt16 index, sal_uInt16 excInd return aName; } -const sal_Char* MethodList::getMethodReturnType(sal_uInt16 index) +const sal_Char* MethodList::getMethodReturnType(sal_uInt16 index) const { const sal_Char* aName = nullptr; @@ -1081,7 +1081,7 @@ const sal_Char* MethodList::getMethodReturnType(sal_uInt16 index) return aName; } -RTMethodMode MethodList::getMethodMode(sal_uInt16 index) +RTMethodMode MethodList::getMethodMode(sal_uInt16 index) const { RTMethodMode aMode = RTMethodMode::INVALID; @@ -1097,7 +1097,7 @@ RTMethodMode MethodList::getMethodMode(sal_uInt16 index) return aMode; } -const sal_Char* MethodList::getMethodDoku(sal_uInt16 index) +const sal_Char* MethodList::getMethodDoku(sal_uInt16 index) const { const sal_Char* aDoku = nullptr; diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx index f80c83f1cfeb..0c1dc67ba6fc 100644 --- a/registry/source/reflwrit.cxx +++ b/registry/source/reflwrit.cxx @@ -187,7 +187,7 @@ struct CPInfo CPInfo(CPInfoTag tag, struct CPInfo* prev); - sal_uInt32 getBlopSize(); + sal_uInt32 getBlopSize() const; sal_uInt32 toBlop(sal_uInt8* buffer); }; @@ -204,7 +204,7 @@ CPInfo::CPInfo(CPInfoTag tag, struct CPInfo* prev) } } -sal_uInt32 CPInfo::getBlopSize() +sal_uInt32 CPInfo::getBlopSize() const { sal_uInt32 size = sizeof(sal_uInt32) /* size */ + sizeof(sal_uInt16) /* tag */; @@ -518,7 +518,7 @@ public: sal_uInt16 excCount, const OString& doku); - void setExcName(sal_uInt16 excIndex, const OString& name); + void setExcName(sal_uInt16 excIndex, const OString& name) const; protected: @@ -550,7 +550,7 @@ void MethodEntry::setData(const OString& name, reallocExcs(excCount); } -void MethodEntry::setExcName(sal_uInt16 excIndex, const OString& name) +void MethodEntry::setExcName(sal_uInt16 excIndex, const OString& name) const { if (excIndex < m_excCount) { @@ -649,7 +649,7 @@ public: ~TypeWriter(); - void setSuperType(sal_uInt16 index, OString const & name); + void setSuperType(sal_uInt16 index, OString const & name) const; void createBlop(); // throws std::bad_alloc }; @@ -708,7 +708,7 @@ TypeWriter::~TypeWriter() delete[] m_references; } -void TypeWriter::setSuperType(sal_uInt16 index, OString const & name) +void TypeWriter::setSuperType(sal_uInt16 index, OString const & name) const { m_superTypeNames[index] = name; } -- cgit