[Libreoffice-commits] core.git: unoxml/source

2023-10-19 Thread khushishikhu (via logerrit)
 unoxml/source/xpath/xpathapi.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit baf677e2f1130205df6e4a5cf0a94f4d9dc228a5
Author: khushishikhu 
AuthorDate: Mon Oct 16 00:59:32 2023 +0530
Commit: Hossein 
CommitDate: Thu Oct 19 13:13:38 2023 +0200

tdf#42982: Improve UNO API error reporting

Change-Id: I16bd4bb935d02ff03422cb48d21a63e3d994d0b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157993
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index 17b28027534c..a60083983882 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -110,7 +110,7 @@ namespace XPath
 nsmap_t & rNamespaces, Reference< XNode > const& xNamespaceNode)
 {
 DOM::CNode *const 
pCNode(dynamic_cast(xNamespaceNode.get()));
-if (!pCNode) { throw RuntimeException(); }
+if (!pCNode) { throw RuntimeException("Could not use the namespace 
node in order to collect namespace declarations."); }
 
 ::osl::MutexGuard const g(pCNode->GetOwnerDocument().GetMutex());
 
@@ -274,7 +274,7 @@ namespace XPath
 Reference< XNode > const& xContextNode,
 const OUString& expr)
 {
-if (!xContextNode.is()) { throw RuntimeException(); }
+if (!xContextNode.is()) { throw RuntimeException("xContextNode does 
not exist!"); }
 
 nsmap_t nsmap;
 extensions_t extensions;
@@ -288,15 +288,15 @@ namespace XPath
 // get the node and document
 ::rtl::Reference const pCDoc(
 
dynamic_cast(xContextNode->getOwnerDocument().get()));
-if (!pCDoc.is()) { throw RuntimeException(); }
+if (!pCDoc.is()) { throw RuntimeException("Interface pointer for the 
owner document of the xContextNode does not exist."); }
 
 DOM::CNode *const pCNode = 
dynamic_cast(xContextNode.get());
-if (!pCNode) { throw RuntimeException(); }
+if (!pCNode) { throw RuntimeException("xContextNode interface pointer 
does not exist."); }
 
 ::osl::MutexGuard const g(pCDoc->GetMutex()); // lock the document!
 
 xmlNodePtr const pNode = pCNode->GetNodePtr();
-if (!pNode) { throw RuntimeException(); }
+if (!pNode) { throw RuntimeException("Node pointer for xContextNode 
does not exist."); }
 xmlDocPtr pDoc = pNode->doc;
 
 /* NB: workaround for #i87252#:
@@ -376,7 +376,7 @@ namespace XPath
 Reference< XXPathExtension> const& xExtension)
 {
 if (!xExtension.is()) {
-throw RuntimeException();
+throw RuntimeException("Extension instance xExtension to be used 
by XPath does not exist.");
 }
 std::scoped_lock const g(m_Mutex);
 m_extensions.push_back( xExtension );


[Libreoffice-commits] core.git: unoxml/source

2023-05-27 Thread Mike Kaganski (via logerrit)
 unoxml/source/dom/attributesmap.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit dccf807b7585c0b73700c54642c37821c0836ae3
Author: Mike Kaganski 
AuthorDate: Sun Apr 23 20:15:34 2023 +0300
Commit: Mike Kaganski 
CommitDate: Sat May 27 12:46:01 2023 +0200

Use getXWeak in unoxml

Change-Id: I141bad0d1b244bd801f613f159b79c4518fdf252
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150883
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/unoxml/source/dom/attributesmap.cxx 
b/unoxml/source/dom/attributesmap.cxx
index b11dcc6a1e01..f629d4cb3f31 100644
--- a/unoxml/source/dom/attributesmap.cxx
+++ b/unoxml/source/dom/attributesmap.cxx
@@ -164,7 +164,7 @@ namespace DOM
 if (!xAttr.is()) {
 throw DOMException(
 "CAttributesMap::removeNamedItem: no such attribute",
-static_cast(this),
+getXWeak(),
 DOMExceptionType_NOT_FOUND_ERR);
 }
 return m_pElement->removeAttributeNode(xAttr);
@@ -183,7 +183,7 @@ namespace DOM
 if (!xAttr.is()) {
 throw DOMException(
 "CAttributesMap::removeNamedItemNS: no such attribute",
-static_cast(this),
+getXWeak(),
 DOMExceptionType_NOT_FOUND_ERR);
 }
 return m_pElement->removeAttributeNode(xAttr);
@@ -199,7 +199,7 @@ namespace DOM
 if (!xNode.is()) {
 throw DOMException(
 "CAttributesMap::setNamedItem: XAttr argument expected",
-static_cast(this),
+getXWeak(),
 DOMExceptionType_HIERARCHY_REQUEST_ERR);
 }
 // no MutexGuard needed: m_pElement is const
@@ -216,7 +216,7 @@ namespace DOM
 if (!xNode.is()) {
 throw DOMException(
 "CAttributesMap::setNamedItemNS: XAttr argument expected",
-static_cast(this),
+getXWeak(),
 DOMExceptionType_HIERARCHY_REQUEST_ERR);
 }
 // no MutexGuard needed: m_pElement is const


[Libreoffice-commits] core.git: unoxml/source

2023-03-06 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/attr.cxx |   18 +-
 unoxml/source/dom/attr.hxx |3 ++-
 unoxml/source/dom/document.cxx |2 +-
 3 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit c0f69aa125081c31ca2b79e9e29e13bc91a21be7
Author: Noel Grandin 
AuthorDate: Mon Mar 6 15:03:55 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Mar 6 16:28:51 2023 +

no need to allocate these separately

they are all one or two words in size

Change-Id: I9bbe80a1be4d138f00d864352896d61d0df6366d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148337
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx
index 4988aa4211ec..dd974d910edb 100644
--- a/unoxml/source/dom/attr.cxx
+++ b/unoxml/source/dom/attr.cxx
@@ -46,14 +46,14 @@ namespace DOM
 
 xmlNsPtr CAttr::GetNamespace(xmlNodePtr const pNode)
 {
-if (!m_pNamespace)
+if (!m_oNamespace)
 {
 return nullptr;
 }
 xmlChar const*const pUri(reinterpret_cast(
-m_pNamespace->first.getStr()));
+m_oNamespace->first.getStr()));
 xmlChar const*const pPrefix(reinterpret_cast(
-m_pNamespace->second.getStr()));
+m_oNamespace->second.getStr()));
 xmlNsPtr pNs = xmlSearchNs(pNode->doc, pNode, pPrefix);
 if (pNs && (0 != xmlStrcmp(pNs->href, pUri))) {
 return pNs;
@@ -214,10 +214,10 @@ namespace DOM
 
 if (!m_aNodePtr) { return; }
 
-if (m_pNamespace)
+if (m_oNamespace)
 {
 OSL_ASSERT(!m_aNodePtr->parent);
-m_pNamespace->second =
+m_oNamespace->second =
 OUStringToOString(prefix, RTL_TEXTENCODING_UTF8);
 }
 else
@@ -232,11 +232,11 @@ namespace DOM
 
 if (!m_aNodePtr) { return OUString(); }
 
-if (m_pNamespace)
+if (m_oNamespace)
 {
 OSL_ASSERT(!m_aNodePtr->parent);
 OUString const ret(OStringToOUString(
-m_pNamespace->second, RTL_TEXTENCODING_UTF8));
+m_oNamespace->second, RTL_TEXTENCODING_UTF8));
 return ret;
 }
 else
@@ -251,11 +251,11 @@ namespace DOM
 
 if (!m_aNodePtr) { return OUString(); }
 
-if (m_pNamespace)
+if (m_oNamespace)
 {
 OSL_ASSERT(!m_aNodePtr->parent);
 OUString const ret(OStringToOUString(
-m_pNamespace->first, RTL_TEXTENCODING_UTF8));
+m_oNamespace->first, RTL_TEXTENCODING_UTF8));
 return ret;
 }
 else
diff --git a/unoxml/source/dom/attr.hxx b/unoxml/source/dom/attr.hxx
index f30b25896158..5c32968e2860 100644
--- a/unoxml/source/dom/attr.hxx
+++ b/unoxml/source/dom/attr.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include 
 
 #include 
 
@@ -43,7 +44,7 @@ namespace DOM
 friend class CDocument;
 
 xmlAttrPtr m_aAttrPtr;
-::std::unique_ptr< stringpair_t > m_pNamespace;
+::std::optional< stringpair_t > m_oNamespace;
 
 CAttr(CDocument const& rDocument, ::osl::Mutex const& rMutex,
 xmlAttrPtr const pAttr);
diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 413f764815e5..cb48bd1635f8 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -456,7 +456,7 @@ namespace DOM
 reinterpret_cast(pAttr)).get()));
 if (!pCAttr.is()) { throw RuntimeException(); }
 // store the namespace data!
-pCAttr->m_pNamespace.reset( new stringpair_t(oUri, oPrefix) );
+pCAttr->m_oNamespace.emplace( oUri, oPrefix );
 pCAttr->m_bUnlinked = true;
 
 return pCAttr;


[Libreoffice-commits] core.git: unoxml/source

2022-06-27 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/attributesmap.cxx |5 +-
 unoxml/source/dom/attributesmap.hxx |2 -
 unoxml/source/dom/childlist.cxx |5 +-
 unoxml/source/dom/childlist.hxx |2 -
 unoxml/source/dom/elementlist.cxx   |5 +-
 unoxml/source/dom/elementlist.hxx   |2 -
 unoxml/source/rdf/librdf_repository.cxx |   59 
 unoxml/source/xpath/nodelist.cxx|6 ++-
 unoxml/source/xpath/nodelist.hxx|2 -
 unoxml/source/xpath/xpathobject.cxx |6 ++-
 unoxml/source/xpath/xpathobject.hxx |2 -
 11 files changed, 52 insertions(+), 44 deletions(-)

New commits:
commit 9de4cafcf0efdc2986c3130658ee9233df392773
Author: Noel Grandin 
AuthorDate: Mon Jun 27 10:11:58 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Jun 27 13:06:01 2022 +0200

clang-tidy modernize-pass-by-value in unoxml

Change-Id: Id0df30bed0de7db0564816180497406c55cf9fff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136476
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/attributesmap.cxx 
b/unoxml/source/dom/attributesmap.cxx
index 575fa96c2ce0..b11dcc6a1e01 100644
--- a/unoxml/source/dom/attributesmap.cxx
+++ b/unoxml/source/dom/attributesmap.cxx
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 
 #include "element.hxx"
 #include "document.hxx"
@@ -31,9 +32,9 @@ using namespace css::xml::dom;
 
 namespace DOM
 {
-CAttributesMap::CAttributesMap(::rtl::Reference const& pElement,
+CAttributesMap::CAttributesMap(::rtl::Reference pElement,
 ::osl::Mutex & rMutex)
-: m_pElement(pElement)
+: m_pElement(std::move(pElement))
 , m_rMutex(rMutex)
 {
 }
diff --git a/unoxml/source/dom/attributesmap.hxx 
b/unoxml/source/dom/attributesmap.hxx
index 55f4c6795194..994cd72b0a1e 100644
--- a/unoxml/source/dom/attributesmap.hxx
+++ b/unoxml/source/dom/attributesmap.hxx
@@ -42,7 +42,7 @@ namespace DOM
 ::osl::Mutex & m_rMutex;
 
 public:
-CAttributesMap(::rtl::Reference const& pElement,
+CAttributesMap(::rtl::Reference pElement,
 ::osl::Mutex & rMutex);
 
 /**
diff --git a/unoxml/source/dom/childlist.cxx b/unoxml/source/dom/childlist.cxx
index 6f62f0144dbb..c147d8622dc4 100644
--- a/unoxml/source/dom/childlist.cxx
+++ b/unoxml/source/dom/childlist.cxx
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 #include "document.hxx"
 
 using namespace css::uno;
@@ -29,9 +30,9 @@ using namespace css::xml::dom;
 
 namespace DOM
 {
-CChildList::CChildList(::rtl::Reference const& pBase,
+CChildList::CChildList(::rtl::Reference pBase,
 ::osl::Mutex & rMutex)
-: m_pNode(pBase)
+: m_pNode(std::move(pBase))
 , m_rMutex(rMutex)
 {
 }
diff --git a/unoxml/source/dom/childlist.hxx b/unoxml/source/dom/childlist.hxx
index 091a8e450837..89fd0ea9bbda 100644
--- a/unoxml/source/dom/childlist.hxx
+++ b/unoxml/source/dom/childlist.hxx
@@ -42,7 +42,7 @@ namespace DOM
 ::osl::Mutex & m_rMutex;
 
 public:
-CChildList(::rtl::Reference const& pBase,
+CChildList(::rtl::Reference pBase,
 ::osl::Mutex & rMutex);
 
 /**
diff --git a/unoxml/source/dom/elementlist.cxx 
b/unoxml/source/dom/elementlist.cxx
index c8fc604377de..0f2605afe8c3 100644
--- a/unoxml/source/dom/elementlist.cxx
+++ b/unoxml/source/dom/elementlist.cxx
@@ -24,6 +24,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include "element.hxx"
@@ -78,10 +79,10 @@ namespace DOM
 }
 }
 
-CElementListImpl::CElementListImpl(::rtl::Reference const& 
pElement,
+CElementListImpl::CElementListImpl(::rtl::Reference pElement,
 ::osl::Mutex & rMutex,
 std::u16string_view rName, OUString const*const pURI)
-: m_pElement(pElement)
+: m_pElement(std::move(pElement))
 , m_rMutex(rMutex)
 , m_pName(lcl_initXmlString(rName))
 , m_pURI(pURI ? lcl_initXmlString(*pURI) : nullptr)
diff --git a/unoxml/source/dom/elementlist.hxx 
b/unoxml/source/dom/elementlist.hxx
index 66ce3bedac18..092529282148 100644
--- a/unoxml/source/dom/elementlist.hxx
+++ b/unoxml/source/dom/elementlist.hxx
@@ -60,7 +60,7 @@ namespace DOM
 void buildlist(xmlNodePtr pNode, bool start=true);
 
 public:
-CElementListImpl(::rtl::Reference const& pElement,
+CElementListImpl(::rtl::Reference pElement,
 ::osl::Mutex & rMutex,
 std::u16string_view rName, OUString const*const pURI);
 
diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 51c8317f369f..ccf4d87ffedd 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -65,6 +65,7 @@
 #include 
 
 #include 
+#include 
 
 /**
 Implementation of the service com.sun.star.rdf.Repository.
@@ -183,15 +184,15 @@ public:
 struct URI : 

[Libreoffice-commits] core.git: unoxml/source

2022-05-07 Thread Noel Grandin (via logerrit)
 unoxml/source/rdf/librdf_repository.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 6e8f63f772ebb9487c75324c23352ef3fea8e38b
Author: Noel Grandin 
AuthorDate: Sat May 7 08:43:40 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat May 7 12:50:20 2022 +0200

osl::Mutex->std::mutex in librdf_NamedGraph

Change-Id: If28bef2bd44dc469e6534b166d4c25c0a7c3b2eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133968
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 7b5aaa508f0d..63654e09efdd 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -741,7 +741,7 @@ private:
 
 /// Querying is rather slow, so cache the results.
 std::map> m_aStatementsCache;
-::osl::Mutex m_CacheMutex;
+std::mutex m_CacheMutex;
 };
 
 
@@ -783,7 +783,7 @@ void SAL_CALL librdf_NamedGraph::clear()
 throw lang::WrappedTargetRuntimeException( ex.Message,
 *this, anyEx );
 }
-::osl::MutexGuard g(m_CacheMutex);
+std::unique_lock g(m_CacheMutex);
 m_aStatementsCache.clear();
 }
 
@@ -798,7 +798,7 @@ void SAL_CALL librdf_NamedGraph::addStatement(
 "librdf_NamedGraph::addStatement: repository is gone", *this);
 }
 {
-::osl::MutexGuard g(m_CacheMutex);
+std::unique_lock g(m_CacheMutex);
 m_aStatementsCache.clear();
 }
 m_pRep->addStatementGraph_NoLock(
@@ -816,7 +816,7 @@ void SAL_CALL librdf_NamedGraph::removeStatements(
 "librdf_NamedGraph::removeStatements: repository is gone", *this);
 }
 {
-::osl::MutexGuard g(m_CacheMutex);
+std::unique_lock g(m_CacheMutex);
 m_aStatementsCache.clear();
 }
 m_pRep->removeStatementsGraph_NoLock(
@@ -845,7 +845,7 @@ librdf_NamedGraph::getStatements(
 {
 OUString cacheKey = createCacheKey_NoLock(i_xSubject, i_xPredicate, 
i_xObject);
 {
-::osl::MutexGuard g(m_CacheMutex);
+std::unique_lock g(m_CacheMutex);
 auto it = m_aStatementsCache.find(cacheKey);
 if (it != m_aStatementsCache.end()) {
 return new librdf_GraphResult2(it->second);
@@ -861,7 +861,7 @@ librdf_NamedGraph::getStatements(
 i_xSubject, i_xPredicate, i_xObject, m_xName);
 
 {
-::osl::MutexGuard g(m_CacheMutex);
+std::unique_lock g(m_CacheMutex);
 m_aStatementsCache.emplace(cacheKey, vStatements);
 }
 return new librdf_GraphResult2(vStatements);


[Libreoffice-commits] core.git: unoxml/source

2022-05-03 Thread Stephan Bergmann (via logerrit)
 unoxml/source/rdf/librdf_repository.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit a56474374b7a5aeacf41419fc1a6c99007cd7483
Author: Stephan Bergmann 
AuthorDate: Tue May 3 11:19:04 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 3 16:18:13 2022 +0200

Just use Any ctor instead of makeAny in unoxml

Change-Id: Iae66ed959d1b5734151ba42d272171254293501a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133749
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 45648c342a8a..7b5aaa508f0d 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -514,7 +514,7 @@ librdf_GraphResult::nextElement()
 throw lang::WrappedTargetException(
 "librdf_GraphResult::nextElement: "
 "librdf_stream_get_object failed", *this,
-uno::makeAny(e));
+uno::Any(e));
 }
 // NB: pCtxt may be null here if this is result of a graph query
 if (pCtxt && isInternalContext(pCtxt)) {
@@ -524,7 +524,7 @@ librdf_GraphResult::nextElement()
 m_xRep->getTypeConverter().convertToStatement(pStmt, pCtxt) );
 // NB: this will invalidate current item.
 librdf_stream_next(m_pStream.get());
-return uno::makeAny(Stmt);
+return uno::Any(Stmt);
 }
 
 
@@ -568,7 +568,7 @@ librdf_GraphResult2::nextElement()
 m_nIndex = m_vStatements.size(); // avoid overflow
 throw container::NoSuchElementException();
 }
-return uno::makeAny(m_vStatements[n]);
+return uno::Any(m_vStatements[n]);
 }
 
 /** result of tuple queries ("SELECT").
@@ -666,7 +666,7 @@ librdf_QuerySelectResult::nextElement()
 throw lang::WrappedTargetException(
 "librdf_QuerySelectResult::nextElement: "
 "librdf_query_results_get_bindings failed", *this,
-uno::makeAny(e));
+uno::Any(e));
 }
 uno::Sequence< uno::Reference< rdf::XNode > > ret(count);
 auto retRange = asNonConstRange(ret);
@@ -675,7 +675,7 @@ librdf_QuerySelectResult::nextElement()
 }
 // NB: this will invalidate current item.
 librdf_query_results_next(m_pQueryResult.get());
-return uno::makeAny(ret);
+return uno::Any(ret);
 }
 
 // css::rdf::XQuerySelectResult:
@@ -2015,7 +2015,7 @@ librdf_Repository::getStatementsGraph_NoLock(
 throw lang::WrappedTargetException(
 "librdf_GraphResult::nextElement: "
 "librdf_stream_get_object failed", *this,
-uno::makeAny(e));
+uno::Any(e));
 }
 // NB: pCtxt may be null here if this is result of a graph query
 if (pCtxt && isInternalContext(pCtxt)) {


[Libreoffice-commits] core.git: unoxml/source

2022-03-06 Thread Caolán McNamara (via logerrit)
 unoxml/source/dom/documentbuilder.cxx |   13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit ffa0dedf93d913536488bc1718f855e6ff48284b
Author: Caolán McNamara 
AuthorDate: Sat Mar 5 21:29:35 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Mar 6 13:36:42 2022 +0100

crashtesting: assert that !rtl::isAscii in xmlError message

probably detected since:

commit 089ce740f9f97f9c7b13e37a31acfc94984e9a3e
Date:   Thu Feb 24 17:45:18 2022 +0300

Deduplicate rtl_*String_newConcat*L

or similar

Change-Id: I69ac57bd5718a4da85516e2a2afa79dc2b04665e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131068
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/unoxml/source/dom/documentbuilder.cxx 
b/unoxml/source/dom/documentbuilder.cxx
index 3da15ee7d7e9..8139a4c7d8f1 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -138,14 +138,11 @@ namespace DOM
 
 static OUString make_error_message(xmlParserCtxtPtr ctxt)
 {
-OUStringBuffer buf;
-buf.appendAscii(ctxt->lastError.message);
-buf.append("Line: ");
-buf.append(static_cast(ctxt->lastError.line));
-buf.append("\nColumn: ");
-buf.append(static_cast(ctxt->lastError.int2));
-OUString msg = buf.makeStringAndClear();
-return msg;
+return OUString(ctxt->lastError.message, 
strlen(ctxt->lastError.message), RTL_TEXTENCODING_ASCII_US) +
+   "Line: " +
+   OUString::number(static_cast(ctxt->lastError.line)) +
+   "\nColumn: " +
+   OUString::number(static_cast(ctxt->lastError.int2));
 }
 
 // -- callbacks and context struct for parsing from stream


[Libreoffice-commits] core.git: unoxml/source

2021-11-19 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/domimplementation.cxx |   16 ++--
 unoxml/source/dom/node.cxx  |1 -
 2 files changed, 6 insertions(+), 11 deletions(-)

New commits:
commit 2fe77d0ed8c7c6f2ea0374e0c003ae6280fd591c
Author: Noel Grandin 
AuthorDate: Thu Nov 18 20:28:00 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Nov 19 12:58:53 2021 +0100

rtl::Static->thread-safe static in unoxml

Change-Id: Icb458f9ba38225aef17a2421533be79c6d9445d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125496
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/domimplementation.cxx 
b/unoxml/source/dom/domimplementation.cxx
index 41cf2c7c053c..0bd7e5940ac6 100644
--- a/unoxml/source/dom/domimplementation.cxx
+++ b/unoxml/source/dom/domimplementation.cxx
@@ -19,25 +19,21 @@
 
 #include "domimplementation.hxx"
 
-#include 
 #include 
+#include 
 
 using namespace css::uno;
 using namespace css::xml::dom;
 
 namespace DOM
 {
-// why the heck is this thing static?
-// perhaps it would be helpful to know what the implementation should
-// do to answer this question...
-namespace {
-struct DOMImplementation
-: public ::rtl::Static {};
-}
-
 CDOMImplementation* CDOMImplementation::get()
 {
-return & DOMImplementation::get();
+// why the heck is this thing static?
+// perhaps it would be helpful to know what the implementation should
+// do to answer this question...
+static rtl::Reference xDOMImplementation = new 
CDOMImplementation;
+return &*xDOMImplementation;
 }
 
 // there is just 1 static instance, so these must not delete it!
diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 14c5dc454da1..f39aba6bd079 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -25,7 +25,6 @@
 
 #include 
 
-#include 
 #include 
 #include 
 #include 


[Libreoffice-commits] core.git: unoxml/source

2021-08-01 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/document.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2bbb7b94b2cf7b0d4723e8a00a9d9705bc443acd
Author: Noel Grandin 
AuthorDate: Sun Aug 1 10:54:00 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 20:05:36 2021 +0200

o3tl::sorted_vector is better for small sets of pointers

Change-Id: Ieffb65301b83c03fd690e7269c3b326abcfe9b8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119813
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx
index 0f2fda8b0d81..291535ebf8e5 100644
--- a/unoxml/source/dom/document.hxx
+++ b/unoxml/source/dom/document.hxx
@@ -19,7 +19,6 @@
 
 #pragma once
 
-#include 
 #include 
 #include 
 
@@ -46,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -76,7 +76,7 @@ namespace DOM
 xmlDocPtr const m_aDocPtr;
 
 // datacontrol/source state
-typedef std::set< css::uno::Reference< css::io::XStreamListener > > 
listenerlist_t;
+typedef o3tl::sorted_vector< css::uno::Reference< 
css::io::XStreamListener > > listenerlist_t;
 listenerlist_t m_streamListeners;
 css::uno::Reference< css::io::XOutputStream > m_rOutputStream;
 


[Libreoffice-commits] core.git: unoxml/source

2021-08-01 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/document.hxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 34617c92805bc413dc464cdadf8ed17861a95f75
Author: Noel Grandin 
AuthorDate: Sun Aug 1 10:53:03 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 19:14:40 2021 +0200

unordered_map is better when using pointers as keys

Change-Id: I0d423dc2cafb3f7cbd41fd884ada252a86b8da86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119812
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/document.hxx b/unoxml/source/dom/document.hxx
index a26da7fcd169..0f2fda8b0d81 100644
--- a/unoxml/source/dom/document.hxx
+++ b/unoxml/source/dom/document.hxx
@@ -21,7 +21,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -80,7 +80,7 @@ namespace DOM
 listenerlist_t m_streamListeners;
 css::uno::Reference< css::io::XOutputStream > m_rOutputStream;
 
-typedef std::map< const xmlNodePtr,
+typedef std::unordered_map< xmlNodePtr,
 ::std::pair< 
css::uno::WeakReference, CNode* > > nodemap_t;
 nodemap_t m_NodeMap;
 


[Libreoffice-commits] core.git: unoxml/source

2021-07-31 Thread Noel Grandin (via logerrit)
 unoxml/source/xpath/xpathapi.cxx |   10 +-
 unoxml/source/xpath/xpathapi.hxx |3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 23071f68eaba463e9c1a00270e82ef51dcdcfce8
Author: Noel Grandin 
AuthorDate: Sat Jul 31 19:58:42 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 31 22:32:57 2021 +0200

osl::Mutex->std::mutex in CXPathAPI

Change-Id: I008e9d660b1c245aea57ebef02ab651d435a90d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119757
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index d6698c98a117..88f1d37c5d8c 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)
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 m_nsmap.emplace(aPrefix, aURI);
 }
@@ -81,7 +81,7 @@ namespace XPath
 const OUString& aPrefix,
 const OUString& aURI)
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 if ((m_nsmap.find(aPrefix))->second == aURI) {
 m_nsmap.erase(aPrefix);
@@ -284,7 +284,7 @@ namespace XPath
 extensions_t extensions;
 
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 nsmap = m_nsmap;
 extensions = m_extensions;
 }
@@ -365,7 +365,7 @@ namespace XPath
 void SAL_CALL CXPathAPI::registerExtension(
 const OUString& aName)
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 // get extension from service manager
 Reference< XXPathExtension > const xExtension(
@@ -383,7 +383,7 @@ namespace XPath
 if (!xExtension.is()) {
 throw RuntimeException();
 }
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 m_extensions.push_back( xExtension );
 }
 }
diff --git a/unoxml/source/xpath/xpathapi.hxx b/unoxml/source/xpath/xpathapi.hxx
index 154eb78f722d..50fa1952eae8 100644
--- a/unoxml/source/xpath/xpathapi.hxx
+++ b/unoxml/source/xpath/xpathapi.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include 
+#include 
 #include 
 
 #include 
@@ -53,7 +54,7 @@ namespace XPath
 {
 
 private:
-::osl::Mutex m_Mutex;
+std::mutex m_Mutex;
 nsmap_t m_nsmap;
 const css::uno::Reference< css::uno::XComponentContext > m_xContext;
 extensions_t m_extensions;


[Libreoffice-commits] core.git: unoxml/source

2021-07-31 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/documentbuilder.cxx |   12 ++--
 unoxml/source/dom/documentbuilder.hxx |3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

New commits:
commit e66fdb597b30fc701bb068824d0ae4d89fecd55f
Author: Noel Grandin 
AuthorDate: Sat Jul 31 20:12:30 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 31 21:59:29 2021 +0200

osl::Mutex->std::mutex in CDocumentBuilder

Change-Id: I4ffd2c1d5a28a692e94b8dfa6e468c297789ef63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119760
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/documentbuilder.cxx 
b/unoxml/source/dom/documentbuilder.cxx
index 8d42ad5f9b75..b40a7347ea08 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()
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 // create a new document
 xmlDocPtr pDocument = xmlNewDoc(reinterpret_cast("1.0"));
@@ -333,7 +333,7 @@ namespace DOM
 throw RuntimeException();
 }
 
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard 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)
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 std::unique_ptr const pContext(
 xmlNewParserCtxt());
@@ -403,14 +403,14 @@ namespace DOM
 void SAL_CALL
 CDocumentBuilder::setEntityResolver(Reference< XEntityResolver > const& 
xER)
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 m_xEntityResolver = xER;
 }
 
 Reference< XEntityResolver > CDocumentBuilder::getEntityResolver()
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 return m_xEntityResolver;
 }
@@ -418,7 +418,7 @@ namespace DOM
 void SAL_CALL
 CDocumentBuilder::setErrorHandler(Reference< XErrorHandler > const& xEH)
 {
-::osl::MutexGuard const g(m_Mutex);
+std::lock_guard const g(m_Mutex);
 
 m_xErrorHandler = xEH;
 }
diff --git a/unoxml/source/dom/documentbuilder.hxx 
b/unoxml/source/dom/documentbuilder.hxx
index 40edc4525979..4e3d123094f5 100644
--- a/unoxml/source/dom/documentbuilder.hxx
+++ b/unoxml/source/dom/documentbuilder.hxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace DOM
 {
@@ -47,7 +48,7 @@ namespace DOM
 : public CDocumentBuilder_Base
 {
 private:
-::osl::Mutex m_Mutex;
+std::mutex m_Mutex;
 css::uno::Reference< css::xml::sax::XEntityResolver > 
m_xEntityResolver;
 css::uno::Reference< css::xml::sax::XErrorHandler > m_xErrorHandler;
 


[Libreoffice-commits] core.git: unoxml/source

2021-07-31 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/saxbuilder.cxx |   28 ++--
 unoxml/source/dom/saxbuilder.hxx |4 ++--
 2 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 5a882b83dfe1483883a5d112ae1aa6d685d7334f
Author: Noel Grandin 
AuthorDate: Sat Jul 31 20:10:02 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 31 21:59:10 2021 +0200

osl::Mutex->std::mutex in CSAXDocumentBuilder

Change-Id: Ib50ca1070d9b0999795c73fcd85fe8e2e1aabc8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119759
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index b0e521f033e4..ab174e3052cd 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -55,14 +55,14 @@ namespace DOM
 
 SAXDocumentBuilderState SAL_CALL CSAXDocumentBuilder::getState()
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard g(m_Mutex);
 
 return m_aState;
 }
 
 void SAL_CALL CSAXDocumentBuilder::reset()
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard g(m_Mutex);
 
 m_aDocument.clear();
 m_aFragment.clear();
@@ -72,7 +72,7 @@ namespace DOM
 
 Reference< XDocument > SAL_CALL CSAXDocumentBuilder::getDocument()
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard g(m_Mutex);
 
 if (m_aState != SAXDocumentBuilderState_DOCUMENT_FINISHED)
 throw RuntimeException();
@@ -82,7 +82,7 @@ namespace DOM
 
 Reference< XDocumentFragment > SAL_CALL 
CSAXDocumentBuilder::getDocumentFragment()
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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)
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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()
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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()
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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()
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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 )
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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  )
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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 )
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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 )
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard 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 )
 {
-::osl::MutexGuard g(m_Mutex);
+std::lock_guard g(m_Mutex);
 
 // pop the current element from the stack
 if ( m_aState != 

[Libreoffice-commits] core.git: unoxml/source

2021-07-31 Thread Noel Grandin (via logerrit)
 unoxml/source/rdf/librdf_repository.cxx |   69 
 1 file changed, 35 insertions(+), 34 deletions(-)

New commits:
commit f7b530736869461ed1f0548a1424d240c1a756ea
Author: Noel Grandin 
AuthorDate: Sat Jul 31 20:07:32 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 31 21:58:50 2021 +0200

osl::Mutex->std::mutex in librdf_Repository

Change-Id: Iceec0138a05e914935e3b6df2044a40cb76d10b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119758
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 6ed9e552cef6..881fee7636ab 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -21,6 +21,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -399,7 +400,7 @@ private:
 /// refcount
 static sal_uInt32 m_NumInstances;
 /// mutex for m_pWorld - redland is not as threadsafe as is often claimed
-static osl::Mutex m_aMutex;
+static std::mutex m_aMutex;
 
 // NB: sequence of the shared pointers is important!
 /// librdf repository storage
@@ -428,7 +429,7 @@ class librdf_GraphResult:
 public:
 
 librdf_GraphResult(librdf_Repository *i_pRepository,
-::osl::Mutex & i_rMutex,
+std::mutex & i_rMutex,
 std::shared_ptr const& i_pStream,
 std::shared_ptr const& i_pContext,
 std::shared_ptr  const& i_pQuery =
@@ -442,7 +443,7 @@ public:
 
 virtual ~librdf_GraphResult() override
 {
-::osl::MutexGuard g(m_rMutex); // lock mutex when destroying members
+std::lock_guard g(m_rMutex); // lock mutex when destroying members
 const_cast& >(m_pStream).reset();
 const_cast& >(m_pContext).reset();
 const_cast& >(m_pQuery).reset();
@@ -462,7 +463,7 @@ private:
 // also, sequence is important: the stream must be destroyed first.
 ::rtl::Reference< librdf_Repository > m_xRep;
 // needed for synchronizing access to librdf (it doesn't do win32 
threading)
-::osl::Mutex & m_rMutex;
+std::mutex & m_rMutex;
 // the query (in case this is a result of a graph query)
 // not that the redland documentation spells this out explicitly, but
 // queries must be freed only after all the results are completely read
@@ -478,7 +479,7 @@ private:
 sal_Bool SAL_CALL
 librdf_GraphResult::hasMoreElements()
 {
-::osl::MutexGuard g(m_rMutex);
+std::lock_guard g(m_rMutex);
 return m_pStream && !librdf_stream_end(m_pStream.get());
 }
 
@@ -500,7 +501,7 @@ librdf_node* librdf_GraphResult::getContext_Lock() const
 css::uno::Any SAL_CALL
 librdf_GraphResult::nextElement()
 {
-::osl::MutexGuard g(m_rMutex);
+std::lock_guard g(m_rMutex);
 if (m_pStream && librdf_stream_end(m_pStream.get())) {
 throw container::NoSuchElementException();
 }
@@ -580,7 +581,7 @@ class librdf_QuerySelectResult:
 public:
 
 librdf_QuerySelectResult(librdf_Repository *i_pRepository,
-::osl::Mutex & i_rMutex,
+std::mutex & i_rMutex,
 std::shared_ptr  const& i_pQuery,
 std::shared_ptr const& i_pQueryResult,
 uno::Sequence< OUString > const& i_rBindingNames )
@@ -593,7 +594,7 @@ public:
 
 virtual ~librdf_QuerySelectResult() override
 {
-::osl::MutexGuard g(m_rMutex); // lock mutex when destroying members
+std::lock_guard g(m_rMutex); // lock mutex when destroying members
 const_cast& >(m_pQueryResult)
 .reset();
 const_cast& >(m_pQuery).reset();
@@ -616,7 +617,7 @@ private:
 // also, sequence is important: the stream must be destroyed first.
 ::rtl::Reference< librdf_Repository > m_xRep;
 // needed for synchronizing access to librdf (it doesn't do win32 
threading)
-::osl::Mutex & m_rMutex;
+std::mutex & m_rMutex;
 // not that the redland documentation spells this out explicitly, but
 // queries must be freed only after all the results are completely read
 std::shared_ptr const m_pQuery;
@@ -629,7 +630,7 @@ private:
 sal_Bool SAL_CALL
 librdf_QuerySelectResult::hasMoreElements()
 {
-::osl::MutexGuard g(m_rMutex);
+std::lock_guard g(m_rMutex);
 return !librdf_query_results_finished(m_pQueryResult.get());
 }
 
@@ -650,7 +651,7 @@ public:
 css::uno::Any SAL_CALL
 librdf_QuerySelectResult::nextElement()
 {
-::osl::MutexGuard g(m_rMutex);
+std::lock_guard g(m_rMutex);
 if (librdf_query_results_finished(m_pQueryResult.get())) {
 throw container::NoSuchElementException();
 }
@@ -869,7 +870,7 @@ librdf_NamedGraph::getStatements(
 
 std::shared_ptr librdf_Repository::m_pWorld;
 sal_uInt32 librdf_Repository::m_NumInstances = 0;
-osl::Mutex librdf_Repository::m_aMutex;
+std::mutex librdf_Repository::m_aMutex;
 
 librdf_Repository::librdf_Repository(
 uno::Reference< 

[Libreoffice-commits] core.git: unoxml/source

2021-02-19 Thread Noel (via logerrit)
 unoxml/source/dom/document.cxx   |4 ++--
 unoxml/source/dom/element.cxx|5 ++---
 unoxml/source/events/eventdispatcher.cxx |8 
 3 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 63058a4f2b0809748d43c7f45dcf85dbcd1dfcb7
Author: Noel 
AuthorDate: Fri Feb 19 11:26:46 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Feb 19 11:24:22 2021 +0100

loplugin:refcounting in unoxml

Change-Id: I979b309271809b64d6f04cbccd14e0ee3b09ec81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index db93dcad847a..27db21ebe09b 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -937,7 +937,7 @@ namespace DOM
 Reference< XEvent > SAL_CALL CDocument::createEvent(const OUString& aType)
 {
 // does not need mutex currently
-events::CEvent *pEvent = nullptr;
+rtl::Reference pEvent;
 if ( aType == "DOMSubtreeModified" || aType == "DOMNodeInserted" || 
aType == "DOMNodeRemoved"
   || aType == "DOMNodeRemovedFromDocument" || aType == 
"DOMNodeInsertedIntoDocument" || aType == "DOMAttrModified"
   || aType == "DOMCharacterDataModified")
@@ -956,7 +956,7 @@ namespace DOM
 {
 pEvent = new events::CEvent;
 }
-return Reference< XEvent >(pEvent);
+return pEvent;
 }
 
 // css::xml::sax::XSAXSerializable
diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index 988d7f1b9c32..e82f2edab4f2 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -56,7 +56,7 @@ namespace DOM
 void CElement::saxify(const Reference< XDocumentHandler >& i_xHandler)
 {
 if (!i_xHandler.is()) throw RuntimeException();
-comphelper::AttributeList *pAttrs =
+rtl::Reference pAttrs =
 new comphelper::AttributeList();
 OUString type = "";
 // add namespace definitions to attributes
@@ -90,8 +90,7 @@ namespace DOM
 OUString name = (prefix.isEmpty())
 ? getLocalName()
 : prefix + ":" + getLocalName();
-Reference< XAttributeList > xAttrList(pAttrs);
-i_xHandler->startElement(name, xAttrList);
+i_xHandler->startElement(name, pAttrs);
 // recurse
 for (xmlNodePtr pChild = m_aNodePtr->children;
 pChild != nullptr; pChild = pChild->next) {
diff --git a/unoxml/source/events/eventdispatcher.cxx 
b/unoxml/source/events/eventdispatcher.cxx
index fc396ee9dc76..201f682f7d66 100644
--- a/unoxml/source/events/eventdispatcher.cxx
+++ b/unoxml/source/events/eventdispatcher.cxx
@@ -117,7 +117,7 @@ namespace DOM::events {
 if (captureListeners.empty() && targetListeners.empty())
 return;
 
-CEvent *pEvent = nullptr; // pointer to internal event representation
+rtl::Reference pEvent; // pointer to internal event 
representation
 
 OUString const aType = i_xEvent->getType();
 if (aType == "DOMSubtreeModified"  ||
@@ -133,7 +133,7 @@ namespace DOM::events {
 // dispatch a mutation event
 // we need to clone the event in order to have complete control
 // over the implementation
-CMutationEvent* pMEvent = new CMutationEvent;
+rtl::Reference pMEvent = new CMutationEvent;
 pMEvent->initMutationEvent(
 aType, aMEvent->getBubbles(), aMEvent->getCancelable(),
 aMEvent->getRelatedNode(), aMEvent->getPrevValue(),
@@ -146,7 +146,7 @@ namespace DOM::events {
 aType == "DOMActivate" )
 {
 Reference< XUIEvent > const aUIEvent(i_xEvent, UNO_QUERY_THROW);
-CUIEvent* pUIEvent = new CUIEvent;
+rtl::Reference pUIEvent = new CUIEvent;
 pUIEvent->initUIEvent(aType,
 aUIEvent->getBubbles(), aUIEvent->getCancelable(),
 aUIEvent->getView(), aUIEvent->getDetail());
@@ -161,7 +161,7 @@ namespace DOM::events {
 {
 Reference< XMouseEvent > const aMouseEvent(i_xEvent,
 UNO_QUERY_THROW);
-CMouseEvent *pMouseEvent = new CMouseEvent;
+rtl::Reference pMouseEvent = new CMouseEvent;
 pMouseEvent->initMouseEvent(aType,
 aMouseEvent->getBubbles(), aMouseEvent->getCancelable(),
 aMouseEvent->getView(), aMouseEvent->getDetail(),
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2020-08-06 Thread Noel Grandin (via logerrit)
 unoxml/source/dom/document.cxx   |   27 +-
 unoxml/source/dom/saxbuilder.cxx |   26 -
 unoxml/source/events/eventdispatcher.cxx |   83 +++
 unoxml/source/rdf/CLiteral.cxx   |   35 ++---
 unoxml/source/rdf/librdf_repository.cxx  |   33 ++--
 5 files changed, 104 insertions(+), 100 deletions(-)

New commits:
commit febc581c30fe22eb133d5c1e355fc12fe3c0dc39
Author: Noel Grandin 
AuthorDate: Wed Aug 5 20:28:37 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 6 09:27:18 2020 +0200

loplugin:flatten in unoxml

Change-Id: I7c85b3618450ea6914c3076b0dca67ef4847be51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100187
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx
index 68f88442e4f5..c753f37c6054 100644
--- a/unoxml/source/dom/document.cxx
+++ b/unoxml/source/dom/document.cxx
@@ -137,19 +137,20 @@ namespace DOM
 CDocument::RemoveCNode(xmlNodePtr const pNode, CNode const*const pCNode)
 {
 nodemap_t::iterator const i = m_NodeMap.find(pNode);
-if (i != m_NodeMap.end()) {
-// #i113681# consider this scenario:
-// T1 calls ~CNode
-// T2 calls getCNode:lookup will find i->second->first invalid
-//   so a new CNode is created and inserted
-// T1 calls removeCNode: i->second->second now points to a
-//   different CNode instance!
-
-// check that the CNode is the right one
-CNode *const pCurrent = i->second.second;
-if (pCurrent == pCNode) {
-m_NodeMap.erase(i);
-}
+if (i == m_NodeMap.end())
+return;
+
+// #i113681# consider this scenario:
+// T1 calls ~CNode
+// T2 calls getCNode:lookup will find i->second->first invalid
+//   so a new CNode is created and inserted
+// T1 calls removeCNode: i->second->second now points to a
+//   different CNode instance!
+
+// check that the CNode is the right one
+CNode *const pCurrent = i->second.second;
+if (pCurrent == pCNode) {
+m_NodeMap.erase(i);
 }
 }
 
diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index 25686b21c4de..b0e521f033e4 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -225,20 +225,20 @@ namespace DOM
 aElement.set( m_aNodeStack.top()->appendChild(aElement), UNO_QUERY);
 m_aNodeStack.push(aElement);
 
-if (xAttribs.is())
+if (!xAttribs.is())
+return;
+
+setElementFastAttributes(aElement, xAttribs);
+const Sequence< css::xml::Attribute > unknownAttribs = 
xAttribs->getUnknownAttributes();
+for ( const auto& rUnknownAttrib : unknownAttribs )
 {
-setElementFastAttributes(aElement, xAttribs);
-const Sequence< css::xml::Attribute > unknownAttribs = 
xAttribs->getUnknownAttributes();
-for ( const auto& rUnknownAttrib : unknownAttribs )
-{
-const OUString& rAttrValue = rUnknownAttrib.Value;
-const OUString& rAttrName = rUnknownAttrib.Name;
-const OUString& rAttrNamespace = rUnknownAttrib.NamespaceURL;
-if ( !rAttrNamespace.isEmpty() )
-aElement->setAttributeNS( rAttrNamespace, rAttrName, 
rAttrValue );
-else
-aElement->setAttribute( rAttrName, rAttrValue );
-}
+const OUString& rAttrValue = rUnknownAttrib.Value;
+const OUString& rAttrName = rUnknownAttrib.Name;
+const OUString& rAttrNamespace = rUnknownAttrib.NamespaceURL;
+if ( !rAttrNamespace.isEmpty() )
+aElement->setAttributeNS( rAttrNamespace, rAttrName, 
rAttrValue );
+else
+aElement->setAttribute( rAttrName, rAttrValue );
 }
 }
 
diff --git a/unoxml/source/events/eventdispatcher.cxx 
b/unoxml/source/events/eventdispatcher.cxx
index ef07dff5ad2d..cc5fb159d3c8 100644
--- a/unoxml/source/events/eventdispatcher.cxx
+++ b/unoxml/source/events/eventdispatcher.cxx
@@ -60,20 +60,21 @@ namespace DOM::events {
 
 // get the multimap for the specified type
 auto tIter = pTMap->find(aType);
-if (tIter != pTMap->end()) {
-ListenerMap & rMap = tIter->second;
-// find listeners of specified type for specified node
-ListenerMap::iterator iter = rMap.find(pNode);
-while (iter != rMap.end() && iter->first == pNode)
+if (tIter == pTMap->end())
+return;
+
+ListenerMap & rMap = tIter->second;
+// find listeners of specified type for specified node
+ 

[Libreoffice-commits] core.git: unoxml/source

2020-06-05 Thread Stephan Bergmann (via logerrit)
 unoxml/source/dom/element.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit af1f10879672005d268139f9b0b11fee680ed3f4
Author: Stephan Bergmann 
AuthorDate: Fri Jun 5 14:23:16 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 5 16:17:20 2020 +0200

Upcoming loplugin:elidestringvar: unoxml

Change-Id: I3b9aad378c13019f0411ce3adf5fadd588eda5ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95594
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index a729601c57e9..afef8b313b29 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -189,12 +189,11 @@ namespace DOM
 i_rContext.mxCurrentHandler->endFastElement( nElementToken );
 else
 {
-const OUString aNamespace;
 const OUString aElementName( reinterpret_cast(pPrefix),
  strlen(reinterpret_cast(pPrefix)),
  RTL_TEXTENCODING_UTF8 );
 
-i_rContext.mxCurrentHandler->endUnknownElement( aNamespace, 
aElementName );
+i_rContext.mxCurrentHandler->endUnknownElement( "", 
aElementName );
 }
 }
 catch( Exception& )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2020-01-24 Thread Mike Kaganski (via logerrit)
 unoxml/source/rdf/librdf_repository.cxx |   21 +
 1 file changed, 9 insertions(+), 12 deletions(-)

New commits:
commit 4e1e77b059942fa548c5053409d1b2fa712631c9
Author: Mike Kaganski 
AuthorDate: Fri Jan 24 07:12:53 2020 +0100
Commit: Mike Kaganski 
CommitDate: Fri Jan 24 12:25:36 2020 +0100

Use std::vector instead of std::unique_ptr

Change-Id: Ibf99c6408201f7e2ecf6b019c53e140edd81164c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87319
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 68ba3135512f..df9f34001441 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -634,21 +634,18 @@ librdf_QuerySelectResult::hasMoreElements()
 return !librdf_query_results_finished(m_pQueryResult.get());
 }
 
-struct NodeArray
+class NodeArray : private std::vector
 {
-int m_Count;
-std::unique_ptr m_pNodes;
-
-NodeArray(int cnt) : m_Count(cnt), m_pNodes(new librdf_node*[cnt])
-{
-for (int i = 0; i < cnt; ++i)
-m_pNodes[i] = nullptr;
-}
+public:
+NodeArray(int cnt) : std::vector(cnt) {}
 
 ~NodeArray() throw ()
 {
-std::for_each(m_pNodes.get(), m_pNodes.get() + m_Count, 
safe_librdf_free_node);
+std::for_each(begin(), end(), safe_librdf_free_node);
 }
+
+using std::vector::data;
+using std::vector::operator[];
 };
 
 css::uno::Any SAL_CALL
@@ -662,7 +659,7 @@ librdf_QuerySelectResult::nextElement()
 OSL_ENSURE(count >= 0, "negative length?");
 NodeArray aNodes(count);
 if (librdf_query_results_get_bindings(m_pQueryResult.get(), nullptr,
-aNodes.m_pNodes.get()))
+aNodes.data()))
 {
 rdf::QueryException e(
 "librdf_QuerySelectResult::nextElement: "
@@ -674,7 +671,7 @@ librdf_QuerySelectResult::nextElement()
 }
 uno::Sequence< uno::Reference< rdf::XNode > > ret(count);
 for (int i = 0; i < count; ++i) {
-ret[i] = m_xRep->getTypeConverter().convertToXNode(aNodes.m_pNodes[i]);
+ret[i] = m_xRep->getTypeConverter().convertToXNode(aNodes[i]);
 }
 // NB: this will invalidate current item.
 librdf_query_results_next(m_pQueryResult.get());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2020-01-23 Thread Noel Grandin (via logerrit)
 unoxml/source/rdf/librdf_repository.cxx |   27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

New commits:
commit 5fd05b2d4a61af0e72cf75f465c4f6ad7b2f4cc9
Author: Noel Grandin 
AuthorDate: Thu Jan 23 15:03:17 2020 +0200
Commit: Noel Grandin 
CommitDate: Thu Jan 23 15:58:38 2020 +0100

simplify NodeArray code

no need to use shared_ptr here

Change-Id: Ib40929c4378e110eb42261df36b4add969416cb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87269
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 39db47b51b99..68ba3135512f 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -634,17 +634,20 @@ librdf_QuerySelectResult::hasMoreElements()
 return !librdf_query_results_finished(m_pQueryResult.get());
 }
 
-class NodeArrayDeleter
+struct NodeArray
 {
-const int m_Count;
+int m_Count;
+std::unique_ptr m_pNodes;
 
-public:
-explicit NodeArrayDeleter(int i_Count) : m_Count(i_Count) { }
+NodeArray(int cnt) : m_Count(cnt), m_pNodes(new librdf_node*[cnt])
+{
+for (int i = 0; i < cnt; ++i)
+m_pNodes[i] = nullptr;
+}
 
-void operator() (librdf_node** io_pArray) const throw ()
+~NodeArray() throw ()
 {
-std::for_each(io_pArray, io_pArray + m_Count, safe_librdf_free_node);
-delete[] io_pArray;
+std::for_each(m_pNodes.get(), m_pNodes.get() + m_Count, 
safe_librdf_free_node);
 }
 };
 
@@ -657,13 +660,9 @@ librdf_QuerySelectResult::nextElement()
 }
 sal_Int32 count(m_BindingNames.getLength());
 OSL_ENSURE(count >= 0, "negative length?");
-std::shared_ptr const pNodes(new librdf_node*[count],
-NodeArrayDeleter(count));
-for (int i = 0; i < count; ++i) {
-pNodes.get()[i] = nullptr;
-}
+NodeArray aNodes(count);
 if (librdf_query_results_get_bindings(m_pQueryResult.get(), nullptr,
-pNodes.get()))
+aNodes.m_pNodes.get()))
 {
 rdf::QueryException e(
 "librdf_QuerySelectResult::nextElement: "
@@ -675,7 +674,7 @@ librdf_QuerySelectResult::nextElement()
 }
 uno::Sequence< uno::Reference< rdf::XNode > > ret(count);
 for (int i = 0; i < count; ++i) {
-ret[i] = m_xRep->getTypeConverter().convertToXNode(pNodes.get()[i]);
+ret[i] = m_xRep->getTypeConverter().convertToXNode(aNodes.m_pNodes[i]);
 }
 // NB: this will invalidate current item.
 librdf_query_results_next(m_pQueryResult.get());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2020-01-16 Thread Michael Meeks (via logerrit)
 unoxml/source/dom/documentbuilder.cxx |   25 +
 1 file changed, 21 insertions(+), 4 deletions(-)

New commits:
commit e217f2cec1505a65e4ca5651bf27449a606b09c3
Author: Michael Meeks 
AuthorDate: Thu Jan 16 02:04:53 2020 +
Commit: Michael Meeks 
CommitDate: Thu Jan 16 19:15:23 2020 +0100

unoxml: CDocumentBuilder::parseURI should handle non-file:/// URIs.

The proximate symptom of this is of only some of the slide layouts
applying in impress on Android. This is caused by not parsing the
file:///assets/.../layoutlist.xml - which needs to use UCB and its
cleverer osl/ file APIs.

Change-Id: I22ed77170891c0ec136caaa29da69987a0e51a73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86900
Tested-by: Jenkins
Reviewed-by: Michael Meeks 

diff --git a/unoxml/source/dom/documentbuilder.cxx 
b/unoxml/source/dom/documentbuilder.cxx
index 880d37abe31c..03f4b2a79e91 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -393,11 +394,27 @@ namespace DOM
 OString oUri = OUStringToOString(sUri, RTL_TEXTENCODING_UTF8);
 char *uri = const_cast(oUri.getStr());
 xmlDocPtr pDoc = xmlCtxtReadFile(pContext.get(), uri, nullptr, 0);
+
+Reference< XDocument > xRet;
+
+// if we failed to parse the URI as a simple file, lets try via a ucb 
stream.
+// For Android file:///assets/ URLs which must go via the osl/ file 
API.
 if (pDoc == nullptr) {
-throwEx(pContext.get());
-}
-Reference< XDocument > const xRet(
-CDocument::CreateCDocument(pDoc).get());
+Reference < XSimpleFileAccess3 > xStreamAccess(
+SimpleFileAccess::create( 
comphelper::getProcessComponentContext() ) );
+Reference< XInputStream > xInStream = xStreamAccess->openFileRead( 
sUri );
+if (!xInStream.is())
+throwEx(pContext.get());
+
+// loop over every layout entry in current file
+xRet = parse( xInStream );
+
+xInStream->closeInput();
+xInStream.clear();
+
+} else
+xRet = CDocument::CreateCDocument(pDoc).get();
+
 return xRet;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2019-09-07 Thread Arkadiy Illarionov (via logerrit)
 unoxml/source/dom/node.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 694784687e502f2e68fde5c2e5d7fb860517cbf8
Author: Arkadiy Illarionov 
AuthorDate: Sat Sep 7 15:09:33 2019 +0300
Commit: Arkadiy Illarionov 
CommitDate: Sat Sep 7 14:54:03 2019 +0200

tdf#39593 use isUnoTunnelId in unoxml

Change-Id: I8f29df9763030ff69791bf978a359f36d553dda4
Reviewed-on: https://gerrit.libreoffice.org/78742
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov 

diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 7171e6c2f791..cdeab8e2d419 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -993,9 +993,7 @@ namespace DOM
 ::sal_Int64 SAL_CALL
 CNode::getSomething(Sequence< ::sal_Int8 > const& rId)
 {
-if ((rId.getLength() == 16) &&
-(0 == memcmp(getUnoTunnelId().getConstArray(),
-rId.getConstArray(), 16)))
+if (isUnoTunnelId(rId))
 {
 return ::sal::static_int_cast< sal_Int64 >(
 reinterpret_cast< sal_IntPtr >(this) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: unoxml/source

2019-07-30 Thread Michael Stahl (via logerrit)
 unoxml/source/rdf/librdf_repository.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ee1900a01c61e656de5b3c14446b9513cf83c7fc
Author: Michael Stahl 
AuthorDate: Tue Jul 30 16:22:43 2019 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 30 16:25:18 2019 +0200

unordf: oops, and we forgot to amend with <= instead of <

... in 751a5ad9c4e75fd1019bd4bca940d8a9e73f171a

Change-Id: I81fb9e12b02eedd0fc6f4deccc392543cf2c14da
Reviewed-on: https://gerrit.libreoffice.org/76614
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index e775be583bf0..4e7b8382b5a6 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -566,7 +566,7 @@ css::uno::Any SAL_CALL
 librdf_GraphResult2::nextElement()
 {
 std::size_t const n = m_nIndex++;
-if (m_vStatements.size() < n)
+if (m_vStatements.size() <= n)
 {
 m_nIndex = m_vStatements.size(); // avoid overflow
 throw container::NoSuchElementException();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: unoxml/source

2019-07-30 Thread Michael Stahl (via logerrit)
 unoxml/source/rdf/librdf_repository.cxx |   65 
 1 file changed, 42 insertions(+), 23 deletions(-)

New commits:
commit 751a5ad9c4e75fd1019bd4bca940d8a9e73f171a
Author: Michael Stahl 
AuthorDate: Tue Jul 30 15:30:39 2019 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 30 16:21:23 2019 +0200

unordf: restore thread safety

(regression from f2c513e686536dc308609c56fa9354d4d10b072c)

Change-Id: I620d726555172fbaec3d468bcf21c0c1101cdc70
Reviewed-on: https://gerrit.libreoffice.org/76601
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 26f4a950518c..e775be583bf0 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -243,12 +244,12 @@ public:
 Statement const& i_rStatement);
 static std::shared_ptr extractResource_NoLock(
 const uno::Reference< rdf::XResource > & i_xResource);
-static void extractResourceToCacheKey(
+static void extractResourceToCacheKey_NoLock(
 const uno::Reference< rdf::XResource > & i_xResource,
 OUStringBuffer& rBuf);
 static std::shared_ptr extractNode_NoLock(
 const uno::Reference< rdf::XNode > & i_xNode);
-static void extractNodeToCacheKey(
+static void extractNodeToCacheKey_NoLock(
 const uno::Reference< rdf::XNode > & i_xNode,
 OUStringBuffer& rBuffer);
 static Statement extractStatement_NoLock(
@@ -550,7 +551,7 @@ public:
 private:
 
 std::vector m_vStatements;
-int m_nIndex = 0;
+std::atomic m_nIndex = 0;
 };
 
 
@@ -558,16 +559,19 @@ private:
 sal_Bool SAL_CALL
 librdf_GraphResult2::hasMoreElements()
 {
-return m_nIndex < static_cast(m_vStatements.size());
+return m_nIndex < m_vStatements.size();
 }
 
 css::uno::Any SAL_CALL
 librdf_GraphResult2::nextElement()
 {
-if (m_nIndex >= static_cast(m_vStatements.size()))
+std::size_t const n = m_nIndex++;
+if (m_vStatements.size() < n)
+{
+m_nIndex = m_vStatements.size(); // avoid overflow
 throw container::NoSuchElementException();
-m_nIndex++;
-return uno::makeAny(m_vStatements[m_nIndex-1]);
+}
+return uno::makeAny(m_vStatements[n]);
 }
 
 /** result of tuple queries ("SELECT").
@@ -731,7 +735,7 @@ private:
 librdf_NamedGraph(librdf_NamedGraph const&) = delete;
 librdf_NamedGraph& operator=(librdf_NamedGraph const&) = delete;
 
-static OUString createCacheKey(
+static OUString createCacheKey_NoLock(
 const uno::Reference< rdf::XResource > & i_xSubject,
 const uno::Reference< rdf::XURI > & i_xPredicate,
 const uno::Reference< rdf::XNode > & i_xObject);
@@ -741,8 +745,9 @@ private:
 librdf_Repository *const m_pRep;
 uno::Reference< rdf::XURI > const m_xName;
 
-// Querying is rather slow, so cache the results.
+/// Querying is rather slow, so cache the results.
 std::map> m_aStatementsCache;
+::osl::Mutex m_CacheMutex;
 };
 
 
@@ -784,6 +789,7 @@ void SAL_CALL librdf_NamedGraph::clear()
 throw lang::WrappedTargetRuntimeException( ex.Message,
 *this, anyEx );
 }
+::osl::MutexGuard g(m_CacheMutex);
 m_aStatementsCache.clear();
 }
 
@@ -797,7 +803,10 @@ void SAL_CALL librdf_NamedGraph::addStatement(
 throw rdf::RepositoryException(
 "librdf_NamedGraph::addStatement: repository is gone", *this);
 }
-m_aStatementsCache.clear();
+{
+::osl::MutexGuard g(m_CacheMutex);
+m_aStatementsCache.clear();
+}
 m_pRep->addStatementGraph_NoLock(
 i_xSubject, i_xPredicate, i_xObject, m_xName);
 }
@@ -812,22 +821,25 @@ void SAL_CALL librdf_NamedGraph::removeStatements(
 throw rdf::RepositoryException(
 "librdf_NamedGraph::removeStatements: repository is gone", *this);
 }
-m_aStatementsCache.clear();
+{
+::osl::MutexGuard g(m_CacheMutex);
+m_aStatementsCache.clear();
+}
 m_pRep->removeStatementsGraph_NoLock(
 i_xSubject, i_xPredicate, i_xObject, m_xName);
 }
 
-OUString librdf_NamedGraph::createCacheKey(
+OUString librdf_NamedGraph::createCacheKey_NoLock(
 const uno::Reference< rdf::XResource > & i_xSubject,
 const uno::Reference< rdf::XURI > & i_xPredicate,
 const uno::Reference< rdf::XNode > & i_xObject)
 {
 OUStringBuffer cacheKey(256);
-librdf_TypeConverter::extractResourceToCacheKey(i_xSubject, cacheKey);
+librdf_TypeConverter::extractResourceToCacheKey_NoLock(i_xSubject, 
cacheKey);
 cacheKey.append("\t");
-librdf_TypeConverter::extractResourceToCacheKey(i_xPredicate, cacheKey);
+librdf_TypeConverter::extractResourceToCacheKey_NoLock(i_xPredicate, 
cacheKey);
 cacheKey.append("\t");
-

[Libreoffice-commits] core.git: unoxml/source

2019-05-05 Thread Julien Nabet (via logerrit)
 unoxml/source/events/eventdispatcher.cxx |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit adafd453c564a65eb3b9c435e457c7ee7131b737
Author: Julien Nabet 
AuthorDate: Sun May 5 09:44:22 2019 +0200
Commit: Julien Nabet 
CommitDate: Sun May 5 10:57:27 2019 +0200

Use returned iterator from erase

Change-Id: I1ae4e4d0adc467f1bcce08fdd07a5dbf94c3111c
Reviewed-on: https://gerrit.libreoffice.org/71815
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/unoxml/source/events/eventdispatcher.cxx 
b/unoxml/source/events/eventdispatcher.cxx
index b5d5ef705b31..40a08305bfd0 100644
--- a/unoxml/source/events/eventdispatcher.cxx
+++ b/unoxml/source/events/eventdispatcher.cxx
@@ -69,9 +69,7 @@ namespace DOM { namespace events {
 // erase all references to specified listener
 if (iter->second.is() && iter->second == aListener)
 {
-ListenerMap::iterator tmp_iter = iter;
-++iter;
-rMap.erase(tmp_iter);
+iter = rMap.erase(iter);
 }
 else
 ++iter;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: unoxml/source

2018-12-05 Thread Libreoffice Gerrit user
 unoxml/source/dom/documentbuilder.cxx |6 +++---
 unoxml/source/dom/documentbuilder.hxx |2 --
 unoxml/source/dom/saxbuilder.cxx  |6 +++---
 unoxml/source/dom/saxbuilder.hxx  |2 --
 unoxml/source/xpath/xpathapi.cxx  |6 +++---
 unoxml/source/xpath/xpathapi.hxx  |2 --
 6 files changed, 9 insertions(+), 15 deletions(-)

New commits:
commit 2b938a369462b6ae650b1bfb973f0c7d380daf52
Author: Noel Grandin 
AuthorDate: Wed Dec 5 10:03:14 2018 +0200
Commit: Noel Grandin 
CommitDate: Thu Dec 6 07:19:06 2018 +0100

loplugin:singlevalfields in unoxml

Change-Id: I340be161aeb343ccc01b86bcb807e4441025419e
Reviewed-on: https://gerrit.libreoffice.org/64595
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/documentbuilder.cxx 
b/unoxml/source/dom/documentbuilder.cxx
index 8d244ab6d6e9..bbb412a32df0 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -101,15 +101,15 @@ namespace DOM
 return static_cast< XDocumentBuilder* >(new CDocumentBuilder);
 }
 
-const char* CDocumentBuilder::aImplementationName = 
"com.sun.star.comp.xml.dom.DocumentBuilder";
-const char* CDocumentBuilder::aSupportedServiceNames[] = {
+static const char aImplementationName[] = 
"com.sun.star.comp.xml.dom.DocumentBuilder";
+static const char* aSupportedServiceNames[] = {
 "com.sun.star.xml.dom.DocumentBuilder",
 nullptr
 };
 
 OUString CDocumentBuilder::_getImplementationName()
 {
-return OUString::createFromAscii(aImplementationName);
+return OUString(aImplementationName);
 }
 Sequence CDocumentBuilder::_getSupportedServiceNames()
 {
diff --git a/unoxml/source/dom/documentbuilder.hxx 
b/unoxml/source/dom/documentbuilder.hxx
index 4ef3e1840de1..ca5927161ceb 100644
--- a/unoxml/source/dom/documentbuilder.hxx
+++ b/unoxml/source/dom/documentbuilder.hxx
@@ -60,8 +60,6 @@ namespace DOM
 explicit CDocumentBuilder();
 
 // static helpers for service info and component management
-static const char* aImplementationName;
-static const char* aSupportedServiceNames[];
 static OUString _getImplementationName();
 static css::uno::Sequence< OUString > _getSupportedServiceNames();
 static css::uno::Reference< XInterface > _getInstance(
diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index 81da91c51073..a6e189b4b475 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -38,8 +38,8 @@ namespace DOM
 return static_cast< XSAXDocumentBuilder* >(new 
CSAXDocumentBuilder(rSMgr));
 }
 
-const char* CSAXDocumentBuilder::aImplementationName = 
"com.sun.star.comp.xml.dom.SAXDocumentBuilder";
-const char* CSAXDocumentBuilder::aSupportedServiceNames[] = {
+static const char aImplementationName[] = 
"com.sun.star.comp.xml.dom.SAXDocumentBuilder";
+static const char* aSupportedServiceNames[] = {
 "com.sun.star.xml.dom.SAXDocumentBuilder",
 nullptr
 };
@@ -51,7 +51,7 @@ namespace DOM
 
 OUString CSAXDocumentBuilder::_getImplementationName()
 {
-return OUString::createFromAscii(aImplementationName);
+return OUString(aImplementationName);
 }
 Sequence CSAXDocumentBuilder::_getSupportedServiceNames()
 {
diff --git a/unoxml/source/dom/saxbuilder.hxx b/unoxml/source/dom/saxbuilder.hxx
index 79c8ba0c5ff7..e2279a0c24bb 100644
--- a/unoxml/source/dom/saxbuilder.hxx
+++ b/unoxml/source/dom/saxbuilder.hxx
@@ -61,8 +61,6 @@ namespace DOM
 
 public:
 // static helpers for service info and component management
-static const char* aImplementationName;
-static const char* aSupportedServiceNames[];
 static OUString _getImplementationName();
 static css::uno::Sequence< OUString > _getSupportedServiceNames();
 static css::uno::Reference< XInterface > _getInstance(const 
css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr);
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index 74f216d59a7f..b010c6b61341 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -58,15 +58,15 @@ namespace XPath
 {
 }
 
-const char* CXPathAPI::aImplementationName = 
"com.sun.star.comp.xml.xpath.XPathAPI";
-const char* CXPathAPI::aSupportedServiceNames[] = {
+static const char aImplementationName[] = 
"com.sun.star.comp.xml.xpath.XPathAPI";
+static const char* aSupportedServiceNames[] = {
 "com.sun.star.xml.xpath.XPathAPI",
 nullptr
 };
 
 OUString CXPathAPI::_getImplementationName()
 {
-return OUString::createFromAscii(aImplementationName);
+return OUString(aImplementationName);
 }
 
 Sequence CXPathAPI::_getSupportedServiceNames()
diff --git a/unoxml/source/xpath/xpathapi.hxx 

[Libreoffice-commits] core.git: unoxml/source

2018-10-08 Thread Libreoffice Gerrit user
 unoxml/source/rdf/librdf_repository.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 260701270abc7997996625449cd3d40f8b4f7f49
Author: Stephan Bergmann 
AuthorDate: Mon Oct 8 18:29:02 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Oct 8 18:29:02 2018 +0200

Missing include

Change-Id: I5cb4fad28312e3ab28f26d7e12169d6db25e3758

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index b4e6e266cd2c..995c3034d02f 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -53,6 +53,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2018-02-02 Thread Mike Kaganski
 unoxml/source/dom/saxbuilder.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 5ab1d6f5d727f4823071386d40c147ce2f79a624
Author: Mike Kaganski 
Date:   Wed Jan 31 22:43:57 2018 +0300

unoxml: MSVC: pragma warning: make more specific, remove obsolete

Change-Id: I6c09eeeb43cd0bf85b89b1332f2ee6121b11de3c
Reviewed-on: https://gerrit.libreoffice.org/49056
Tested-by: Jenkins 
Reviewed-by: Mike Kaganski 

diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx
index b62dd3f839a2..626293a4d4a7 100644
--- a/unoxml/source/dom/saxbuilder.cxx
+++ b/unoxml/source/dom/saxbuilder.cxx
@@ -16,9 +16,6 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifdef _MSC_VER
-#pragma warning(disable : 4701)
-#endif
 
 #include "saxbuilder.hxx"
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2018-01-04 Thread Caolán McNamara
 unoxml/source/dom/element.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 73cd2cf7d1707e464f13c28b6ec583c484fd3f46
Author: Caolán McNamara 
Date:   Thu Jan 4 11:09:54 2018 +

ofz#4940 Null-dereference READ

Change-Id: I2c8c83ef6ffde5f1599814538acc36ec5beab6c8
Reviewed-on: https://gerrit.libreoffice.org/47387
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index fa4ef9ce4670..f7cae19fdbdc 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -132,7 +132,7 @@ namespace DOM
 
RTL_TEXTENCODING_UTF8));
 }
 
-const xmlChar* pPrefix = m_aNodePtr->ns ? m_aNodePtr->ns->prefix : 
reinterpret_cast("");
+const xmlChar* pPrefix = (m_aNodePtr->ns && m_aNodePtr->ns->prefix) ? 
m_aNodePtr->ns->prefix : reinterpret_cast("");
 const xmlChar* pName = m_aNodePtr->name;
 sal_Int32 nElementToken=FastToken::DONTKNOW;
 if( strlen(reinterpret_cast(pPrefix)) )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2017-10-16 Thread Caolán McNamara
 unoxml/source/events/eventdispatcher.cxx |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 68f8200e1cd22ad9e65d7fce6dfae8f3a24d88c7
Author: Caolán McNamara 
Date:   Sun Oct 15 21:23:37 2017 +0100

ofz: timeouts in fods/fodt/fodp

Change-Id: I543d4bc41d06712cef81b8b0853144625f0b9940
Reviewed-on: https://gerrit.libreoffice.org/43413
Reviewed-by: Michael Stahl 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/unoxml/source/events/eventdispatcher.cxx 
b/unoxml/source/events/eventdispatcher.cxx
index a68256a278fa..51572eea5e99 100644
--- a/unoxml/source/events/eventdispatcher.cxx
+++ b/unoxml/source/events/eventdispatcher.cxx
@@ -107,6 +107,18 @@ namespace DOM { namespace events {
 xmlNodePtr const pNode, Reference const& xNode,
 Reference< XEvent > const& i_xEvent) const
 {
+TypeListenerMap captureListeners;
+TypeListenerMap targetListeners;
+{
+::osl::MutexGuard g(rMutex);
+
+captureListeners = m_CaptureListeners;
+targetListeners = m_TargetListeners;
+}
+
+if (captureListeners.empty() && targetListeners.empty())
+return true;
+
 CEvent *pEvent = nullptr; // pointer to internal event representation
 
 OUString const aType = i_xEvent->getType();
@@ -180,8 +192,6 @@ namespace DOM { namespace events {
 typedef std::vector< ::std::pair >
 NodeVector_t;
 NodeVector_t captureVector;
-TypeListenerMap captureListeners;
-TypeListenerMap targetListeners;
 {
 ::osl::MutexGuard g(rMutex);
 
@@ -193,8 +203,6 @@ namespace DOM { namespace events {
 captureVector.emplace_back(xRef, cur);
 cur = cur->parent;
 }
-captureListeners = m_CaptureListeners;
-targetListeners = m_TargetListeners;
 }
 
 // the capture vector now holds the node path from target to root
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2017-08-25 Thread Michael Stahl
 unoxml/source/dom/documentbuilder.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ae3ba018bfe066854fd787e2938441e4cc1316e1
Author: Michael Stahl 
Date:   Fri Aug 25 13:31:25 2017 +0200

unoxml: CDocumentBuilder: just catch all Exception

Turns out that XErrorHandler can throw SAXException too, which isn't
derived from RuntimeException.

Change-Id: Ib853805259b5b32a979e4f9a20297975431dee08

diff --git a/unoxml/source/dom/documentbuilder.cxx 
b/unoxml/source/dom/documentbuilder.cxx
index e8eb6097c23d..0b5aa5d583d7 100644
--- a/unoxml/source/dom/documentbuilder.cxx
+++ b/unoxml/source/dom/documentbuilder.cxx
@@ -292,7 +292,7 @@ namespace DOM
 
pDocBuilder->getErrorHandler()->warning(::css::uno::Any(saxex));
 }
 }
-catch (const css::uno::RuntimeException )
+catch (const css::uno::Exception )
 {
 // Protect lib2xml from UNO Exception
 SAL_WARN("unoxml",
@@ -326,7 +326,7 @@ namespace DOM
 pDocBuilder->getErrorHandler()->error(::css::uno::Any(saxex));
 }
 }
-catch (const css::uno::RuntimeException )
+catch (const css::uno::Exception )
 {
 // Protect lib2xml from UNO Exception
 SAL_WARN("unoxml",
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2017-05-18 Thread Dilek Uzulmez
 unoxml/source/rdf/CLiteral.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 7902ac9fbcdbaefa5ec4e7d8d07c240aecad346a
Author: Dilek Uzulmez 
Date:   Wed May 17 16:02:24 2017 +0300

tdf#88205 Adapt uses of css::uno::Sequence to use initializer_list ctor

Change-Id: I37ab94954f30ad24418ee7453911557ded4f5ee8
Reviewed-on: https://gerrit.libreoffice.org/37707
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/unoxml/source/rdf/CLiteral.cxx b/unoxml/source/rdf/CLiteral.cxx
index fc1b2044ec3d..a922dc874397 100644
--- a/unoxml/source/rdf/CLiteral.cxx
+++ b/unoxml/source/rdf/CLiteral.cxx
@@ -179,8 +179,7 @@ OUString SAL_CALL _getImplementationName() {
 
 css::uno::Sequence< OUString > SAL_CALL _getSupportedServiceNames()
 {
-css::uno::Sequence< OUString > s { "com.sun.star.rdf.Literal" };
-return s;
+return { "com.sun.star.rdf.Literal" };
 }
 
 css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2017-04-07 Thread Stephan Bergmann
 unoxml/source/dom/documentbuilder.cxx |   32 +---
 1 file changed, 21 insertions(+), 11 deletions(-)

New commits:
commit d78040aadb6a8e31652b62a06d6e7e9b28ce
Author: Stephan Bergmann 
Date:   Fri Apr 7 10:17:49 2017 +0200

ASan stack-use-after-scope

...as reported during CppunitTest_extensions_test_update (see below).  I 
don't
see a reason why those pContext should be shared_ptr, so better make them
unique_ptr to guarantee that xmlFreeParserCtxt is called with c still in 
scope
(in CDocumentBuilder::parse).

> ==10883==ERROR: AddressSanitizer: stack-use-after-scope on address 
0x2b111da94b68 at pc 0x2b116e55a200 bp 0x7fff7228b0f0 sp 0x7fff7228b0e8
> READ of size 8 at 0x2b111da94b68 thread T0
> #0 0x2b116e55a1ff in com::sun::star::uno::BaseReference::is() const 
include/com/sun/star/uno/Reference.h:94:27
> #1 0x2b116e699756 in DOM::xmlIO_close_func(void*) 
unoxml/source/dom/documentbuilder.cxx:214:33
> #2 0x2b11300cf646 in xmlFreeParserInputBuffer__internal_alias 
workdir/UnpackedTarball/xml2/xmlIO.c:2575:2
> #3 0x2b112fdd2706 in xmlFreeInputStream__internal_alias 
workdir/UnpackedTarball/xml2/parserInternals.c:1341:9
> #4 0x2b112fddebf3 in xmlFreeParserCtxt__internal_alias 
workdir/UnpackedTarball/xml2/parserInternals.c:1774:9
> #5 0x2b116e6aaddc in std::_Sp_counted_deleter<_xmlParserCtxt*, void 
(*)(_xmlParserCtxt*), std::allocator, 
(__gnu_cxx::_Lock_policy)2>::_M_dispose() 
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/bits/shared_ptr_base.h:464:9
> #6 0x2b116e65370a in 
std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() 
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/bits/shared_ptr_base.h:150:6
> #7 0x2b116e653494 in 
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() 
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/bits/shared_ptr_base.h:662:11
> #8 0x2b116e6a78b1 in std::__shared_ptr<_xmlParserCtxt, 
(__gnu_cxx::_Lock_policy)2>::~__shared_ptr() 
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/bits/shared_ptr_base.h:928:31
> #9 0x2b116e69f01d in std::shared_ptr<_xmlParserCtxt>::~shared_ptr() 
/usr/lib/gcc/x86_64-redhat-linux/6.3.1/../../../../include/c++/6.3.1/bits/shared_ptr.h:93:11
> #10 0x2b116e696aca in 
DOM::CDocumentBuilder::parse(com::sun::star::uno::Reference
 const&) unoxml/source/dom/documentbuilder.cxx:336:5
> #11 0x2b116e699fe2 in non-virtual thunk to 
DOM::CDocumentBuilder::parse(com::sun::star::uno::Reference
 const&) unoxml/source/dom/documentbuilder.cxx
> #12 0x2b116df6449a in (anonymous 
namespace)::UpdateInformationProvider::getUpdateInformationEnumeration(com::sun::star::uno::Sequence
 const&, rtl::OUString const&) 
extensions/source/update/feed/updatefeed.cxx:589:83
> #13 0x2b116df682ea in non-virtual thunk to (anonymous 
namespace)::UpdateInformationProvider::getUpdateInformationEnumeration(com::sun::star::uno::Sequence
 const&, rtl::OUString const&) extensions/source/update/feed/updatefeed.cxx
> #14 0x2b115d9a73eb in 
testupdate::Test::testGetUpdateInformationEnumeration() 
extensions/qa/update/test_update.cxx:57:26
> #15 0x2b115d9baf1b in 
CppUnit::TestCaller::runTest() 
workdir/UnpackedTarball/cppunit/include/cppunit/TestCaller.h:166:6
> #16 0x2b111904ad8b in CppUnit::TestCaseMethodFunctor::operator()() 
const workdir/UnpackedTarball/cppunit/src/cppunit/TestCase.cpp:32:5
> #17 0x2b11322dab0f in (anonymous 
namespace)::Protector::protect(CppUnit::Functor const&, 
CppUnit::ProtectorContext const&) test/source/vclbootstrapprotector.cxx:39:14
> #18 0x2b11190093ce in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 
workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #19 0x2b1128c6214f in (anonymous 
namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext 
const&) unotest/source/cpp/unobootstrapprotector/unobootstrapprotector.cxx:89:12
> #20 0x2b11190093ce in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 
workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #21 0x2b1124efc351 in (anonymous 
namespace)::Prot::protect(CppUnit::Functor const&, CppUnit::ProtectorContext 
const&) unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx:63:16
> #22 0x2b11190093ce in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 
workdir/UnpackedTarball/cppunit/src/cppunit/ProtectorChain.cpp:20:25
> #23 0x2b1118f87350 in 
CppUnit::DefaultProtector::protect(CppUnit::Functor const&, 
CppUnit::ProtectorContext const&) 
workdir/UnpackedTarball/cppunit/src/cppunit/DefaultProtector.cpp:15:12
> #24 0x2b11190093ce in 
CppUnit::ProtectorChain::ProtectFunctor::operator()() const 

[Libreoffice-commits] core.git: unoxml/source

2016-06-07 Thread Michael Stahl
 unoxml/source/events/eventdispatcher.cxx |   34 ---
 unoxml/source/events/eventdispatcher.hxx |2 -
 2 files changed, 15 insertions(+), 21 deletions(-)

New commits:
commit 93f3bd545b65a4df1ed04118f696a85a0e50c423
Author: Michael Stahl 
Date:   Tue Jun 7 14:57:43 2016 +0200

unoxml: fix data race in CEventDispatcher::callListeners()

JunitTest_unoxml_complex crashed with an assertion:

error: attempt to increment a singular iterator.

This is because the CEventDispatcher::dispatchEvent() attempts to copy the
m_TargetListeners onto the stack, before dropping the mutex to call the,
listeners, but the copy is unintentionally shallow and the ListenerMap
that is the value of the outer type is not copied, so this member is
accessed in callListeners() without MutexGuard.

Fix this by replacing ListenerMap* with ListenerMap as the value,
which also allows getting rid of explicit delete calls.

15 0x2b7793e5ace8 in abort () at /lib64/libc.so.6
16 0x2b77948c1565 in __gnu_debug::_Error_formatter::_M_error() const () 
at /lib64/libstdc++.so.6
17 0x2b77b802a7d8 in 
__gnu_debug::_Safe_iterator >, std::__debug::multimap<_xmlNode*, 
com::sun::star::uno::Reference,
 std::less<_xmlNode*>, std::allocator > > >::operator++() (this=0x2b77b7d99c90) at 
/usr/include/c++/4.8.2/debug/safe_iterator.h:291
18 0x2b77b80275ae in 
DOM::events::CEventDispatcher::callListeners(std::__debug::map, std::allocator > >*, std::less, std::allocator, std::allocator > >*> > > const&, _xmlNode*, rtl::OUString const&, 
com::sun::star::uno::Reference 
const&) (rTMap=std::__debug::map with 1 elements, pNode=0x21a9c10, aType=..., 
xEvent=...) at /unoxml/source/events/eventdispatcher.cxx:103
pMap = 0x2203b10
iter = {first = , second = { = 
{_pInterface = }, }}
ibound = {first = , second = { 
= {_pInterface = }, }}
tIter = {first = {pData = }, second = }
19 0x2b77b80284e4 in 
DOM::events::CEventDispatcher::dispatchEvent(DOM::CDocument&, osl::Mutex&, 
_xmlNode*, com::sun::star::uno::Reference 
const&, 
com::sun::star::uno::Reference 
const&) const (this=0x21fbee0, rDocument=..., rMutex=..., pNode=0x2200890, 
xNode=..., i_xEvent=...) at /unoxml/source/events/eventdispatcher.cxx:242
captureListeners = std::__debug::map with 0 elements
targetListeners = std::__debug::map with 1 elements = {[{pData = 
0x2202a30}] = 0x2203b10}

Change-Id: I66fb7a461df0f8066383365850536f7b0394306d

diff --git a/unoxml/source/events/eventdispatcher.cxx 
b/unoxml/source/events/eventdispatcher.cxx
index 7fd7a48..0dab5b9 100644
--- a/unoxml/source/events/eventdispatcher.cxx
+++ b/unoxml/source/events/eventdispatcher.cxx
@@ -41,16 +41,16 @@ namespace DOM { namespace events {
 
 // get the multimap for the specified type
 ListenerMap *pMap = nullptr;
-TypeListenerMap::const_iterator tIter = pTMap->find(aType);
+auto tIter = pTMap->find(aType);
 if (tIter == pTMap->end()) {
 // the map has to be created
-pMap = new ListenerMap();
-pTMap->insert(TypeListenerMap::value_type(aType, pMap));
+auto const pair = pTMap->insert(TypeListenerMap::value_type(aType, 
ListenerMap()));
+pMap = & pair.first->second;
 } else {
-pMap = tIter->second;
+pMap = & tIter->second;
 }
-if (pMap !=nullptr)
-pMap->insert(ListenerMap::value_type(pNode, aListener));
+assert(pMap != nullptr);
+pMap->insert(ListenerMap::value_type(pNode, aListener));
 }
 
 void CEventDispatcher::removeListener(xmlNodePtr pNode, const OUString& 
aType, const Reference& aListener, bool bCapture)
@@ -59,19 +59,19 @@ namespace DOM { namespace events {
 ? (& m_CaptureListeners) : (& m_TargetListeners);
 
 // get the multimap for the specified type
-TypeListenerMap::const_iterator tIter = pTMap->find(aType);
+auto tIter = pTMap->find(aType);
 if (tIter != pTMap->end()) {
-ListenerMap *pMap = tIter->second;
+ListenerMap & rMap = tIter->second;
 // find listeners of specified type for specified node
-ListenerMap::iterator iter = pMap->find(pNode);
-while (iter != pMap->end() && iter->first == pNode)
+ListenerMap::iterator iter = rMap.find(pNode);
+while (iter != rMap.end() && iter->first == 

[Libreoffice-commits] core.git: unoxml/source

2015-10-25 Thread Mario J . Rugiero
 unoxml/source/dom/node.cxx |2 --
 1 file changed, 2 deletions(-)

New commits:
commit 96a6ab886f6d3e726fe54f6dc18c6c6769c27716
Author: Mario J. Rugiero 
Date:   Sun Oct 25 18:06:43 2015 -0300

Remove unneeded boost/bind include from unoxml/source/dom/node.cxx

Change-Id: Ia97d9a24ffd455a135c44bba250fd0c27df7f910
Reviewed-on: https://gerrit.libreoffice.org/19591
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index a01296e..bf378c0 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -26,8 +26,6 @@
 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2015-10-22 Thread Mario J . Rugiero
 unoxml/source/dom/node.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit eb9e0ddfd69618bf0a7f8cd908c631751b93ea1e
Author: Mario J. Rugiero 
Date:   Sun Oct 11 15:28:39 2015 -0300

Replace uses of boost::bind with C++11 lambdas in unoxml/source/dom/node.cxx

Change-Id: I2455476a876012051ca1651721915243503fbb22
Reviewed-on: https://gerrit.libreoffice.org/19308
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/unoxml/source/dom/node.cxx b/unoxml/source/dom/node.cxx
index 4501b7a..a01296e 100644
--- a/unoxml/source/dom/node.cxx
+++ b/unoxml/source/dom/node.cxx
@@ -121,10 +121,8 @@ namespace DOM
 Context::NamespaceVectorType::value_type::const_iterator aIter;
 if( (aIter=std::find_if(rContext.maNamespaces.back().begin(),
 rContext.maNamespaces.back().end(),
-boost::bind(std::equal_to(),
-
boost::bind(::Namespace::getPrefix,
-_1),
-boost::cref(prefix != 
rContext.maNamespaces.back().end() )
+[](const Context::Namespace 
){ return aNamespace.getPrefix() == prefix; } )) !=
+rContext.maNamespaces.back().end() 
)
 {
 nNamespaceToken = aIter->mnToken;
 sal_Int32 nNameToken = getToken( rContext, pName );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2015-09-03 Thread David Ostrovsky
 unoxml/source/rdf/librdf_repository.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit aafc0d29178ebb88201d4062481d3498e4a9ff18
Author: David Ostrovsky 
Date:   Thu Sep 3 21:55:16 2015 +0200

unoxml: Add missing include

Change-Id: I5497abb747dc12080f076aaf81b946710bcd5570
Reviewed-on: https://gerrit.libreoffice.org/18319
Reviewed-by: Michael Stahl 
Tested-by: Michael Stahl 

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index aefdc8d..1dc5eaf 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -23,6 +23,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2014-07-18 Thread Miklos Vajna
 unoxml/source/dom/elementlist.hxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c6a7c5ee5abb867edbdd5a35f1f6c06cee8cab0b
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Fri Jul 18 10:18:46 2014 +0200

loplugin:saloverride

Change-Id: I27600820acb4a432840ef9bc7220fc3d4bb6a273

diff --git a/unoxml/source/dom/elementlist.hxx 
b/unoxml/source/dom/elementlist.hxx
index 18289e6..51baa03 100644
--- a/unoxml/source/dom/elementlist.hxx
+++ b/unoxml/source/dom/elementlist.hxx
@@ -71,7 +71,7 @@ namespace DOM
 
 void registerListener(CElement  rElement);
 
-~CElementListImpl();
+virtual ~CElementListImpl();
 
 /**
 The number of nodes in the list.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2014-04-15 Thread Stephan Bergmann
 unoxml/source/rdf/CBlankNode.cxx |7 +++
 unoxml/source/rdf/CLiteral.cxx   |7 +++
 unoxml/source/rdf/CURI.cxx   |7 +++
 3 files changed, 9 insertions(+), 12 deletions(-)

New commits:
commit f981c42edac92ac03dd04e87baab238b84963de5
Author: Stephan Bergmann sberg...@redhat.com
Date:   Tue Apr 15 08:37:14 2014 +0200

Clean up function declarations

Change-Id: I1be08414e3c816f01a9712eeb9474acc16838389

diff --git a/unoxml/source/rdf/CBlankNode.cxx b/unoxml/source/rdf/CBlankNode.cxx
index 1d1e7b6..2c16ee4 100644
--- a/unoxml/source/rdf/CBlankNode.cxx
+++ b/unoxml/source/rdf/CBlankNode.cxx
@@ -19,6 +19,7 @@
 
 #include CNodes.hxx
 
+#include boost/noncopyable.hpp
 #include cppuhelper/implbase3.hxx
 #include cppuhelper/supportsservice.hxx
 #include com/sun/star/lang/XServiceInfo.hpp
@@ -35,7 +36,8 @@ class CBlankNode:
 public ::cppu::WeakImplHelper3
 css::lang::XServiceInfo,
 css::lang::XInitialization,
-css::rdf::XBlankNode
+css::rdf::XBlankNode,
+private boost::noncopyable
 {
 public:
 explicit CBlankNode(css::uno::Reference css::uno::XComponentContext  
const  context);
@@ -53,9 +55,6 @@ public:
 virtual OUString SAL_CALL getStringValue() throw 
(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
-CBlankNode(const CBlankNode ); // not defined
-CBlankNode operator=(const CBlankNode ); // not defined
-
 css::uno::Reference css::uno::XComponentContext  m_xContext;
 
 OUString m_NodeID;
diff --git a/unoxml/source/rdf/CLiteral.cxx b/unoxml/source/rdf/CLiteral.cxx
index 6d69fac..5fd0bef 100644
--- a/unoxml/source/rdf/CLiteral.cxx
+++ b/unoxml/source/rdf/CLiteral.cxx
@@ -19,6 +19,7 @@
 
 #include CNodes.hxx
 
+#include boost/noncopyable.hpp
 #include cppuhelper/implbase3.hxx
 #include cppuhelper/supportsservice.hxx
 #include com/sun/star/lang/XServiceInfo.hpp
@@ -37,7 +38,8 @@ class CLiteral:
 public ::cppu::WeakImplHelper3
 css::lang::XServiceInfo,
 css::lang::XInitialization,
-css::rdf::XLiteral
+css::rdf::XLiteral,
+private boost::noncopyable
 {
 public:
 explicit CLiteral(css::uno::Reference css::uno::XComponentContext  const 
 context);
@@ -60,9 +62,6 @@ public:
 virtual css::uno::Reference css::rdf::XURI  SAL_CALL getDatatype() throw 
(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
-CLiteral(const CLiteral ); // not defined
-CLiteral operator=(const CLiteral ); // not defined
-
 css::uno::Reference css::uno::XComponentContext  m_xContext;
 
 OUString m_Value;
diff --git a/unoxml/source/rdf/CURI.cxx b/unoxml/source/rdf/CURI.cxx
index 6ddd1c6..228af1c 100644
--- a/unoxml/source/rdf/CURI.cxx
+++ b/unoxml/source/rdf/CURI.cxx
@@ -19,6 +19,7 @@
 
 #include CNodes.hxx
 
+#include boost/noncopyable.hpp
 #include cppuhelper/implbase3.hxx
 #include cppuhelper/supportsservice.hxx
 #include com/sun/star/lang/XServiceInfo.hpp
@@ -36,7 +37,8 @@ class CURI:
 public ::cppu::WeakImplHelper3
 css::lang::XServiceInfo,
 css::lang::XInitialization,
-css::rdf::XURI
+css::rdf::XURI,
+private boost::noncopyable
 {
 public:
 explicit CURI(css::uno::Reference css::uno::XComponentContext  const  
context);
@@ -58,9 +60,6 @@ public:
 virtual OUString SAL_CALL getNamespace() throw 
(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
 private:
-CURI(const CURI ); // not defined
-CURI operator=(const CURI ); // not defined
-
 /// handle css.rdf.URIs
 void SAL_CALL initFromConstant(const sal_Int16 i_Constant);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2014-01-09 Thread Michael Stahl
 unoxml/source/rdf/librdf_repository.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit d3aad81268298c05163136e2e953e1dfe0728d9e
Author: Michael Stahl mst...@redhat.com
Date:   Thu Jan 9 12:32:59 2014 +0100

librdf_Repository: make older compilers happy

Change-Id: Ide4df8f621f810b20be811db06d46edd5a9dc5f8

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index 6d7df63..d56cfad 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -2119,7 +2119,9 @@ librdf_uri* librdf_TypeConverter::mkURI_Lock( 
librdf_world* i_pWorld,
 librdf_TypeConverter::extractResource_NoLock(
 const uno::Reference rdf::XResource   i_xResource) const
 {
-if (!i_xResource.is()) return 0;
+if (!i_xResource.is()) {
+return ::boost::shared_ptrResource();
+}
 uno::Reference rdf::XBlankNode  xBlankNode(i_xResource, uno::UNO_QUERY);
 if (xBlankNode.is()) {
 const OString label(
@@ -2172,7 +2174,9 @@ librdf_node* librdf_TypeConverter::mkResource_Lock( 
librdf_world* i_pWorld,
 librdf_TypeConverter::extractNode_NoLock(
 const uno::Reference rdf::XNode   i_xNode) const
 {
-if (!i_xNode.is()) return 0;
+if (!i_xNode.is()) {
+return ::boost::shared_ptrNode();
+}
 uno::Reference rdf::XResource  xResource(i_xNode, uno::UNO_QUERY);
 if (xResource.is()) {
 return extractResource_NoLock(xResource);
@@ -2180,7 +2184,9 @@ librdf_TypeConverter::extractNode_NoLock(
 uno::Reference rdf::XLiteral xLiteral(i_xNode, uno::UNO_QUERY);
 OSL_ENSURE(xLiteral.is(),
 mkNode: someone invented a new rdf.XNode and did not tell me);
-if (!xLiteral.is()) return 0;
+if (!xLiteral.is()) {
+return ::boost::shared_ptrNode();
+}
 const OString val(
 OUStringToOString(xLiteral-getValue(),
 RTL_TEXTENCODING_UTF8) );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2013-09-20 Thread Andres Gomez
 unoxml/source/dom/element.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a30652bfef1ca8c8d6a20a01aabc700b92978fb3
Author: Andres Gomez ago...@igalia.com
Date:   Mon Sep 16 15:56:53 2013 +0300

unoxml: avoid SIGSEV when xmlNsPtr prefix is NULL

When serializing a XDocument with xmlns elements, they usually come
with a prefix like in xmlns:xlink=http://www.w3.org/1999/xlink;.

When the prefix doesn exist like in xmlns=, the prefix member of the
xmlNsPtr structure is NULL and unsafe operations on it like strlen
may cause a SIGSEV.

Change-Id: Icdfcddeccb37c246a48aa1239b7f3c5b0b3727e3
Reviewed-on: https://gerrit.libreoffice.org/6003
Tested-by: Miklos Vajna vmik...@collabora.co.uk
Reviewed-by: Miklos Vajna vmik...@collabora.co.uk

diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index 87dba8a..e41420a 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -55,7 +55,7 @@ namespace DOM
 OUString type = ;
 // add namespace definitions to attributes
 for (xmlNsPtr pNs = m_aNodePtr-nsDef; pNs != 0; pNs = pNs-next) {
-const xmlChar *pPrefix = pNs-prefix;
+const xmlChar *pPrefix = pNs-prefix ? pNs-prefix : (const 
xmlChar*);
 OUString prefix(reinterpret_castconst sal_Char*(pPrefix),
 strlen(reinterpret_castconst char*(pPrefix)),
 RTL_TEXTENCODING_UTF8);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source writerfilter/source xmlsecurity/source

2013-06-19 Thread Jelle van der Waa
 unoxml/source/dom/element.cxx  |2 +-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |6 +++---
 xmlsecurity/source/dialogs/resourcemanager.cxx |2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit b5f3f55ce59b400f885c41413a3087e3406a424d
Author: Jelle van der Waa je...@vdwaa.nl
Date:   Tue Jun 18 20:02:13 2013 +0200

fdo#43460 unoxml,writerfilter,xmlsecurity: use isEmpty()

Change-Id: Iba3b39086212803bc41384f5c8f51e42712a5249
Reviewed-on: https://gerrit.libreoffice.org/4349
Reviewed-by: Noel Power noel.po...@suse.com
Tested-by: Noel Power noel.po...@suse.com

diff --git a/unoxml/source/dom/element.cxx b/unoxml/source/dom/element.cxx
index 50bb0bd..87dba8a 100644
--- a/unoxml/source/dom/element.cxx
+++ b/unoxml/source/dom/element.cxx
@@ -502,7 +502,7 @@ namespace DOM
 Reference XAttr  aAttr;
 if (!oldAttr-getNamespaceURI().isEmpty()) {
 OUStringBuffer qname(oldAttr-getPrefix());
-if (0 != qname.getLength()) {
+if (!qname.isEmpty()) {
 qname.append(sal_Unicode(':'));
 }
 qname.append(oldAttr-getName());
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8bd05dc..8849ed7 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1237,7 +1237,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword 
nKeyword)
 aBuf.append(ch);
 else if (bInKeyword  isspace(ch))
 bInKeyword = false;
-if (aBuf.getLength()  0  !isalnum(ch))
+if (!aBuf.isEmpty()  !isalnum(ch))
 bFoundCode = true;
 }
 Strm().Seek(nPos);
@@ -4649,12 +4649,12 @@ void RTFDocumentImpl::setSkipUnknown(bool bSkipUnknown)
 
 void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex)
 {
-if (bUnicode  m_aUnicodeBuffer.getLength()  0)
+if (bUnicode  !m_aUnicodeBuffer.isEmpty())
 {
 OUString aString = m_aUnicodeBuffer.makeStringAndClear();
 text(aString);
 }
-if (bHex  m_aHexBuffer.getLength()  0)
+if (bHex  !m_aHexBuffer.isEmpty())
 {
 OUString aString = 
OStringToOUString(m_aHexBuffer.makeStringAndClear(), 
m_aStates.top().nCurrentEncoding);
 text(aString);
diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx 
b/xmlsecurity/source/dialogs/resourcemanager.cxx
index 2611960..d9279b1 100644
--- a/xmlsecurity/source/dialogs/resourcemanager.cxx
+++ b/xmlsecurity/source/dialogs/resourcemanager.cxx
@@ -284,7 +284,7 @@ vector pair OUString, OUString  parseDN(const OUString 
rRawString)
 }
 }
 }
-if (sbufValue.getLength())
+if (!sbufValue.isEmpty())
 {
 OSL_ASSERT(!sType.isEmpty());
 retVal.push_back(make_pair(sType, sbufValue.makeStringAndClear()));
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source

2013-04-22 Thread Michael Stahl
 unoxml/source/rdf/librdf_repository.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit a504e7f289297f0acc21075080495996e677e020
Author: Michael Stahl mst...@redhat.com
Date:   Mon Apr 22 13:49:26 2013 +0200

unordf: put in a version check for librdf_stream_get_context2

Strangely Apple llvm-g++ 4.2.1 ignores the warning-disabling macro here
and gives a deprecation warning, so use a version check instead.

Change-Id: Ibc09930a907baea8665828529332d40de156b70e

diff --git a/unoxml/source/rdf/librdf_repository.cxx 
b/unoxml/source/rdf/librdf_repository.cxx
index eb1bb94..ab202d1 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -454,10 +454,12 @@ librdf_node* librdf_GraphResult::getContext() const
 {
 if (!m_pStream.get() || librdf_stream_end(m_pStream.get()))
 return NULL;
-SAL_WNODEPRECATED_DECLARATIONS_PUSH;
 librdf_node *pCtxt( static_castlibrdf_node *
+#if LIBRDF_VERSION = 10012
+(librdf_stream_get_context2(m_pStream.get())) );
+#else
 (librdf_stream_get_context(m_pStream.get())) );
-SAL_WNODEPRECATED_DECLARATIONS_POP;
+#endif
 if (pCtxt)
 return pCtxt;
 return m_pContext.get();
@@ -1585,10 +1587,12 @@ librdf_statement *rdfa_context_stream_map_handler(
 {
 OSL_ENSURE(i_pStream, rdfa_context_stream_map_handler: stream null);
 if (i_pStream) {
-SAL_WNODEPRECATED_DECLARATIONS_PUSH;
 librdf_node *pCtxt( static_castlibrdf_node *
+#if LIBRDF_VERSION = 10012
+(librdf_stream_get_context2(i_pStream)) );
+#else
 (librdf_stream_get_context(i_pStream)) );
-SAL_WNODEPRECATED_DECLARATIONS_POP;
+#endif
 OSL_ENSURE(pCtxt, rdfa_context_stream_map_handler: context null);
 if (pCtxt  isInternalContext(pCtxt)) {
 return i_pStatement;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: unoxml/source ure/source vbahelper/source writerfilter/qa xmlhelp/source

2013-02-24 Thread Chr . Rossmanith
 unoxml/source/dom/attr.cxx |2 -
 unoxml/source/dom/attributesmap.cxx|   16 ++--
 ure/source/uretest/cppmain.cc  |   21 +++-
 vbahelper/source/msforms/vbacontrols.cxx   |   26 ++---
 vbahelper/source/vbahelper/vbacommandbars.cxx  |6 ++--
 writerfilter/qa/cppunittests/doctok/testdoctok.cxx |6 +---
 xmlhelp/source/cxxhelp/provider/db.hxx |2 -
 xmlhelp/source/cxxhelp/provider/inputstream.cxx|2 -
 8 files changed, 38 insertions(+), 43 deletions(-)

New commits:
commit ed383ebfbae4c79c870389868762767b16f444ee
Author: Chr. Rossmanith chrrossman...@gmx.de
Date:   Sun Feb 24 20:13:06 2013 +0100

remove RTL_CONSTASCII_(U)STRINGPARAM

Change-Id: Ica4dc859229c2ba0dc052a97ff23178895c25580
Reviewed-on: https://gerrit.libreoffice.org/2368
Reviewed-by: Norbert Thiebaud nthieb...@gmail.com
Tested-by: LibreOffice gerrit bot ger...@libreoffice.org

diff --git a/unoxml/source/dom/attr.cxx b/unoxml/source/dom/attr.cxx
index e116950..dc2ef6e 100644
--- a/unoxml/source/dom/attr.cxx
+++ b/unoxml/source/dom/attr.cxx
@@ -197,7 +197,7 @@ namespace DOM
 
 // dispatch DOM events to signal change in attribute value
 // dispatch DomAttrModified + DOMSubtreeModified
-OUString sEventName( RTL_CONSTASCII_USTRINGPARAM(DOMAttrModified) );
+OUString sEventName( DOMAttrModified );
 Reference XDocumentEvent  docevent(getOwnerDocument(), UNO_QUERY);
 Reference XMutationEvent  
event(docevent-createEvent(sEventName),UNO_QUERY);
 event-initMutationEvent(
diff --git a/unoxml/source/dom/attributesmap.cxx 
b/unoxml/source/dom/attributesmap.cxx
index d0508f7..9c93f24 100644
--- a/unoxml/source/dom/attributesmap.cxx
+++ b/unoxml/source/dom/attributesmap.cxx
@@ -162,8 +162,8 @@ namespace DOM
 // no MutexGuard needed: m_pElement is const
 Reference XAttr  const xAttr(m_pElement-getAttributeNode(name));
 if (!xAttr.is()) {
-throw DOMException(OUString(RTL_CONSTASCII_USTRINGPARAM(
-CAttributesMap::removeNamedItem: no such attribute)),
+throw DOMException(OUString(
+CAttributesMap::removeNamedItem: no such attribute),
 static_castOWeakObject*(this),
 DOMExceptionType_NOT_FOUND_ERR);
 }
@@ -184,8 +184,8 @@ namespace DOM
 Reference XAttr  const xAttr(
 m_pElement-getAttributeNodeNS(namespaceURI, localName));
 if (!xAttr.is()) {
-throw DOMException(OUString(RTL_CONSTASCII_USTRINGPARAM(
-CAttributesMap::removeNamedItemNS: no such attribute)),
+throw DOMException(OUString(
+CAttributesMap::removeNamedItemNS: no such attribute),
 static_castOWeakObject*(this),
 DOMExceptionType_NOT_FOUND_ERR);
 }
@@ -203,8 +203,8 @@ namespace DOM
 {
 Reference XAttr  const xAttr(xNode, UNO_QUERY);
 if (!xNode.is()) {
-throw DOMException(OUString(RTL_CONSTASCII_USTRINGPARAM(
-CAttributesMap::setNamedItem: XAttr argument expected)),
+throw DOMException(OUString(
+CAttributesMap::setNamedItem: XAttr argument expected),
 static_castOWeakObject*(this),
 DOMExceptionType_HIERARCHY_REQUEST_ERR);
 }
@@ -223,8 +223,8 @@ namespace DOM
 {
 Reference XAttr  const xAttr(xNode, UNO_QUERY);
 if (!xNode.is()) {
-throw DOMException(OUString(RTL_CONSTASCII_USTRINGPARAM(
-CAttributesMap::setNamedItemNS: XAttr argument 
expected)),
+throw DOMException(OUString(
+CAttributesMap::setNamedItemNS: XAttr argument expected),
 static_castOWeakObject*(this),
 DOMExceptionType_HIERARCHY_REQUEST_ERR);
 }
diff --git a/ure/source/uretest/cppmain.cc b/ure/source/uretest/cppmain.cc
index 41fc255..86ca2b5 100644
--- a/ure/source/uretest/cppmain.cc
+++ b/ure/source/uretest/cppmain.cc
@@ -137,8 +137,7 @@ private:
 throw;
 } catch (::css::uno::Exception ) {
 throw ::css::uno::RuntimeException(
-::rtl::OUString(
-RTL_CONSTASCII_USTRINGPARAM(error creating instance)),
+::rtl::OUString(error creating instance),
 static_cast ::cppu::OWeakObject * (this));
 }
 if (!instance.is()) {
@@ -152,18 +151,18 @@ private:
 for (::std::size_t i = 0; i  SAL_N_ELEMENTS(singletons); ++i)
 {
 ::rtl::OUStringBuffer b;
-b.appendAscii(RTL_CONSTASCII_STRINGPARAM(/singletons/));
-b.appendAscii(singletons[i]);
+b.append(/singletons/);
+b.append(singletons[i]);
 ::css::uno::Reference ::css::uno::XInterface  instance(