l10ntools/source/treemerge.cxx | 9 +++++---- sal/cppunittester/cppunittester.cxx | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-)
New commits: commit 795940e4acb56d4085c93072b4def0310bf2b4eb Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Sep 18 17:42:18 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Sep 19 15:43:19 2024 +0200 cid#1606864 Overflowed constant Change-Id: I08beb9bd76065ea846171e07fbf6e427ada37360 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173667 Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index 610f8a8155ef..b1dcbfcd155e 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -356,7 +356,8 @@ double get_time(timeval* time) OString generateTestName(std::u16string_view rPath) { size_t nPathSep = rPath.rfind('/'); - std::u16string_view aTestName = rPath.substr(nPathSep+1); + size_t nAfterPathSep = (nPathSep != std::string_view::npos) ? (nPathSep + 1) : 0; + std::u16string_view aTestName = rPath.substr(nAfterPathSep); return OUStringToOString(aTestName, RTL_TEXTENCODING_UTF8); } commit 2f4c8f896f38e9d4999addff980278154e3b9322 Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Sep 18 17:36:39 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Sep 19 15:43:13 2024 +0200 cid#1606656 Overflowed constant Change-Id: I1503ebd911abf6e1e2060ce6dc3f0ac05e325982 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173666 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx index f6af92791662..47bfec04ef46 100644 --- a/l10ntools/source/treemerge.cxx +++ b/l10ntools/source/treemerge.cxx @@ -67,13 +67,14 @@ namespace helper::xmlStrToOString( pID ); xmlFree( pID ); - const sal_Int32 nFirstSlash = sID.indexOf('/'); + const std::string_view::size_type nFirstSlash = sID.indexOf('/'); + const auto nAfterSlash = (nFirstSlash != std::string_view::npos) ? (nFirstSlash + 1) : 0; // Update id attribute of topic { OString sNewID = - OString::Concat(sID.subView( 0, nFirstSlash + 1 )) + + OString::Concat(sID.subView( 0, nAfterSlash )) + rXhpRoot.substr( rXhpRoot.rfind('/') + 1 ) + - sID.subView( sID.indexOf( '/', nFirstSlash + 1 ) ); + sID.subView( sID.indexOf( '/', nAfterSlash ) ); xmlSetProp( pReturn, reinterpret_cast<const xmlChar*>("id"), reinterpret_cast<const xmlChar*>(sNewID.getStr())); @@ -81,7 +82,7 @@ namespace const OString sXhpPath = OString::Concat(rXhpRoot) + - sID.subView(sID.indexOf('/', nFirstSlash + 1)); + sID.subView(sID.indexOf('/', nAfterSlash)); xmlDocPtr pXhpFile = xmlParseFile( sXhpPath.getStr() ); // if xhpfile is missing than put this topic into comment if ( !pXhpFile )