[Libreoffice-commits] core.git: unoxml/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 24 11:26:08 UTC 2020
unoxml/source/rdf/librdf_repository.cxx | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
New commits:
commit 4e1e77b059942fa548c5053409d1b2fa712631c9
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Jan 24 07:12:53 2020 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
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 <mike.kaganski at collabora.com>
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());
More information about the Libreoffice-commits
mailing list