summaryrefslogtreecommitdiff
path: root/lotuswordpro
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-19 08:47:29 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-19 11:00:32 +0000
commitd41bc0f7b328ed6c69b2c2822de00165cdc62c61 (patch)
treef92cb1c15af79b7100e90d713eaa3ee6adcd5115 /lotuswordpro
parentbfb9eb550c4facb9aa6346a8d19f015cf5182668 (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 'lotuswordpro')
-rw-r--r--lotuswordpro/source/filter/lwpdoc.cxx10
-rw-r--r--lotuswordpro/source/filter/lwpfoundry.cxx3
-rw-r--r--lotuswordpro/source/filter/lwplayout.cxx4
-rw-r--r--lotuswordpro/source/filter/lwppagelayout.cxx2
-rw-r--r--lotuswordpro/source/filter/lwppara.cxx5
-rw-r--r--lotuswordpro/source/filter/lwpstory.cxx3
-rw-r--r--lotuswordpro/source/filter/lwptablelayout.cxx3
-rw-r--r--lotuswordpro/source/filter/lwptblformula.cxx3
-rw-r--r--lotuswordpro/source/filter/xfilter/xfliststyle.cxx6
9 files changed, 13 insertions, 26 deletions
diff --git a/lotuswordpro/source/filter/lwpdoc.cxx b/lotuswordpro/source/filter/lwpdoc.cxx
index e2ab2a793175..a2ff123d6170 100644
--- a/lotuswordpro/source/filter/lwpdoc.cxx
+++ b/lotuswordpro/source/filter/lwpdoc.cxx
@@ -257,10 +257,9 @@ void LwpDocument::RegisterLayoutStyles()
//set initial pagelayout in story for parsing pagelayout
LwpDivInfo* pDivInfo = dynamic_cast<LwpDivInfo*> (m_DivInfo.obj( VO_DIVISIONINFO).get());
- LwpPageLayout* pPageLayout = NULL;
if(pDivInfo)
{
- pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
+ LwpPageLayout* pPageLayout = dynamic_cast<LwpPageLayout*>(pDivInfo->GetInitialLayoutID().obj(VO_PAGELAYOUT).get());
if(pPageLayout)
{
//In Ole division, the content of pagelayout is VO_OLEOBJECT
@@ -540,11 +539,10 @@ LwpDocument* LwpDocument::GetPreviousDivision()
}
LwpDocument* pDivision = GetLastDivision();
- LwpDocument* pContentDivision = NULL;
while(pDivision)
{
- pContentDivision = pDivision->GetLastDivisionWithContents();
+ LwpDocument* pContentDivision = pDivision->GetLastDivisionWithContents();
if(pContentDivision)
{
return pContentDivision;
@@ -621,11 +619,9 @@ LwpDocument* LwpDocument::GetPreviousDivision()
LwpDocument* pDivision = GetFirstDivision();
- LwpDocument* pContentDivision = NULL;
-
while (pDivision)
{
- pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
+ LwpDocument* pContentDivision = pDivision->GetFirstDivisionWithContentsThatIsNotOLE();
if(pContentDivision)
return pContentDivision;
pDivision = pDivision->GetNextDivision();
diff --git a/lotuswordpro/source/filter/lwpfoundry.cxx b/lotuswordpro/source/filter/lwpfoundry.cxx
index 580f5fd3f0bb..232afb861d09 100644
--- a/lotuswordpro/source/filter/lwpfoundry.cxx
+++ b/lotuswordpro/source/filter/lwpfoundry.cxx
@@ -488,7 +488,6 @@ LwpOrderedObject* LwpOrderedObjectManager::Enumerate(LwpOrderedObject * pLast)
LwpListList* LwpOrderedObjectManager::GetNextActiveListList(LwpListList * pLast)
{
LwpListList* pList = NULL;
- LwpContent* pContent = NULL;
if(pLast)
pList = static_cast<LwpListList*>(pLast->GetNext().obj().get());
else
@@ -502,7 +501,7 @@ LwpListList* LwpOrderedObjectManager::GetNextActiveListList(LwpListList * pLast)
while(pList)
{
- pContent = static_cast<LwpContent*>(pList->GetObject().obj().get());
+ LwpContent* pContent = static_cast<LwpContent*>(pList->GetObject().obj().get());
if(pContent && pContent->HasNonEmbeddedLayouts() &&
!pContent->IsStyleContent())
return pList;
diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 0c5c78d30701..594a375147b6 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -447,8 +447,6 @@ void LwpAssociatedLayouts::Read(LwpObjectStream* pStrm)
*/
LwpVirtualLayout* LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout)
{
- LwpVirtualLayout* pLayout = NULL;
-
if (!pStartLayout && !m_OnlyLayout.IsNull())
/* Looking for the first layout and there's only one layout in the list.*/
return dynamic_cast<LwpVirtualLayout*>(m_OnlyLayout.obj().get());
@@ -456,7 +454,7 @@ LwpVirtualLayout* LwpAssociatedLayouts::GetLayout(LwpVirtualLayout *pStartLayout
LwpObjectHolder* pObjHolder = dynamic_cast<LwpObjectHolder*>(m_Layouts.GetHead().obj().get());
if(pObjHolder)
{
- pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
+ LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(pObjHolder->GetObject().obj().get());
if(!pStartLayout )
return pLayout;
diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx
index ad75b8847814..1a3967c38ba1 100644
--- a/lotuswordpro/source/filter/lwppagelayout.cxx
+++ b/lotuswordpro/source/filter/lwppagelayout.cxx
@@ -719,10 +719,10 @@ LwpPara* LwpPageLayout::GetPagePosition()
if(pPara)
return pPara;
//Get the position from its related section
- LwpSection* pSection = NULL;
LwpFoundry* pFoundry = GetFoundry();
if(pFoundry)
{
+ LwpSection* pSection = NULL;
while( (pSection = pFoundry->EnumSections(pSection)) )
{
if(pSection->GetPageLayout() == this)
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index 02ca8d4ff6e6..22cf0287b047 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -368,11 +368,11 @@ void LwpPara::RegisterStyle()
XFParaStyle* pOverStyle = NULL;
bool noSpacing = true;
- bool noIndent = true;
LwpParaProperty* pBulletProps = NULL, *pNumberingProps = NULL;
if (m_pProps != NULL)
{
+ bool noIndent = true;
pOverStyle = new XFParaStyle;
*pOverStyle = *pBaseStyle;
pOverStyle->SetStyleName("");
@@ -582,7 +582,6 @@ void LwpPara::RegisterStyle()
bool bHeading;
LwpPara* pPara = this;
LwpPara* pPrePara = NULL;
- LwpSilverBullet* pParaSilverBullet = NULL;
sal_uInt16 nNum = 0, nLevel = 0, nFoundLevel = 0xffff, nFoundBound = 0;
nFoundBound = nLevel = pNumbering->GetLevel();
@@ -602,7 +601,7 @@ void LwpPara::RegisterStyle()
break;
}*/
- pParaSilverBullet = pPara->GetSilverBullet();
+ LwpSilverBullet* pParaSilverBullet = pPara->GetSilverBullet();
pNumbering = pPara->GetParaNumbering();
if (pPara->GetObjectID() != this->GetObjectID())
diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx
index 911e9ae47e90..f4b8effac00d 100644
--- a/lotuswordpro/source/filter/lwpstory.cxx
+++ b/lotuswordpro/source/filter/lwpstory.cxx
@@ -284,14 +284,13 @@ void LwpStory::SortPageLayout()
**************************************************************************/
bool LwpStory::IsNeedSection()
{
- bool bColumns = false;
bool bNewSection = false;
if(m_pCurrentLayout)
{
if(m_pCurrentLayout->HasColumns())
{
//get the following pagelayout and its type
- bColumns = true;
+ bool bColumns = true;
LwpPageLayout* pNextLayout = GetNextPageLayout();
if(pNextLayout)
{
diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 6734edbdb4af..90897ad92c37 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -848,7 +848,6 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
sal_uInt16 nRowNum = pTmpTable->GetRowCount();
sal_uInt8* CellMark = new sal_uInt8[nRowNum];
- bool bFindFlag = false;
if (nRowNum == 1)
{
@@ -860,7 +859,7 @@ sal_uInt16 LwpTableLayout::ConvertHeadingRow(
else
{
sal_uInt8 nFirstColSpann = 1;
- bFindFlag = FindSplitColMark(pTmpTable,CellMark,nFirstColSpann);
+ const bool bFindFlag = FindSplitColMark(pTmpTable,CellMark,nFirstColSpann);
if (bFindFlag)//split to 2 cells
{
diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx
index 4f6bca048031..eda2b45fa55e 100644
--- a/lotuswordpro/source/filter/lwptblformula.cxx
+++ b/lotuswordpro/source/filter/lwptblformula.cxx
@@ -310,14 +310,13 @@ bool LwpFormulaInfo::ReadArguments(LwpFormulaFunc& aFunc)
sal_uInt16 NumberOfArguments = m_pObjStrm->QuickReaduInt16();
sal_uInt16 ArgumentDiskLength, Count;
sal_uInt8 ArgumentType;
- bool bArgument = false;
bool readSucceeded = true;
for (Count = 0; Count < NumberOfArguments; Count++)
{
ArgumentType = (sal_uInt8) m_pObjStrm->QuickReaduInt16(); // written as lushort
ArgumentDiskLength = m_pObjStrm->QuickReaduInt16();
- bArgument = true;
+ bool bArgument = true;
switch(ArgumentType)
{
diff --git a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx
index 14d28b2de066..6e75c9422226 100644
--- a/lotuswordpro/source/filter/xfilter/xfliststyle.cxx
+++ b/lotuswordpro/source/filter/xfilter/xfliststyle.cxx
@@ -169,10 +169,9 @@ XFListStyle::XFListStyle()
XFListStyle::XFListStyle(const XFListStyle& other):XFStyle(other)
{
- enumXFListLevel type;
for( int i=0; i<10; i++ )
{
- type = other.m_pListLevels[i]->m_eListType;
+ const enumXFListLevel type = other.m_pListLevels[i]->m_eListType;
if( type == enumXFListLevelNumber )
{
XFListlevelNumber *pNum = static_cast<XFListlevelNumber*>(other.m_pListLevels[i]);
@@ -190,10 +189,9 @@ XFListStyle::XFListStyle(const XFListStyle& other):XFStyle(other)
XFListStyle& XFListStyle::operator=(const XFListStyle& other)
{
- enumXFListLevel type;
for( int i=0; i<10; i++ )
{
- type = other.m_pListLevels[i]->m_eListType;
+ const enumXFListLevel type = other.m_pListLevels[i]->m_eListType;
if( type == enumXFListLevelNumber )
{
XFListlevelNumber *pNum = static_cast<XFListlevelNumber*>(m_pListLevels[i]);