[Libreoffice-commits] core.git: registry/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 5 11:59:31 UTC 2020
registry/source/keyimpl.cxx | 4 +---
registry/source/regimpl.cxx | 5 ++---
registry/source/registry.cxx | 8 ++------
3 files changed, 5 insertions(+), 12 deletions(-)
New commits:
commit 45a7fbfb4fbb85297cc2756bb9d4aa5b65932274
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Thu Nov 5 11:25:21 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 5 12:58:52 2020 +0100
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 at collabora.co.uk>
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;
More information about the Libreoffice-commits
mailing list