std::size/SAL_N_ELEMENTS also counts the null terminator

which libxml2 2.12 will fail on with error:

'Extra content at the end of the document'

Change-Id: I9d5da9fdd826cce8462ede8c510eaea7281b760f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161627
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2024-01-04 17:00:06 +00:00
parent 79018bac2e
commit cbb17a548b

View file

@ -204,9 +204,9 @@ struct BasicTest : public test::BootstrapFixture
mxErrHandler.set( new ErrorHandler() );
uno::Reference<XDocumentBuilder> xDB( getMultiServiceFactory()->createInstance("com.sun.star.xml.dom.DocumentBuilder"), uno::UNO_QUERY_THROW );
mxDomBuilder.set( xDB );
mxValidInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile))) );
mxWarningInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(warningTestFile), std::size(warningTestFile))) );
mxErrorInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(errorTestFile), std::size(errorTestFile))) );
mxValidInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile) - 1)) );
mxWarningInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(warningTestFile), std::size(warningTestFile) - 1)) );
mxErrorInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(errorTestFile), std::size(errorTestFile) - 1)) );
mxDomBuilder->setErrorHandler(mxErrHandler);
}
@ -288,7 +288,7 @@ struct SerializerTest : public test::BootstrapFixture
mxErrHandler.set( new ErrorHandler() );
uno::Reference<XDocumentBuilder> xDB( getMultiServiceFactory()->createInstance("com.sun.star.xml.dom.DocumentBuilder"), uno::UNO_QUERY_THROW );
mxDomBuilder.set( xDB );
mxInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile))) );
mxInStream.set( new SequenceInputStream(css::uno::Sequence<sal_Int8>(reinterpret_cast<sal_Int8 const *>(validTestFile), std::size(validTestFile) - 1)) );
mxDomBuilder->setErrorHandler(mxErrHandler);
mxHandler.set( new DocumentHandler );
mxTokHandler.set( new TokenHandler );