summaryrefslogtreecommitdiff
path: root/sal
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 /sal
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 'sal')
-rw-r--r--sal/cppunittester/cppunittester.cxx3
1 files changed, 1 insertions, 2 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index c859ee5e102f..6729903edd5d 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -91,8 +91,7 @@ std::string convertLazy(std::u16string_view s16) {
OString s8(OUStringToOString(s16, osl_getThreadTextEncoding()));
static_assert(sizeof (sal_Int32) <= sizeof (std::string::size_type), "must be at least the same size");
// ensure following cast is legitimate
- return std::string(
- s8.getStr(), static_cast< std::string::size_type >(s8.getLength()));
+ return std::string(s8);
}
//Output how long each test took