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>
This commit is contained in:
Michael Weghorn
2014-12-12 08:08:11 +00:00
committed by Noel Grandin
parent f5c5bab09f
commit 04b183a9bc
8 changed files with 8 additions and 14 deletions
@@ -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() );
+1 -2
View File
@@ -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:
+1 -1
View File
@@ -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;
+1 -2
View File
@@ -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...
+1 -2
View File
@@ -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() )
{
+1 -2
View File
@@ -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() );
+1 -2
View File
@@ -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 )
{
+1 -2
View File
@@ -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");