summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-17 21:16:11 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-18 06:39:15 +0000
commita23f6eb3ae49dfc326c6e57a8ab95a840c0661d2 (patch)
treee4bfa45604b2a62a6683573305763dd13f195e33 /idlc
parent36936c2580bf15117dd3bf775dd91340d16d3239 (diff)
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: Ib16e4ecc0e0c43b2c1fb527eb0668a960ae9756e Reviewed-on: https://gerrit.libreoffice.org/13513 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'idlc')
-rw-r--r--idlc/source/astdump.cxx3
-rw-r--r--idlc/source/astenum.cxx9
-rw-r--r--idlc/source/astoperation.cxx3
-rw-r--r--idlc/source/aststruct.cxx3
-rw-r--r--idlc/source/idlccompile.cxx2
5 files changed, 7 insertions, 13 deletions
diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx
index 90b182c8de7d..e0f786b68505 100644
--- a/idlc/source/astdump.cxx
+++ b/idlc/source/astdump.cxx
@@ -69,11 +69,10 @@ bool AstModule::dump(RegistryKey& rKey)
DeclList::const_iterator iter = getIteratorBegin();
DeclList::const_iterator end = getIteratorEnd();
- AstDeclaration* pDecl = NULL;
sal_uInt16 index = 0;
while ( iter != end )
{
- pDecl = *iter;
+ AstDeclaration* pDecl = *iter;
if ( pDecl->getNodeType() == NT_const &&
pDecl->isInMainfile() )
{
diff --git a/idlc/source/astenum.cxx b/idlc/source/astenum.cxx
index 1f330b18f780..32f813803c6e 100644
--- a/idlc/source/astenum.cxx
+++ b/idlc/source/astenum.cxx
@@ -37,13 +37,11 @@ AstConstant* AstEnum::checkValue(AstExpression* pExpr)
{
DeclList::const_iterator iter = getIteratorBegin();
DeclList::const_iterator end = getIteratorEnd();
- AstConstant* pConst = NULL;
- AstDeclaration* pDecl = NULL;
while ( iter != end)
{
- pDecl = *iter;
- pConst = static_cast<AstConstant*>(pDecl);
+ AstDeclaration* pDecl = *iter;
+ AstConstant* pConst = static_cast<AstConstant*>(pDecl);
if (pConst->getConstValue()->compare(pExpr))
return pConst;
@@ -80,11 +78,10 @@ bool AstEnum::dump(RegistryKey& rKey)
DeclList::const_iterator iter = getIteratorBegin();
DeclList::const_iterator end = getIteratorEnd();
- AstDeclaration* pDecl = NULL;
sal_uInt16 index = 0;
while ( iter != end )
{
- pDecl = *iter;
+ AstDeclaration* pDecl = *iter;
if ( pDecl->getNodeType() == NT_enum_val )
static_cast<AstConstant*>(pDecl)->dumpBlob(aBlob, index++, false);
diff --git a/idlc/source/astoperation.cxx b/idlc/source/astoperation.cxx
index 5a38c8acbc20..ce67313a8632 100644
--- a/idlc/source/astoperation.cxx
+++ b/idlc/source/astoperation.cxx
@@ -60,12 +60,11 @@ bool AstOperation::dumpBlob(typereg::Writer & rBlob, sal_uInt16 index)
{
DeclList::const_iterator iter = getIteratorBegin();
DeclList::const_iterator end = getIteratorEnd();
- AstDeclaration* pDecl = NULL;
RTParamMode paramMode;
sal_uInt16 paramIndex = 0;
while ( iter != end )
{
- pDecl = *iter;
+ AstDeclaration* pDecl = *iter;
if ( pDecl->getNodeType() == NT_parameter )
{
AstParameter* pParam = static_cast<AstParameter*>(pDecl);
diff --git a/idlc/source/aststruct.cxx b/idlc/source/aststruct.cxx
index 482ee73dadfa..0a85a12965fa 100644
--- a/idlc/source/aststruct.cxx
+++ b/idlc/source/aststruct.cxx
@@ -121,12 +121,11 @@ bool AstStruct::dump(RegistryKey& rKey)
{
DeclList::const_iterator iter = getIteratorBegin();
DeclList::const_iterator end = getIteratorEnd();
- AstDeclaration* pDecl = NULL;
AstMember* pMember = NULL;
sal_uInt16 index = 0;
while ( iter != end )
{
- pDecl = *iter;
+ AstDeclaration* pDecl = *iter;
if ( pDecl->getNodeType() == NT_member )
{
pMember = static_cast<AstMember*>(pDecl);
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 45dbfbcfb694..3d4ef7d22b1a 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -186,11 +186,11 @@ bool copyFile(const OString* source, const OString& target)
}
size_t totalSize = 512;
- size_t readSize = 0;
char pBuffer[513];
while ( !feof(pSource) )
{
+ size_t readSize;
if ( (readSize = fread(pBuffer, 1, totalSize, pSource)) > 0 && !ferror(pSource) )
{
if ( (fwrite(pBuffer, 1, readSize, pTarget)) != readSize || ferror(pTarget) )