diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-19 08:47:29 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-19 11:00:32 +0000 |
commit | d41bc0f7b328ed6c69b2c2822de00165cdc62c61 (patch) | |
tree | f92cb1c15af79b7100e90d713eaa3ee6adcd5115 /registry | |
parent | bfb9eb550c4facb9aa6346a8d19f015cf5182668 (diff) |
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: Idcedd908c653d5a5700884f233ad134dde8be018
Reviewed-on: https://gerrit.libreoffice.org/13540
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'registry')
-rw-r--r-- | registry/source/regimpl.cxx | 6 | ||||
-rw-r--r-- | registry/source/registry.cxx | 8 |
2 files changed, 4 insertions, 10 deletions
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 37813095e0af..039cde3270b7 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -1616,14 +1616,13 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ sal::static_int_cast< unsigned long >(len)); fprintf(stdout, "%s Data = ", indent); - sal_Char *pValue; for (sal_uInt32 i=0; i < len; i++) { readUINT32(pBuffer+offset, sLen); offset += 4; // 4 Bytes (sal_uInt32) fuer die Groesse des strings in Bytes - pValue = (sal_Char*)rtl_allocateMemory(sLen); + sal_Char *pValue = (sal_Char*)rtl_allocateMemory(sLen); readUtf8(pBuffer+offset, pValue, sLen); if (offset > 8) @@ -1654,7 +1653,6 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ sal::static_int_cast< unsigned long >(len)); fprintf(stdout, "%s Data = ", indent); - sal_Unicode *pValue; OString uStr; for (sal_uInt32 i=0; i < len; i++) { @@ -1662,7 +1660,7 @@ RegError ORegistry::dumpValue(const OUString& sPath, const OUString& sName, sal_ offset += 4; // 4 Bytes (sal_uInt32) fuer die Groesse des strings in Bytes - pValue = (sal_Unicode*)rtl_allocateMemory((sLen / 2) * sizeof(sal_Unicode)); + sal_Unicode *pValue = (sal_Unicode*)rtl_allocateMemory((sLen / 2) * sizeof(sal_Unicode)); readString(pBuffer+offset, pValue, sLen); if (offset > 8) diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx index 803372fa8028..3086adb44b2e 100644 --- a/registry/source/registry.cxx +++ b/registry/source/registry.cxx @@ -74,11 +74,9 @@ static void REGISTRY_CALLTYPE release(RegHandle hReg) static RegError REGISTRY_CALLTYPE getName(RegHandle hReg, rtl_uString** pName) { - ORegistry* pReg; - if (hReg) { - pReg = (ORegistry*)hReg; + ORegistry* pReg = (ORegistry*)hReg; if ( pReg->isOpen() ) { rtl_uString_assign(pName, pReg->getName().pData); @@ -580,11 +578,9 @@ REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_openRegistry(rtl_uString* registryN REG_DLLPUBLIC RegError REGISTRY_CALLTYPE reg_closeRegistry(RegHandle hRegistry) { - ORegistry* pReg; - if (hRegistry) { - pReg = (ORegistry*)hRegistry; + ORegistry* pReg = (ORegistry*)hRegistry; delete(pReg); return REG_NO_ERROR; } else |