From 66fd1442696059cc6de07ec96af77082654a0990 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 13 Aug 2011 15:12:01 +0200 Subject: Some cppcheck cleaning --- drawinglayer/source/processor2d/vclprocessor2d.cxx | 2 +- extensions/source/update/check/updatecheck.cxx | 2 +- extensions/source/update/check/updateprotocol.cxx | 7 +--- lotuswordpro/source/filter/lwprowlayout.cxx | 4 +- lotuswordpro/source/filter/lwptblformula.cxx | 2 +- oox/source/ole/axcontrol.cxx | 4 +- package/source/xstor/xstorage.cxx | 46 +++++++++++----------- stoc/source/javavm/javavm.cxx | 2 +- svtools/source/control/valueacc.cxx | 8 ++-- svtools/source/table/tablecontrol_impl.cxx | 8 ++-- svtools/source/uno/unoimap.cxx | 2 +- svx/source/customshapes/EnhancedCustomShape2d.cxx | 4 +- svx/source/unodraw/unoprov.cxx | 2 +- sw/source/core/docnode/ndcopy.cxx | 3 +- sw/source/filter/ww8/ww8scan.cxx | 2 +- .../source/helper/documentsignaturehelper.cxx | 2 +- 16 files changed, 47 insertions(+), 53 deletions(-) diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 7087ea406cb5..a13ca70f948e 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -231,7 +231,7 @@ namespace drawinglayer const double fPixelVectorFactor(aPixelVector.getLength()); for(::std::vector< double >::const_iterator aStart(rTextCandidate.getDXArray().begin()); - aStart != rTextCandidate.getDXArray().end(); aStart++) + aStart != rTextCandidate.getDXArray().end(); ++aStart) { aTransformedDXArray.push_back(basegfx::fround((*aStart) * fPixelVectorFactor)); } diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 2a5fc808180a..468be3e9d86c 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -1359,7 +1359,7 @@ UpdateCheck::setUpdateInfo(const UpdateInfo& aInfo) rModel->updateLastChecked(); UpdateState eUIState; - if( m_aUpdateInfo.Sources.size() > 0 ) + if( !m_aUpdateInfo.Sources.empty() ) { rModel->storeUpdateFound(aInfo, getBuildId()); diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx index 5a59b4e070fe..e5e1087e2be3 100644 --- a/extensions/source/update/check/updateprotocol.cxx +++ b/extensions/source/update/check/updateprotocol.cxx @@ -231,13 +231,8 @@ checkForUpdates( o_rUpdateInfo.ReleaseNotes.push_back(aRelNote); } } -/* - o_rUpdateInfo.ReleaseNotes.push_back( - ReleaseNote(1, UNISTRING("http://qa.openoffice.org/tests/online_update_test.html")) - ); -*/ - if( o_rUpdateInfo.Sources.size() > 0 ) + if( !o_rUpdateInfo.Sources.empty() ) return true; } } diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index 05ce115ad078..0d6264da06da 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -300,7 +300,7 @@ void LwpRowLayout::RegisterCurRowStyle(XFRow* pXFRow,sal_uInt16 nRowMark) */ sal_Int32 LwpRowLayout::FindMarkConnCell(sal_uInt8 nStartCol,sal_uInt8 nEndCol) { - if (m_ConnCellList.size() == 0) + if (m_ConnCellList.empty()) return -1; sal_uInt16 nSpannRows = 1; @@ -458,7 +458,7 @@ void LwpRowLayout::SetCellSplit(sal_uInt16 nEffectRows) */ sal_Bool LwpRowLayout::GetMergeCellFlag() { - if (m_ConnCellList.size() == 0) + if (m_ConnCellList.empty()) return sal_False; else return sal_True; diff --git a/lotuswordpro/source/filter/lwptblformula.cxx b/lotuswordpro/source/filter/lwptblformula.cxx index 55082cbefeb5..89c3f840a973 100644 --- a/lotuswordpro/source/filter/lwptblformula.cxx +++ b/lotuswordpro/source/filter/lwptblformula.cxx @@ -635,7 +635,7 @@ String LwpFormulaFunc::ToString(LwpTableLayout* pCellsMap) } //erase the last "|" - if (m_aArgs.size()>0) + if (!m_aArgs.empty()) { aFormula.Erase(aFormula.Len()-1,1); } diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx index 95a791d86b11..0eef022eaef7 100644 --- a/oox/source/ole/axcontrol.cxx +++ b/oox/source/ole/axcontrol.cxx @@ -1801,14 +1801,14 @@ HtmlSelectModel::importBinaryModel( BinaryInputStream& rInStrm ) } } } - if ( listValues.size() ) + if ( !listValues.empty() ) { msListData.realloc( listValues.size() ); sal_Int32 index = 0; for( std::vector< rtl::OUString >::iterator it = listValues.begin(); it != listValues.end(); ++it, ++index ) msListData[ index ] = *it; } - if ( selectedIndices.size() ) + if ( !selectedIndices.empty() ) { msIndices.realloc( selectedIndices.size() ); sal_Int32 index = 0; diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 91c24e148c62..9c0c117f5e35 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -329,7 +329,7 @@ OStorage_Impl::~OStorage_Impl() else if ( !m_aReadOnlyWrapList.empty() ) { for ( OStorageList_Impl::iterator pStorageIter = m_aReadOnlyWrapList.begin(); - pStorageIter != m_aReadOnlyWrapList.end(); pStorageIter++ ) + pStorageIter != m_aReadOnlyWrapList.end(); ++pStorageIter ) { uno::Reference< embed::XStorage > xTmp = pStorageIter->m_xWeakRef; if ( xTmp.is() ) @@ -349,13 +349,13 @@ OStorage_Impl::~OStorage_Impl() } for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); - pElementIter != m_aChildrenList.end(); pElementIter++ ) + pElementIter != m_aChildrenList.end(); ++pElementIter ) delete *pElementIter; m_aChildrenList.clear(); for ( SotElementList_Impl::iterator pDeletedIter = m_aDeletedList.begin(); - pDeletedIter != m_aDeletedList.end(); pDeletedIter++ ) + pDeletedIter != m_aDeletedList.end(); ++pDeletedIter ) delete *pDeletedIter; m_aDeletedList.clear(); @@ -370,7 +370,7 @@ OStorage_Impl::~OStorage_Impl() m_xPackage = uno::Reference< lang::XSingleServiceFactory >(); ::rtl::OUString aPropertyName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); - for ( sal_Int32 aInd = 0; aInd < m_xProperties.getLength(); aInd++ ) + for ( sal_Int32 aInd = 0; aInd < m_xProperties.getLength(); ++aInd ) { if ( m_xProperties[aInd].Name.equals( aPropertyName ) ) { @@ -452,11 +452,11 @@ void OStorage_Impl::RemoveReadOnlyWrap( OStorage& aStorage ) } OStorageList_Impl::iterator pIterToDelete( pStorageIter ); - pStorageIter++; + ++pStorageIter; m_aReadOnlyWrapList.erase( pIterToDelete ); } else - pStorageIter++; + ++pStorageIter; } } @@ -727,7 +727,7 @@ void OStorage_Impl::CopyToStorage( const uno::Reference< embed::XStorage >& xDes throw embed::InvalidStorageException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference< uno::XInterface >() ); for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); - pElementIter != m_aChildrenList.end(); pElementIter++ ) + pElementIter != m_aChildrenList.end(); ++pElementIter ) { if ( !(*pElementIter)->m_bIsRemoved ) CopyStorageElement( *pElementIter, xDest, (*pElementIter)->m_aName, bDirect ); @@ -1099,7 +1099,7 @@ void OStorage_Impl::Commit() // remove replaced removed elements for ( SotElementList_Impl::iterator pDeletedIter = m_aDeletedList.begin(); pDeletedIter != m_aDeletedList.end(); - pDeletedIter++ ) + ++pDeletedIter ) { if ( m_nStorageType == embed::StorageFormats::OFOPXML && !(*pDeletedIter)->m_bIsStorage ) @@ -1131,17 +1131,17 @@ void OStorage_Impl::Commit() SotElement_Impl* pToDelete = *pElementIter; - pElementIter++; // to let the iterator be valid it should be increased before removing + ++pElementIter; // to let the iterator be valid it should be increased before removing m_aChildrenList.remove( pToDelete ); delete pToDelete; } else - pElementIter++; + ++pElementIter; } // there should be no more deleted elements - for ( pElementIter = m_aChildrenList.begin(); pElementIter != m_aChildrenList.end(); pElementIter++ ) + for ( pElementIter = m_aChildrenList.begin(); pElementIter != m_aChildrenList.end(); ++pElementIter ) { // if it is a 'duplicate commit' inserted elements must be really inserted to package later // since thay can conflict with renamed elements @@ -1215,7 +1215,7 @@ void OStorage_Impl::Commit() } } - for ( pElementIter = m_aChildrenList.begin(); pElementIter != m_aChildrenList.end(); pElementIter++ ) + for ( pElementIter = m_aChildrenList.begin(); pElementIter != m_aChildrenList.end(); ++pElementIter ) { // now inserted elements can be inserted to the package if ( (*pElementIter)->m_bIsInserted ) @@ -1328,7 +1328,7 @@ void OStorage_Impl::Revert() { SotElement_Impl* pToDelete = *pElementIter; - pElementIter++; // to let the iterator be valid it should be increased before removing + ++pElementIter; // to let the iterator be valid it should be increased before removing m_aChildrenList.remove( pToDelete ); delete pToDelete; @@ -1340,14 +1340,14 @@ void OStorage_Impl::Revert() (*pElementIter)->m_aName = (*pElementIter)->m_aOriginalName; (*pElementIter)->m_bIsRemoved = sal_False; - pElementIter++; + ++pElementIter; } } // return replaced removed elements for ( SotElementList_Impl::iterator pDeletedIter = m_aDeletedList.begin(); pDeletedIter != m_aDeletedList.end(); - pDeletedIter++ ) + ++pDeletedIter ) { m_aChildrenList.push_back( (*pDeletedIter) ); @@ -1407,7 +1407,7 @@ SotElement_Impl* OStorage_Impl::FindElement( const ::rtl::OUString& rName ) ReadContents(); for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); - pElementIter != m_aChildrenList.end(); pElementIter++ ) + pElementIter != m_aChildrenList.end(); ++pElementIter ) { if ( (*pElementIter)->m_aName == rName && !(*pElementIter)->m_bIsRemoved ) return *pElementIter; @@ -1543,7 +1543,7 @@ SotElement_Impl* OStorage_Impl::InsertElement( ::rtl::OUString aName, sal_Bool b SotElement_Impl* pDeletedElm = NULL; for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); - pElementIter != m_aChildrenList.end(); pElementIter++ ) + pElementIter != m_aChildrenList.end(); ++pElementIter ) { if ( (*pElementIter)->m_aName == aName ) { @@ -1638,7 +1638,7 @@ uno::Sequence< ::rtl::OUString > OStorage_Impl::GetElementNames() sal_uInt32 nInd = 0; for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin(); - pElementIter != m_aChildrenList.end(); pElementIter++ ) + pElementIter != m_aChildrenList.end(); ++pElementIter ) { if ( !(*pElementIter)->m_bIsRemoved ) aElementNames[nInd++] = (*pElementIter)->m_aName; @@ -2040,7 +2040,7 @@ void SAL_CALL OStorage::InternalDispose( sal_Bool bNotifyImpl ) if ( !m_pData->m_aOpenSubComponentsList.empty() ) { for ( WeakComponentList::iterator pCompIter = m_pData->m_aOpenSubComponentsList.begin(); - pCompIter != m_pData->m_aOpenSubComponentsList.end(); pCompIter++ ) + pCompIter != m_pData->m_aOpenSubComponentsList.end(); ++pCompIter ) { uno::Reference< lang::XComponent > xTmp = (*pCompIter); if ( xTmp.is() ) @@ -2101,11 +2101,11 @@ void OStorage::ChildIsDisposed( const uno::Reference< uno::XInterface >& xChild if ( !xTmp.is() || xTmp == xChild ) { WeakComponentList::iterator pIterToRemove = pCompIter; - pCompIter++; + ++pCompIter; m_pData->m_aOpenSubComponentsList.erase( pIterToRemove ); } else - pCompIter++; + ++pCompIter; } } } @@ -2675,7 +2675,7 @@ uno::Reference< embed::XStorage > SAL_CALL OStorage::openStorageElement( pElementIter != pElement->m_pStorage->m_aChildrenList.end(); ) { SotElement_Impl* pElementToDel = (*pElementIter); - pElementIter++; + ++pElementIter; m_pImpl->RemoveElement( pElementToDel ); } @@ -4193,7 +4193,7 @@ void SAL_CALL OStorage::revert() } for ( SotElementList_Impl::iterator pElementIter = m_pImpl->m_aChildrenList.begin(); - pElementIter != m_pImpl->m_aChildrenList.end(); pElementIter++ ) + pElementIter != m_pImpl->m_aChildrenList.end(); ++pElementIter ) { if ( ((*pElementIter)->m_pStorage && ( (*pElementIter)->m_pStorage->m_pAntiImpl || !(*pElementIter)->m_pStorage->m_aReadOnlyWrapList.empty() )) diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index ffdf02e1c36f..4ba0c78e70ce 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -1551,7 +1551,7 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset) const ::std::vector< rtl::OUString> & Props = jvm.getProperties(); typedef ::std::vector< rtl::OUString >::const_iterator C_IT; - for( C_IT i= Props.begin(); i != Props.end(); i++) + for( C_IT i= Props.begin(); i != Props.end(); ++i) { rtl::OUString prop= *i; sal_Int32 index= prop.indexOf( (sal_Unicode)'='); diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx index 137c17a65faf..ced04f665fcc 100644 --- a/svtools/source/control/valueacc.cxx +++ b/svtools/source/control/valueacc.cxx @@ -391,7 +391,7 @@ void SAL_CALL ValueSetAcc::addEventListener( const uno::Reference< accessibility if( *aIter == rxListener ) bFound = sal_True; else - aIter++; + ++aIter; } if (!bFound) @@ -420,7 +420,7 @@ void SAL_CALL ValueSetAcc::removeEventListener( const uno::Reference< accessibil bFound = sal_True; } else - aIter++; + ++aIter; } } } @@ -1066,7 +1066,7 @@ void SAL_CALL ValueItemAcc::addEventListener( const uno::Reference< accessibilit if( *aIter == rxListener ) bFound = sal_True; else - aIter++; + ++aIter; } if (!bFound) @@ -1094,7 +1094,7 @@ void SAL_CALL ValueItemAcc::removeEventListener( const uno::Reference< accessibi bFound = sal_True; } else - aIter++; + ++aIter; } } } diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index bbcdbfaddeb6..cf486bba5149 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1477,7 +1477,7 @@ namespace svt { namespace table if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) { //if other rows already selected, deselect them - if(m_aSelectedRows.size()>0) + if(!m_aSelectedRows.empty()) { for(std::vector::iterator it=m_aSelectedRows.begin(); it!=m_aSelectedRows.end();++it) @@ -1508,7 +1508,7 @@ namespace svt { namespace table case cursorUp: if(m_pSelEngine->GetSelectionMode() == SINGLE_SELECTION) { - if(m_aSelectedRows.size()>0) + if(!m_aSelectedRows.empty()) { for(std::vector::iterator it=m_aSelectedRows.begin(); it!=m_aSelectedRows.end();++it) @@ -1625,7 +1625,7 @@ namespace svt { namespace table else { //there are other selected rows - if(m_aSelectedRows.size()>0) + if(!m_aSelectedRows.empty()) { //the anchor wasn't set -> a region is not selected, that's why clear all selection //and select the current row @@ -1712,7 +1712,7 @@ namespace svt { namespace table } else { - if(m_aSelectedRows.size()>0) + if(!m_aSelectedRows.empty()) { //the anchor wasn't set -> a region is not selected, that's why clear all selection //and select the current row diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 6c8527ffedc7..29bc879c0cf0 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -725,7 +725,7 @@ Type SAL_CALL SvUnoImageMap::getElementType( ) throw(RuntimeException) sal_Bool SAL_CALL SvUnoImageMap::hasElements( ) throw(RuntimeException) { - return maObjectList.size() != 0; + return (!maObjectList.empty()); } // XSerivceInfo diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index ea757e9ec0fc..1d0baff17e5d 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -2013,7 +2013,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl SdrObject* pRet = NULL; sal_uInt32 i; - if ( vObjectList.size() ) + if ( !vObjectList.empty() ) { const SfxItemSet& rCustomShapeSet = pCustomShapeObj->GetMergedItemSet(); Color aFillColor; @@ -2021,7 +2021,7 @@ SdrObject* EnhancedCustomShape2d::CreatePathObj( sal_Bool bLineGeometryNeededOnl sal_uInt32 nColorIndex = 0; // #i37011# remove invisible objects - if(vObjectList.size()) + if(!vObjectList.empty()) { std::vector< SdrPathObj* > vTempList; diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 4634589a4fbb..743d2b72e74c 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -910,7 +910,7 @@ uno::Sequence< OUString > UHashMap::getServiceNames() OUString* pStrings = aSeq.getArray(); int i = 0; - for (UHashMapImpl::const_iterator it = rMap.begin(); it != rMap.end(); it++) + for (UHashMapImpl::const_iterator it = rMap.begin(); it != rMap.end(); ++it) pStrings[i++] = it->first; return aSeq; diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index a4ee1447052e..97709cd98e8f 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -206,10 +206,9 @@ namespace ::sw::mark::IFieldmark::parameter_map_t* pNewParams = pNewFieldmark->GetParameters(); const ::sw::mark::IFieldmark::parameter_map_t* pOldParams = pOldFieldmark->GetParameters(); ::sw::mark::IFieldmark::parameter_map_t::const_iterator pIt = pOldParams->begin(); - while ( pIt != pOldParams->end() ) + for (; pIt != pOldParams->end(); ++pIt ) { pNewParams->insert( *pIt ); - pIt++; } } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index ac92dd268a09..964929bab740 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -6617,7 +6617,7 @@ bool WW8PLCF_HdFt::GetTextPos(sal_uInt8 grpfIhdt, sal_uInt8 nWhich, WW8_CP& rSta aPLCF.SetIdx( nIdx ); // Lookup suitable CP aPLCF.Get( rStart, nEnd, pData ); rLen = nEnd - rStart; - aPLCF++; + ++aPLCF; return true; } diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx b/xmlsecurity/source/helper/documentsignaturehelper.cxx index 2c33af2dc372..fc06f9e7555c 100644 --- a/xmlsecurity/source/helper/documentsignaturehelper.cxx +++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx @@ -155,7 +155,7 @@ bool DocumentSignatureHelper::isOOo3_2_Signature(const SignatureInformation & si bool bOOo3_2 = false; typedef ::std::vector< SignatureReferenceInformation >::const_iterator CIT; for (CIT i = sigInfo.vSignatureReferenceInfors.begin(); - i < sigInfo.vSignatureReferenceInfors.end(); i++) + i < sigInfo.vSignatureReferenceInfors.end(); ++i) { if (i->ouURI.equals(sManifestURI)) { -- cgit