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 ); mxHandler.set( new DocumentHandler );
mxTokHandler.set( new TokenHandler ); mxTokHandler.set( new TokenHandler );
maRegisteredNamespaces.realloc(2); maRegisteredNamespaces = {
maRegisteredNamespaces[0] = beans::make_Pair( beans::make_Pair(
OUString( "urn:oasis:names:tc:opendocument:xmlns:office:1.0" ), OUString( "urn:oasis:names:tc:opendocument:xmlns:office:1.0" ),
xml::sax::FastToken::NAMESPACE); xml::sax::FastToken::NAMESPACE),
maRegisteredNamespaces[1] = beans::make_Pair( beans::make_Pair(
OUString( "http://www.w3.org/1999/xlink" ), OUString( "http://www.w3.org/1999/xlink" ),
2*xml::sax::FastToken::NAMESPACE); 2*xml::sax::FastToken::NAMESPACE)
};
} }
void serializerTest () void serializerTest ()

View File

@@ -670,8 +670,9 @@ librdf_QuerySelectResult::nextElement()
uno::makeAny(e)); uno::makeAny(e));
} }
uno::Sequence< uno::Reference< rdf::XNode > > ret(count); uno::Sequence< uno::Reference< rdf::XNode > > ret(count);
auto retRange = asNonConstRange(ret);
for (int i = 0; i < count; ++i) { 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. // NB: this will invalidate current item.
librdf_query_results_next(m_pQueryResult.get()); 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); "librdf_query_results_get_bindings_count failed", *this);
} }
uno::Sequence< OUString > names(count); uno::Sequence< OUString > names(count);
auto namesRange = asNonConstRange(names);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
const char* name( librdf_query_results_get_binding_name( const char* name( librdf_query_results_get_binding_name(
pResults.get(), i) ); pResults.get(), i) );
@@ -1411,7 +1413,7 @@ librdf_Repository::querySelect(const OUString & i_rQuery)
"librdf_Repository::querySelect: binding is null", *this); "librdf_Repository::querySelect: binding is null", *this);
} }
names[i] = OUString::createFromAscii(name); namesRange[i] = OUString::createFromAscii(name);
} }
return new librdf_QuerySelectResult(this, m_aMutex, return new librdf_QuerySelectResult(this, m_aMutex,