summaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-16 16:57:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-22 13:31:57 +0200
commit60bc26354763fa3461db49a3e827da552484150d (patch)
tree5c66cee43f76f556f9a086a67fa8a6e88750c5d5 /registry
parent7867e1f1cdd726cb98a236245e3d08557cc3a313 (diff)
new loplugin:conststringfield
Look for const string fields which can be static, and mostly convert them to OUStringLiteral And add a getLength() method to OUStringLiteral to make the transition easier. Remove dead code in XclExpRoot::GenerateDefaultEncryptionData, default password is never empty. Change-Id: Iae75514d9dbb87289fd5b016222f640abe755091 Reviewed-on: https://gerrit.libreoffice.org/59204 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'registry')
-rw-r--r--registry/source/keyimpl.cxx22
-rw-r--r--registry/source/regimpl.cxx5
-rw-r--r--registry/source/regimpl.hxx2
3 files changed, 16 insertions, 13 deletions
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index 82077d4f287c..75b1e7d7101d 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -177,7 +177,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
OUString sFullKeyName(pKey->getName());
if (sFullKeyName.getLength() > 1)
- sFullKeyName += m_pRegistry->ROOT;
+ sFullKeyName += ORegistry::ROOT;
sFullKeyName += sSubKeyName;
rtl_uString_newFromString(&pSubKeys[nSubKeys], sFullKeyName.pData);
@@ -231,7 +231,7 @@ RegError ORegKey::getValueInfo(const OUString& valueName, RegValueType* pValueTy
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(m_pRegistry->getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if ( rValue.create(m_pRegistry->getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
*pValueType = RegValueType::NOT_DEFINED;
*pValueSize = 0;
@@ -301,7 +301,7 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT , sImplValueName, storeAccessMode::Create) )
+ if ( rValue.create(getStoreFile(), m_name + ORegistry::ROOT , sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -371,7 +371,7 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32 const *
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, storeAccessMode::Create) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -430,7 +430,7 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, storeAccessMode::Create) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -498,7 +498,7 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, storeAccessMode::Create) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, storeAccessMode::Create) )
{
return RegError::SET_VALUE_FAILED;
}
@@ -569,7 +569,7 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
return RegError::VALUE_NOT_EXISTS;
}
@@ -663,7 +663,7 @@ RegError ORegKey::getLongListValue(const OUString& valueName, sal_Int32** pValue
REG_GUARD(m_pRegistry->m_mutex);
- if (rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if (rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
pValueList = nullptr;
*pLen = 0;
@@ -777,7 +777,7 @@ RegError ORegKey::getStringListValue(const OUString& valueName, sal_Char*** pVal
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if ( rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
pValueList = nullptr;
*pLen = 0;
@@ -883,7 +883,7 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
REG_GUARD(m_pRegistry->m_mutex);
- if ( rValue.create(getStoreFile(), m_name + m_pRegistry->ROOT, sImplValueName, accessMode) )
+ if ( rValue.create(getStoreFile(), m_name + ORegistry::ROOT, sImplValueName, accessMode) )
{
pValueList = nullptr;
*pLen = 0;
@@ -1011,7 +1011,7 @@ OStoreDirectory ORegKey::getStoreDir() const
OUString relativName;
storeAccessMode accessMode = storeAccessMode::ReadWrite;
- if ( m_name == m_pRegistry->ROOT )
+ if ( m_name == ORegistry::ROOT )
{
fullPath.clear();
relativName.clear();
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 1e24220f0ee9..43039fcddc29 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -420,11 +420,14 @@ void dumpType(typereg::Reader const & reader, OString const & indent) {
}
+#if __cplusplus <= 201402
+constexpr OUStringLiteral ORegistry::ROOT;
+#endif
+
ORegistry::ORegistry()
: m_refCount(1)
, m_readOnly(false)
, m_isOpen(false)
- , ROOT("/")
{
}
diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx
index 838456e4a061..7aaf3e5ac207 100644
--- a/registry/source/regimpl.hxx
+++ b/registry/source/regimpl.hxx
@@ -145,7 +145,7 @@ private:
store::OStoreFile m_file;
KeyMap m_openKeyTable;
- const OUString ROOT;
+ static constexpr OUStringLiteral ROOT { "/" };
};
#endif