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 <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2021-10-29 10:22:53 +03:00
parent db149ba980
commit 359a17d021
2 changed files with 12 additions and 9 deletions

View file

@ -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 ()

View file

@ -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,