summaryrefslogtreecommitdiff
path: root/unoxml/source
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 /unoxml/source
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 'unoxml/source')
-rw-r--r--unoxml/source/dom/documentbuilder.cxx12
-rw-r--r--unoxml/source/dom/saxbuilder.cxx28
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx52
-rw-r--r--unoxml/source/xpath/xpathapi.cxx10
4 files changed, 51 insertions, 51 deletions
diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx
index b40a7347ea08..3da15ee7d7e9 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -129,7 +129,7 @@ namespace DOM
Reference< XDocument > SAL_CALL CDocumentBuilder::newDocument()
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
// create a new document
xmlDocPtr pDocument = xmlNewDoc(reinterpret_cast<const xmlChar*>("1.0"));
@@ -333,7 +333,7 @@ namespace DOM
throw RuntimeException();
}
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
// IO context struct. Must outlive pContext, as destroying that via
// xmlFreeParserCtxt may still access this context_t
@@ -364,7 +364,7 @@ namespace DOM
Reference< XDocument > SAL_CALL CDocumentBuilder::parseURI(const OUString& sUri)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
std::unique_ptr<xmlParserCtxt, XmlFreeParserCtxt> const pContext(
xmlNewParserCtxt());
@@ -403,14 +403,14 @@ namespace DOM
void SAL_CALL
CDocumentBuilder::setEntityResolver(Reference< XEntityResolver > const& xER)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_xEntityResolver = xER;
}
Reference< XEntityResolver > CDocumentBuilder::getEntityResolver()
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
return m_xEntityResolver;
}
@@ -418,7 +418,7 @@ namespace DOM
void SAL_CALL
CDocumentBuilder::setErrorHandler(Reference< XErrorHandler > const& xEH)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_xErrorHandler = xEH;
}
diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index ab174e3052cd..43dd54ed3130 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -55,14 +55,14 @@ namespace DOM
SAXDocumentBuilderState SAL_CALL CSAXDocumentBuilder::getState()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
return m_aState;
}
void SAL_CALL CSAXDocumentBuilder::reset()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
m_aDocument.clear();
m_aFragment.clear();
@@ -72,7 +72,7 @@ namespace DOM
Reference< XDocument > SAL_CALL CSAXDocumentBuilder::getDocument()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if (m_aState != SAXDocumentBuilderState_DOCUMENT_FINISHED)
throw RuntimeException();
@@ -82,7 +82,7 @@ namespace DOM
Reference< XDocumentFragment > SAL_CALL CSAXDocumentBuilder::getDocumentFragment()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if (m_aState != SAXDocumentBuilderState_FRAGMENT_FINISHED)
throw RuntimeException();
@@ -91,7 +91,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::startDocumentFragment(const Reference< XDocument >& ownerDoc)
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// start a new document fragment and push it onto the stack
// we have to be in a clean state to do this
@@ -107,7 +107,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endDocumentFragment()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// there should only be the document left on the node stack
if (m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
@@ -123,7 +123,7 @@ namespace DOM
//XFastDocumentHandler
void SAL_CALL CSAXDocumentBuilder::startDocument()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// start a new document and push it onto the stack
// we have to be in a clean state to do this
@@ -139,7 +139,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endDocument()
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// there should only be the document left on the node stack
if (m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT)
@@ -154,7 +154,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::processingInstruction( const OUString& rTarget, const OUString& rData )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// append PI node to the current top
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
@@ -172,7 +172,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::startFastElement( sal_Int32 nElement , const Reference< XFastAttributeList >& xAttribs )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
@@ -208,7 +208,7 @@ namespace DOM
// For arbitrary meta elements
void SAL_CALL CSAXDocumentBuilder::startUnknownElement( const OUString& rNamespace, const OUString& rName, const Reference< XFastAttributeList >& xAttribs )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
m_aState != SAXDocumentBuilderState_BUILDING_FRAGMENT)
@@ -262,7 +262,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endFastElement( sal_Int32 nElement )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// pop the current element from the stack
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
@@ -285,7 +285,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::endUnknownElement( const OUString& /*rNamespace*/, const OUString& rName )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// pop the current element from the stack
if ( m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
@@ -323,7 +323,7 @@ namespace DOM
void SAL_CALL CSAXDocumentBuilder::characters( const OUString& rChars )
{
- std::lock_guard g(m_Mutex);
+ std::scoped_lock g(m_Mutex);
// append text node to the current top element
if (m_aState != SAXDocumentBuilderState_BUILDING_DOCUMENT &&
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 881fee7636ab..b3854d65a267 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -443,7 +443,7 @@ public:
virtual ~librdf_GraphResult() override
{
- std::lock_guard g(m_rMutex); // lock mutex when destroying members
+ std::scoped_lock g(m_rMutex); // lock mutex when destroying members
const_cast<std::shared_ptr<librdf_stream>& >(m_pStream).reset();
const_cast<std::shared_ptr<librdf_node>& >(m_pContext).reset();
const_cast<std::shared_ptr<librdf_query>& >(m_pQuery).reset();
@@ -479,7 +479,7 @@ private:
sal_Bool SAL_CALL
librdf_GraphResult::hasMoreElements()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
return m_pStream && !librdf_stream_end(m_pStream.get());
}
@@ -501,7 +501,7 @@ librdf_node* librdf_GraphResult::getContext_Lock() const
css::uno::Any SAL_CALL
librdf_GraphResult::nextElement()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
if (m_pStream && librdf_stream_end(m_pStream.get())) {
throw container::NoSuchElementException();
}
@@ -594,7 +594,7 @@ public:
virtual ~librdf_QuerySelectResult() override
{
- std::lock_guard g(m_rMutex); // lock mutex when destroying members
+ std::scoped_lock g(m_rMutex); // lock mutex when destroying members
const_cast<std::shared_ptr<librdf_query_results>& >(m_pQueryResult)
.reset();
const_cast<std::shared_ptr<librdf_query>& >(m_pQuery).reset();
@@ -630,7 +630,7 @@ private:
sal_Bool SAL_CALL
librdf_QuerySelectResult::hasMoreElements()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
return !librdf_query_results_finished(m_pQueryResult.get());
}
@@ -651,7 +651,7 @@ public:
css::uno::Any SAL_CALL
librdf_QuerySelectResult::nextElement()
{
- std::lock_guard g(m_rMutex);
+ std::scoped_lock g(m_rMutex);
if (librdf_query_results_finished(m_pQueryResult.get())) {
throw container::NoSuchElementException();
}
@@ -883,7 +883,7 @@ librdf_Repository::librdf_Repository(
{
OSL_ENSURE(i_xContext.is(), "librdf_Repository: null context");
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
if (!m_NumInstances++) {
m_pWorld.reset(m_TypeConverter.createWorld_Lock(),
safe_librdf_free_world);
@@ -892,7 +892,7 @@ librdf_Repository::librdf_Repository(
librdf_Repository::~librdf_Repository()
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
// must destroy these before world!
m_pModel.reset();
@@ -929,7 +929,7 @@ librdf_Repository::getSupportedServiceNames()
// css::rdf::XRepository:
uno::Reference< rdf::XBlankNode > SAL_CALL librdf_Repository::createBlankNode()
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const std::shared_ptr<librdf_node> pNode(
librdf_new_node_from_blank_identifier(m_pWorld.get(), nullptr),
safe_librdf_free_node);
@@ -1001,7 +1001,7 @@ librdf_Repository::importGraph(::sal_Int16 i_Format,
// exceptions are propagated
i_xInStream->readBytes( buf, static_cast<sal_Int32>( sz ) );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (m_NamedGraphs.find(contextU) != m_NamedGraphs.end()) {
throw container::ElementExistException(
@@ -1253,7 +1253,7 @@ librdf_Repository::exportGraph(::sal_Int16 i_Format,
uno::Sequence< uno::Reference< rdf::XURI > > SAL_CALL
librdf_Repository::getGraphNames()
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
::std::vector< uno::Reference<rdf::XURI> > ret;
std::transform(m_NamedGraphs.begin(), m_NamedGraphs.end(),
std::back_inserter(ret),
@@ -1271,7 +1271,7 @@ librdf_Repository::getGraph(const uno::Reference< rdf::XURI > & i_xGraphName)
}
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const NamedGraphMap_t::iterator iter( m_NamedGraphs.find(contextU) );
if (iter != m_NamedGraphs.end()) {
return iter->second;
@@ -1295,7 +1295,7 @@ librdf_Repository::createGraph(const uno::Reference< rdf::XURI > & i_xGraphName)
"librdf_Repository::createGraph: URI is reserved", *this, 0);
}
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
// NB: librdf does not have a concept of graphs as such;
// a librdf named graph exists iff the model contains a statement with
@@ -1320,7 +1320,7 @@ librdf_Repository::destroyGraph(
}
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
const NamedGraphMap_t::iterator iter( clearGraph_Lock(contextU, false) );
m_NamedGraphs.erase(iter);
@@ -1352,7 +1352,7 @@ librdf_Repository::getStatements(
librdf_TypeConverter::extractStatement_NoLock(
i_xSubject, i_xPredicate, i_xObject));
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
const std::shared_ptr<librdf_statement> pStatement(
librdf_TypeConverter::mkStatement_Lock(m_pWorld.get(), stmt),
@@ -1376,7 +1376,7 @@ librdf_Repository::getStatements(
uno::Reference< rdf::XQuerySelectResult > SAL_CALL
librdf_Repository::querySelect(const OUString & i_rQuery)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const OString query(
OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) );
const std::shared_ptr<librdf_query> pQuery(
@@ -1422,7 +1422,7 @@ librdf_Repository::querySelect(const OUString & i_rQuery)
uno::Reference< container::XEnumeration > SAL_CALL
librdf_Repository::queryConstruct(const OUString & i_rQuery)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const OString query(
OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) );
const std::shared_ptr<librdf_query> pQuery(
@@ -1458,7 +1458,7 @@ librdf_Repository::queryConstruct(const OUString & i_rQuery)
sal_Bool SAL_CALL
librdf_Repository::queryAsk(const OUString & i_rQuery)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
const OString query(
OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) );
@@ -1572,7 +1572,7 @@ void SAL_CALL librdf_Repository::setStatementRDFa(
removeStatementRDFa(i_xObject); // not atomic with insertion?
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (i_rRDFaContent.isEmpty()) {
m_RDFaXHTMLContentSet.erase(sXmlId);
@@ -1655,7 +1655,7 @@ librdf_Repository::getStatementRDFa(
"cannot getStatementsGraph", *this, anyEx);
}
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
return beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool >(
comphelper::containerToSequence(ret), 0 != m_RDFaXHTMLContentSet.count(sXmlId));
@@ -1700,7 +1700,7 @@ librdf_Repository::getStatementsRDFa(
librdf_TypeConverter::extractStatement_NoLock(
i_xSubject, i_xPredicate, i_xObject));
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
const std::shared_ptr<librdf_statement> pStatement(
librdf_TypeConverter::mkStatement_Lock(m_pWorld.get(), stmt),
@@ -1731,7 +1731,7 @@ librdf_Repository::getStatementsRDFa(
void SAL_CALL librdf_Repository::initialize(
const uno::Sequence< css::uno::Any > &)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
// m_pWorld.reset(m_TypeConverter.createWorld(), safe_librdf_free_world);
m_pStorage.reset(m_TypeConverter.createStorage_Lock(m_pWorld.get()),
@@ -1745,7 +1745,7 @@ NamedGraphMap_t::iterator librdf_Repository::clearGraph_NoLock(
// throw (uno::RuntimeException, container::NoSuchElementException,
// rdf::RepositoryException)
{
- std::lock_guard g(m_aMutex);
+ std::scoped_lock g(m_aMutex);
return clearGraph_Lock(i_rGraphName, i_Internal);
}
@@ -1809,7 +1809,7 @@ void librdf_Repository::addStatementGraph_NoLock(
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
addStatementGraph_Lock(stmt, contextU, false/*i_Internal*/);
}
@@ -1883,7 +1883,7 @@ void librdf_Repository::removeStatementsGraph_NoLock(
i_xSubject, i_xPredicate, i_xObject));
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (m_NamedGraphs.find(contextU) == m_NamedGraphs.end()) {
throw container::NoSuchElementException(
@@ -1964,7 +1964,7 @@ librdf_Repository::getStatementsGraph_NoLock(
i_xSubject, i_xPredicate, i_xObject));
const OUString contextU( i_xGraphName->getStringValue() );
- std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked
+ std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked
if (!i_Internal && (m_NamedGraphs.find(contextU) == m_NamedGraphs.end())) {
throw container::NoSuchElementException(
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index 88f1d37c5d8c..28c733490b04 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -72,7 +72,7 @@ namespace XPath
const OUString& aPrefix,
const OUString& aURI)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_nsmap.emplace(aPrefix, aURI);
}
@@ -81,7 +81,7 @@ namespace XPath
const OUString& aPrefix,
const OUString& aURI)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
if ((m_nsmap.find(aPrefix))->second == aURI) {
m_nsmap.erase(aPrefix);
@@ -284,7 +284,7 @@ namespace XPath
extensions_t extensions;
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
nsmap = m_nsmap;
extensions = m_extensions;
}
@@ -365,7 +365,7 @@ namespace XPath
void SAL_CALL CXPathAPI::registerExtension(
const OUString& aName)
{
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
// get extension from service manager
Reference< XXPathExtension > const xExtension(
@@ -383,7 +383,7 @@ namespace XPath
if (!xExtension.is()) {
throw RuntimeException();
}
- std::lock_guard const g(m_Mutex);
+ std::scoped_lock const g(m_Mutex);
m_extensions.push_back( xExtension );
}
}