Kaydet (Commit) 3338f479 authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Noel Grandin

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/13330Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 664e64a1
...@@ -460,12 +460,11 @@ namespace accessibility ...@@ -460,12 +460,11 @@ namespace accessibility
sal_uInt16 iRealItemCount = 0; sal_uInt16 iRealItemCount = 0;
sal_uInt16 iCount = 0; sal_uInt16 iCount = 0;
sal_uInt16 iTotleItemCount = pEntry->ItemCount(); sal_uInt16 iTotleItemCount = pEntry->ItemCount();
SvLBoxItem* pItem;
while( iCount < iTotleItemCount ) while( iCount < iTotleItemCount )
{ {
pItem = pEntry->GetItem( iCount ); const SvLBoxItem* pItem = pEntry->GetItem( iCount );
if ( pItem->GetType() == SV_ITEM_ID_LBOXSTRING && if ( pItem->GetType() == SV_ITEM_ID_LBOXSTRING &&
!static_cast<SvLBoxString*>( pItem )->GetText().isEmpty() ) !static_cast<const SvLBoxString*>( pItem )->GetText().isEmpty() )
{ {
iRealItemCount++; iRealItemCount++;
} }
......
...@@ -304,14 +304,13 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) ...@@ -304,14 +304,13 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message )
} }
if( mnWidth == 0 ) { if( mnWidth == 0 ) {
GstPad *pad = NULL; GstPad *pad = NULL;
GstCaps *caps;
g_signal_emit_by_name( mpPlaybin, "get-video-pad", 0, &pad ); g_signal_emit_by_name( mpPlaybin, "get-video-pad", 0, &pad );
if( pad ) { if( pad ) {
int w = 0, h = 0; 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 ), if( gst_structure_get( gst_caps_get_structure( caps, 0 ),
"width", G_TYPE_INT, &w, "width", G_TYPE_INT, &w,
......
...@@ -87,7 +87,6 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) ...@@ -87,7 +87,6 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
// memorize item because of the adjustments... // memorize item because of the adjustments...
GetExtraData()->SetSearchItem(rSearchItem); GetExtraData()->SetSearchItem(rSearchItem);
sal_Int32 nFound = 0; sal_Int32 nFound = 0;
bool bCanceled = false;
if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL) if (rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL)
{ {
sal_uInt16 nActModWindows = 0; sal_uInt16 nActModWindows = 0;
...@@ -115,6 +114,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) ...@@ -115,6 +114,7 @@ void Shell::ExecuteCurrent( SfxRequest& rReq )
} }
else else
{ {
bool bCanceled = false;
nFound = pCurWin->StartSearchAndReplace(rSearchItem); nFound = pCurWin->StartSearchAndReplace(rSearchItem);
if ( !nFound && !rSearchItem.GetSelection() ) if ( !nFound && !rSearchItem.GetSelection() )
{ {
......
...@@ -240,7 +240,6 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, ...@@ -240,7 +240,6 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
GetExtraData()->ChoosingMacro() = true; GetExtraData()->ChoosingMacro() = true;
OUString aScriptURL; OUString aScriptURL;
bool bError = false;
SbMethod* pMethod = NULL; SbMethod* pMethod = NULL;
boost::scoped_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) ); boost::scoped_ptr< MacroChooser > pChooser( new MacroChooser( NULL, true ) );
...@@ -259,6 +258,8 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, ...@@ -259,6 +258,8 @@ OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument,
{ {
case Macro_OkRun: case Macro_OkRun:
{ {
bool bError = false;
pMethod = pChooser->GetMacro(); pMethod = pChooser->GetMacro();
if ( !pMethod && pChooser->GetMode() == MacroChooser::Recording ) if ( !pMethod && pChooser->GetMode() == MacroChooser::Recording )
pMethod = pChooser->CreateMacro(); pMethod = pChooser->CreateMacro();
......
...@@ -190,9 +190,9 @@ SbxVariable* TreeListBox::FindVariable( SvTreeListEntry* pEntry ) ...@@ -190,9 +190,9 @@ SbxVariable* TreeListBox::FindVariable( SvTreeListEntry* pEntry )
} }
SbxVariable* pVar = 0; SbxVariable* pVar = 0;
bool bDocumentObjects = false;
if ( !aEntries.empty() ) if ( !aEntries.empty() )
{ {
bool bDocumentObjects = false;
for ( size_t n = 0; n < aEntries.size(); n++ ) for ( size_t n = 0; n < aEntries.size(); n++ )
{ {
SvTreeListEntry* pLE = aEntries[n]; SvTreeListEntry* pLE = aEntries[n];
......
...@@ -273,9 +273,9 @@ bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& ) ...@@ -273,9 +273,9 @@ bool CheckBox::EditingEntry( SvTreeListEntry* pEntry, Selection& )
} }
// i24094: Password verification necessary for renaming // i24094: Password verification necessary for renaming
bool bOK = true;
if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && !xModLibContainer->isLibraryLoaded( aLibName ) ) if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) && !xModLibContainer->isLibraryLoaded( aLibName ) )
{ {
bool bOK = true;
// check password // check password
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY ); Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) ) if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
......
...@@ -116,9 +116,10 @@ void DlgEditor::ShowDialog() ...@@ -116,9 +116,10 @@ void DlgEditor::ShowDialog()
} }
// Disable decoration // Disable decoration
bool bDecoration = true;
try try
{ {
bool bDecoration = true;
Any aDecorationAny = xSrcDlgModPropSet->getPropertyValue( aDecorationPropName ); Any aDecorationAny = xSrcDlgModPropSet->getPropertyValue( aDecorationPropName );
aDecorationAny >>= bDecoration; aDecorationAny >>= bDecoration;
if( !bDecoration ) if( !bDecoration )
......
...@@ -586,8 +586,6 @@ namespace basegfx ...@@ -586,8 +586,6 @@ namespace basegfx
scissor_plane *pPlane, // scissoring plane scissor_plane *pPlane, // scissoring plane
const ::basegfx::B2DRectangle &rR ) // clipping rectangle const ::basegfx::B2DRectangle &rR ) // clipping rectangle
{ {
::basegfx::B2DPoint *curr;
::basegfx::B2DPoint *next;
sal_uInt32 out_count=0; sal_uInt32 out_count=0;
...@@ -596,8 +594,8 @@ namespace basegfx ...@@ -596,8 +594,8 @@ namespace basegfx
// vertices are relative to the coordinate // vertices are relative to the coordinate
// system defined by the rectangle. // system defined by the rectangle.
curr = &in_vertex[i]; ::basegfx::B2DPoint *curr = &in_vertex[i];
next = &in_vertex[(i+1)%in_count]; ::basegfx::B2DPoint *next = &in_vertex[(i+1)%in_count];
// perform clipping judgement & mask against current plane. // perform clipping judgement & mask against current plane.
sal_uInt32 clip = pPlane->clipmask & ((getCohenSutherlandClipFlags(*curr,rR)<<4)|getCohenSutherlandClipFlags(*next,rR)); sal_uInt32 clip = pPlane->clipmask & ((getCohenSutherlandClipFlags(*curr,rR)<<4)|getCohenSutherlandClipFlags(*next,rR));
......
...@@ -136,13 +136,13 @@ namespace basegfx ...@@ -136,13 +136,13 @@ namespace basegfx
for(sal_uInt32 a(0); a < nEdgeCount; a++) for(sal_uInt32 a(0); a < nEdgeCount; a++)
{ {
// update current edge // update current edge
double fLastDotDashMovingLength(0.0);
const sal_uInt32 nNextIndex((a + 1) % nPointCount); const sal_uInt32 nNextIndex((a + 1) % nPointCount);
const B3DPoint aNextPoint(rCandidate.getB3DPoint(nNextIndex)); const B3DPoint aNextPoint(rCandidate.getB3DPoint(nNextIndex));
const double fEdgeLength(B3DVector(aNextPoint - aCurrentPoint).getLength()); const double fEdgeLength(B3DVector(aNextPoint - aCurrentPoint).getLength());
if(!fTools::equalZero(fEdgeLength)) if(!fTools::equalZero(fEdgeLength))
{ {
double fLastDotDashMovingLength(0.0);
while(fTools::less(fDotDashMovingLength, fEdgeLength)) while(fTools::less(fDotDashMovingLength, fEdgeLength))
{ {
// new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength] // new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment