summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-06 01:07:11 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-08 08:01:58 +0000
commit3338f479182a5face7f143bdc4b9ea9067028887 (patch)
tree1f9ae6785720b3a086a166a906bcb0a7340545d6
parent664e64a1901d84137245c14ecfa9432123238bfa (diff)
reduce scope of local variables
This eliminates some of the warnings from Cppcheck report of 2014-11-29. Change-Id: Id5bf885de12a6de262d2cca9fa71627ac67f50d9 Reviewed-on: https://gerrit.libreoffice.org/13330 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--accessibility/source/extended/accessiblelistboxentry.cxx5
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx3
-rw-r--r--basctl/source/basicide/basides1.cxx2
-rw-r--r--basctl/source/basicide/basobj2.cxx3
-rw-r--r--basctl/source/basicide/bastype3.cxx2
-rw-r--r--basctl/source/basicide/moduldl2.cxx2
-rw-r--r--basctl/source/dlged/dlged.cxx3
-rw-r--r--basegfx/source/polygon/b2dpolygonclipper.cxx6
-rw-r--r--basegfx/source/polygon/b3dpolygontools.cxx2
9 files changed, 13 insertions, 15 deletions
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
index fc296b4eb121..a0aa0a760c21 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -460,12 +460,11 @@ namespace accessibility
sal_uInt16 iRealItemCount = 0;
sal_uInt16 iCount = 0;
sal_uInt16 iTotleItemCount = pEntry->ItemCount();
- SvLBoxItem* pItem;
while( iCount < iTotleItemCount )
{
- pItem = pEntry->GetItem( iCount );
+ const SvLBoxItem* pItem = pEntry->GetItem( iCount );
if ( pItem->GetType() == SV_ITEM_ID_LBOXSTRING &&
- !static_cast<SvLBoxString*>( pItem )->GetText().isEmpty() )
+ !static_cast<const SvLBoxString*>( pItem )->GetText().isEmpty() )
{
iRealItemCount++;
}
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
index cc44a4a9347d..88e62cfb9d1f 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -304,14 +304,13 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message )
}
if( mnWidth == 0 ) {
GstPad *pad = NULL;
- GstCaps *caps;
g_signal_emit_by_name( mpPlaybin, "get-video-pad", 0, &pad );
if( pad ) {
int w = 0, h = 0;
- caps = gst_pad_get_current_caps( pad );
+ GstCaps *caps = gst_pad_get_current_caps( pad );
if( gst_structure_get( gst_caps_get_structure( caps, 0 ),
"width", G_TYPE_INT, &w,
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
index d9812963dc64..e5d4da4a7710 100644
--- a/basctl/source/basicide/basides1.cxx
+++ b/basctl/source/basicide/basides1.cxx
@@ -87,7 +87,6 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
// memorize item because of the adjustments...
GetExtraData()->SetSearchItem(rSearchItem);
sal_Int32 nFound = 0;
- bool bCanceled = false;
if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
{
sal_uInt16 nActModWindows = 0;
@@ -115,6 +114,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
}
else
{
+ bool bCanceled = false;
nFound = pCurWin->StartSearchAndReplace(rSearchItem);
if ( !nFound && !rSearchItem.GetSelection() )
{
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 28a781c5a622..98348758e73a 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -240,7 +240,6 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
GetExtraData()->ChoosingMacro() = true;
OUString aScriptURL;
- bool bError = false;
SbMethod* pMethod = NULL;
boost::scoped_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) );
@@ -259,6 +258,8 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
{
case Macro_OkRun:
{
+ bool bError = false;
+
pMethod = pChooser->GetMacro();
if ( !pMethod && pChooser->GetMode() == MacroChooser::Recording )
pMethod = pChooser->CreateMacro();
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
index 8cb3b2f178ee..24122eaefaf4 100644
--- a/basctl/source/basicide/bastype3.cxx
+++ b/basctl/source/basicide/bastype3.cxx
@@ -190,9 +190,9 @@ SbxVariable* TreeListBox::FindVariable( SvTreeListEntry* pEntry )
}
SbxVariable* pVar = 0;
- bool bDocumentObjects = false;
if ( !aEntries.empty() )
{
+ bool bDocumentObjects = false;
for ( size_t n = 0; n < aEntries.size(); n++ )
{
SvTreeListEntry* pLE = aEntries[n];
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 874cbc040518..812c9ec1fa03 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -273,9 +273,9 @@ bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
}
// i24094: Password verification necessary for renaming
- bool bOK = true;
if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && !xModLibContainer->isLibraryLoaded( aLibName ) )
{
+ bool bOK = true;
// check password
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 74c46e91e9f5..5a00fc4fcd17 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -116,9 +116,10 @@ void DlgEditor::ShowDialog()
}
// Disable decoration
- bool bDecoration = true;
try
{
+ bool bDecoration = true;
+
Any aDecorationAny = xSrcDlgModPropSet->getPropertyValue( aDecorationPropName );
aDecorationAny >>= bDecoration;
if( !bDecoration )
diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx
index 7dc42139b927..73eb7851ce5c 100644
--- a/basegfx/source/polygon/b2dpolygonclipper.cxx
+++ b/basegfx/source/polygon/b2dpolygonclipper.cxx
@@ -586,8 +586,6 @@ namespace basegfx
scissor_plane *pPlane, // scissoring plane
const ::basegfx::B2DRectangle &rR ) // clipping rectangle
{
- ::basegfx::B2DPoint *curr;
- ::basegfx::B2DPoint *next;
sal_uInt32 out_count=0;
@@ -596,8 +594,8 @@ namespace basegfx
// vertices are relative to the coordinate
// system defined by the rectangle.
- curr = &in_vertex[i];
- next = &in_vertex[(i+1)%in_count];
+ ::basegfx::B2DPoint *curr = &in_vertex[i];
+ ::basegfx::B2DPoint *next = &in_vertex[(i+1)%in_count];
// perform clipping judgement & mask against current plane.
sal_uInt32 clip = pPlane->clipmask & ((getCohenSutherlandClipFlags(*curr,rR)<<4)|getCohenSutherlandClipFlags(*next,rR));
diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx
index 8f3e9c8b74ec..1ca3820d5f6e 100644
--- a/basegfx/source/polygon/b3dpolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolygontools.cxx
@@ -136,13 +136,13 @@ namespace basegfx
for(sal_uInt32 a(0); a < nEdgeCount; a++)
{
// update current edge
- double fLastDotDashMovingLength(0.0);
const sal_uInt32 nNextIndex((a + 1) % nPointCount);
const B3DPoint aNextPoint(rCandidate.getB3DPoint(nNextIndex));
const double fEdgeLength(B3DVector(aNextPoint - aCurrentPoint).getLength());
if(!fTools::equalZero(fEdgeLength))
{
+ double fLastDotDashMovingLength(0.0);
while(fTools::less(fDotDashMovingLength, fEdgeLength))
{
// new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength]