[Libreoffice-commits] .: 7 commits - basic/source chart2/source comphelper/source connectivity/workben framework/source package/source sdext/source starmath/source svtools/source sw/source vcl/source xml2cmp/source xmloff/source
Michael Meeks
michael at kemper.freedesktop.org
Thu May 31 06:59:46 PDT 2012
basic/source/uno/dlgcont.cxx | 2
chart2/source/tools/InternalDataProvider.cxx | 4 -
comphelper/source/property/MasterPropertySet.cxx | 2
comphelper/source/property/MasterPropertySetInfo.cxx | 2
connectivity/workben/testmoz/mozthread.cxx | 2
framework/source/layoutmanager/toolbarlayoutmanager.cxx | 38 ++++++++--------
package/source/zippackage/ZipPackageFolder.cxx | 3 -
sdext/source/minimizer/pagecollector.cxx | 2
sdext/source/pdfimport/tree/pdfiprocessor.cxx | 8 ---
starmath/source/cfgitem.cxx | 8 ---
starmath/source/parse.cxx | 4 -
svtools/source/control/ctrlbox.cxx | 2
sw/source/core/access/accportions.cxx | 2
sw/source/core/crsr/crsrsh.cxx | 2
sw/source/core/crsr/viscrs.cxx | 2
sw/source/core/doc/docnum.cxx | 2
sw/source/core/doc/fmtcol.cxx | 2
sw/source/core/unocore/unobkm.cxx | 2
sw/source/core/unocore/unocoll.cxx | 6 +-
sw/source/core/unocore/unoftn.cxx | 3 -
sw/source/core/unocore/unoidx.cxx | 26 ++++------
sw/source/core/unocore/unoobj.cxx | 2
sw/source/core/unocore/unoobj2.cxx | 8 +--
sw/source/core/unocore/unoparagraph.cxx | 2
sw/source/core/unocore/unorefmk.cxx | 6 +-
sw/source/core/unocore/unosect.cxx | 8 +--
sw/source/core/unocore/unotext.cxx | 10 ++--
sw/source/filter/rtf/rtffld.cxx | 2
sw/source/filter/ww8/fields.cxx | 2
sw/source/filter/ww8/styles.cxx | 2
sw/source/filter/ww8/writerwordglue.cxx | 5 --
sw/source/filter/ww8/ww8par6.cxx | 8 +--
sw/source/filter/ww8/ww8scan.cxx | 8 +--
sw/source/ui/app/docshini.cxx | 4 -
sw/source/ui/app/swmodul1.cxx | 3 -
sw/source/ui/docvw/PostItMgr.cxx | 6 +-
sw/source/ui/frmdlg/cption.cxx | 2
sw/source/ui/index/cntex.cxx | 2
sw/source/ui/index/cnttab.cxx | 4 -
sw/source/ui/misc/redlndlg.cxx | 2
vcl/source/control/spinfld.cxx | 2
vcl/source/gdi/outdev3.cxx | 12 ++---
xml2cmp/source/support/list.hxx | 5 +-
xml2cmp/source/xcd/xmlelem.cxx | 2
xmloff/source/chart/SchXMLExport.cxx | 9 +--
45 files changed, 114 insertions(+), 126 deletions(-)
New commits:
commit 569867b6769104f001dc1ae070783318098de583
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu May 31 14:48:44 2012 +0100
targetted tweak to prep for stl re-work reversion
Change-Id: Ibe60e96b6f961fba13fdd39320969acf51f545f4
diff --git a/xml2cmp/source/support/list.hxx b/xml2cmp/source/support/list.hxx
index cf949a0..7b270d9 100644
--- a/xml2cmp/source/support/list.hxx
+++ b/xml2cmp/source/support/list.hxx
@@ -73,6 +73,9 @@ class List
unsigned size() const { return len; }
unsigned space() const { return allocated; }
+ bool is_valid_index(
+ unsigned n) const
+ { return n < len; }
// ACCESS
XX & front() { return elem(0); }
XX & back() { return elem(len-1); }
@@ -236,7 +239,7 @@ template <class XY>
void
DynamicList<XY>::remove( unsigned pos )
{
- if (pos >= this->len)
+ if (!this->is_valid_index(pos) )
return;
this->len--;
delete this->inhalt[pos];
diff --git a/xml2cmp/source/xcd/xmlelem.cxx b/xml2cmp/source/xcd/xmlelem.cxx
index 5a795d6..836c8f6 100644
--- a/xml2cmp/source/xcd/xmlelem.cxx
+++ b/xml2cmp/source/xcd/xmlelem.cxx
@@ -202,7 +202,7 @@ MultipleTextElement::Data( unsigned i_nNr ) const
{
static const Simstr sNull_;
- if (i_nNr < aContent.size())
+ if (aContent.is_valid_index(i_nNr))
return aContent[i_nNr];
return sNull_;
}
commit 93b415a68f6080b5cb88381637433ff29e64cf2d
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu May 31 14:43:00 2012 +0100
targetted prefer prefix operators reversion
Change-Id: I7e1ae9622bc89b584ddbb307dac15b0ed56ae563
diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx
index c9517d5..68f135c 100644
--- a/comphelper/source/property/MasterPropertySet.cxx
+++ b/comphelper/source/property/MasterPropertySet.cxx
@@ -95,7 +95,7 @@ MasterPropertySet::~MasterPropertySet()
while (aIter != aEnd )
{
delete (*aIter).second;
- ++aIter;
+ aIter++;
}
}
diff --git a/comphelper/source/property/MasterPropertySetInfo.cxx b/comphelper/source/property/MasterPropertySetInfo.cxx
index df3e299..ec661d0 100644
--- a/comphelper/source/property/MasterPropertySetInfo.cxx
+++ b/comphelper/source/property/MasterPropertySetInfo.cxx
@@ -56,7 +56,7 @@ MasterPropertySetInfo::~MasterPropertySetInfo()
while (aIter != aEnd )
{
delete (*aIter).second;
- ++aIter;
+ aIter++;
}
}
diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx
index 54b7913..2503690 100644
--- a/package/source/zippackage/ZipPackageFolder.cxx
+++ b/package/source/zippackage/ZipPackageFolder.cxx
@@ -725,7 +725,8 @@ void ZipPackageFolder::saveContents( ::rtl::OUString &rPath, std::vector < uno::
}
for ( ContentHash::const_iterator aCI = maContents.begin(), aEnd = maContents.end();
- aCI != aEnd; ++aCI)
+ aCI != aEnd;
+ aCI++)
{
const ::rtl::OUString &rShortName = (*aCI).first;
const ContentInfo &rInfo = *(*aCI).second;
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index a4a6e47..15eae11 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -394,7 +394,7 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap )
while ( pIt != aToCompare.end() && !bInvalid )
{
bInvalid = ( nWidth != *pIt );
- ++pIt;
+ pIt++;
}
if ( bInvalid )
nWidth = 0.0;
commit dc0d009f10dee5d379b41abcd51d181dda38f1dd
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu May 31 14:34:59 2012 +0100
targetted misc. minor cppcheck cleanups reversion
Change-Id: Ic7f91c035d3e7f0e792d2e9ab217e1fc4ebcf697
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 4c4c502..1076575 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -283,7 +283,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
::xmlscript::importDialogModel( xInput, xDialogModel, xContext, mxOwnerDocument );
std::vector< rtl::OUString > vEmbeddedImageURLs;
GraphicObject::InspectForGraphicObjectImageURL( Reference< XInterface >( xDialogModel, UNO_QUERY ), vEmbeddedImageURLs );
- if ( !vEmbeddedImageURLs.empty() )
+ if ( vEmbeddedImageURLs.size() )
{
// Export the images to the storage
Sequence< Any > aArgs( 1 );
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 1bcf3c3..2fe8306 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -288,7 +288,7 @@ Rectangle ToolbarLayoutManager::implts_calcDockingArea()
aRowColumnSizes[nCurrDockingArea].clear();
aRowColumnSizes[nCurrDockingArea].push_back( 0 );
- for ( pConstIter = aWindowVector.begin(); pConstIter != aWindowVector.end(); ++pConstIter )
+ for ( pConstIter = aWindowVector.begin(); pConstIter != aWindowVector.end(); pConstIter++ )
{
uno::Reference< ui::XUIElement > xUIElement( pConstIter->m_xUIElement, uno::UNO_QUERY );
if ( xUIElement.is() )
@@ -481,7 +481,7 @@ bool ToolbarLayoutManager::destroyToolbar( const ::rtl::OUString& rResourceURL )
bool bMustBeDestroyed( rResourceURL.indexOf( aAddonTbResourceName ) != 0 );
WriteGuard aWriteLock( m_aLock );
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_aName == rResourceURL )
{
@@ -562,7 +562,7 @@ void ToolbarLayoutManager::destroyToolbars()
aWriteLock.unlock();
UIElementVector::iterator pIter;
- for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+ for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
{
uno::Reference< lang::XComponent > xComponent( pIter->m_xUIElement, uno::UNO_QUERY );
if ( xComponent.is() )
@@ -630,7 +630,7 @@ void ToolbarLayoutManager::refreshToolbarsVisibility( bool bAutomaticToolbars )
UIElement aUIElement;
SolarMutexGuard aGuard;
UIElementVector::iterator pIter;
- for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+ for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
{
if ( implts_readWindowStateData( pIter->m_aName, aUIElement ) &&
( pIter->m_bVisible != aUIElement.m_bVisible ) && !pIter->m_bMasterHide )
@@ -653,7 +653,7 @@ void ToolbarLayoutManager::setFloatingToolbarsVisibility( bool bVisible )
SolarMutexGuard aGuard;
UIElementVector::iterator pIter;
- for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+ for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
{
Window* pWindow = getWindowFromXUIElement( pIter->m_xUIElement );
if ( pWindow && pIter->m_bFloating )
@@ -676,7 +676,7 @@ void ToolbarLayoutManager::setVisible( bool bVisible )
SolarMutexGuard aGuard;
UIElementVector::iterator pIter;
- for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+ for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
{
pIter->m_bMasterHide = !bVisible;
Window* pWindow = getWindowFromXUIElement( pIter->m_xUIElement );
@@ -792,7 +792,7 @@ bool ToolbarLayoutManager::dockAllToolbars()
ReadGuard aReadLock( m_aLock );
UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_aType == "toolbar" && pIter->m_xUIElement.is() && pIter->m_bFloating && pIter->m_bVisible )
aToolBarNameVector.push_back( pIter->m_aName );
@@ -838,7 +838,7 @@ long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent* pEvent )
::std::vector< uno::Reference< ui::XUIFunctionListener > > aListenerArray;
UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_xUIElement.is() )
{
@@ -1246,7 +1246,7 @@ void ToolbarLayoutManager::implts_reparentToolbars()
if ( pContainerWindow )
{
UIElementVector::iterator pIter;
- for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); ++pIter )
+ for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
{
uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
if ( xUIElement.is() )
@@ -1794,7 +1794,7 @@ UIElement& ToolbarLayoutManager::impl_findToolbar( const rtl::OUString& aName )
UIElementVector::iterator pIter;
ReadGuard aReadLock( m_aLock );
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_aName == aName )
return *pIter;
@@ -1818,7 +1818,7 @@ UIElement ToolbarLayoutManager::implts_findToolbar( const uno::Reference< uno::X
UIElementVector::const_iterator pIter;
ReadGuard aReadLock( m_aLock );
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_xUIElement.is() )
{
@@ -1840,7 +1840,7 @@ uno::Reference< awt::XWindow > ToolbarLayoutManager::implts_getXWindow( const ::
uno::Reference< awt::XWindow > xWindow;
ReadGuard aReadLock( m_aLock );
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_aName == aName && pIter->m_xUIElement.is() )
{
@@ -1930,7 +1930,7 @@ awt::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos()
// Try to find a cascaded position for the new floating window
UIElementVector::const_iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_xUIElement.is() )
{
@@ -1969,7 +1969,7 @@ void ToolbarLayoutManager::implts_sortUIElements()
// We have to reset our temporary flags.
UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
pIter->m_bUserActive = sal_False;
aWriteLock.unlock();
}
@@ -2013,7 +2013,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
aWindowVector.reserve(m_aUIElements.size());
xDockAreaWindow = m_xDockAreaWindows[eDockingArea];
UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea && pIter->m_bVisible && !pIter->m_bFloating )
{
@@ -2197,7 +2197,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::D
ReadGuard aReadLock( m_aLock );
UIElementVector::iterator pIter;
UIElementVector::iterator pEnd = m_aUIElements.end();
- for ( pIter = m_aUIElements.begin(); pIter != pEnd; ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != pEnd; pIter++ )
{
if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea )
{
@@ -3271,7 +3271,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
WriteGuard aWriteLock( m_aLock );
UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if (( pIter->m_aDockedData.m_nDockedArea == sal_Int16( eDockingArea )) && ( pIter->m_aName != rUIElement.m_aName ))
{
@@ -3926,7 +3926,7 @@ throw (uno::RuntimeException)
UIElementVector::iterator pIter;
WriteGuard aWriteLock( m_aLock );
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
if ( xUIElement.is() )
@@ -4126,7 +4126,7 @@ uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolb
{
sal_uInt32 nCount(0);
UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); ++pIter )
+ for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
{
if ( pIter->m_xUIElement.is() )
{
diff --git a/sw/source/core/access/accportions.cxx b/sw/source/core/access/accportions.cxx
index 223a758..17ed51e 100644
--- a/sw/source/core/access/accportions.cxx
+++ b/sw/source/core/access/accportions.cxx
@@ -224,7 +224,7 @@ void SwAccessiblePortionData::LineBreak()
void SwAccessiblePortionData::Skip(sal_uInt16 nLength)
{
OSL_ENSURE( !bFinished, "We are already done!" );
- OSL_ENSURE( aModelPositions.empty(), "Never Skip() after portions" );
+ OSL_ENSURE( aModelPositions.size() == 0, "Never Skip() after portions" );
OSL_ENSURE( nLength <= pTxtNode->GetTxt().Len(), "skip exceeds model string!" );
nModelPosition += nLength;
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f6e43fc..dfd80d9 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3298,7 +3298,7 @@ void lcl_FillRecognizerData( uno::Sequence< rtl::OUString >& rSmartTagTypes,
}
}
- if ( !aSmartTagTypes.empty() )
+ if ( aSmartTagTypes.size() )
{
rSmartTagTypes.realloc( aSmartTagTypes.size() );
rStringKeyMaps.realloc( aSmartTagTypes.size() );
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 2df5fff..7633a6f 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -332,7 +332,7 @@ void SwSelPaintRects::Show()
if(mpCursorOverlay)
{
- if(!aNewRanges.empty())
+ if(aNewRanges.size())
{
static_cast< sdr::overlay::OverlaySelection* >(mpCursorOverlay)->setRanges(aNewRanges);
}
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 8d5c6d7..7caae4d 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1052,7 +1052,7 @@ sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast )
++aListIter;
}
- while ( !aListsForDeletion.empty() )
+ while ( aListsForDeletion.size() > 0 )
{
SwList* pList = aListsForDeletion.back();
aListsForDeletion.pop_back();
diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx
index c647089..4f6a30a 100644
--- a/sw/source/ui/index/cntex.cxx
+++ b/sw/source/ui/index/cntex.cxx
@@ -421,7 +421,7 @@ void SwMultiTOXTabDialog::CreateOrUpdateExample(
pValues[nTokenIndex] = aPropVals;
nTokenIndex++;
- ++aIt; // #i24377#
+ aIt++; // #i24377#
}
aSequPropVals.realloc(nTokenIndex);
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 619889f..ffacb5d 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -2515,7 +2515,7 @@ IMPL_LINK(SwTOXEntryTabPage, LevelHdl, SvTreeListBox*, pBox)
aAuthFieldsLB.RemoveEntry(nLstBoxPos);
}
- ++aIt; // #i21237#
+ aIt++; // #i21237#
}
aAuthFieldsLB.SelectEntryPos(0);
}
@@ -2926,7 +2926,7 @@ void SwTokenWindow::SetForm(SwForm& rForm, sal_uInt16 nL)
bLastWasText = sal_False;
}
- ++aIt; // #i21237#
+ aIt++; // #i21237#
}
if(!bLastWasText)
{
diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx
index 5be01f8..ae65e1f 100644
--- a/sw/source/ui/misc/redlndlg.cxx
+++ b/sw/source/ui/misc/redlndlg.cxx
@@ -853,7 +853,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept )
ListBoxEntries_t::iterator aEnd = aRedlines.end();
for( ListBoxEntries_t::iterator aIter = aRedlines.begin();
aIter != aEnd;
- ++aIter )
+ aIter++ )
{
sal_uInt16 nPosition = GetRedlinePos( **aIter );
if( nPosition != USHRT_MAX )
commit 4139e6a208ea5040b169e9775828a5513c4f4ea9
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu May 31 14:30:02 2012 +0100
target cppcheck index incrementing revert
Change-Id: I890dfe9fbd7b5a850daaa0d2b4d5040a5ddbefd7
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 48e7cb6..62de736 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -296,7 +296,7 @@ public:
rVector.resize( m_nLevel );
vector< uno::Any >::iterator aIt( rVector.begin() );
- for( sal_Int32 nN=0; aIt<rVector.end(); ++aIt, ++nN)
+ for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
{
if( nN==m_nLevel )
break;
@@ -318,7 +318,7 @@ public:
void operator() ( vector< uno::Any >& rVector )
{
vector< uno::Any >::iterator aIt( rVector.begin() );
- for( sal_Int32 nN=0; aIt<rVector.end(); ++aIt, ++nN)
+ for( sal_Int32 nN=0; aIt<rVector.end(); aIt++, nN++)
{
if( nN==m_nLevel )
{
diff --git a/sdext/source/minimizer/pagecollector.cxx b/sdext/source/minimizer/pagecollector.cxx
index 668ce5f..511299b 100644
--- a/sdext/source/minimizer/pagecollector.cxx
+++ b/sdext/source/minimizer/pagecollector.cxx
@@ -94,7 +94,7 @@ void PageCollector::CollectNonCustomShowPages( const com::sun::star::uno::Refere
{
std::vector< Reference< XDrawPage > > vUsedPageList;
PageCollector::CollectCustomShowPages( rxModel, rCustomShowName, vUsedPageList );
- if ( !vUsedPageList.empty() )
+ if ( vUsedPageList.size() )
{
Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
index 12d2ab4..9d066b9 100644
--- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx
+++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx
@@ -219,7 +219,7 @@ sal_Int32 PDFIProcessor::getFontId( const FontAttributes& rAttr ) const
// line diagnose block - start
void PDFIProcessor::processGlyphLine()
{
- if( m_GlyphsList.empty() )
+ if( m_GlyphsList.size()<1 )
return;
double fPreAvarageSpaceValue= 0.0;
@@ -315,21 +315,17 @@ void PDFIProcessor::processGlyphLine()
ParagraphElement* pPara= NULL ;
FrameElement* pFrame= NULL ;
- if(!m_GlyphsList.empty())
+ if(m_GlyphsList.size()>0)
{
pFrame = m_pElFactory->createFrameElement( m_GlyphsList[0].getCurElement(), getGCId( getTransformGlyphContext( m_GlyphsList[0])) );
pFrame->ZOrder = m_nNextZOrder++;
pPara = m_pElFactory->createParagraphElement( pFrame );
-
-
processGlyph( 0,
m_GlyphsList[0],
pPara,
pFrame,
m_bIsWhiteSpaceInLine );
-
-
}
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 302e9fa..586c498 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2378,7 +2378,7 @@ SwXDocumentIndexes::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
{
return ::sw::SupportsServiceImpl(
- SAL_N_ELEMENTS(g_ServicesDocumentIndexes)
+ SAL_N_ELEMENTS(g_ServicesDocumentIndexes),
g_ServicesDocumentIndexes, rServiceName);
}
commit a49cd8632ea7e0fdfc3fbb2729ec4d15fbf25a18
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu May 31 13:58:40 2012 +0100
targetted cppcheck warning fix reversion
Change-Id: I44bafcc62a127f2d7c6da2952573e4128783c342
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 5f8c825..7277161 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -696,6 +696,7 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec
long nBottom1 = aSize.Height()/2;
long nBottom2 = aSize.Height()-1;
long nTop2 = nBottom1;
+ long nTop1 = 0;
if ( !(aSize.Height() & 0x01) )
nBottom1--;
@@ -740,7 +741,6 @@ void SpinField::ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rec
}
else
{
- long nTop1 = 0;
aSize.Width() -= CalcZoom( GetDrawPixel( pDev, rStyleSettings.GetSpinSize() ) );
rSpinUpArea = Rectangle( aSize.Width(), nTop1, rOutSz.Width()-aDropDownSize.Width()-1, nBottom1 );
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index bb44ac5..06d04cc 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -3601,8 +3601,12 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
{
long nCurX = nStartX;
long nCurY = nStartY;
+ long nDiffX = 2;
long nDiffY = nHeight-1;
long nCount = nWidth;
+ long nOffY = -1;
+ long nFreq;
+ long i;
long nPixWidth;
long nPixHeight;
sal_Bool bDrawPixAsRect;
@@ -3642,11 +3646,8 @@ void OutputDevice::ImplDrawWaveLine( long nBaseX, long nBaseY,
}
else
{
- long nDiffX = 2;
- long nOffY = -1;
- long i;
nCurY += nDiffY;
- long nFreq = nCount / (nDiffX+nDiffY);
+ nFreq = nCount / (nDiffX+nDiffY);
while ( nFreq-- )
{
for( i = nDiffY; i; --i )
@@ -4914,6 +4915,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
// auf mehr als Zwei Zeilen gebrochen wird...
if ( xHyph.is() )
{
+ sal_Unicode cAlternateReplChar = 0;
i18n::Boundary aBoundary = xBI->getWordBoundary( aText, nBreakPos, rDefLocale, ::com::sun::star::i18n::WordType::DICTIONARY_WORD, sal_True );
// sal_uInt16 nWordStart = nBreakPos;
// sal_uInt16 nBreakPos_OLD = nBreakPos;
@@ -4985,8 +4987,6 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
DBG_ASSERT( ( nAltEnd - nAltStart ) == 1, "Alternate: Falsche Annahme!" );
- sal_Unicode cAlternateReplChar = 0;
-
if ( nTxtEnd > nTxtStart )
cAlternateReplChar = aAlt.GetChar( nAltStart );
commit 3f5762b649c43383bc4dd362d86a445205332590
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu May 31 13:57:11 2012 +0100
targetted SAL_N_ELEMENTS revert.
Change-Id: Idd43d44dd7fc4bb33be2de5b855a7741de88ec51
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 4870c61..6108bf7 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -181,18 +181,14 @@ static Sequence< OUString > lcl_GetPropertyNames(
return aNames;
}
-
static Sequence< OUString > GetFormatPropertyNames()
{
- sal_uInt16 nCnt = SAL_N_ELEMENTS(aFormatPropNames);
- return lcl_GetPropertyNames( aFormatPropNames, nCnt );
+ return lcl_GetPropertyNames( aFormatPropNames, SAL_N_ELEMENTS( aFormatPropNames ) );
}
-
static Sequence< OUString > GetOtherPropertyNames()
{
- sal_uInt16 nCnt = SAL_N_ELEMENTS(aMathPropNames);
- return lcl_GetPropertyNames( aMathPropNames, nCnt );
+ return lcl_GetPropertyNames( aMathPropNames, SAL_N_ELEMENTS( aMathPropNames ) );
}
/////////////////////////////////////////////////////////////////
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index d3999a5..7503cb3 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -334,8 +334,7 @@ const SmTokenTableEntry * SmParser::GetTokenTableEntry( const String &rName )
const SmTokenTableEntry * pRes = 0;
if (rName.Len())
{
- sal_Int32 nEntries = SAL_N_ELEMENTS(aTokenTable);
- for (sal_Int32 i = 0; i < nEntries; ++i)
+ for (sal_Int32 i = 0; i < SAL_N_ELEMENTS(aTokenTable); ++i)
{
if (rName.EqualsIgnoreCaseAscii( aTokenTable[i].pIdent ))
{
@@ -343,7 +342,6 @@ const SmTokenTableEntry * SmParser::GetTokenTableEntry( const String &rName )
break;
}
}
-
}
return pRes;
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index be95c81..3263a58 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -296,7 +296,7 @@ void SwTxtFmtColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
}
- for( int nC = 0, nArrLen = SAL_N_ELEMENTS(aFontSizeArr);
+ for( int nC = 0, nArrLen = sizeof(aFontSizeArr) / sizeof( aFontSizeArr[0]);
nC < nArrLen; ++nC )
{
SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize;
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index d20a5f3..03462f6 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -402,7 +402,7 @@ static char const*const g_ServicesBookmark[] =
"com.sun.star.document.LinkTarget",
};
static const size_t g_nServicesBookmark(
- SAL_N_ELEMENTS(g_ServicesBookmark));
+ sizeof(g_ServicesBookmark)/sizeof(g_ServicesBookmark[0]));
sal_Bool SAL_CALL SwXBookmark::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 47fa26e..2841791 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -490,7 +490,7 @@ OUString SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
{
SolarMutexGuard aGuard;
OUString sRet;
- sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
+ sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
if(nObjectType < nEntries)
sRet = rtl::OUString::createFromAscii(aProvNamesId[nObjectType].pName);
return sRet;
@@ -498,7 +498,7 @@ OUString SwXServiceProvider::GetProviderName(sal_uInt16 nObjectType)
uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
{
- sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
+ sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
uno::Sequence<OUString> aRet(nEntries);
OUString* pArray = aRet.getArray();
sal_uInt16 n = 0;
@@ -518,7 +518,7 @@ uno::Sequence<OUString> SwXServiceProvider::GetAllServiceNames()
sal_uInt16 SwXServiceProvider::GetProviderType(const OUString& rServiceName)
{
- sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId);
+ sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
for(sal_uInt16 i = 0; i < nEntries; i++ )
{
if( COMPARE_EQUAL == rServiceName.compareToAscii(aProvNamesId[i].pName))
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 3e1cb79..09e63bd 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -206,8 +206,7 @@ static char const*const g_ServicesFootnote[] =
"com.sun.star.text.Endnote", // NB: only supported for endnotes!
};
-static const size_t g_nServicesEndnote(
- SAL_N_ELEMENTS(g_ServicesFootnote));
+static const size_t g_nServicesEndnote( sizeof (g_ServicesFootnote) / sizeof (g_ServicesFootnote[0]) );
static const size_t g_nServicesFootnote( g_nServicesEndnote - 1 ); // NB: omit!
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index a0ee7b3..302e9fa 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2373,22 +2373,20 @@ static char const*const g_ServicesDocumentIndexes[] =
"com.sun.star.text.DocumentIndexes",
};
-static const size_t g_nServicesDocumentIndexes(
- SAL_N_ELEMENTS(g_ServicesDocumentIndexes));
-
sal_Bool SAL_CALL
SwXDocumentIndexes::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
{
return ::sw::SupportsServiceImpl(
- g_nServicesDocumentIndexes, g_ServicesDocumentIndexes, rServiceName);
+ SAL_N_ELEMENTS(g_ServicesDocumentIndexes)
+ g_ServicesDocumentIndexes, rServiceName);
}
uno::Sequence< OUString > SAL_CALL
SwXDocumentIndexes::getSupportedServiceNames() throw (uno::RuntimeException)
{
return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesDocumentIndexes, g_ServicesDocumentIndexes);
+ SAL_N_ELEMENTS(g_ServicesDocumentIndexes), g_ServicesDocumentIndexes);
}
sal_Int32 SAL_CALL
@@ -2577,16 +2575,14 @@ static char const*const g_ServicesIndexStyleAccess[] =
"com.sun.star.text.DocumentIndexParagraphStyles",
};
-static const size_t g_nServicesIndexStyleAccess(
- SAL_N_ELEMENTS(g_ServicesIndexStyleAccess));
-
sal_Bool SAL_CALL
SwXDocumentIndex::StyleAccess_Impl::supportsService(
const OUString& rServiceName)
throw (uno::RuntimeException)
{
return ::sw::SupportsServiceImpl(
- g_nServicesIndexStyleAccess, g_ServicesIndexStyleAccess, rServiceName);
+ SAL_N_ELEMENTS(g_ServicesIndexStyleAccess),
+ g_ServicesIndexStyleAccess, rServiceName);
}
uno::Sequence< OUString > SAL_CALL
@@ -2594,7 +2590,8 @@ SwXDocumentIndex::StyleAccess_Impl::getSupportedServiceNames()
throw (uno::RuntimeException)
{
return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesIndexStyleAccess, g_ServicesIndexStyleAccess);
+ SAL_N_ELEMENTS(g_ServicesIndexStyleAccess),
+ g_ServicesIndexStyleAccess);
}
void SAL_CALL
@@ -2712,16 +2709,14 @@ static char const*const g_ServicesIndexTokenAccess[] =
"com.sun.star.text.DocumentIndexLevelFormat",
};
-static const size_t g_nServicesIndexTokenAccess(
- SAL_N_ELEMENTS(g_ServicesIndexTokenAccess));
-
sal_Bool SAL_CALL
SwXDocumentIndex::TokenAccess_Impl::supportsService(
const OUString& rServiceName)
throw (uno::RuntimeException)
{
return ::sw::SupportsServiceImpl(
- g_nServicesIndexTokenAccess, g_ServicesIndexTokenAccess, rServiceName);
+ SAL_N_ELEMENTS(g_ServicesIndexTokenAccess),
+ g_ServicesIndexTokenAccess, rServiceName);
}
uno::Sequence< OUString > SAL_CALL
@@ -2729,7 +2724,8 @@ SwXDocumentIndex::TokenAccess_Impl::getSupportedServiceNames()
throw (uno::RuntimeException)
{
return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesIndexTokenAccess, g_ServicesIndexTokenAccess);
+ SAL_N_ELEMENTS(g_ServicesIndexTokenAccess),
+ g_ServicesIndexTokenAccess);
}
struct TokenType {
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index e478a69..3bba084 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -982,7 +982,7 @@ static char const*const g_ServicesTextCursor[] =
};
static const size_t g_nServicesTextCursor(
- SAL_N_ELEMENTS(g_ServicesTextCursor));
+ sizeof(g_ServicesTextCursor)/sizeof(g_ServicesTextCursor[0]));
sal_Bool SAL_CALL SwXTextCursor::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 4052050..ea121c1 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -549,7 +549,7 @@ static char const*const g_ServicesParagraphEnum[] =
};
static const size_t g_nServicesParagraphEnum(
- SAL_N_ELEMENTS(g_ServicesParagraphEnum));
+ sizeof(g_ServicesParagraphEnum)/sizeof(g_ServicesParagraphEnum[0]));
sal_Bool SAL_CALL
SwXParagraphEnumeration::supportsService(const OUString& rServiceName)
@@ -934,7 +934,7 @@ static char const*const g_ServicesTextRange[] =
};
static const size_t g_nServicesTextRange(
- SAL_N_ELEMENTS(g_ServicesTextRange));
+ sizeof(g_ServicesTextRange)/sizeof(g_ServicesTextRange[0]));
sal_Bool SAL_CALL SwXTextRange::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
@@ -1666,7 +1666,7 @@ static char const*const g_ServicesTextRanges[] =
};
static const size_t g_nServicesTextRanges(
- SAL_N_ELEMENTS(g_ServicesTextRanges));
+ sizeof(g_ServicesTextRanges)/sizeof(g_ServicesTextRanges[0]));
sal_Bool SAL_CALL SwXTextRanges::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
@@ -1963,7 +1963,7 @@ static char const*const g_ServicesParaFrameEnum[] =
};
static const size_t g_nServicesParaFrameEnum(
- SAL_N_ELEMENTS(g_ServicesParaFrameEnum));
+ sizeof(g_ServicesParaFrameEnum)/sizeof(g_ServicesParaFrameEnum[0]));
sal_Bool SAL_CALL
SwXParaFrameEnumeration::supportsService(const OUString& rServiceName)
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 5fa413c..14ee196 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -304,7 +304,7 @@ static char const*const g_ServicesParagraph[] =
};
static const size_t g_nServicesParagraph(
- SAL_N_ELEMENTS(g_ServicesParagraph));
+ sizeof(g_ServicesParagraph)/sizeof(g_ServicesParagraph[0]));
sal_Bool SAL_CALL
SwXParagraph::supportsService(const OUString& rServiceName)
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 088f5d2..34e2e7e 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -182,7 +182,7 @@ static char const*const g_ServicesReferenceMark[] =
};
static const size_t g_nServicesReferenceMark(
- SAL_N_ELEMENTS(g_ServicesReferenceMark));
+ sizeof(g_ServicesReferenceMark)/sizeof(g_ServicesReferenceMark[0]));
sal_Bool SAL_CALL
SwXReferenceMark::supportsService(const OUString& rServiceName)
@@ -923,7 +923,7 @@ static char const*const g_ServicesMeta[] =
};
static const size_t g_nServicesMeta(
- SAL_N_ELEMENTS(g_ServicesMeta));
+ sizeof(g_ServicesMeta)/sizeof(g_ServicesMeta[0]));
sal_Bool SAL_CALL
SwXMeta::supportsService(const ::rtl::OUString& rServiceName)
@@ -1361,7 +1361,7 @@ static char const*const g_ServicesMetaField[] =
};
static const size_t g_nServicesMetaField(
- SAL_N_ELEMENTS(g_ServicesMetaField));
+ sizeof(g_ServicesMetaField)/sizeof(g_ServicesMetaField[0]));
sal_Bool SAL_CALL
SwXMetaField::supportsService(const ::rtl::OUString& rServiceName)
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 4dc90b8..338c376 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1774,20 +1774,20 @@ static char const*const g_ServicesTextSection[] =
"com.sun.star.document.LinkTarget",
};
-static const size_t g_nServicesTextSection(SAL_N_ELEMENTS(g_ServicesTextSection));
-
sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
{
return ::sw::SupportsServiceImpl(
- g_nServicesTextSection, g_ServicesTextSection, rServiceName);
+ SAL_N_ELEMENTS(g_ServicesTextSection),
+ g_ServicesTextSection, rServiceName);
}
uno::Sequence< OUString > SAL_CALL
SwXTextSection::getSupportedServiceNames() throw (uno::RuntimeException)
{
return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesTextSection, g_ServicesTextSection);
+ SAL_N_ELEMENTS(g_ServicesTextSection),
+ g_ServicesTextSection);
}
// MetadatableMixin
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 2334391..241aae3 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2369,7 +2369,7 @@ static char const*const g_ServicesBodyText[] =
};
static const size_t g_nServicesBodyText(
- SAL_N_ELEMENTS(g_ServicesBodyText));
+ sizeof(g_ServicesBodyText)/sizeof(g_ServicesBodyText[0]));
sal_Bool SAL_CALL SwXBodyText::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
@@ -2665,20 +2665,20 @@ static char const*const g_ServicesHeadFootText[] =
"com.sun.star.text.Text",
};
-static const size_t g_nServicesHeadFootText(SAL_N_ELEMENTS(g_ServicesHeadFootText));
-
sal_Bool SAL_CALL SwXHeadFootText::supportsService(const OUString& rServiceName)
throw (uno::RuntimeException)
{
return ::sw::SupportsServiceImpl(
- g_nServicesHeadFootText, g_ServicesHeadFootText, rServiceName);
+ SAL_N_ELEMENTS(g_ServicesHeadFootText),
+ g_ServicesHeadFootText, rServiceName);
}
uno::Sequence< OUString > SAL_CALL
SwXHeadFootText::getSupportedServiceNames() throw (uno::RuntimeException)
{
return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesHeadFootText, g_ServicesHeadFootText);
+ SAL_N_ELEMENTS(g_ServicesHeadFootText),
+ g_ServicesHeadFootText);
}
const SwStartNode *SwXHeadFootText::GetStartNode() const
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 9750d52..5886fcf 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -145,7 +145,7 @@ static RTF_FLD_TYPES _WhichFld( String& rName, String& rNext )
xub_StrLen nTokenStt = rName.Search( sNm );
sNm.ToLowerAscii();
- for (size_t n = 0; n < SAL_N_ELEMENTS(aFldNmArr); ++n)
+ for (size_t n = 0; n < sizeof(aFldNmArr) / sizeof(aFldNmArr[0]); ++n)
{
const sal_Char* pCmp = aFldNmArr[n].pFldNm;
int nLen = *pCmp++;
diff --git a/sw/source/filter/ww8/fields.cxx b/sw/source/filter/ww8/fields.cxx
index 38a208b..af21b39 100644
--- a/sw/source/filter/ww8/fields.cxx
+++ b/sw/source/filter/ww8/fields.cxx
@@ -139,7 +139,7 @@ namespace ww
};
size_t nIndex = static_cast<size_t>(eIndex);
- if (nIndex >= SAL_N_ELEMENTS(aFieldNames))
+ if (nIndex >= sizeof(aFieldNames) / sizeof(aFieldNames[0]))
eIndex = eNONE;
OSL_ENSURE(eIndex != eNONE, "Unknown WinWord Field, let cmc know");
return aFieldNames[eIndex];
diff --git a/sw/source/filter/ww8/styles.cxx b/sw/source/filter/ww8/styles.cxx
index d1b819c..920d9e5 100644
--- a/sw/source/filter/ww8/styles.cxx
+++ b/sw/source/filter/ww8/styles.cxx
@@ -144,7 +144,7 @@ namespace
"Plain Text"
};
- OSL_ENSURE( (SAL_N_ELEMENTS(stiName)) == ww::stiMax, "WrongSizeOfArray" );
+ OSL_ENSURE( (sizeof (stiName) / sizeof (stiName[0])) == ww::stiMax, "WrongSizeOfArray" );
return stiName;
}
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index eece703..2c1bd54 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -160,14 +160,13 @@ namespace myImplHelpers
RES_NONE, RES_NONE, RES_POOLCOLL_DOC_SUBTITEL
};
- const size_t nArrSize = (SAL_N_ELEMENTS(aArr));
- OSL_ENSURE(nArrSize == 75, "Style Array has false size");
+ OSL_ENSURE(SAL_N_ELEMENTS(aArr) == 75, "Style Array has false size");
SwTxtFmtColl* pRet = 0;
//If this is a built-in word style that has a built-in writer
//equivalent, then map it to one of our built in styles regardless
//of its name
- if (sal::static_int_cast< size_t >(eSti) < nArrSize && aArr[eSti] != RES_NONE)
+ if (sal::static_int_cast< size_t >(eSti) < SAL_N_ELEMENTS(aArr) && aArr[eSti] != RES_NONE)
pRet = mrDoc.GetTxtCollFromPool( static_cast< sal_uInt16 >(aArr[eSti]), false);
return pRet;
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index d0a94a1..6d79548 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -4571,7 +4571,7 @@ void SwWW8Shade::SetShade(ColorData nFore, ColorData nBack, sal_uInt16 nIndex)
nUseBack = COL_WHITE;
- if( nIndex >= SAL_N_ELEMENTS(eMSGrayScale))
+ if( nIndex >= sizeof( eMSGrayScale ) / sizeof ( eMSGrayScale[ 0 ] ) )
nIndex = 0;
sal_uLong nWW8BrushStyle = eMSGrayScale[nIndex];
@@ -5126,7 +5126,7 @@ const wwSprmDispatcher *GetWW2SprmDispatcher()
{99, 0} //"sprmPicBrcRight",
};
- static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
+ static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
return &aSprmSrch;
}
@@ -5488,7 +5488,7 @@ const wwSprmDispatcher *GetWW6SprmDispatcher()
{207, 0}, //dunno
};
- static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
+ static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
return &aSprmSrch;
}
@@ -6077,7 +6077,7 @@ const wwSprmDispatcher *GetWW8SprmDispatcher()
{0x246D, &SwWW8ImplReader::Read_ParaContextualSpacing} //"sprmPFContextualSpacing"
};
- static wwSprmDispatcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
+ static wwSprmDispatcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
return &aSprmSrch;
}
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index bd50f62..6af0100 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -261,7 +261,7 @@ const wwSprmSearcher *wwSprmParser::GetWW2SprmSearcher()
{164, 4, L_FIX}, // "sprmTSetShd", tap.rgshd complex 4 bytes
};
- static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
+ static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
return &aSprmSrch;
};
@@ -444,7 +444,7 @@ const wwSprmSearcher *wwSprmParser::GetWW6SprmSearcher()
{207, 0, L_VAR} // rtl property ?
};
- static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
+ static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
return &aSprmSrch;
};
@@ -783,7 +783,7 @@ const wwSprmSearcher *wwSprmParser::GetWW8SprmSearcher()
{0x246D, 1, L_FIX}
};
- static wwSprmSearcher aSprmSrch(aSprms, SAL_N_ELEMENTS(aSprms));
+ static wwSprmSearcher aSprmSrch(aSprms, sizeof(aSprms) / sizeof(aSprms[0]));
return &aSprmSrch;
};
@@ -6360,7 +6360,7 @@ WW8Fonts::WW8Fonts( SvStream& rSt, WW8Fib& rFib )
if ((eEnc == RTL_TEXTENCODING_SYMBOL) || (eEnc == RTL_TEXTENCODING_DONTKNOW))
eEnc = RTL_TEXTENCODING_MS_1252;
p->sFontname = String(pVer6->szFfn, eEnc);
- const sal_uInt16 maxStrSize = SAL_N_ELEMENTS(pVer6->szFfn);
+ const sal_uInt16 maxStrSize = sizeof (pVer6->szFfn) / sizeof (pVer6->szFfn[0]);
if (p->ibszAlt && p->ibszAlt < maxStrSize) //don't start after end of string
{
p->sFontname.Append(';');
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
index 8321abd..a860c3b 100644
--- a/sw/source/ui/app/docshini.cxx
+++ b/sw/source/ui/app/docshini.cxx
@@ -706,8 +706,8 @@ void SwDocShell::SubInitNew()
0, 0, 0 };
if(!bWeb)
{
- nRange[ (SAL_N_ELEMENTS(nRange)) - 3 ] = RES_PARATR_TABSTOP;
- nRange[ (SAL_N_ELEMENTS(nRange)) - 2 ] = RES_PARATR_HYPHENZONE;
+ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 3 ] = RES_PARATR_TABSTOP;
+ nRange[ (sizeof(nRange)/sizeof(nRange[0])) - 2 ] = RES_PARATR_HYPHENZONE;
}
SfxItemSet aDfltSet( pDoc->GetAttrPool(), nRange );
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index 2ed478e..186ae80 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -467,7 +467,8 @@ void lcl_FillAuthorAttr( sal_uInt16 nAuthor, SfxItemSet &rSet,
COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
- aCol.SetColor( aColArr[ nAuthor % (SAL_N_ELEMENTS(aColArr)) ] );
+ aCol.SetColor( aColArr[ nAuthor % (sizeof( aColArr ) /
+ sizeof( aColArr[0] )) ] );
}
sal_Bool bBackGr = COL_NONE == rAttr.nColor;
diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx
index 7052fcc..84e55a1 100644
--- a/sw/source/ui/docvw/PostItMgr.cxx
+++ b/sw/source/ui/docvw/PostItMgr.cxx
@@ -1582,7 +1582,7 @@ Color SwPostItMgr::GetColorDark(sal_uInt16 aAuthorIndex)
COL_AUTHOR4_NORMAL, COL_AUTHOR5_NORMAL, COL_AUTHOR6_NORMAL,
COL_AUTHOR7_NORMAL, COL_AUTHOR8_NORMAL, COL_AUTHOR9_NORMAL };
- return Color( aArrayNormal[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayNormal))]);
+ return Color( aArrayNormal[ aAuthorIndex % (sizeof( aArrayNormal )/ sizeof( aArrayNormal[0] ))]);
}
else
return Color(COL_WHITE);
@@ -1597,7 +1597,7 @@ Color SwPostItMgr::GetColorLight(sal_uInt16 aAuthorIndex)
COL_AUTHOR4_LIGHT, COL_AUTHOR5_LIGHT, COL_AUTHOR6_LIGHT,
COL_AUTHOR7_LIGHT, COL_AUTHOR8_LIGHT, COL_AUTHOR9_LIGHT };
- return Color( aArrayLight[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayLight))]);
+ return Color( aArrayLight[ aAuthorIndex % (sizeof( aArrayLight )/ sizeof( aArrayLight[0] ))]);
}
else
return Color(COL_WHITE);
@@ -1612,7 +1612,7 @@ Color SwPostItMgr::GetColorAnchor(sal_uInt16 aAuthorIndex)
COL_AUTHOR4_DARK, COL_AUTHOR5_DARK, COL_AUTHOR6_DARK,
COL_AUTHOR7_DARK, COL_AUTHOR8_DARK, COL_AUTHOR9_DARK };
- return Color( aArrayAnchor[ aAuthorIndex % (SAL_N_ELEMENTS(aArrayAnchor))]);
+ return Color( aArrayAnchor[ aAuthorIndex % (sizeof( aArrayAnchor ) / sizeof( aArrayAnchor[0] ))]);
}
else
return Color(COL_WHITE);
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 4b386c4..0a16423 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -461,7 +461,7 @@ void SwCaptionDialog::CheckButtonWidth()
&aOKButton, &aCancelButton, &aHelpButton, &aAutoCaptionButton, &aOptionButton
};
Button** pCurrent = pBtns;
- for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS(pBtns); ++i, ++pCurrent )
+ for ( sal_uInt32 i = 0; i < sizeof( pBtns ) / sizeof( pBtns[ 0 ] ); ++i, ++pCurrent )
{
aNewSize = (*pCurrent)->GetSizePixel();
aNewSize.Width() += nDelta;
commit 3eeca6d39a0dd957bd9c3c27dae6c942ce0d9df4
Author: Michael Meeks <michael.meeks at suse.com>
Date: Thu May 31 13:40:07 2012 +0100
targetted re-work of minor cppcheck fixes
Change-Id: Id0c3cecaccb4d9733149061f652684d3398e9bf2
diff --git a/connectivity/workben/testmoz/mozthread.cxx b/connectivity/workben/testmoz/mozthread.cxx
old mode 100644
new mode 100755
index 352f12b..f24be56
--- a/connectivity/workben/testmoz/mozthread.cxx
+++ b/connectivity/workben/testmoz/mozthread.cxx
@@ -322,10 +322,10 @@ Reference< ::com::sun::star::sdbc::XConnection> TestConnected
int autoTest(Reference<XResultSet> &xRes)
{
+ sal_Int32 nRows = 0;
printColumns(xRes);
if(xRes.is())
{
- sal_Int32 nRows = 0;
while( xRes.is() && xRes->next())
{
nRows++;
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
old mode 100644
new mode 100755
index ee0ad50..cabb0f1
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -2748,6 +2748,7 @@ void SchXMLExportHelper_Impl::exportSeries(
SvXMLElementExport* pSeries = NULL;
Sequence< Reference< chart2::data::XLabeledDataSequence > > aSeqCnt(
xSource->getDataSequences());
+ sal_Int32 nMainSequenceIndex = -1;
sal_Int32 nSeriesLength = 0;
sal_Int32 nAttachedAxis = chart::ChartAxisAssign::PRIMARY_Y;
sal_Bool bHasMeanValueLine = false;
@@ -2760,7 +2761,6 @@ void SchXMLExportHelper_Impl::exportSeries(
Reference< chart2::data::XDataSequence > xValuesSeq;
Reference< chart2::data::XDataSequence > xLabelSeq;
sal_Int32 nSeqIdx=0;
- sal_Int32 nMainSequenceIndex = -1;
for( ; nSeqIdx<aSeqCnt.getLength(); ++nSeqIdx )
{
OUString aRole;
@@ -3359,6 +3359,9 @@ void SchXMLExportHelper_Impl::exportDataPoints(
::std::list< SchXMLDataPointStruct > aDataPointList;
+ sal_Int32 nLastIndex = -1;
+ sal_Int32 nCurrIndex = 0;
+
// collect elements
if( bVaryColorsByPoint && xColorScheme.is() )
{
@@ -3427,10 +3430,6 @@ void SchXMLExportHelper_Impl::exportDataPoints(
}
else
{
-
- sal_Int32 nLastIndex = -1;
- sal_Int32 nCurrIndex = 0;
-
for( nElement = 0; nElement < nSize; ++nElement )
{
aPropertyStates.clear();
More information about the Libreoffice-commits
mailing list