This was:
../../master/src/mathed/InsetMathBox.cpp:116:20: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::__cxx11::basic_string<wchar_t> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
116 | for (int i = 0; i < parts.size(); i += 2) {
| ~~^~~~~~~~~~~~~~
../../master/src/mathed/InsetMathBox.cpp:120:20: warning: comparison of integer expressions of different signedness: ‘std::vector<std::__cxx11::basic_string<wchar_t> >::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
Error noticed by Coverity:
*** CID 382777: Memory - illegal accesses (RETURN_LOCAL)
/home/lasgoutt/src/lyx/coverity/lyx/src/insets/InsetIndex.cpp: 1866 in _ZNK3lyx15InsetPrintIndex5xhtmlB5cxx11ERNS_9XMLStreamERKNS_12OutputParamsE()
1860
1861 // Collect the index entries in a form we can use them.
1862 vector<IndexEntry> entries;
1863 const docstring & indexType = params().getParamOr("type", from_ascii("idx"));
1864 for (const TocItem& item : *toc) {
1865 const auto* inset = static_cast<const InsetIndex*>(&(item.dit().inset()));
>>> CID 382777: Memory - illegal accesses (RETURN_LOCAL)
>>> Using "indexType", which points to an out-of-scope temporary variable of type "lyx::docstring const".
1866 if (item.isOutput() && inset->params().index == indexType)
1867 entries.emplace_back(IndexEntry{inset, &op});
1868 }
1869
1870 // If all the index entries are in notes or not displayed, get out sooner.
1871 if (entries.empty())
ATM, the validation is commented out.
To use it, one has first to install html5validator with
$ pip3 install html5validator>=0.4.2
and uncomment the line 335 in export.cmake
Rationales:
- previously, <mstyle> was used, but it's being deprecated for MathML 4 Core in favour of CSS and <mrow> (not a big deal in itself)
- the whole box cannot be hosted within the same tag, because neither <mstyle> nor <mrow> can have text, they need an intermediate container, <mtext> (which cannot hold anything else that pure text)
- new behaviour: always output a container for the whole box that has the right attributes, i.e. an <mrow>; split the content of the cell to have text and other tags set apart (text in <mtext>, other tags left as they were)
Old behaviour, invalid MathML (2 to 4):
<mstyle XXX>text<mn>.</mn></mstyle>
New behaviour, valid MathML:
<mrow XXX><mtext>text</mtext><mn>.</mn></mrow>
The inset represents text (as opposed to maths in formulae). <m:mstyle> is used to give style to its children, it is not supposed to have any contents on its own.
With the current settings, a theorem with several paragraphs will have several wrapper tags (i.e. two `<db:figure>`, with one paragraph each, one next to the other when it's the same theorem), while there should be only one (one `<db:figure>` with two paragraphs).
It makes me wonder whether DocBookWrapperMergeWithPrevious should be the default value. I don't see a case where it would be set to `false` with a wrapper tag, but the test suite isn't developed enough to make the change with peace of mind (i.e. remove the parameter `DocBookWrapperMergeWithPrevious` and consider it is always `true` in the code).
For the record, the current code also works with two subsequent theorems with two paragraphs each (see new test case).
Instead of asserting when there are unprocessed row elements (which,
as I understand it, should almost never happen), play safe and keep
them for later processing.
Related to bug #12617.