summaryrefslogtreecommitdiff
path: root/unotest
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-05-05 08:31:35 +0200
committerStephan Bergmann <sbergman@redhat.com>2023-05-05 10:11:54 +0200
commit9c6b7283e366788c629b237cb2a3045ce926fed6 (patch)
tree8d21e3dcf201336cbea91222ea099e207039355d /unotest
parentf7e1cdf951f7f9cbb5822c49b86ba8a77a2fa878 (diff)
loplugin:unnecessarygetstr
The plugin in its current form is probably not intending to find these cases. But it happened to do so on macOS with libc++, where the std::basic_string ctors taking a final defaulted Allocator argument are instead implemented by a pair of overloaded ctors, one taking no Allocator at all (see 671d1c6cd14b28b5960ad56086299bd69533dfd8 "Adapt loplugin:unnecessarygetstr to libc++"). But these changes here are useful regardless, so lets leave it at that. Change-Id: I2776671e2953182bdcad36432951a75f82412ebb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151410 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'unotest')
-rw-r--r--unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx3
1 files changed, 1 insertions, 2 deletions
diff --git a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx
index 764f49d79bf5..5a76cbdb11c1 100644
--- a/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx
+++ b/unotest/source/cpp/unoexceptionprotector/unoexceptionprotector.cxx
@@ -39,8 +39,7 @@ std::string convert(std::u16string_view s16) {
OString s8(OUStringToOString(s16, osl_getThreadTextEncoding()));
static_assert(sizeof (sal_Int32) <= sizeof (std::string::size_type), "got to be at least equal");
// ensure following cast is legitimate
- return std::string(
- s8.getStr(), static_cast< std::string::size_type >(s8.getLength()));
+ return std::string(s8);
}
class Prot : public CppUnit::Protector