From 490e64cdc890c5998d54d4ad3c3ac85e7e8e3bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 20 Sep 2024 20:19:49 +0100 Subject: [PATCH] cid#1607175 Overflowed constant MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit and cid#1606656 Overflowed constant Change-Id: I278d3745ca5d22defde8ab268e644e9ee312a3cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173751 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- l10ntools/source/treemerge.cxx | 5 ++++- unodevtools/source/skeletonmaker/cpptypemaker.cxx | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx index 47bfec04ef46..5dc6455e7018 100644 --- a/l10ntools/source/treemerge.cxx +++ b/l10ntools/source/treemerge.cxx @@ -71,9 +71,12 @@ namespace const auto nAfterSlash = (nFirstSlash != std::string_view::npos) ? (nFirstSlash + 1) : 0; // Update id attribute of topic { + std::u16string_view::size_type nXhpSlash = rXhpRoot.rfind('/'); + const auto nAfterXhpSlash = (nXhpSlash != std::u16string_view::npos) ? (nXhpSlash + 1) : 0; + OString sNewID = OString::Concat(sID.subView( 0, nAfterSlash )) + - rXhpRoot.substr( rXhpRoot.rfind('/') + 1 ) + + rXhpRoot.substr( nAfterXhpSlash ) + sID.subView( sID.indexOf( '/', nAfterSlash ) ); xmlSetProp( pReturn, reinterpret_cast("id"), diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx index 481299c2e1c2..1423f2739a5b 100644 --- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx +++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx @@ -265,7 +265,8 @@ static void printConstructor( rtl::Reference< unoidl::Entity > const & entity, std::u16string_view name, std::vector< OUString > const & arguments) { - o << "public " << OUString(name.substr(name.rfind('.') + 1)) << '('; + std::u16string_view::size_type pos = name.rfind('.'); + o << "public " << OUString(name.substr((pos != std::u16string_view::npos) ? pos + 1 : 0)) << '('; printConstructorParameters( o, options, manager, sort, entity, name, arguments); o << ");\n";