summaryrefslogtreecommitdiff
path: root/unoxml
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-01-24 07:12:53 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2020-01-24 12:25:36 +0100
commit4e1e77b059942fa548c5053409d1b2fa712631c9 (patch)
tree53b08ce4c9a1962b6958bbf47f6024bb779d3c8f /unoxml
parentd290f0b618473f392500244354c6ec0cadb78c0e (diff)
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'unoxml')
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx21
1 files changed, 9 insertions, 12 deletions
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<librdf_node*>
{
- int m_Count;
- std::unique_ptr<librdf_node*[]> 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<librdf_node*>(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<librdf_node*>::data;
+ using std::vector<librdf_node*>::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());