diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-05-13 11:57:17 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-05-14 13:11:50 +0200 |
commit | af16aa625682b649e8843237652b9246d519cbae (patch) | |
tree | 2ea597c328318d6b75761b71af313bef02b5ad77 /sd | |
parent | f40cbba63f13e7081fc5901769651fd4d43ea34d (diff) |
Improve loplugin:stringview
Issue the "instead of O[U]String, pass [u16]string_view" diagnostic also for
operator call arguments. (The "rather than copy, pass subView()" diagnostic is
already part of handleSubExprThatCouldBeView, so no need to repeat it explicitly
for operator call arguments.)
(And many call sites don't even require an explicit [u16]string_view, esp. with
the recent ad48b2b02f83eed41fb1eb8d16de7e804156fcf1 "Optimized OString operator
+= overloads". Just some test code in sal/qa/ that explicitly tests the
O[U]String functionality had to be excluded.)
Change-Id: I8d55ba5a7fa16a563f5ffe43d245125c88c793bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115589
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/app/sdpopup.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/remotecontrol/BluetoothServer.cxx | 11 |
3 files changed, 15 insertions, 8 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 627ef8e8412a..0814abb2515d 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -56,6 +56,7 @@ #include <chrono> #include <cstdlib> +#include <string_view> using namespace css; @@ -931,7 +932,7 @@ public: case LOK_CALLBACK_CURSOR_VISIBLE: { m_bCursorVisibleChanged = true; - m_bCursorVisible = (OString("true") == pPayload); + m_bCursorVisible = (std::string_view("true") == pPayload); } break; case LOK_CALLBACK_VIEW_LOCK: @@ -957,7 +958,7 @@ public: boost::property_tree::ptree aTree; boost::property_tree::read_json(aStream, aTree); const int nViewId = aTree.get_child("viewId").get_value<int>(); - m_aViewCursorVisibilities[nViewId] = OString("true") == pPayload; + m_aViewCursorVisibilities[nViewId] = std::string_view("true") == pPayload; } break; case LOK_CALLBACK_TEXT_VIEW_SELECTION: diff --git a/sd/source/ui/app/sdpopup.cxx b/sd/source/ui/app/sdpopup.cxx index 52a0435351de..4aafd2848a3a 100644 --- a/sd/source/ui/app/sdpopup.cxx +++ b/sd/source/ui/app/sdpopup.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <string_view> + #include <editeng/flditem.hxx> #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> @@ -164,7 +168,8 @@ void SdFieldPopup::Execute(weld::Window* pParent, const tools::Rectangle& rRect) { int nCount = m_xPopup->n_children(); for (int i = 3; i < nCount; i++) - m_xPopup->set_active(OString::number(i), sIdent == OString::number(i)); + m_xPopup->set_active( + OString::number(i), sIdent == std::string_view(OString::number(i))); } } diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx index 0a6d198f1d0b..65564a00d280 100644 --- a/sd/source/ui/remotecontrol/BluetoothServer.cxx +++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx @@ -12,6 +12,7 @@ #include <iostream> #include <memory> #include <new> +#include <string_view> #include <sal/log.hxx> #include <osl/socket.hxx> @@ -254,7 +255,7 @@ getBluez5Adapter(DBusConnection *pConnection) char* pMessage; dbus_message_iter_get_basic(&aInnerInnerIter, &pMessage); - if (OString(pMessage) == "org.bluez.Adapter1") + if (pMessage == std::string_view("org.bluez.Adapter1")) { dbus_message_unref(pMsg); if (pPath) @@ -882,13 +883,13 @@ static DBusHandlerResult ProfileMessageFunction { SAL_INFO("sdremote.bluetooth", "ProfileMessageFunction||" << dbus_message_get_interface(pMessage) << "||" << dbus_message_get_member(pMessage)); - if (OString(dbus_message_get_interface(pMessage)) == "org.bluez.Profile1") + if (dbus_message_get_interface(pMessage) == std::string_view("org.bluez.Profile1")) { - if (OString(dbus_message_get_member(pMessage)) == "Release") + if (dbus_message_get_member(pMessage) == std::string_view("Release")) { return DBUS_HANDLER_RESULT_HANDLED; } - else if (OString(dbus_message_get_member(pMessage)) == "NewConnection") + else if (dbus_message_get_member(pMessage) == std::string_view("NewConnection")) { if (!dbus_message_has_signature(pMessage, "oha{sv}")) { @@ -939,7 +940,7 @@ static DBusHandlerResult ProfileMessageFunction return DBUS_HANDLER_RESULT_HANDLED; } } - else if (OString(dbus_message_get_member(pMessage)) == "RequestDisconnection") + else if (dbus_message_get_member(pMessage) == std::string_view("RequestDisconnection")) { return DBUS_HANDLER_RESULT_HANDLED; } |