diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-11 23:32:12 +0100 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2014-12-12 08:08:11 +0000 |
commit | 04b183a9bc792a53a9f081353a79486faa4f3872 (patch) | |
tree | 62a467485cc0f03f1d32998b362707f15b07bee0 | |
parent | f5c5bab09f2e3a7e13a6b397faf4bdfcb898f295 (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>
-rw-r--r-- | desktop/source/deployment/registry/component/dp_component.cxx | 2 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_app.cxx | 3 | ||||
-rw-r--r-- | dtrans/source/win32/workbench/XTDo.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 3 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 3 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 3 | ||||
-rw-r--r-- | editeng/source/items/xmlcnitm.cxx | 3 | ||||
-rw-r--r-- | editeng/source/outliner/outliner.cxx | 3 |
8 files changed, 8 insertions, 14 deletions
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 5c1375541876..26018f42caac 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -1307,10 +1307,10 @@ BackendImpl::ComponentPackageImpl::isRegistered_( if (m_registered == REG_UNINIT) { m_registered = REG_NOT_REGISTERED; - bool bAmbiguousComponentName = false; const Reference<registry::XSimpleRegistry> xRDB( getRDB() ); if (xRDB.is()) { + bool bAmbiguousComponentName = false; // lookup rdb for location URL: const Reference<registry::XRegistryKey> xRootKey( xRDB->getRootKey() ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 04dcac8fccc7..5bef9ed301ec 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -187,7 +187,6 @@ extern "C" DESKTOP_DLLPUBLIC int unopkg_main() bool option_verbose = false; bool option_bundled = false; bool option_suppressLicense = false; - bool subcmd_add = false; bool subcmd_gui = false; OUString logFile; OUString repository; @@ -239,7 +238,7 @@ extern "C" DESKTOP_DLLPUBLIC int unopkg_main() osl_getCommandArg( nPos, &subCommand.pData ); ++nPos; subCommand = subCommand.trim(); - subcmd_add = subCommand == "add"; + bool subcmd_add = subCommand == "add"; subcmd_gui = subCommand == "gui"; // sun-command options and packages: diff --git a/dtrans/source/win32/workbench/XTDo.cxx b/dtrans/source/win32/workbench/XTDo.cxx index 83b446464666..8961285763d6 100644 --- a/dtrans/source/win32/workbench/XTDo.cxx +++ b/dtrans/source/win32/workbench/XTDo.cxx @@ -127,12 +127,12 @@ STDMETHODIMP CXTDataObject::GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium return E_INVALIDARG; HRESULT hr = E_FAIL; - char pBuff[] = "Test OleClipboard"; if ( CF_TEXT == pFormatetc->cfFormat ) { CHGlobalHelper hGlobHlp( TRUE ); + char pBuff[] = "Test OleClipboard"; hGlobHlp.Write( pBuff, sizeof( pBuff ), NULL ); pmedium->tymed = TYMED_HGLOBAL; 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"); |