diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-10 12:28:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-10 19:10:31 +0100 |
commit | 9444c925b254cca32c08c473cc294a5f0e90881a (patch) | |
tree | e98a5fdd4125ab931d9acf7bd17e2ba7732995c5 /testtools | |
parent | 6610bfdd8c8923e85b30e364c6ea5c7abf218367 (diff) |
new loplugin:stringliteraldefine
look for
#define FOO "foo"
that can be converted into OUStringLiteral.
This is the first pass of this plugin, only doing those #define which
are local to a single compilation unit.
Change-Id: Ic8610e29ec42c36d03db5014a93c244315d5bbea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124962
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'testtools')
-rw-r--r-- | testtools/source/bridgetest/bridgetest.cxx | 8 | ||||
-rw-r--r-- | testtools/source/bridgetest/cppobj.cxx | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index bb1c3af497f2..5860708695d2 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -67,10 +67,10 @@ using namespace com::sun::star::bridge; using namespace test::testtools::bridgetest; -#define SERVICENAME "com.sun.star.test.bridge.BridgeTest" -#define IMPLNAME "com.sun.star.comp.bridge.BridgeTest" +constexpr OUStringLiteral SERVICENAME = u"com.sun.star.test.bridge.BridgeTest"; +constexpr OUStringLiteral IMPLNAME = u"com.sun.star.comp.bridge.BridgeTest"; -#define STRING_TEST_CONSTANT "\" paco\' chorizo\\\' \"\'" +constexpr OUStringLiteral STRING_TEST_CONSTANT = u"\" paco\' chorizo\\\' \"\'"; namespace bridge_test { @@ -1313,7 +1313,7 @@ SAL_DLLPUBLIC_EXPORT void * component_getFactory( { void * pRet = nullptr; - if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) + if (pServiceManager && OUString(IMPLNAME).equalsAscii(pImplName)) { Reference< XInterface > xFactory( createSingleComponentFactory( diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx index f8cfb521351e..9d5b469d48c7 100644 --- a/testtools/source/bridgetest/cppobj.cxx +++ b/testtools/source/bridgetest/cppobj.cxx @@ -61,8 +61,8 @@ using namespace test::testtools::bridgetest; #pragma warning (disable : 4503) // irrelevant for test code #endif -#define SERVICENAME "com.sun.star.test.bridge.CppTestObject" -#define IMPLNAME "com.sun.star.comp.bridge.CppTestObject" +constexpr OUStringLiteral SERVICENAME = u"com.sun.star.test.bridge.CppTestObject"; +constexpr OUStringLiteral IMPLNAME = u"com.sun.star.comp.bridge.CppTestObject"; namespace bridge_object { @@ -1199,7 +1199,7 @@ SAL_DLLPUBLIC_EXPORT void * component_getFactory( { void * pRet = nullptr; - if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) + if (pServiceManager && OUString(IMPLNAME).equalsAscii(pImplName)) { Reference< XSingleServiceFactory > xFactory( createSingleFactory( static_cast< XMultiServiceFactory * >( pServiceManager ), |