summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-10-21 12:41:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-11-04 08:51:00 +0100
commit5de73f04f3db9c8fb488bf75b1860bf8378a5b45 (patch)
tree162ce145c1bec1ac5b41b5caa5bac1591c54c11a /sal
parentdce64cc7cfd5f696ef0c030524558306687ae3c7 (diff)
new loplugin:staticconstexpr
Change-Id: Ida1996dfffa106bf95fd064e8191b8033b4002f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175336 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r--sal/qa/osl/socket.cxx2
-rw-r--r--sal/qa/rtl/strings/test_oustring_stringliterals.cxx2
-rw-r--r--sal/qa/rtl/strings/test_strings_defaultstringview.cxx3
-rw-r--r--sal/qa/rtl/textenc/rtl_textcvt.cxx2
-rw-r--r--sal/rtl/strtmpl.hxx2
5 files changed, 6 insertions, 5 deletions
diff --git a/sal/qa/osl/socket.cxx b/sal/qa/osl/socket.cxx
index 16b1366ba884..2a02e409a5a7 100644
--- a/sal/qa/osl/socket.cxx
+++ b/sal/qa/osl/socket.cxx
@@ -25,7 +25,7 @@ class SocketTest : public CppUnit::TestFixture
void test_createInetSocketAddr()
{
- OUString constexpr in(u"123.4.56.78"_ustr);
+ static constexpr OUString in(u"123.4.56.78"_ustr);
auto const addr = osl_createInetSocketAddr(in.pData, 100);
CPPUNIT_ASSERT(addr != nullptr);
CPPUNIT_ASSERT_EQUAL(osl_Socket_FamilyInet, osl_getFamilyOfSocketAddr(addr));
diff --git a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
index 25bc346fb495..1937029a1fdf 100644
--- a/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
+++ b/sal/qa/rtl/strings/test_oustring_stringliterals.cxx
@@ -409,7 +409,7 @@ void test::oustring::StringLiterals::checkUtf16() {
void test::oustring::StringLiterals::checkEmbeddedNul() {
using namespace std::literals;
rtl::OUString const s("foobar");
- constexpr char16_t const a[] = u"foo\0hidden";
+ static constexpr char16_t const a[] = u"foo\0hidden";
char16_t const * const p = a;
CPPUNIT_ASSERT(s.startsWith(a));
CPPUNIT_ASSERT(s.startsWith(p));
diff --git a/sal/qa/rtl/strings/test_strings_defaultstringview.cxx b/sal/qa/rtl/strings/test_strings_defaultstringview.cxx
index cbedc3a8e461..87b1d79ed331 100644
--- a/sal/qa/rtl/strings/test_strings_defaultstringview.cxx
+++ b/sal/qa/rtl/strings/test_strings_defaultstringview.cxx
@@ -50,7 +50,8 @@ class Test : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(true, u"foo"_ustr.startsWithIgnoreAsciiCase(std::u16string_view()));
CPPUNIT_ASSERT_EQUAL(true, u"foo"_ustr.endsWith(std::u16string_view()));
CPPUNIT_ASSERT_EQUAL(true, u"foo"_ustr.endsWithIgnoreAsciiCase(std::u16string_view()));
- OUString constexpr foo(u"foo"_ustr); // avoid loplugin:stringconstant, loplugin:stringview
+ static constexpr OUString foo(
+ u"foo"_ustr); // avoid loplugin:stringconstant, loplugin:stringview
CPPUNIT_ASSERT_EQUAL(false, foo == std::u16string_view());
CPPUNIT_ASSERT_EQUAL(true, foo != std::u16string_view());
CPPUNIT_ASSERT_EQUAL(false, foo < std::u16string_view());
diff --git a/sal/qa/rtl/textenc/rtl_textcvt.cxx b/sal/qa/rtl/textenc/rtl_textcvt.cxx
index 6780b37f55fe..fe6c8251d88d 100644
--- a/sal/qa/rtl/textenc/rtl_textcvt.cxx
+++ b/sal/qa/rtl/textenc/rtl_textcvt.cxx
@@ -3027,7 +3027,7 @@ void Test::testInvalidUtf8() {
auto const converter = rtl_createTextToUnicodeConverter(
RTL_TEXTENCODING_JAVA_UTF8);
CPPUNIT_ASSERT(converter != nullptr);
- constexpr OString input(u8"\U00010000"_ostr);
+ static constexpr OString input(u8"\U00010000"_ostr);
sal_Unicode buf[TEST_STRING_SIZE];
sal_uInt32 info;
sal_Size converted;
diff --git a/sal/rtl/strtmpl.hxx b/sal/rtl/strtmpl.hxx
index d13e5f73acd5..c5e2ff5810fd 100644
--- a/sal/rtl/strtmpl.hxx
+++ b/sal/rtl/strtmpl.hxx
@@ -1420,7 +1420,7 @@ void doubleToString(rtl_tString** pResult, sal_Int32* pResultCapacity, sal_Int32
if (std::isnan(fValue))
{
// #i112652# XMLSchema-2
- constexpr std::string_view nan{ "NaN" };
+ static constexpr std::string_view nan{ "NaN" };
return append(pResult, pResultCapacity, nResultOffset, nan);
}