summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-11 23:32:12 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-12 08:08:11 +0000
commit04b183a9bc792a53a9f081353a79486faa4f3872 (patch)
tree62a467485cc0f03f1d32998b362707f15b07bee0 /editeng
parentf5c5bab09f2e3a7e13a6b397faf4bdfcb898f295 (diff)
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: Ifbc5a7a562e714f48dcfd51a75e9a4e0bfcde81c Reviewed-on: https://gerrit.libreoffice.org/13443 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx3
-rw-r--r--editeng/source/editeng/impedit2.cxx3
-rw-r--r--editeng/source/editeng/impedit4.cxx3
-rw-r--r--editeng/source/items/xmlcnitm.cxx3
-rw-r--r--editeng/source/outliner/outliner.cxx3
5 files changed, 5 insertions, 10 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 9e2e29fbb3ce..85419c6d6e3d 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1434,7 +1434,6 @@ void ContentNode::CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDeleted, SfxItemP
// Since features are treated differently than normal character attributes,
// can also the order of the start list be change!
bool bResort = false;
- bool bDelAttr = false;
sal_Int32 nEndChanges = nIndex+nDeleted;
sal_Int32 nAttr = 0;
@@ -1442,7 +1441,7 @@ void ContentNode::CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDeleted, SfxItemP
EditCharAttrib* pAttrib = GetAttrib(rAttribs, nAttr);
while ( pAttrib )
{
- bDelAttr = false;
+ bool bDelAttr = false;
if ( pAttrib->GetEnd() >= nIndex )
{
// Move all Attribute behind the insert point...
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index db8fe9cf536d..1e2c2fcabf21 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3002,13 +3002,12 @@ EditPaM ImpEditEngine::GetPaM( Point aDocPos, bool bSmart )
OSL_ENSURE( GetUpdateMode(), "Must not be reached when Update=FALSE: GetPaM" );
long nY = 0;
- long nTmpHeight;
EditPaM aPaM;
sal_Int32 nPortion;
for ( nPortion = 0; nPortion < GetParaPortions().Count(); nPortion++ )
{
ParaPortion* pPortion = GetParaPortions()[nPortion];
- nTmpHeight = pPortion->GetHeight(); // should also be correct for !bVisible!
+ const long nTmpHeight = pPortion->GetHeight(); // should also be correct for !bVisible!
nY += nTmpHeight;
if ( nY > aDocPos.Y() )
{
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index dd5c2f035efc..f75d85c7ad49 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2079,12 +2079,11 @@ void ImpEditEngine::AddPortionIterated(
pFieldAttr->GetStart() != pFieldAttr->GetEnd() &&
pFieldAttr->Which() == EE_FEATURE_FIELD;
sal_Int32 nEndField = bIsField ? pFieldAttr->GetEnd() : USHRT_MAX;
- bool bIsEndField = false;
do
{
aCursor = CursorRight( aCursor);
//determine whether a field and has been reached
- bIsEndField = nEndField == aCursor.GetIndex();
+ bool bIsEndField = nEndField == aCursor.GetIndex();
//search for a new field attribute
const EditCharAttrib* _pFieldAttr = aCursor.GetNode()->GetCharAttribs().
FindFeature( aCursor.GetIndex() );
diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx
index 4a9833016ddc..631de1ac8129 100644
--- a/editeng/source/items/xmlcnitm.cxx
+++ b/editeng/source/items/xmlcnitm.cxx
@@ -120,7 +120,6 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal
const OUString* pNames = aNameSequence.getConstArray();
const sal_Int32 nCount = aNameSequence.getLength();
Any aAny;
- AttributeData* pData;
sal_Int32 nAttr;
for( nAttr = 0; nAttr < nCount; nAttr++ )
@@ -131,7 +130,7 @@ bool SvXMLAttrContainerItem::PutValue( const com::sun::star::uno::Any& rVal, sal
if( aAny.getValue() == NULL || aAny.getValueType() != cppu::UnoType<AttributeData>::get() )
return false;
- pData = (AttributeData*)aAny.getValue();
+ AttributeData* pData = (AttributeData*)aAny.getValue();
sal_Int32 pos = aName.indexOf( ':' );
if( pos != -1 )
{
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 154be10fa663..1f870bc82c4d 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -613,7 +613,6 @@ void Outliner::SetText( const OutlinerParaObject& rPObj )
void Outliner::AddText( const OutlinerParaObject& rPObj )
{
- Paragraph* pPara;
bool bUpdate = pEditEngine->GetUpdateMode();
pEditEngine->SetUpdateMode( false );
@@ -635,7 +634,7 @@ void Outliner::AddText( const OutlinerParaObject& rPObj )
for( sal_Int32 n = 0; n < rPObj.Count(); n++ )
{
- pPara = new Paragraph( rPObj.GetParagraphData(n) );
+ Paragraph* pPara = new Paragraph( rPObj.GetParagraphData(n) );
pParaList->Append(pPara);
sal_Int32 nP = nPara+n;
DBG_ASSERT(pParaList->GetAbsPos(pPara)==nP,"AddText:Out of sync");