From 359a17d0215d36a441688ac3261af04f20a03c6c Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Fri, 29 Oct 2021 10:22:53 +0300 Subject: [PATCH] Prepare for removal of non-const operator[] from Sequence in unoxml Change-Id: Ie7738eb599ac2ae98618e258786b2a0d956cb9dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124408 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- unoxml/qa/unit/domtest.cxx | 15 ++++++++------- unoxml/source/rdf/librdf_repository.cxx | 6 ++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/unoxml/qa/unit/domtest.cxx b/unoxml/qa/unit/domtest.cxx index c6501547183c..3a715a9ed314 100644 --- a/unoxml/qa/unit/domtest.cxx +++ b/unoxml/qa/unit/domtest.cxx @@ -293,13 +293,14 @@ struct SerializerTest : public test::BootstrapFixture mxHandler.set( new DocumentHandler ); mxTokHandler.set( new TokenHandler ); - maRegisteredNamespaces.realloc(2); - maRegisteredNamespaces[0] = beans::make_Pair( - OUString( "urn:oasis:names:tc:opendocument:xmlns:office:1.0" ), - xml::sax::FastToken::NAMESPACE); - maRegisteredNamespaces[1] = beans::make_Pair( - OUString( "http://www.w3.org/1999/xlink" ), - 2*xml::sax::FastToken::NAMESPACE); + maRegisteredNamespaces = { + beans::make_Pair( + OUString( "urn:oasis:names:tc:opendocument:xmlns:office:1.0" ), + xml::sax::FastToken::NAMESPACE), + beans::make_Pair( + OUString( "http://www.w3.org/1999/xlink" ), + 2*xml::sax::FastToken::NAMESPACE) + }; } void serializerTest () diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index f9e918aff168..176a871fa872 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -670,8 +670,9 @@ librdf_QuerySelectResult::nextElement() uno::makeAny(e)); } uno::Sequence< uno::Reference< rdf::XNode > > ret(count); + auto retRange = asNonConstRange(ret); for (int i = 0; i < count; ++i) { - ret[i] = m_xRep->getTypeConverter().convertToXNode(aNodes[i]); + retRange[i] = m_xRep->getTypeConverter().convertToXNode(aNodes[i]); } // NB: this will invalidate current item. librdf_query_results_next(m_pQueryResult.get()); @@ -1403,6 +1404,7 @@ librdf_Repository::querySelect(const OUString & i_rQuery) "librdf_query_results_get_bindings_count failed", *this); } uno::Sequence< OUString > names(count); + auto namesRange = asNonConstRange(names); for (int i = 0; i < count; ++i) { const char* name( librdf_query_results_get_binding_name( pResults.get(), i) ); @@ -1411,7 +1413,7 @@ librdf_Repository::querySelect(const OUString & i_rQuery) "librdf_Repository::querySelect: binding is null", *this); } - names[i] = OUString::createFromAscii(name); + namesRange[i] = OUString::createFromAscii(name); } return new librdf_QuerySelectResult(this, m_aMutex,