summaryrefslogtreecommitdiff
path: root/registry
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-11-05 11:25:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-11-05 12:58:52 +0100
commit45a7fbfb4fbb85297cc2756bb9d4aa5b65932274 (patch)
treead503359ed0353ba18df6e4083865ecc6b01552b /registry
parent00aafa2e0140742983ec6e6e916636d23794dfe3 (diff)
loplugin:reducevarscope in registry
Change-Id: I86a93530ea8d39157eb898715f6597d3f472785b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105334 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'registry')
-rw-r--r--registry/source/keyimpl.cxx4
-rw-r--r--registry/source/regimpl.cxx5
-rw-r--r--registry/source/registry.cxx8
3 files changed, 5 insertions, 12 deletions
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index e76512e9e19a..437aa3114e10 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -146,15 +146,13 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
rtl_uString*** pSubKeyNames,
sal_uInt32* pnSubKeys)
{
- RegError _ret = RegError::NO_ERROR;
-
*pSubKeyNames = nullptr;
*pnSubKeys = 0;
ORegKey* pKey = this;
if (!keyName.isEmpty())
{
- _ret = openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pKey));
+ RegError _ret = openKey(keyName, reinterpret_cast<RegKeyHandle*>(&pKey));
if (_ret != RegError::NO_ERROR)
return _ret;
}
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 60d90faa9c6c..13b9d4251802 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -1018,8 +1018,6 @@ RegError ORegistry::checkBlop(OStoreStream& rValue,
}
std::vector<sal_uInt8> aBuffer(VALUE_HEADERSIZE);
- RegValueType valueType;
- sal_uInt32 valueSize;
sal_uInt32 rwBytes;
OString targetPath(OUStringToOString(sTargetPath, RTL_TEXTENCODING_UTF8));
@@ -1027,7 +1025,8 @@ RegError ORegistry::checkBlop(OStoreStream& rValue,
(rwBytes == VALUE_HEADERSIZE))
{
sal_uInt8 type = aBuffer[0];
- valueType = static_cast<RegValueType>(type);
+ RegValueType valueType = static_cast<RegValueType>(type);
+ sal_uInt32 valueSize;
readUINT32(aBuffer.data() + VALUE_TYPEOFFSET, valueSize);
if (valueType == RegValueType::BINARY)
diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx
index 166354aa5d62..eb2a38f6ba5a 100644
--- a/registry/source/registry.cxx
+++ b/registry/source/registry.cxx
@@ -162,11 +162,9 @@ static RegError REGISTRY_CALLTYPE openRegistry(rtl_uString* registryName,
static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg)
{
- ORegistry *pReg;
-
if (hReg)
{
- pReg = static_cast<ORegistry*>(hReg);
+ ORegistry *pReg = static_cast<ORegistry*>(hReg);
if (!pReg->isOpen())
return RegError::REGISTRY_NOT_OPEN;
@@ -192,11 +190,9 @@ static RegError REGISTRY_CALLTYPE closeRegistry(RegHandle hReg)
static RegError REGISTRY_CALLTYPE destroyRegistry(RegHandle hReg,
rtl_uString* registryName)
{
- ORegistry *pReg;
-
if (hReg)
{
- pReg = static_cast<ORegistry*>(hReg);
+ ORegistry *pReg = static_cast<ORegistry*>(hReg);
if (!pReg->isOpen())
return RegError::INVALID_REGISTRY;