sw/source/core/access/acccell.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
New commits: commit d57e03e2640d273e4dd3d0ba68666f33c50c2432 Author: Michael Weghorn <[email protected]> AuthorDate: Fri Mar 6 10:05:02 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Mar 6 13:29:23 2026 +0100 tdf#171086 sw a11y: Use npos for string_view index check std::basic_string_view<CharT,Traits>::find_first_of returns npos [1] (which is size_type(-1) [2]) if the string is not found, so use that in the check. Fixes this build error seen in a local gcc build on Debian testing after commit 43bf1cab57e7ac65ff376c46b2e3bd6b3cd91806 Author: Michael Weghorn <[email protected]> Date: Thu Mar 5 18:23:57 2026 +0100 tdf#171086 sw a11y: Report "{row,col}indextext" for Writer cells : In file included from /usr/include/c++/15/cassert:46, from /home/michi/development/git/libreoffice/include/rtl/ustrbuf.hxx:29, from /home/michi/development/git/libreoffice/include/svl/zforlist.hxx:24, from /home/michi/development/git/libreoffice/sw/inc/cellatr.hxx:23, from /home/michi/development/git/libreoffice/sw/source/core/access/acccell.cxx:35: /home/michi/development/git/libreoffice/sw/source/core/access/acccell.cxx: In member function ‘virtual std::__debug::unordered_map<rtl::OUString, rtl::OUString> SwAccessibleCell::implGetExtendedAttributes()’: /home/michi/development/git/libreoffice/sw/source/core/access/acccell.cxx:321:35: error: comparison of unsigned expression in ‘>= 0’ is always true [-Werror=type-limits] 321 | assert(nRowNameStartIndex >= 0 && "Cell name doesn't contain a row number"); | ~~~~~~~~~~~~~~~~~~~^~~~ [1] https://en.cppreference.com/w/cpp/string/basic_string_view/find_first_of.html [2] https://en.cppreference.com/w/cpp/string/basic_string_view/npos.html Change-Id: Ifcfbd1bf66221d82457bd61d12b0941e44eb64d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201110 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index 1df76fbe7dcc..f258c883ef7c 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -318,7 +318,7 @@ std::unordered_map<OUString, OUString> SwAccessibleCell::implGetExtendedAttribut } // cell name consists of column name (using letters) and row name (using digits) const size_t nRowNameStartIndex = sCellName.find_first_of(u"0123456789"); - assert(nRowNameStartIndex >= 0 && "Cell name doesn't contain a row number"); + assert(nRowNameStartIndex != std::u16string_view::npos && "Cell name doesn't contain a row number"); aAttributes.emplace(AccessibleAttribute::ColIndexText, sCellName.substr(0, nRowNameStartIndex)); aAttributes.emplace(AccessibleAttribute::RowIndexText, sCellName.substr(nRowNameStartIndex)); }
