summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-08-03 11:36:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-03 12:20:53 +0200
commit05ab38359ae72f2a54dc0b5f1b84ac5f649c507a (patch)
tree5830c7ee2442984e0bc804def7bd95ddd8a25410 /unotools
parent5afdcad4c0e7850b18996c549892b9360cd8973f (diff)
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/accessibility/accessiblerelationsethelper.cxx10
-rw-r--r--unotools/source/accessibility/accessiblestatesethelper.cxx12
-rw-r--r--unotools/source/config/itemholder1.cxx4
-rw-r--r--unotools/source/i18n/charclass.cxx40
-rw-r--r--unotools/source/i18n/textsearch.cxx2
-rw-r--r--unotools/source/streaming/streamhelper.cxx12
-rw-r--r--unotools/source/streaming/streamwrap.cxx14
-rw-r--r--unotools/source/ucbhelper/ucblockbytes.cxx8
8 files changed, 51 insertions, 51 deletions
diff --git a/unotools/source/accessibility/accessiblerelationsethelper.cxx b/unotools/source/accessibility/accessiblerelationsethelper.cxx
index e7bf704a300b..323b12c53506 100644
--- a/unotools/source/accessibility/accessiblerelationsethelper.cxx
+++ b/unotools/source/accessibility/accessiblerelationsethelper.cxx
@@ -66,7 +66,7 @@ AccessibleRelationSetHelper::~AccessibleRelationSetHelper()
sal_Int32 SAL_CALL
AccessibleRelationSetHelper::getRelationCount( )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return maRelations.size();
}
@@ -87,7 +87,7 @@ sal_Int32 SAL_CALL
AccessibleRelation SAL_CALL
AccessibleRelationSetHelper::getRelation( sal_Int32 nIndex )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= maRelations.size()))
throw lang::IndexOutOfBoundsException();
@@ -110,7 +110,7 @@ sal_Int32 SAL_CALL
sal_Bool SAL_CALL
AccessibleRelationSetHelper::containsRelation( sal_Int16 aRelationType )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
AccessibleRelation defaultRelation; // default is INVALID
AccessibleRelation relationByType = lcl_getRelationByType(maRelations, aRelationType);
@@ -131,14 +131,14 @@ sal_Bool SAL_CALL
AccessibleRelation SAL_CALL
AccessibleRelationSetHelper::getRelationByType( sal_Int16 aRelationType )
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return lcl_getRelationByType(maRelations, aRelationType);
}
void AccessibleRelationSetHelper::AddRelation(const AccessibleRelation& rRelation)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
for (auto& aRelation: maRelations)
{
diff --git a/unotools/source/accessibility/accessiblestatesethelper.cxx b/unotools/source/accessibility/accessiblestatesethelper.cxx
index db725d079a06..1c3ccc8ff6de 100644
--- a/unotools/source/accessibility/accessiblestatesethelper.cxx
+++ b/unotools/source/accessibility/accessiblestatesethelper.cxx
@@ -70,7 +70,7 @@ AccessibleStateSetHelper::~AccessibleStateSetHelper()
*/
sal_Bool SAL_CALL AccessibleStateSetHelper::isEmpty ()
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return maStates == 0;
}
@@ -87,7 +87,7 @@ sal_Bool SAL_CALL AccessibleStateSetHelper::isEmpty ()
*/
sal_Bool SAL_CALL AccessibleStateSetHelper::contains (sal_Int16 aState)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return lcl_contains(maStates, aState);
}
@@ -110,14 +110,14 @@ sal_Bool SAL_CALL AccessibleStateSetHelper::contains (sal_Int16 aState)
sal_Bool SAL_CALL AccessibleStateSetHelper::containsAll
(const uno::Sequence<sal_Int16>& rStateSet)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
return std::all_of(rStateSet.begin(), rStateSet.end(),
[this](const sal_Int16 nState) { return lcl_contains(maStates, nState); });
}
uno::Sequence<sal_Int16> SAL_CALL AccessibleStateSetHelper::getStates()
{
- std::lock_guard aGuard(maMutex);
+ std::scoped_lock aGuard(maMutex);
uno::Sequence<sal_Int16> aRet(BITFIELDSIZE);
sal_Int16* pSeq = aRet.getArray();
sal_Int16 nStateCount(0);
@@ -134,7 +134,7 @@ uno::Sequence<sal_Int16> SAL_CALL AccessibleStateSetHelper::getStates()
void AccessibleStateSetHelper::AddState(sal_Int16 aState)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small");
sal_uInt64 aTempBitSet(1);
aTempBitSet <<= aState;
@@ -143,7 +143,7 @@ void AccessibleStateSetHelper::AddState(sal_Int16 aState)
void AccessibleStateSetHelper::RemoveState(sal_Int16 aState)
{
- std::lock_guard aGuard (maMutex);
+ std::scoped_lock aGuard (maMutex);
DBG_ASSERT(aState < BITFIELDSIZE, "the statesset is too small");
sal_uInt64 aTempBitSet(1);
aTempBitSet <<= aState;
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 7870e63ae888..5931026995ac 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -86,7 +86,7 @@ void SAL_CALL ItemHolder1::disposing(const css::lang::EventObject&)
void ItemHolder1::impl_addItem(EItem eItem)
{
- std::lock_guard aLock(m_aLock);
+ std::scoped_lock aLock(m_aLock);
for ( auto const & rInfo : m_lItems )
{
@@ -105,7 +105,7 @@ void ItemHolder1::impl_releaseAllItems()
{
std::vector< TItemInfo > items;
{
- std::lock_guard aLock(m_aLock);
+ std::scoped_lock aLock(m_aLock);
items.swap(m_lItems);
}
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
index 7c1c2b92d4c4..c326e4315681 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -53,13 +53,13 @@ CharClass::~CharClass()
void CharClass::setLanguageTag( const LanguageTag& rLanguageTag )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
maLanguageTag = rLanguageTag;
}
const LanguageTag& CharClass::getLanguageTag() const
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return maLanguageTag;
}
@@ -115,7 +115,7 @@ bool CharClass::isAlpha( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
nCharClassAlphaType) != 0;
}
@@ -137,7 +137,7 @@ bool CharClass::isLetter( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
nCharClassLetterType) != 0;
}
@@ -155,7 +155,7 @@ bool CharClass::isLetter( const OUString& rStr ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return isLetterType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
}
}
@@ -176,7 +176,7 @@ bool CharClass::isDigit( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
KCharacterType::DIGIT) != 0;
}
@@ -194,7 +194,7 @@ bool CharClass::isNumeric( const OUString& rStr ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return isNumericType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
}
}
@@ -215,7 +215,7 @@ bool CharClass::isAlphaNumeric( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
(nCharClassAlphaType | KCharacterType::DIGIT)) != 0;
}
@@ -237,7 +237,7 @@ bool CharClass::isLetterNumeric( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return (xCC->getCharacterType( rStr, nPos, getMyLocale() ) &
(nCharClassLetterType | KCharacterType::DIGIT)) != 0;
}
@@ -255,7 +255,7 @@ bool CharClass::isLetterNumeric( const OUString& rStr ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return isLetterNumericType( xCC->getStringType( rStr, 0, rStr.getLength(), getMyLocale() ) );
}
}
@@ -272,7 +272,7 @@ OUString CharClass::titlecase(const OUString& rStr, sal_Int32 nPos, sal_Int32 nC
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->toTitle( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -289,7 +289,7 @@ OUString CharClass::uppercase( const OUString& rStr, sal_Int32 nPos, sal_Int32 n
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->toUpper( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -306,7 +306,7 @@ OUString CharClass::lowercase( const OUString& rStr, sal_Int32 nPos, sal_Int32 n
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->toLower( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -323,7 +323,7 @@ sal_Int16 CharClass::getType( const OUString& rStr, sal_Int32 nPos ) const
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->getType( rStr, nPos );
}
}
@@ -340,7 +340,7 @@ css::i18n::DirectionProperty CharClass::getCharacterDirection( const OUString& r
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return static_cast<css::i18n::DirectionProperty>(xCC->getCharacterDirection( rStr, nPos ));
}
}
@@ -357,7 +357,7 @@ css::i18n::UnicodeScript CharClass::getScript( const OUString& rStr, sal_Int32 n
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return static_cast<css::i18n::UnicodeScript>(xCC->getScript( rStr, nPos ));
}
}
@@ -374,7 +374,7 @@ sal_Int32 CharClass::getCharacterType( const OUString& rStr, sal_Int32 nPos ) co
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->getCharacterType( rStr, nPos, getMyLocale() );
}
}
@@ -391,7 +391,7 @@ sal_Int32 CharClass::getStringType( const OUString& rStr, sal_Int32 nPos, sal_In
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->getStringType( rStr, nPos, nCount, getMyLocale() );
}
}
@@ -414,7 +414,7 @@ css::i18n::ParseResult CharClass::parseAnyToken(
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->parseAnyToken( rStr, nPos, getMyLocale(),
nStartCharFlags, userDefinedCharactersStart,
nContCharFlags, userDefinedCharactersCont );
@@ -440,7 +440,7 @@ css::i18n::ParseResult CharClass::parsePredefinedToken(
{
if ( xCC.is() )
{
- std::lock_guard aGuard( aMutex );
+ std::scoped_lock aGuard( aMutex );
return xCC->parsePredefinedToken( nTokenType, rStr, nPos, getMyLocale(),
nStartCharFlags, userDefinedCharactersStart,
nContCharFlags, userDefinedCharactersCont );
diff --git a/unotools/source/i18n/textsearch.cxx b/unotools/source/i18n/textsearch.cxx
index 38c089f7c835..ba75b0b2319b 100644
--- a/unotools/source/i18n/textsearch.cxx
+++ b/unotools/source/i18n/textsearch.cxx
@@ -104,7 +104,7 @@ Reference<XTextSearch2> TextSearch::getXTextSearch( const i18nutil::SearchOption
{
static CachedTextSearch theCachedTextSearch;
- std::lock_guard aGuard(theCachedTextSearch.mutex);
+ std::scoped_lock aGuard(theCachedTextSearch.mutex);
if ( lcl_Equals(theCachedTextSearch.Options, rPara) )
return theCachedTextSearch.xTextSearch;
diff --git a/unotools/source/streaming/streamhelper.cxx b/unotools/source/streaming/streamhelper.cxx
index bd8824d9456f..63820352179d 100644
--- a/unotools/source/streaming/streamhelper.cxx
+++ b/unotools/source/streaming/streamhelper.cxx
@@ -36,7 +36,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >&
if (nBytesToRead < 0)
throw css::io::BufferSizeExceededException(OUString(), static_cast<css::uno::XWeak*>(this));
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead);
@@ -56,7 +56,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readBytes(css::uno::Sequence< sal_Int8 >&
void SAL_CALL OInputStreamHelper::seek( sal_Int64 location )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
m_nActPos = location;
}
@@ -70,7 +70,7 @@ sal_Int64 SAL_CALL OInputStreamHelper::getLength( )
if (!m_xLockBytes.is())
return 0;
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
SvLockBytesStat aStat;
m_xLockBytes->Stat( &aStat );
return aStat.nSize;
@@ -85,7 +85,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::readSomeBytes(css::uno::Sequence< sal_Int
void SAL_CALL OInputStreamHelper::skipBytes(sal_Int32 nBytesToSkip)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_xLockBytes.is())
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
@@ -97,7 +97,7 @@ void SAL_CALL OInputStreamHelper::skipBytes(sal_Int32 nBytesToSkip)
sal_Int32 SAL_CALL OInputStreamHelper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_xLockBytes.is())
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
@@ -106,7 +106,7 @@ sal_Int32 SAL_CALL OInputStreamHelper::available()
void SAL_CALL OInputStreamHelper::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (!m_xLockBytes.is())
throw css::io::NotConnectedException(OUString(), static_cast<css::uno::XWeak*>(this));
diff --git a/unotools/source/streaming/streamwrap.cxx b/unotools/source/streaming/streamwrap.cxx
index 77e7168d69a2..9a9b53d1f1ec 100644
--- a/unotools/source/streaming/streamwrap.cxx
+++ b/unotools/source/streaming/streamwrap.cxx
@@ -63,7 +63,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readBytes(css::uno::Sequence< sal_Int8 >
if (nBytesToRead < 0)
throw css::io::BufferSizeExceededException(OUString(),static_cast<css::uno::XWeak*>(this));
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
if (aData.getLength() < nBytesToRead)
aData.realloc(nBytesToRead);
@@ -96,7 +96,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::readSomeBytes(css::uno::Sequence< sal_In
void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkError();
m_pSvStream->SeekRel(nBytesToSkip);
@@ -105,7 +105,7 @@ void SAL_CALL OInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip)
sal_Int32 SAL_CALL OInputStreamWrapper::available()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_Int64 nAvailable = m_pSvStream->remainingSize();
@@ -116,7 +116,7 @@ sal_Int32 SAL_CALL OInputStreamWrapper::available()
void SAL_CALL OInputStreamWrapper::closeInput()
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
if (m_bSvStreamOwner)
@@ -157,7 +157,7 @@ OSeekableInputStreamWrapper::OSeekableInputStreamWrapper(SvStream* _pStream, boo
void SAL_CALL OSeekableInputStreamWrapper::seek( sal_Int64 _nLocation )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
m_pSvStream->Seek(static_cast<sal_uInt32>(_nLocation));
@@ -166,7 +166,7 @@ void SAL_CALL OSeekableInputStreamWrapper::seek( sal_Int64 _nLocation )
sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getPosition( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
sal_uInt32 nPos = m_pSvStream->Tell();
@@ -176,7 +176,7 @@ sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getPosition( )
sal_Int64 SAL_CALL OSeekableInputStreamWrapper::getLength( )
{
- std::lock_guard aGuard( m_aMutex );
+ std::scoped_lock aGuard( m_aMutex );
checkConnected();
checkError();
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 1afa874d49f8..7394f106bd4f 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -308,7 +308,7 @@ public:
virtual Reference<XStream> SAL_CALL getStream () override
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
return m_xStream;
}
@@ -334,7 +334,7 @@ public:
virtual Reference<XInputStream> SAL_CALL getInputStream() override
{
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
return m_xStream;
}
@@ -358,7 +358,7 @@ ModeratorsActiveDataSink::setInputStream (
)
{
m_aModerator.setInputStream(rxInputStream);
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
m_xStream = rxInputStream;
}
@@ -376,7 +376,7 @@ ModeratorsActiveDataStreamer::setStream (
)
{
m_aModerator.setStream(rxStream);
- std::lock_guard aGuard(m_aMutex);
+ std::scoped_lock aGuard(m_aMutex);
m_xStream = rxStream;
}