Repurpose loplugin:stringstatic for O[U]String vars that can be constexpr

...now that warning about O[U]String vars that could be O[U]StringLiteral is no
longer useful

Change-Id: I389e72038171f28482049b41f6224257dd11f452
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157992
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2023-10-15 21:15:49 +02:00
parent 8797ba5e5d
commit b4844c310b
50 changed files with 164 additions and 326 deletions
+20 -20
View File
@@ -69,12 +69,12 @@ private:
CPPUNIT_TEST_SUITE_END();
};
const OUString cr = "\n";
const OUString rem = "REM";
const OUString asdf = "asdf";
const OUString dot = ".";
const OUString goto_ = "goto";
const OUString excl = "!";
constexpr OUString cr = u"\n"_ustr;
constexpr OUString rem = u"REM"_ustr;
constexpr OUString asdf = u"asdf"_ustr;
constexpr OUString dot = u"."_ustr;
constexpr OUString goto_ = u"goto"_ustr;
constexpr OUString excl = u"!"_ustr;
std::vector<Symbol> getSymbols(const OUString& source, sal_Int32& errors, bool bCompatible = false)
{
@@ -160,14 +160,14 @@ void ScannerTest::testBlankLines()
void ScannerTest::testOperators()
{
const OUString sourceE("=");
const OUString sourceLT("<");
const OUString sourceGT(">");
const OUString sourceLTE("<=");
const OUString sourceGTE(">=");
const OUString sourceNE("<>");
const OUString sourceA(":=");
const OUString sourceNot("Not");
constexpr OUString sourceE(u"="_ustr);
constexpr OUString sourceLT(u"<"_ustr);
constexpr OUString sourceGT(u">"_ustr);
constexpr OUString sourceLTE(u"<="_ustr);
constexpr OUString sourceGTE(u">="_ustr);
constexpr OUString sourceNE(u"<>"_ustr);
constexpr OUString sourceA(u":="_ustr);
constexpr OUString sourceNot(u"Not"_ustr);
std::vector<Symbol> symbols;
@@ -239,12 +239,12 @@ void ScannerTest::testOperators()
void ScannerTest::testAlphanum()
{
const OUString source1("asdfghefg");
const OUString source3("AdfsaAUdsl10987");
const OUString source4("asdfa_mnvcnm");
const OUString source5("_asdf1");
const OUString source6("_6");
const OUString source7("joxclk_");
constexpr OUString source1(u"asdfghefg"_ustr);
constexpr OUString source3(u"AdfsaAUdsl10987"_ustr);
constexpr OUString source4(u"asdfa_mnvcnm"_ustr);
constexpr OUString source5(u"_asdf1"_ustr);
constexpr OUString source6(u"_6"_ustr);
constexpr OUString source7(u"joxclk_"_ustr);
std::vector<Symbol> symbols;
+1 -1
View File
@@ -62,7 +62,7 @@ constexpr OUStringLiteral m_aMultiClick = u"MultiClick";
constexpr OUStringLiteral m_aDragMethodEquals = u"DragMethod=";
constexpr OUStringLiteral m_aDragParameterEquals = u"DragParameter=";
constexpr OUStringLiteral m_aProtocol = u"CID/";
const OUString m_aPieSegmentDragMethodServiceName("PieSegmentDragging");
constexpr OUString m_aPieSegmentDragMethodServiceName(u"PieSegmentDragging"_ustr);
namespace
{
+1 -1
View File
@@ -1512,7 +1512,7 @@ namespace comphelper
const OUString& BackupFileHelper::getSafeModeName()
{
static const OUString aSafeMode("SafeMode");
static constexpr OUString aSafeMode(u"SafeMode"_ustr);
return aSafeMode;
}
+6 -136
View File
@@ -12,16 +12,7 @@
#include "check.hxx"
#include "plugin.hxx"
#include "config_clang.h"
#include <unordered_set>
/** Look for static O*String and O*String[], they can be more efficiently declared as:
static constexpr OUStringLiteral our_aLBEntryMap[] = {u" ", u", "};
static constexpr OUStringLiteral sName(u"name");
which is more efficient at startup time.
/** Look for static O*String and O*String[] which can be constepxr.
*/
namespace {
@@ -34,17 +25,7 @@ public:
FilteringPlugin(rData) {}
void run() override;
bool preRun() override;
void postRun() override;
bool VisitVarDecl(VarDecl const*);
bool VisitReturnStmt(ReturnStmt const*);
bool VisitDeclRefExpr(DeclRefExpr const*);
bool VisitMemberExpr(MemberExpr const*);
bool VisitUnaryOperator(UnaryOperator const*);
private:
std::unordered_set<VarDecl const *> potentialVars;
std::unordered_set<VarDecl const *> excludeVars;
};
void StringStatic::run()
@@ -54,51 +35,17 @@ void StringStatic::run()
postRun();
}
bool StringStatic::preRun()
{
StringRef fn(handler.getMainFileName());
// passing around pointers to global OUString
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/filter/source/svg/"))
return false;
// call replaceAll on a 'const OUString", for which there is no OUStringLiteral equivalent
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/i18npool/qa/cppunit/test_breakiterator.cxx"))
return false;
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sd/qa/unit/export-tests-ooxml2.cxx"))
return false;
return true;
}
void StringStatic::postRun()
{
for (auto const & pVarDecl : excludeVars) {
potentialVars.erase(pVarDecl);
}
for (auto const & varDecl : potentialVars) {
report(DiagnosticsEngine::Warning,
"rather declare this using OUStringLiteral/OStringLiteral/char[]",
varDecl->getLocation())
<< varDecl->getSourceRange();
}
}
bool StringStatic::VisitVarDecl(VarDecl const* varDecl)
{
if (ignoreLocation(varDecl))
return true;
QualType qt = varDecl->getType();
if (!varDecl->isThisDeclarationADefinition()
|| !qt.isConstQualified())
|| !qt.isConstQualified() || varDecl->isConstexpr())
return true;
if (varDecl->hasGlobalStorage())
{
if (varDecl->hasGlobalStorage() && !varDecl->isStaticLocal()) {
//TODO: For a non-public static member variable from an included file, we could still
// examine it further if all its uses must be seen in that included file:
if (!compiler.getSourceManager().isInMainFile(varDecl->getLocation())) {
return true;
}
}
if (qt->isArrayType())
qt = qt->getAsArrayTypeUnsafe()->getElementType();
@@ -154,91 +101,14 @@ bool StringStatic::VisitVarDecl(VarDecl const* varDecl)
return true;
}
}
potentialVars.insert(varDecl);
report(DiagnosticsEngine::Warning,
"rather declare this as constexpr",
varDecl->getLocation())
<< varDecl->getSourceRange();
return true;
}
bool StringStatic::VisitReturnStmt(ReturnStmt const * returnStmt)
{
if (ignoreLocation(returnStmt)) {
return true;
}
if (!returnStmt->getRetValue()) {
return true;
}
DeclRefExpr const * declRef = dyn_cast<DeclRefExpr>(returnStmt->getRetValue());
if (!declRef) {
return true;
}
VarDecl const * varDecl = dyn_cast<VarDecl>(declRef->getDecl());
if (varDecl) {
excludeVars.insert(varDecl);
}
return true;
}
bool StringStatic::VisitDeclRefExpr(DeclRefExpr const * declRef)
{
if (ignoreLocation(declRef))
return true;
VarDecl const * varDecl = dyn_cast<VarDecl>(declRef->getDecl());
if (!varDecl)
return true;
if (potentialVars.count(varDecl) == 0)
return true;
// ignore globals that are used in CPPUNIT_ASSERT expressions, otherwise we can end up
// trying to compare an OUStringLiteral and an OUString, and CPPUNIT can't handle that
auto loc = declRef->getBeginLoc();
if (compiler.getSourceManager().isMacroArgExpansion(loc))
{
StringRef name { Lexer::getImmediateMacroName(loc, compiler.getSourceManager(), compiler.getLangOpts()) };
if (name.startswith("CPPUNIT_ASSERT"))
excludeVars.insert(varDecl);
}
return true;
}
bool StringStatic::VisitMemberExpr(MemberExpr const * expr)
{
if (ignoreLocation(expr))
return true;
auto const declRef = dyn_cast<DeclRefExpr>(expr->getBase());
if (declRef == nullptr) {
return true;
}
VarDecl const * varDecl = dyn_cast<VarDecl>(declRef->getDecl());
if (!varDecl)
return true;
if (potentialVars.count(varDecl) == 0)
return true;
auto const id = expr->getMemberDecl()->getIdentifier();
if (id == nullptr || id->getName() != "pData") {
return true;
}
excludeVars.insert(varDecl);
return true;
}
bool StringStatic::VisitUnaryOperator(UnaryOperator const * expr)
{
if (ignoreLocation(expr))
return true;
if (expr->getOpcode() != UO_AddrOf)
return true;
if (this->ignoreLocation(expr))
return true;
auto const dre = dyn_cast<DeclRefExpr>(
expr->getSubExpr()->IgnoreParenImpCasts());
if (!dre)
return true;
auto const vd = dyn_cast<VarDecl>(dre->getDecl());
if (!vd)
return true;
excludeVars.insert(vd->getCanonicalDecl());
return true;
}
loplugin::Plugin::Registration<StringStatic> stringstatic("stringstatic");
} // namespace
+10 -11
View File
@@ -9,22 +9,21 @@
#include <rtl/ustring.hxx>
#include "stringstatic.hxx"
// expected-error@+1 {{rather declare this using OUStringLiteral/OStringLiteral/char[] [loplugin:stringstatic]}}
// expected-error@+1 {{rather declare this as constexpr [loplugin:stringstatic]}}
static const OUString TEST1 = "xxx";
void f(rtl_uString const*);
void f(const OUString&);
static constexpr OUString TEST2 = u"xxx"_ustr;
void test2()
{
// expected-error@+1 {{rather declare this using OUStringLiteral/OStringLiteral/char[] [loplugin:stringstatic]}}
(void)TEST2;
// expected-error@+1 {{rather declare this as constexpr [loplugin:stringstatic]}}
static const OUString XXX = "xxx";
// expected-error@+1 {{rather declare this using OUStringLiteral/OStringLiteral/char[] [loplugin:stringstatic]}}
static const OUString XXX2 = "xxx";
static constexpr OUString XXX2 = u"xxx"_ustr;
(void)XXX;
(void)XXX2;
static const OUString DATA = "xxx";
f(DATA.pData);
// expected-error@+1 {{rather declare this as constexpr [loplugin:stringstatic]}}
static const OUString A1[1] = { u"xxx"_ustr };
static constexpr OUString A2[1] = { u"xxx"_ustr };
(void)A1;
(void)A2;
}
@@ -1,23 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "sal/config.h"
#include "rtl/ustring.hxx"
OUString const INCLUDED = "xxx";
inline void f()
{
// expected-error@+1 {{rather declare this using OUStringLiteral/OStringLiteral/char[] [loplugin:stringstatic]}}
static OUString const XXX = "xxx";
(void)XXX;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
@@ -74,7 +74,7 @@ namespace dbtools
}
assert(false);
static const OUString sErr("#FilterManager::getFilterComponent unknown component#");
static constexpr OUString sErr(u"#FilterManager::getFilterComponent unknown component#"_ustr);
return sErr;
}
+1 -1
View File
@@ -79,7 +79,7 @@ namespace connectivity
const OUString& SQLError_Impl::getMessagePrefix()
{
static const OUString s_sMessagePrefix( "[OOoBase]" );
static constexpr OUString s_sMessagePrefix( u"[OOoBase]"_ustr );
return s_sMessagePrefix;
}
+1 -1
View File
@@ -1741,7 +1741,7 @@ IMPL_LINK_NOARG(OfaLanguagesTabPage, LocaleSettingHdl, weld::ComboBox&, void)
const NfCurrencyEntry& rCurr = SvNumberFormatter::GetCurrencyEntry(
(eLang == LANGUAGE_USER_SYSTEM_CONFIG) ? MsLangId::getConfiguredSystemLanguage() : eLang);
const OUString aDefaultID = "default";
constexpr OUString aDefaultID = u"default"_ustr;
// Update the "Default ..." currency.
m_xCurrencyLB->remove_id(aDefaultID);
OUString aDefaultCurr = m_sSystemDefaultString + " - " + rCurr.GetBankSymbol();
+8 -8
View File
@@ -1767,7 +1767,7 @@ void Test::testTransliterate()
CPPUNIT_ASSERT_EQUAL(OUString("One (Two) Three"), editEng.GetText());
using TF = TransliterationFlags;
const OUString sText2 = "Mary Jones met joe Smith. Time Passed.";
constexpr OUString sText2 = u"Mary Jones met joe Smith. Time Passed."_ustr;
int selStart = 12;
int selEnd = 12;
ESelection esel(0, selStart, 0, selEnd);
@@ -1870,7 +1870,7 @@ void Test::testTransliterate()
selStart = 0;
selEnd = 19;
esel = ESelection(0, selStart, 0, selEnd);
const OUString sText3("CURRENT IS EQUAL TO 10 A");
constexpr OUString sText3(u"CURRENT IS EQUAL TO 10 A"_ustr);
editEng.SetText(sText3);
CPPUNIT_ASSERT_EQUAL(OUString("CURRENT IS EQUAL TO"), editEng.GetText(esel));
@@ -1898,7 +1898,7 @@ void Test::testTdf148148()
int selStart = 0;
int selEnd = 3;
ESelection esel(0, selStart, 0, selEnd);
const OUString sText1(" text");
constexpr OUString sText1(u" text"_ustr);
editEng.SetText(sText1);
CPPUNIT_ASSERT_EQUAL(OUString(" "), editEng.GetText(esel));
@@ -1910,7 +1910,7 @@ void Test::testTdf148148()
selStart = 4;
selEnd = 8;
esel = ESelection(0, selStart, 0, selEnd);
const OUString sText2("text ");
constexpr OUString sText2(u"text "_ustr);
editEng.SetText(sText2);
CPPUNIT_ASSERT_EQUAL(OUString(" "), editEng.GetText(esel));
@@ -1923,7 +1923,7 @@ void Test::testTdf148148()
selStart = 0;
selEnd = 3;
esel = ESelection(0, selStart, 0, selEnd);
const OUString sText3(" -1");
constexpr OUString sText3(u" -1"_ustr);
editEng.SetText(sText3);
CPPUNIT_ASSERT_EQUAL(OUString(" "), editEng.GetText(esel));
@@ -1935,7 +1935,7 @@ void Test::testTdf148148()
selStart = 2;
selEnd = 6;
esel = ESelection(0, selStart, 0, selEnd);
const OUString sText4("-1 ");
constexpr OUString sText4(u"-1 "_ustr);
editEng.SetText(sText4);
CPPUNIT_ASSERT_EQUAL(OUString(" "), editEng.GetText(esel));
@@ -1948,7 +1948,7 @@ void Test::testTdf148148()
selStart = 0;
selEnd = 5;
esel = ESelection(0, selStart, 0, selEnd);
const OUString sText5(" -1");
constexpr OUString sText5(u" -1"_ustr);
editEng.SetText(sText3);
CPPUNIT_ASSERT_EQUAL(OUString(" -1"), editEng.GetText(esel));
@@ -1960,7 +1960,7 @@ void Test::testTdf148148()
selStart = 0;
selEnd = 5;
esel = ESelection(0, selStart, 0, selEnd);
const OUString sText6("-1 ");
constexpr OUString sText6(u"-1 "_ustr);
editEng.SetText(sText4);
CPPUNIT_ASSERT_EQUAL(OUString("-1 "), editEng.GetText(esel));
+1 -1
View File
@@ -334,7 +334,7 @@ void TestBreakIterator::testWordBoundaries()
//See https://bz.apache.org/ooo/show_bug.cgi?id=13494
{
const OUString aBase("xxAAxxBBxxCCxx");
constexpr OUString aBase(u"xxAAxxBBxxCCxx"_ustr);
const sal_Unicode aTests[] =
{
'\'', ';', ',', '.', '!', '@', '#', '%', '&', '*',
+3 -3
View File
@@ -35,9 +35,9 @@ const std::vector<OString>& StaticDebugBaseAddressFilter()
{
std::vector<OString> vec;
rtl_uString * pStr = nullptr;
OUString const name(
"OSL_DEBUGBASE_STORE_ADDRESSES" );
if (osl_getEnvironment( name.pData, &pStr ) == osl_Process_E_None) {
if (osl_getEnvironment( u"OSL_DEBUGBASE_STORE_ADDRESSES"_ustr.pData, &pStr )
== osl_Process_E_None)
{
OUString const str(pStr);
rtl_uString_release(pStr);
sal_Int32 nIndex = 0;
+1 -3
View File
@@ -247,10 +247,8 @@ void SAL_CALL osl_setCommandArgs (int argc, char ** argv)
/* see @ osl_getExecutableFile(). */
if (rtl_ustr_indexOfChar (rtl_uString_getStr(ppArgs[0]), '/') == -1)
{
const OUString PATH ("PATH");
rtl_uString * pSearchPath = nullptr;
osl_getEnvironment (PATH.pData, &pSearchPath);
osl_getEnvironment (u"PATH"_ustr.pData, &pSearchPath);
if (pSearchPath)
{
rtl_uString * pSearchResult = nullptr;
+2 -3
View File
@@ -25,7 +25,7 @@ class SocketTest : public CppUnit::TestFixture
void test_createInetSocketAddr()
{
OUString const in("123.4.56.78");
OUString constexpr 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));
@@ -39,8 +39,7 @@ class SocketTest : public CppUnit::TestFixture
void test_createInetBroadcastAddr()
{
OUString const in("123.4.56.78");
auto const addr = osl_createInetBroadcastAddr(in.pData, 100);
auto const addr = osl_createInetBroadcastAddr(u"123.4.56.78"_ustr.pData, 100);
CPPUNIT_ASSERT(addr != nullptr);
CPPUNIT_ASSERT_EQUAL(osl_Socket_FamilyInet, osl_getFamilyOfSocketAddr(addr));
OUString out;
+1 -1
View File
@@ -109,7 +109,7 @@ void Test::testCompareTo()
void Test::testUtf8StringLiterals()
{
const OString sIn(u8"ßa");
OString sIn(u8"ßa");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sIn.getLength());
CPPUNIT_ASSERT_EQUAL(195, int(static_cast<unsigned char>(sIn[0])));
CPPUNIT_ASSERT_EQUAL(159, int(static_cast<unsigned char>(sIn[1])));
@@ -52,7 +52,7 @@ class Test : public CppUnit::TestFixture
OUString("foo").startsWithIgnoreAsciiCase(std::u16string_view()));
CPPUNIT_ASSERT_EQUAL(true, OUString("foo").endsWith(std::u16string_view()));
CPPUNIT_ASSERT_EQUAL(true, OUString("foo").endsWithIgnoreAsciiCase(std::u16string_view()));
OUString const foo("foo"); // avoid loplugin:stringconstant, loplugin:stringview
OUString constexpr 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());
+5 -5
View File
@@ -343,7 +343,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf99856_dataValidationTest)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF16LErtlSHA1)
{
OUString const password("1012345678901234567890123456789012345678901234567890");
OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key1.fods");
@@ -369,7 +369,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF16LErtlSHA1)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1)
{
OUString const password("1012345678901234567890123456789012345678901234567890");
OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key2.fods");
@@ -395,7 +395,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA1)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12)
{
OUString const password("1012345678901234567890123456789012345678901234567890");
OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key3.fods");
@@ -423,7 +423,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256ODF12)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C)
{
OUString const password("1012345678901234567890123456789012345678901234567890");
OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key4.fods");
@@ -451,7 +451,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_UTF8SHA256W3C)
CPPUNIT_TEST_FIXTURE(ScExportTest, testProtectionKeyODS_XL_SHA1)
{
OUString const password("1012345678901234567890123456789012345678901234567890");
OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
createScDoc("fods/protection-key5.fods");
+3 -3
View File
@@ -1030,7 +1030,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf112567)
CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf75702)
{
// The problem was that line breaks were not imported.
const OUString sA1("line1\nline2");
constexpr OUString sA1(u"line1\nline2"_ustr);
createScDoc("ods/tdf75702_textLineBreak.ods");
ScDocument* pDoc = getScDoc();
@@ -1049,8 +1049,8 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf103829)
{
// The problem was that tabspaces were not imported or exported at all.
// These strings match the current implementations of CELLTYPE_EDIT and CELLTYPE_STRING.
const OUString sA1("\x001Leading tab\nTHREE tabs inside: [\x001\x001\x001]");
const OUString sA2("\tLeading tab. THREE tabs inside: [\t\t\t]");
constexpr OUString sA1(u"\x001Leading tab\nTHREE tabs inside: [\x001\x001\x001]"_ustr);
constexpr OUString sA2(u"\tLeading tab. THREE tabs inside: [\t\t\t]"_ustr);
createScDoc("ods/tdf103829_textTab.ods");
ScDocument* pDoc = getScDoc();
+1 -1
View File
@@ -461,7 +461,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf154445_unused_pagestyles)
createScDoc("ods/tdf108188_pagestyle.ods");
// Check if the user defined page style is present
const OUString aTestPageStyle = "TestPageStyle";
constexpr OUString aTestPageStyle = u"TestPageStyle"_ustr;
ScDocument* pDoc = getScDoc();
CPPUNIT_ASSERT_EQUAL(aTestPageStyle, pDoc->GetPageStyle(0));
+1 -2
View File
@@ -535,14 +535,13 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, testBooleanFormatXLSX)
ScDocument* pDoc = getScDoc();
SvNumberFormatter* pNumFormatter = pDoc->GetFormatTable();
// Saved as >"TRUE";"TRUE";"FALSE"< but reading converted back to >BOOLEAN<
const OUString aBooleanTypeStr = "BOOLEAN";
for (SCROW i = 0; i <= 1; i++)
{
sal_uInt32 nNumberFormat = pDoc->GetNumberFormat(0, i, 0);
const SvNumberformat* pNumberFormat = pNumFormatter->GetEntry(nNumberFormat);
const OUString& rFormatStr = pNumberFormat->GetFormatstring();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format != boolean", aBooleanTypeStr, rFormatStr);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format != boolean", u"BOOLEAN"_ustr, rFormatStr);
}
}
+1 -1
View File
@@ -1776,7 +1776,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf108188_pagestyle)
createScDoc("ods/tdf108188_pagestyle.ods");
// Check if the user defined page style is present
const OUString aTestPageStyle = "TestPageStyle";
constexpr OUString aTestPageStyle = u"TestPageStyle"_ustr;
ScDocument* pDoc = getScDoc();
CPPUNIT_ASSERT_EQUAL(aTestPageStyle, pDoc->GetPageStyle(0));
+1 -1
View File
@@ -1504,7 +1504,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testLanguageStatus)
const SfxStringItem* pItem2 = dynamic_cast<const SfxStringItem*>(xItem2.get());
CPPUNIT_ASSERT(pItem1);
CPPUNIT_ASSERT(pItem2);
const OUString aLangBolivia("Spanish (Bolivia);es-BO");
constexpr OUString aLangBolivia(u"Spanish (Bolivia);es-BO"_ustr);
CPPUNIT_ASSERT_EQUAL(aLangBolivia, pItem1->GetValue());
CPPUNIT_ASSERT_EQUAL(aLangBolivia, pItem2->GetValue());
}
+2 -2
View File
@@ -259,7 +259,7 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPaste)
ScRangeData* pLocal5
= new ScRangeData(*m_pDoc, "local5", "$A$1"); // implicit relative sheet reference
ScRangeData* pGlobal = new ScRangeData(*m_pDoc, "global", aAdr);
const OUString aGlobal2Symbol("$Sheet1.$A$1:$A$23");
constexpr OUString aGlobal2Symbol(u"$Sheet1.$A$1:$A$23"_ustr);
ScRangeData* pGlobal2 = new ScRangeData(*m_pDoc, "global2", aGlobal2Symbol);
std::unique_ptr<ScRangeName> pGlobalRangeName(new ScRangeName());
pGlobalRangeName->insert(pGlobal);
@@ -10046,7 +10046,7 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, testCopyPasteFormulasExternalDoc)
m_xDocShell->DoLoad(pMedium);
ScDocShellRef xExtDocSh = new ScDocShell;
OUString const aExtDocName("file:///extdata.fake");
OUString constexpr aExtDocName(u"file:///extdata.fake"_ustr);
SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
xExtDocSh->DoLoad(pMed);
CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
+7 -7
View File
@@ -1558,8 +1558,8 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRef)
rExtDoc.InsertTab(1, aExtSh2Name);
rExtDoc.InsertTab(2, aExtSh3Name);
OUString const name("Name");
OUString const value("Value");
OUString constexpr name(u"Name"_ustr);
OUString constexpr value(u"Value"_ustr);
// Sheet 1
rExtDoc.SetString(0, 0, 0, name);
@@ -1600,7 +1600,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRef)
m_pDoc->InsertTab(0, "Test Sheet");
m_pDoc->SetString(0, 0, 0, "='file:///extdata.fake'#Data1.A1");
OUString test = m_pDoc->GetString(0, 0, 0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Value is different from the original", test, name);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Value is different from the original", name, test);
// After the initial access to the external document, the external ref
// manager should create sheet cache entries for *all* sheets from that
@@ -1617,7 +1617,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRef)
m_pDoc->SetString(1, 0, 0, "='file:///extdata.fake'#Data1.B1");
test = m_pDoc->GetString(1, 0, 0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Value is different from the original", test, value);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Value is different from the original", value, test);
m_pDoc->SetString(0, 1, 0, "='file:///extdata.fake'#Data1.A2");
m_pDoc->SetString(0, 2, 0, "='file:///extdata.fake'#Data1.A3");
@@ -1717,7 +1717,7 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRef)
CPPUNIT_TEST_FIXTURE(TestFormula2, testExternalRangeName)
{
ScDocShellRef xExtDocSh = new ScDocShell;
OUString const aExtDocName("file:///extdata.fake");
OUString constexpr aExtDocName(u"file:///extdata.fake"_ustr);
SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
xExtDocSh->DoLoad(pMed);
CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
@@ -3514,8 +3514,8 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testFormulaErrorPropagation)
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
ScAddress aPos, aPos2;
const OUString aTRUE("TRUE");
const OUString aFALSE("FALSE");
constexpr OUString aTRUE(u"TRUE"_ustr);
constexpr OUString aFALSE(u"FALSE"_ustr);
aPos.Set(0, 0, 0); // A1
m_pDoc->SetValue(aPos, 1.0);
+1 -1
View File
@@ -286,7 +286,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf124816)
// The actual result is completely unrelated to this test and behaviour of
// OFFSET() was changed as of tdf#85551 and here result of that test
// document is now Err:502 instead of 0.
const OUString aExpectedResult("Err:502");
constexpr OUString aExpectedResult(u"Err:502"_ustr);
lcl_AssertCurrentCursorPosition(*pDocSh, u"D10");
CPPUNIT_ASSERT_EQUAL(aExpectedResult, pDoc->GetString(ScAddress(3, 9, 0)));
+1 -1
View File
@@ -3235,7 +3235,7 @@ bool ScCompiler::ParsePredetectedReference( const OUString& rName )
// It could also be a broken invalidated reference that contains #REF!
// (but is not equal to), which we wrote prior to ODFF and also to ODFF
// between 2013 and 2016 until 5.1.4
const OUString aErrRef("#REF!"); // not localized in ODFF
constexpr OUString aErrRef(u"#REF!"_ustr); // not localized in ODFF
sal_Int32 nPos = rName.indexOf( aErrRef);
if (nPos != -1)
{
+4 -4
View File
@@ -284,26 +284,26 @@ void ScfTools::AppendCString( SvStream& rStrm, OUString& rString, rtl_TextEncodi
const OUString& ScfTools::GetHTMLDocName()
{
static const OUString saHTMLDoc( "HTML_all" );
static constexpr OUString saHTMLDoc( u"HTML_all"_ustr );
return saHTMLDoc;
}
const OUString& ScfTools::GetHTMLTablesName()
{
static const OUString saHTMLTables( "HTML_tables" );
static constexpr OUString saHTMLTables( u"HTML_tables"_ustr );
return saHTMLTables;
}
const OUString& ScfTools::GetHTMLIndexPrefix()
{
static const OUString saHTMLIndexPrefix( "HTML_" );
static constexpr OUString saHTMLIndexPrefix( u"HTML_"_ustr );
return saHTMLIndexPrefix;
}
const OUString& ScfTools::GetHTMLNamePrefix()
{
static const OUString saHTMLNamePrefix( "HTML__" );
static constexpr OUString saHTMLNamePrefix( u"HTML__"_ustr );
return saHTMLNamePrefix;
}
+4 -3
View File
@@ -727,8 +727,6 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testPresetShapesExport)
save("Impress Office Open XML");
xmlDocUniquePtr pXmlDocCT = parseExport("ppt/slides/slide1.xml");
const OString sPattern(
"/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]");
static constexpr OStringLiteral sT("_T_");
static constexpr OStringLiteral sN("_N_");
static constexpr OStringLiteral sPropertyName("name");
@@ -742,7 +740,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testPresetShapesExport)
&& o3tl::starts_with(sShapeTypeAndValues[i], "adj");
++j)
{
OString sXPath = sPattern.replaceFirst(sT, sType).replaceFirst(sN, OString::number(j));
OString sXPath
= "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:prstGeom[@prst='_T_']/a:avLst/a:gd[_N_]"_ostr
.replaceFirst(sT, sType)
.replaceFirst(sN, OString::number(j));
assertXPath(pXmlDocCT, sXPath, sPropertyName,
OUString::createFromAscii(sShapeTypeAndValues[i++]));
assertXPath(pXmlDocCT, sXPath, sPropertyFmla,
+1 -1
View File
@@ -736,7 +736,7 @@ CPPUNIT_TEST_FIXTURE(SdExportTest, testLinkedGraphicRT)
// Check if the graphic has been imported correctly (before doing the export/import run)
{
const OString sFailedImportMessage = "Failed to correctly import the document";
constexpr OString sFailedImportMessage = "Failed to correctly import the document"_ostr;
SdXImpressDocument* pXImpressDocument
= dynamic_cast<SdXImpressDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pXImpressDocument);
+29 -29
View File
@@ -53,39 +53,39 @@ namespace pdfi
css::uno::XComponentContext >& xContext,
const OUString& rFilterOptions );
const OUString fontAttributesSuffixes[] = {
constexpr OUString fontAttributesSuffixes[] = {
// Note: for performance consideration, each one listed here is evaluated once,
// and they are checked from the suffix, thus the order matters.
// e.g. for "TimesNewRomanPS-BoldItalic", to get "TimesNewRoman", you should
// first have "Italic", and then "Bold", then "-", and then "PS".
"-VKana",
"MT",
"PS",
"PSMT",
"Regular",
"Normal",
"Book",
"Medium",
"ExtraBold",
"UltraBold",
"ExtraLight",
"UltraLight",
"Bold",
"Heavy",
"Black",
"Italic",
"Oblique",
"Bold", //BoldItalic, BoldOblique
"Light",
"Thin",
"Semibold",
"-Roman",
"Reg",
"VKana",
"-",
",",
";",
"PS", // e.g. TimesNewRomanPS-BoldMT
u"-VKana"_ustr,
u"MT"_ustr,
u"PS"_ustr,
u"PSMT"_ustr,
u"Regular"_ustr,
u"Normal"_ustr,
u"Book"_ustr,
u"Medium"_ustr,
u"ExtraBold"_ustr,
u"UltraBold"_ustr,
u"ExtraLight"_ustr,
u"UltraLight"_ustr,
u"Bold"_ustr,
u"Heavy"_ustr,
u"Black"_ustr,
u"Italic"_ustr,
u"Oblique"_ustr,
u"Bold"_ustr, //BoldItalic, BoldOblique
u"Light"_ustr,
u"Thin"_ustr,
u"Semibold"_ustr,
u"-Roman"_ustr,
u"Reg"_ustr,
u"VKana"_ustr,
u"-"_ustr,
u","_ustr,
u";"_ustr,
u"PS"_ustr, // e.g. TimesNewRomanPS-BoldMT
};
}
+11 -11
View File
@@ -52,43 +52,43 @@ namespace
const OUString& PROP_BACNAME()
{
static const OUString sProp("BusinessAuthorizationCategory:Name");
static constexpr OUString sProp(u"BusinessAuthorizationCategory:Name"_ustr);
return sProp;
}
const OUString& PROP_STARTVALIDITY()
{
static const OUString sProp("Authorization:StartValidity");
static constexpr OUString sProp(u"Authorization:StartValidity"_ustr);
return sProp;
}
const OUString& PROP_NONE()
{
static const OUString sProp("None");
static constexpr OUString sProp(u"None"_ustr);
return sProp;
}
const OUString& PROP_IMPACTSCALE()
{
static const OUString sProp("Impact:Scale");
static constexpr OUString sProp(u"Impact:Scale"_ustr);
return sProp;
}
const OUString& PROP_IMPACTLEVEL()
{
static const OUString sProp("Impact:Level:Confidentiality");
static constexpr OUString sProp(u"Impact:Level:Confidentiality"_ustr);
return sProp;
}
const OUString& PROP_PREFIX_EXPORTCONTROL()
{
static const OUString sProp("urn:bails:ExportControl:");
static constexpr OUString sProp(u"urn:bails:ExportControl:"_ustr);
return sProp;
}
const OUString& PROP_PREFIX_NATIONALSECURITY()
{
static const OUString sProp("urn:bails:NationalSecurity:");
static constexpr OUString sProp(u"urn:bails:NationalSecurity:"_ustr);
return sProp;
}
@@ -917,25 +917,25 @@ const OUString& SfxClassificationHelper::policyTypeToString(SfxClassificationPol
const OUString& SfxClassificationHelper::PROP_DOCHEADER()
{
static const OUString sProp("Marking:document-header");
static constexpr OUString sProp(u"Marking:document-header"_ustr);
return sProp;
}
const OUString& SfxClassificationHelper::PROP_DOCFOOTER()
{
static const OUString sProp("Marking:document-footer");
static constexpr OUString sProp(u"Marking:document-footer"_ustr);
return sProp;
}
const OUString& SfxClassificationHelper::PROP_DOCWATERMARK()
{
static const OUString sProp("Marking:document-watermark");
static constexpr OUString sProp(u"Marking:document-watermark"_ustr);
return sProp;
}
const OUString& SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY()
{
static const OUString sProp("urn:bails:IntellectualProperty:");
static constexpr OUString sProp(u"urn:bails:IntellectualProperty:"_ustr);
return sProp;
}
+1 -1
View File
@@ -134,7 +134,7 @@ void LngMiscTest::testReplaceControlChars()
void LngMiscTest::testGetThesaurusReplaceText()
{
const OUString str2("asdf");
constexpr OUString str2(u"asdf"_ustr);
OUString r = linguistic::GetThesaurusReplaceText("");
CPPUNIT_ASSERT(r.isEmpty());
+5 -5
View File
@@ -166,7 +166,7 @@ void GalleryObjTest::TestThemeURLCase()
CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr));
// Mixed Case Theme Name
const OUString myThemeName = "AddyTestTheme";
constexpr OUString myThemeName = u"AddyTestTheme"_ustr;
CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName));
CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName));
@@ -243,7 +243,7 @@ void GalleryObjTest::TestGalleryThemeEntry()
std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL));
CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr));
const OUString myThemeName = "addytesttheme";
constexpr OUString myThemeName = u"addytesttheme"_ustr;
CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName));
CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName));
@@ -251,8 +251,8 @@ void GalleryObjTest::TestGalleryThemeEntry()
const GalleryThemeEntry* mpThemeEntry = pGallery->GetThemeInfo(myThemeName);
// Check Theme Name
CPPUNIT_ASSERT_EQUAL_MESSAGE("Theme name doesn't match", mpThemeEntry->GetThemeName(),
myThemeName);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Theme name doesn't match", myThemeName,
mpThemeEntry->GetThemeName());
// Check URLs
GalleryStorageLocations& rGalleryStorageLocations = mpThemeEntry->getGalleryStorageLocations();
@@ -458,7 +458,7 @@ void GalleryObjTest::TestGetThemeNameFromGalleryTheme()
std::unique_ptr<Gallery> pGallery(new Gallery(aGalleryURL));
CPPUNIT_ASSERT_MESSAGE("Could not create gallery instance", (pGallery != nullptr));
const OUString myThemeName = "addytesttheme";
constexpr OUString myThemeName = u"addytesttheme"_ustr;
CPPUNIT_ASSERT_MESSAGE("Could not create theme", pGallery->CreateTheme(myThemeName));
CPPUNIT_ASSERT_MESSAGE("Could not find theme", pGallery->HasTheme(myThemeName));
+1 -1
View File
@@ -113,7 +113,7 @@ void ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks()
void ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested()
{
OUString const test("abc");
OUString constexpr test(u"abc"_ustr);
ToxWhitespaceStripper sut(test);
sal_Int32 expected = test.getLength();
CPPUNIT_ASSERT_EQUAL(expected, sut.GetPositionInStrippedString(test.getLength()));
+1 -1
View File
@@ -1115,7 +1115,7 @@ CPPUNIT_TEST_FIXTURE(HtmlExportTest, testFieldShadeReqIf)
DECLARE_HTMLEXPORT_TEST(testTdf126879, "tdf126879.odt")
{
const OString aExpected("<!DOCTYPE html>");
constexpr OString aExpected("<!DOCTYPE html>"_ostr);
SvStream* pStream = maTempFile.GetStream(StreamMode::READ);
CPPUNIT_ASSERT(pStream);
const OString aActual(read_uInt8s_ToOString(*pStream, aExpected.getLength()));
+1 -1
View File
@@ -1196,7 +1196,7 @@ DECLARE_ODFEXPORT_TEST(testCharacterBorder, "charborder.odt")
CPPUNIT_TEST_FIXTURE(Test, testProtectionKey)
{
loadAndReload("protection-key.fodt");
OUString const password("1012345678901234567890123456789012345678901234567890");
OUString constexpr password(u"1012345678901234567890123456789012345678901234567890"_ustr);
// check 1 invalid OOo legacy password and 3 valid ODF 1.2 passwords
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
+1 -1
View File
@@ -1490,7 +1490,7 @@ DECLARE_OOXMLEXPORT_TEST(testActiveXOptionButtonGroup, "activex_option_button_gr
{
// Optionbutton groups were not handled
// The two optionbutton should have the same group name
const OUString sGroupName = "GroupX";
constexpr OUString sGroupName = u"GroupX"_ustr;
uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT(xControlShape.is());
+3 -3
View File
@@ -1568,7 +1568,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
// click on the links...
{
OUString const tmp("Table of Contents");
OUString constexpr tmp(u"Table of Contents"_ustr);
pWrtShell->GotoNextTOXBase(&tmp);
}
@@ -1603,7 +1603,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
}
{
OUString const tmp("User-Defined1");
OUString constexpr tmp(u"User-Defined1"_ustr);
pWrtShell->GotoNextTOXBase(&tmp);
}
@@ -1653,7 +1653,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testToxmarkLinks)
}
{
OUString const tmp("NewUD!|1");
OUString constexpr tmp(u"NewUD!|1"_ustr);
pWrtShell->GotoNextTOXBase(&tmp);
}
+6 -6
View File
@@ -663,7 +663,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testBookmarkCollapsed)
// load only content.xml from the resaved document
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
const OString aPath("/office:document-content/office:body/office:text/text:p");
constexpr OString aPath("/office:document-content/office:body/office:text/text:p"_ostr);
const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
CPPUNIT_ASSERT_EQUAL(0, pos1); // found, and it is first
@@ -736,7 +736,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkText)
// load only content.xml from the resaved document
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
const OString aPath("/office:document-content/office:body/office:text/text:p");
constexpr OString aPath("/office:document-content/office:body/office:text/text:p"_ostr);
CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, "bookmark")); // not found
const int pos2 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
@@ -838,7 +838,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNew)
// load only content.xml from the resaved document
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
const OString aPath("/office:document-content/office:body/office:text/text:p");
constexpr OString aPath("/office:document-content/office:body/office:text/text:p"_ostr);
CPPUNIT_ASSERT_ASSERTION_FAIL(getXPathPosition(pXmlDoc, aPath, "bookmark")); // not found
const int pos2 = getXPathPosition(pXmlDoc, aPath, "bookmark-start");
@@ -902,7 +902,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRemoveBookmarkTextAndAddNewAfterReload
// load only content.xml from the resaved document
xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
const OString aPath("/office:document-content/office:body/office:text/text:p");
constexpr OString aPath("/office:document-content/office:body/office:text/text:p"_ostr);
const int pos1 = getXPathPosition(pXmlDoc, aPath, "bookmark");
const int pos2 = getXPathPosition(pXmlDoc, aPath, "text");
@@ -1319,7 +1319,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testRedlineViewAuthor)
SwWrtShell* pWrtShell = pDocShell->GetWrtShell();
pWrtShell->Insert("middle");
SwView* pView = pDocShell->GetView();
const OUString aAuthor("A U. Thor");
constexpr OUString aAuthor(u"A U. Thor"_ustr);
pView->SetRedlineAuthor(aAuthor);
pDocShell->SetView(pView);
@@ -2141,7 +2141,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testCreateDocxAnnotation)
createSwDoc();
// insert an annotation with a text
const OUString aSomeText("some text");
constexpr OUString aSomeText(u"some text"_ustr);
uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence({
{ "Text", uno::Any(aSomeText) },
{ "Author", uno::Any(OUString("me")) },
+1 -1
View File
@@ -715,7 +715,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113481)
CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf115013)
{
const OUString sColumnName("Name with spaces, \"quotes\" and \\backslashes");
constexpr OUString sColumnName(u"Name with spaces, \"quotes\" and \\backslashes"_ustr);
utl::TempFileNamed aTempDir(nullptr, true);
aTempDir.EnableKillingFile();
+2 -2
View File
@@ -729,7 +729,7 @@ SwNumRule* SwWW8ImplReader::GetStyRule()
if( m_xStyles->mpStyRule ) // Bullet-Style already present
return m_xStyles->mpStyRule;
const OUString aBaseName("WW8StyleNum");
constexpr OUString aBaseName(u"WW8StyleNum"_ustr);
const OUString aName( m_rDoc.GetUniqueNumRuleName( &aBaseName, false) );
// #i86652#
@@ -811,7 +811,7 @@ void SwWW8ImplReader::Read_ANLevelDesc( sal_uInt16, const sal_uInt8* pData, shor
// If NumRuleItems were set, either directly or through inheritance, disable them now
m_pCurrentColl->SetFormatAttr( SwNumRuleItem() );
const OUString aName("Outline");
constexpr OUString aName(u"Outline"_ustr);
SwNumRule aNR( m_rDoc.GetUniqueNumRuleName( &aName ),
SvxNumberFormat::LABEL_WIDTH_AND_POSITION,
OUTLINE_RULE );
@@ -187,13 +187,11 @@ namespace toolkit
if (!s_pFactory)
{
#ifndef DISABLE_DYNLOADING
const OUString sModuleName( SVLIBRARY( "acc" ) );
s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, u"" SVLIBRARY( "acc" ) ""_ustr.pData, 0 );
if ( s_hAccessibleImplementationModule != nullptr )
{
const OUString sFactoryCreationFunc("getStandardAccessibleFactory");
s_pAccessibleFactoryFunc = reinterpret_cast<GetStandardAccComponentFactory>(
osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData ));
osl_getFunctionSymbol( s_hAccessibleImplementationModule, u"getStandardAccessibleFactory"_ustr.pData ));
}
OSL_ENSURE( s_pAccessibleFactoryFunc, "AccessibilityClient::ensureInitialized: could not load the library, or not retrieve the needed symbol!" );
+1 -1
View File
@@ -313,7 +313,7 @@ namespace
void Test::test_write_unicode()
{
const OUString write("abc");
constexpr OUString write(u"abc"_ustr);
utl::TempFileNamed aTempFile(u"test_write_unicode");
aTempFile.EnableKillingFile();
{
+1 -1
View File
@@ -1609,7 +1609,7 @@ const OUString& Application::GetDesktopEnvironment()
{
if (IsHeadlessModeEnabled())
{
static const OUString aNone("none");
static constexpr OUString aNone(u"none"_ustr);
return aNone;
}
else
+2 -4
View File
@@ -243,13 +243,11 @@ namespace vcl
if (!s_pFactory)
{
#ifndef DISABLE_DYNLOADING
const OUString sModuleName( SVLIBRARY( "acc" ));
s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, u"" SVLIBRARY( "acc" ) ""_ustr.pData, 0 );
if ( s_hAccessibleImplementationModule != nullptr )
{
const OUString sFactoryCreationFunc( "getSvtAccessibilityComponentFactory" );
s_pAccessibleFactoryFunc = reinterpret_cast<GetSvtAccessibilityComponentFactory>(
osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData ));
osl_getFunctionSymbol( s_hAccessibleImplementationModule, u"getSvtAccessibilityComponentFactory"_ustr.pData ));
}
OSL_ENSURE( s_pAccessibleFactoryFunc, "ac_registerClient: could not load the library, or not retrieve the needed symbol!" );
@@ -63,9 +63,8 @@ OUString applicationDirPath()
OUString findPickerExecutable()
{
const auto path = applicationDirPath();
const OUString app("lo_kde5filepicker");
OUString ret;
osl_searchFileURL(app.pData, path.pData, &ret.pData);
osl_searchFileURL(u"lo_kde5filepicker"_ustr.pData, path.pData, &ret.pData);
if (ret.isEmpty())
throw std::system_error(std::make_error_code(std::errc::no_such_file_or_directory),
"could not find lo_kde5filepicker executable");
+1 -1
View File
@@ -167,7 +167,7 @@ CPPUNIT_TEST_FIXTURE(EPUBExportTest, testMimetype)
uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponentContext->getServiceManager(),
uno::UNO_QUERY);
const OUString aServiceName("com.sun.star.comp.Writer.EPUBExportFilter");
constexpr OUString aServiceName(u"com.sun.star.comp.Writer.EPUBExportFilter"_ustr);
uno::Reference<document::XFilter> xFilter(xMSF->createInstance(aServiceName), uno::UNO_QUERY);
// Should result in no errors.
xFilter->cancel();
+1 -1
View File
@@ -65,7 +65,7 @@ namespace xmloff
//= OFormLayerXMLExport_Impl
const OUString& OFormLayerXMLExport_Impl::getControlNumberStyleNamePrefix()
{
static const OUString s_sControlNumberStyleNamePrefix("C");
static constexpr OUString s_sControlNumberStyleNamePrefix(u"C"_ustr);
return s_sControlNumberStyleNamePrefix;
}
+1 -1
View File
@@ -414,7 +414,7 @@ OUString const & XMLRedlineExport::ConvertTypeName(
else
{
OSL_FAIL("unknown redline type");
static const OUString sUnknownChange("UnknownChange");
static constexpr OUString sUnknownChange(u"UnknownChange"_ustr);
return sUnknownChange;
}
}
+2 -2
View File
@@ -589,8 +589,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFDoubleX509Certificate)
CPPUNIT_TEST_FIXTURE(SigningTest, testDNCompatibility)
{
OUString const msDN("CN=\"\"\"ABC\"\".\", O=\"Enterprise \"\"ABC\"\"\"");
OUString const nssDN("CN=\\\"ABC\\\".,O=Enterprise \\\"ABC\\\"");
OUString constexpr msDN(u"CN=\"\"\"ABC\"\".\", O=\"Enterprise \"\"ABC\"\"\""_ustr);
OUString constexpr nssDN(u"CN=\\\"ABC\\\".,O=Enterprise \\\"ABC\\\""_ustr);
// this is just the status quo, possibly either NSS or CryptoAPI might change
CPPUNIT_ASSERT(!xmlsecurity::EqualDistinguishedNames(msDN, nssDN, xmlsecurity::NOCOMPAT));
CPPUNIT_ASSERT(!xmlsecurity::EqualDistinguishedNames(nssDN, msDN, xmlsecurity::NOCOMPAT));