From 257f7984618fee8962a5d0167e595efbdcabb2eb Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Fri, 12 Sep 2025 09:47:39 +0200 Subject: [PATCH] rustmaker: Avoid string copy (loplugin:stringview) Address the following clang plugin error seen in an --enable-rust-uno build: /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1016:41: error: rather than copy, pass with a view using subView() [loplugin:stringview] 1016 | && (unoType.copy(unoType.lastIndexOf('.') + 1).startsWith("X"))); | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: Icec8b529abf67ca13243da21136d5f296f53b7d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190854 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- codemaker/source/rustmaker/cpproduce.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codemaker/source/rustmaker/cpproduce.cxx b/codemaker/source/rustmaker/cpproduce.cxx index 6241ef556240..1f0deae93e64 100644 --- a/codemaker/source/rustmaker/cpproduce.cxx +++ b/codemaker/source/rustmaker/cpproduce.cxx @@ -1013,7 +1013,7 @@ void CppProducer::generateStructMemberAccessors(CppFile& file, std::string_view // UNO interface types start with "com.sun.star" and end with an interface name (typically starting with "X") // Examples: "com.sun.star.uno.XInterface", "com.sun.star.text.XText" bool isInterfaceType = (unoType.startsWith("com.sun.star.") && (unoType.lastIndexOf('.') != -1) - && (unoType.copy(unoType.lastIndexOf('.') + 1).startsWith("X"))); + && (unoType.subView(unoType.lastIndexOf('.') + 1).starts_with('X'))); if (isInterfaceType) {