From 45a7fbfb4fbb85297cc2756bb9d4aa5b65932274 Mon Sep 17 00:00:00 2001 From: Noel Date: Thu, 5 Nov 2020 11:25:21 +0200 Subject: loplugin:reducevarscope in registry Change-Id: I86a93530ea8d39157eb898715f6597d3f472785b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105334 Tested-by: Jenkins Reviewed-by: Noel Grandin --- registry/source/keyimpl.cxx | 4 +--- registry/source/regimpl.cxx | 5 ++--- registry/source/registry.cxx | 8 ++------ 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'registry') 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(&pKey)); + RegError _ret = openKey(keyName, reinterpret_cast(&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 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(type); + RegValueType valueType = static_cast(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(hReg); + ORegistry *pReg = static_cast(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(hReg); + ORegistry *pReg = static_cast(hReg); if (!pReg->isOpen()) return RegError::INVALID_REGISTRY; -- cgit