diff options
author | Kayo Hamid <kayo.hamid@gekkolinux.com.br> | 2011-04-22 23:40:55 -0400 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-04-26 15:25:15 +0100 |
commit | ed4efad472e383b68f0a41a4bf7e4444c3f6001c (patch) | |
tree | 7fce76d4aee075759c605386be341e5b6834481e | |
parent | e9d1ceffe609e34c4f02bc76237117ada0742cd1 (diff) |
inefficient emptiness check
-rw-r--r-- | extensions/source/bibliography/general.cxx | 4 | ||||
-rw-r--r-- | lingucomponent/source/languageguessing/simpleguesser.cxx | 2 | ||||
-rw-r--r-- | xmlsecurity/source/framework/buffernode.cxx | 8 | ||||
-rw-r--r-- | xmlsecurity/source/framework/saxeventkeeperimpl.cxx | 6 | ||||
-rw-r--r-- | xmlsecurity/tools/demo/performance.cxx | 16 |
5 files changed, 18 insertions, 18 deletions
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 37c14247d..9c5910613 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -849,7 +849,7 @@ sal_Bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent ) if( pWindow->HasChildPathFocus() ) { // save focused control DBG_ASSERT( nFocused == 0xFFFF, "+BibGeneralPage::HandleShortCutKey(): more than one with focus?!" ); - DBG_ASSERT( aMatchList.size() > 0, "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" ); + DBG_ASSERT( !aMatchList.empty(), "+BibGeneralPage::HandleShortCutKey(): push_back and no content?!" ); nFocused = aMatchList.size() - 1; } } @@ -859,7 +859,7 @@ sal_Bool BibGeneralPage::HandleShortCutKey( const KeyEvent& rKeyEvent ) if( bHandled ) { - DBG_ASSERT( aMatchList.size() > 0, "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." ); + DBG_ASSERT( !aMatchList.empty(), "*BibGeneralPage::HandleShortCutKey(): be prepared to crash..." ); if( nFocused >= ( aMatchList.size() - 1 ) ) // >=... includes 0xFFFF diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx index 8bc444b8f..68c53318f 100644 --- a/lingucomponent/source/languageguessing/simpleguesser.cxx +++ b/lingucomponent/source/languageguessing/simpleguesser.cxx @@ -155,7 +155,7 @@ vector<Guess> SimpleGuesser::GuessLanguage(char* text) Guess SimpleGuesser::GuessPrimaryLanguage(char* text) { vector<Guess> ret = GuessLanguage(text); - if(ret.size() > 0){ + if(!ret.empty()){ return GuessLanguage(text)[0]; } else{ diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx index 60497bbd3..e6f1c6334 100644 --- a/xmlsecurity/source/framework/buffernode.cxx +++ b/xmlsecurity/source/framework/buffernode.cxx @@ -325,7 +325,7 @@ bool BufferNode::hasAnything() const * Email: michael.mi@sun.com ******************************************************************************/ { - return (m_pBlocker != NULL || m_vElementCollectors.size() > 0); + return (m_pBlocker != NULL || !m_vElementCollectors.empty()); } bool BufferNode::hasChildren() const @@ -352,7 +352,7 @@ bool BufferNode::hasChildren() const * Email: michael.mi@sun.com ******************************************************************************/ { - return (m_vChildren.size() > 0); + return (!m_vChildren.empty()); } std::vector< const BufferNode* >* BufferNode::getChildren() const @@ -386,7 +386,7 @@ const BufferNode* BufferNode::getFirstChild() const { BufferNode* rc = NULL; - if (m_vChildren.size() > 0) + if (!m_vChildren.empty()) { rc = (BufferNode*)m_vChildren.front(); } @@ -895,7 +895,7 @@ void BufferNode::elementCollectorNotify() * Email: michael.mi@sun.com ******************************************************************************/ { - if (m_vElementCollectors.size()>0) + if (!m_vElementCollectors.empty()) { cssxc::sax::ElementMarkPriority nMaxPriority = cssxc::sax::ElementMarkPriority_MINIMUM; cssxc::sax::ElementMarkPriority nPriority; diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx index 5a8c286ac..076128eb1 100644 --- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx +++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx @@ -163,7 +163,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() { BufferNode* pBufferNode = NULL; - if ( (m_vNewElementCollectors.size()>0) || + if ( (!m_vNewElementCollectors.empty()) || (m_pNewBlocker != NULL)) { /* @@ -204,7 +204,7 @@ BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers() m_pNewBlocker = NULL; } - if (m_vNewElementCollectors.size()>0) + if (!m_vNewElementCollectors.empty()) { std::vector< const ElementCollector* >::const_iterator ii = m_vNewElementCollectors.begin(); @@ -715,7 +715,7 @@ void SAXEventKeeperImpl::releaseElementMarkBuffer() ******************************************************************************/ { m_bIsReleasing = true; - while (m_vReleasedElementMarkBuffers.size()>0) + while (!m_vReleasedElementMarkBuffers.empty()) { std::vector< sal_Int32 >::iterator pId = m_vReleasedElementMarkBuffers.begin(); sal_Int32 nId = *pId; diff --git a/xmlsecurity/tools/demo/performance.cxx b/xmlsecurity/tools/demo/performance.cxx index 489d07ca8..c30a57383 100644 --- a/xmlsecurity/tools/demo/performance.cxx +++ b/xmlsecurity/tools/demo/performance.cxx @@ -522,10 +522,10 @@ rtl::OUString XSecTester::parseFile( m_bIsBlocking = false; m_bIsInsideCollectedElement = false; - OSL_ASSERT(m_vSignatureList.size() == 0); - OSL_ASSERT(m_vUnsolvedReferenceURIs.size() == 0); - OSL_ASSERT(m_vUnsolvedReferenceKeeperIds.size() == 0); - OSL_ASSERT(m_vUnsolvedReferenceRefNums.size() == 0); + OSL_ASSERT(m_vSignatureList.empty()); + OSL_ASSERT(m_vUnsolvedReferenceURIs.empty()); + OSL_ASSERT(m_vUnsolvedReferenceKeeperIds.empty()); + OSL_ASSERT(m_vUnsolvedReferenceRefNums.empty()); OSL_ASSERT(m_stCurrentPath.empty()); OSL_ASSERT(m_stCurrentPathType.empty()); OSL_ASSERT(m_vAncestorEvents.empty()); @@ -1510,9 +1510,9 @@ void XSecTester::checkReference( void XSecTester::endMission() { - while (m_vSignatureList.size() > 0) + while (!m_vSignatureList.empty()) { - if (m_vSignatureList.size()>0) + if (!m_vSignatureList.empty()) { SignatureEntity * pSignatureEntity = m_vSignatureList.at(0); m_vSignatureList.erase(m_vSignatureList.begin()); @@ -1521,7 +1521,7 @@ void XSecTester::endMission() } } - while (m_vUnsolvedReferenceURIs.size()>0) + while (!m_vUnsolvedReferenceURIs.empty()) { int nKeeperId = m_vUnsolvedReferenceKeeperIds.at(0); m_xSAXEventKeeper->removeElementCollector(nKeeperId); @@ -1641,7 +1641,7 @@ void XSecTester::flushAncestorEvents( /* free the ancestor events list */ std::vector< AncestorEvent* >::iterator jj; - while (m_vAncestorEvents.size()>0) + while (!m_vAncestorEvents.empty()) { jj = m_vAncestorEvents.begin(); delete *jj; |