diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-07 11:48:47 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-04-07 17:53:04 +0200 |
commit | 5a824268dfdd48c00f656b767b48cd12ccbdaabb (patch) | |
tree | a25f4afd3ca49cff41fc44559aedea70c82e6c7e /comphelper/source/container/enumhelper.cxx | |
parent | a6186a678cd9f67359da885606b3c3983f6bdc74 (diff) |
Don't use resettable/clearable guard where plain guard is enough
Also use scope where possible. This allows to limit guard scope at
language level; visualises the scope clearly; and helps avoiding
errors like fixed in commit 61e4437c857854b331fa01da6f39b2b3b58a800b.
Change-Id: Ifeca96e2df8e8a0897770d9546b2536806275f41
Reviewed-on: https://gerrit.libreoffice.org/70376
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'comphelper/source/container/enumhelper.cxx')
-rw-r--r-- | comphelper/source/container/enumhelper.cxx | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/comphelper/source/container/enumhelper.cxx b/comphelper/source/container/enumhelper.cxx index b62838d3b39c..41585ae24a8a 100644 --- a/comphelper/source/container/enumhelper.cxx +++ b/comphelper/source/container/enumhelper.cxx @@ -53,7 +53,7 @@ OEnumerationByName::~OEnumerationByName() sal_Bool SAL_CALL OEnumerationByName::hasMoreElements( ) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (m_xAccess.is() && m_aNames.getLength() > m_nPos) return true; @@ -70,7 +70,7 @@ sal_Bool SAL_CALL OEnumerationByName::hasMoreElements( ) css::uno::Any SAL_CALL OEnumerationByName::nextElement( ) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); css::uno::Any aRes; if (m_xAccess.is() && m_nPos < m_aNames.getLength()) @@ -91,7 +91,7 @@ css::uno::Any SAL_CALL OEnumerationByName::nextElement( ) void SAL_CALL OEnumerationByName::disposing(const css::lang::EventObject& aEvent) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (aEvent.Source == m_xAccess) m_xAccess.clear(); @@ -100,7 +100,7 @@ void SAL_CALL OEnumerationByName::disposing(const css::lang::EventObject& aEvent void OEnumerationByName::impl_startDisposeListening() { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (m_bListening) return; @@ -118,7 +118,7 @@ void OEnumerationByName::impl_startDisposeListening() void OEnumerationByName::impl_stopDisposeListening() { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (!m_bListening) return; @@ -150,7 +150,7 @@ OEnumerationByIndex::~OEnumerationByIndex() sal_Bool SAL_CALL OEnumerationByIndex::hasMoreElements( ) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (m_xAccess.is() && m_xAccess->getCount() > m_nPos) return true; @@ -167,7 +167,7 @@ sal_Bool SAL_CALL OEnumerationByIndex::hasMoreElements( ) css::uno::Any SAL_CALL OEnumerationByIndex::nextElement( ) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); css::uno::Any aRes; if (m_xAccess.is() && m_nPos < m_xAccess->getCount()) @@ -187,7 +187,7 @@ css::uno::Any SAL_CALL OEnumerationByIndex::nextElement( ) void SAL_CALL OEnumerationByIndex::disposing(const css::lang::EventObject& aEvent) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (aEvent.Source == m_xAccess) m_xAccess.clear(); @@ -196,7 +196,7 @@ void SAL_CALL OEnumerationByIndex::disposing(const css::lang::EventObject& aEven void OEnumerationByIndex::impl_startDisposeListening() { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (m_bListening) return; @@ -214,7 +214,7 @@ void OEnumerationByIndex::impl_startDisposeListening() void OEnumerationByIndex::impl_stopDisposeListening() { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); if (!m_bListening) return; @@ -243,7 +243,7 @@ OAnyEnumeration::~OAnyEnumeration() sal_Bool SAL_CALL OAnyEnumeration::hasMoreElements( ) { - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); return (m_lItems.getLength() > m_nPos); } @@ -254,7 +254,7 @@ css::uno::Any SAL_CALL OAnyEnumeration::nextElement( ) if ( ! hasMoreElements()) throw css::container::NoSuchElementException(); - ::osl::ResettableMutexGuard aLock(m_aLock); + osl::MutexGuard aLock(m_aLock); sal_Int32 nPos = m_nPos; ++m_nPos; return m_lItems[nPos]; |