connectivity/source/drivers/mysqlc/mysqlc_connection.cxx |    6 -
 dbaccess/qa/extras/hsql_schema_import.cxx                |   44 +++++++-----
 dbaccess/qa/unit/tdf119625.cxx                           |    6 -
 editeng/qa/unit/core-test.cxx                            |    3 
 sax/source/tools/fastserializer.cxx                      |    2 
 sc/source/ui/Accessibility/AccessibleDocument.cxx        |    9 --
 sc/source/ui/dataprovider/datatransformation.cxx         |   27 ++-----
 sccomp/qa/unit/SwarmSolverTest.cxx                       |   10 +-
 sd/qa/unit/import-tests.cxx                              |    4 -
 sw/qa/extras/layout/layout.cxx                           |    7 +
 sw/qa/extras/odfexport/odfexport.cxx                     |    4 -
 sw/qa/extras/uiwriter/uiwriter.cxx                       |    3 
 tools/qa/cppunit/test_color.cxx                          |    3 
 tools/qa/cppunit/test_config.cxx                         |    9 --
 tools/qa/cppunit/test_date.cxx                           |   54 +++++----------
 vcl/qa/cppunit/FontFeatureTest.cxx                       |    2 
 vcl/qa/cppunit/bitmapcolor.cxx                           |   12 +--
 vcl/source/gdi/pdfwriter_impl.cxx                        |    3 
 18 files changed, 88 insertions(+), 120 deletions(-)

New commits:
commit 41eeaace84b45c803fff3ebd5ab981f0ad09393b
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Oct 29 08:58:11 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Oct 29 15:12:26 2018 +0100

    loplugin:oncevar
    
    Change-Id: Iba892694acb378887a1d15ab59104c55f591f0bd
    Reviewed-on: https://gerrit.libreoffice.org/62498
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx 
b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
index cb1b06261042..981fe7392aa5 100644
--- a/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
+++ b/connectivity/source/drivers/mysqlc/mysqlc_connection.cxx
@@ -268,9 +268,8 @@ OUString SAL_CALL OConnection::nativeSQL(const OUString& 
/*_sSql*/)
     MutexGuard aGuard(m_aMutex);
 
     // const OUString sSqlStatement = transFormPreparedStatement( _sSql );
-    OUString sNativeSQL;
     // TODO
-    return sNativeSQL;
+    return OUString();
 }
 
 void SAL_CALL OConnection::setAutoCommit(sal_Bool autoCommit)
@@ -291,8 +290,7 @@ sal_Bool SAL_CALL OConnection::getAutoCommit()
     MutexGuard aGuard(m_aMutex);
     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
 
-    bool autoCommit = false;
-    return autoCommit;
+    return false;
 }
 
 void SAL_CALL OConnection::commit()
diff --git a/dbaccess/qa/extras/hsql_schema_import.cxx 
b/dbaccess/qa/extras/hsql_schema_import.cxx
index dd75eb2dc38c..89ee74ce03aa 100644
--- a/dbaccess/qa/extras/hsql_schema_import.cxx
+++ b/dbaccess/qa/extras/hsql_schema_import.cxx
@@ -61,7 +61,7 @@ public:
 
 void HsqlSchemaImportTest::testIntegerPrimaryKeyNotNull()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY)" };
+    const OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT 
NULL PRIMARY KEY)" };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
@@ -79,8 +79,10 @@ void HsqlSchemaImportTest::testIntegerPrimaryKeyNotNull()
 
 void HsqlSchemaImportTest::testVarcharWithParam()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY, \"myText\" "
-                  "VARCHAR(50))" };
+    const OUString sql{
+        "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, 
\"myText\" "
+        "VARCHAR(50))"
+    };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
@@ -102,8 +104,10 @@ void HsqlSchemaImportTest::testVarcharWithParam()
  **/
 void HsqlSchemaImportTest::testVarcharWithoutParam()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY, \"myText\" "
-                  "VARCHAR)" };
+    const OUString sql{
+        "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, 
\"myText\" "
+        "VARCHAR)"
+    };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
@@ -118,8 +122,10 @@ void HsqlSchemaImportTest::testVarcharWithoutParam()
 
 void HsqlSchemaImportTest::testNumericWithTwoParam()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY, \"Betrag\" "
-                  "NUMERIC(8,2))" };
+    const OUString sql{
+        "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, 
\"Betrag\" "
+        "NUMERIC(8,2))"
+    };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
@@ -140,8 +146,10 @@ void HsqlSchemaImportTest::testNumericWithTwoParam()
 
 void HsqlSchemaImportTest::testIntegerAutoincremental()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY GENERATED "
-                  "BY DEFAULT AS IDENTITY(START WITH 0), \"myText\" 
VARCHAR(50))" };
+    const OUString sql{
+        "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY 
GENERATED "
+        "BY DEFAULT AS IDENTITY(START WITH 0), \"myText\" VARCHAR(50))"
+    };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
@@ -161,8 +169,10 @@ void HsqlSchemaImportTest::testIntegerAutoincremental()
  */
 void HsqlSchemaImportTest::testTimestampWithParam()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY, \"myText\" "
-                  "TIMESTAMP(0))" };
+    const OUString sql{
+        "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, 
\"myText\" "
+        "TIMESTAMP(0))"
+    };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
@@ -184,8 +194,10 @@ void HsqlSchemaImportTest::testTimestampWithParam()
  */
 void HsqlSchemaImportTest::testDefaultValueNow()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY, \"myDate\" "
-                  "TIMESTAMP DEFAULT NOW)" };
+    const OUString sql{
+        "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL PRIMARY KEY, 
\"myDate\" "
+        "TIMESTAMP DEFAULT NOW)"
+    };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
@@ -201,9 +213,9 @@ void HsqlSchemaImportTest::testDefaultValueNow()
 
 void HsqlSchemaImportTest::testEvilNullColumnName()
 {
-    OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT NULL 
PRIMARY KEY, "
-                  "\"myEvilNOT NULLName\" "
-                  "VARCHAR(20))" };
+    const OUString sql{ "CREATE CACHED TABLE \"myTable\"(\"id\" INTEGER NOT 
NULL PRIMARY KEY, "
+                        "\"myEvilNOT NULLName\" "
+                        "VARCHAR(20))" };
 
     FbCreateStmtParser aCreateParser;
     aCreateParser.parse(sql);
diff --git a/dbaccess/qa/unit/tdf119625.cxx b/dbaccess/qa/unit/tdf119625.cxx
index db1c5002c943..f9aea7b8d004 100644
--- a/dbaccess/qa/unit/tdf119625.cxx
+++ b/dbaccess/qa/unit/tdf119625.cxx
@@ -84,9 +84,9 @@ void Tdf119625Test::testTime()
 
     // select basically everything from the .odb
     uno::Reference<XStatement> statement = xConnection->createStatement();
-    OUString sql{ "  SELECT id, tst_dt, tst_d, tst_t "
-                  "    FROM tst_data "
-                  "ORDER BY id" };
+    const OUString sql{ "  SELECT id, tst_dt, tst_d, tst_t "
+                        "    FROM tst_data "
+                        "ORDER BY id" };
 
     uno::Reference<XResultSet> xRes = statement->executeQuery(sql);
     uno::Reference<XRow> xRow(xRes, UNO_QUERY_THROW);
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index f85ad0287e5d..ad56407d4dca 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -1840,8 +1840,7 @@ void Test::testTransliterate()
     OUString sText("one (two) three");
     aEditEngine.SetText(sText);
     aEditEngine.TransliterateText(ESelection(0, 0, 0, sText.getLength()), 
TransliterationFlags::TITLE_CASE);
-    OUString aExpected("One (Two) Three");
-    CPPUNIT_ASSERT_EQUAL(aExpected, aEditEngine.GetText());
+    CPPUNIT_ASSERT_EQUAL(OUString("One (Two) Three"), aEditEngine.GetText());
 }
 
 void Test::testHoriAlignIgnoreTrailingWhitespace()
diff --git a/sax/source/tools/fastserializer.cxx 
b/sax/source/tools/fastserializer.cxx
index 590c0167a29e..d299ca73ce08 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -135,7 +135,6 @@ namespace sax_fastparser {
             return;
         }
 
-        bool bGood = true;
         const sal_Int32 kXescapeLen = 7;
         char bufXescape[kXescapeLen+1];
         sal_Int32 nNextXescape = 0;
@@ -244,7 +243,6 @@ namespace sax_fastparser {
                 break;
             }
         }
-        SAL_WARN_IF( !bGood && nLen > 1, "sax", "in '" << 
OString(pStr,std::min<sal_Int32>(nLen,42)) << "'");
     }
 
     void FastSaxSerializer::endDocument()
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index fc59f7a4acc8..6996c234858b 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -419,8 +419,7 @@ void ScChildrenShapes::Notify(SfxBroadcaster&, const 
SfxHint& rHint)
                     uno::Reference<drawing::XShape> xShape 
(pObj->getUnoShape(), uno::UNO_QUERY);
                     if (xShape.is())
                     {
-                        ScShapeDataLess aLess;
-                        std::sort(maZOrderedShapes.begin(), 
maZOrderedShapes.end(), aLess); // sort, because the z index or layer could be 
changed
+                        std::sort(maZOrderedShapes.begin(), 
maZOrderedShapes.end(), ScShapeDataLess()); // sort, because the z index or 
layer could be changed
                         CheckWhetherAnchorChanged(xShape);
                     }
                 }
@@ -958,8 +957,7 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const 
uno::Reference<drawing::X
     {
         pFocusedObj = GetSdrObjectFromXShape(aShapesList[0]->xShape);
     }
-    ScShapeDataLess aLess;
-    std::sort(aShapesList.begin(), aShapesList.end(), aLess);
+    std::sort(aShapesList.begin(), aShapesList.end(), ScShapeDataLess());
     SortedShapes vecSelectedShapeAdd;
     SortedShapes vecSelectedShapeRemove;
     bool bHasSelect=false;
@@ -1312,8 +1310,7 @@ bool ScChildrenShapes::FindShape(const 
uno::Reference<drawing::XShape>& xShape,
     bool bResult(false);
     ScAccessibleShapeData aShape;
     aShape.xShape = xShape;
-    ScShapeDataLess aLess;
-    rItr = std::lower_bound(maZOrderedShapes.begin(), maZOrderedShapes.end(), 
&aShape, aLess);
+    rItr = std::lower_bound(maZOrderedShapes.begin(), maZOrderedShapes.end(), 
&aShape, ScShapeDataLess());
     if ((rItr != maZOrderedShapes.end()) && (*rItr != nullptr) && 
((*rItr)->xShape.get() == xShape.get()))
         bResult = true; // if the shape is found
 
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx 
b/sc/source/ui/dataprovider/datatransformation.cxx
index 16707f51d780..e3b526a588a9 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -235,7 +235,6 @@ void TextTransformation::Transform(ScDocument& rDoc) const
             break;
             case TEXT_TRANSFORM_TYPE::CAPITALIZE:
             {
-                sal_Unicode separator = sal_Unicode(U' ');
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     CellType eType;
@@ -250,7 +249,7 @@ void TextTransformation::Transform(ScDocument& rDoc) const
                             aStr = aStr.replaceAt(0, 1, 
ScGlobal::pCharClass->uppercase(OUString(aStr[0])));
 
                         for (sal_Int32 i = 1; i < length; i++){
-                            if (aStr[i-1] == separator)
+                            if (aStr[i-1] == sal_Unicode(U' '))
                             {
                                 aStr = aStr.replaceAt(i, 1, 
ScGlobal::pCharClass->uppercase(OUString(aStr[i])));
                             }
@@ -736,9 +735,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::DATE_STRING:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::DATE;
                 LanguageType        eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
nFormatType, eLanguage );
+                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
SvNumFormatType::DATE, eLanguage );
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     CellType eType;
@@ -770,9 +768,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::START_OF_YEAR:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::DATE;
                 LanguageType        eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
nFormatType, eLanguage );
+                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
SvNumFormatType::DATE, eLanguage );
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     CellType eType;
@@ -794,9 +791,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::END_OF_YEAR:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::DATE;
                 LanguageType        eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
nFormatType, eLanguage );
+                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
SvNumFormatType::DATE, eLanguage );
 
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
@@ -854,9 +850,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::START_OF_MONTH:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::DATE;
                 LanguageType eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
nFormatType, eLanguage );
+                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
SvNumFormatType::DATE, eLanguage );
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     CellType eType;
@@ -877,9 +872,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::END_OF_MONTH:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::DATE;
                 LanguageType eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
nFormatType, eLanguage );
+                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
SvNumFormatType::DATE, eLanguage );
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     CellType eType;
@@ -980,9 +974,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::START_OF_QUARTER:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::DATE;
                 LanguageType eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
nFormatType, eLanguage );
+                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
SvNumFormatType::DATE, eLanguage );
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     CellType eType;
@@ -1036,9 +1029,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::END_OF_QUARTER:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::DATE;
                 LanguageType        eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
nFormatType, eLanguage );
+                sal_uInt32 nFormat = pFormatter->GetStandardFormat( 
SvNumFormatType::DATE, eLanguage );
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     ScAddress aAddress(rCol, nRow, 0);
@@ -1095,9 +1087,8 @@ void DateTimeTransformation::Transform(ScDocument& rDoc) 
const
             case DATETIME_TRANSFORMATION_TYPE::TIME:
             {
                 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
-                SvNumFormatType nFormatType = SvNumFormatType::TIME;
                 LanguageType eLanguage = ScGlobal::eLnge;
-                sal_uInt32 nFormat = 
pFormatter->GetStandardFormat(nFormatType, eLanguage);
+                sal_uInt32 nFormat = 
pFormatter->GetStandardFormat(SvNumFormatType::TIME, eLanguage);
                 for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
                 {
                     ScAddress aAddress(rCol, nRow, 0);
diff --git a/sccomp/qa/unit/SwarmSolverTest.cxx 
b/sccomp/qa/unit/SwarmSolverTest.cxx
index 6403de068a91..2f0e6d48104b 100644
--- a/sccomp/qa/unit/SwarmSolverTest.cxx
+++ b/sccomp/qa/unit/SwarmSolverTest.cxx
@@ -76,7 +76,7 @@ void SwarmSolverTest::testUnconstrained()
     uno::Reference<table::XCell> xCell;
 
     uno::Reference<sheet::XSolver> xSolver;
-    OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
+    const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
     
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
                 uno::UNO_QUERY_THROW);
@@ -128,7 +128,7 @@ void SwarmSolverTest::testVariableBounded()
     uno::Reference<table::XCell> xCell;
 
     uno::Reference<sheet::XSolver> xSolver;
-    OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
+    const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
     
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
                 uno::UNO_QUERY_THROW);
@@ -182,7 +182,7 @@ void SwarmSolverTest::testVariableConstrained()
     uno::Reference<table::XCell> xCell;
 
     uno::Reference<sheet::XSolver> xSolver;
-    OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
+    const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
     
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
                 uno::UNO_QUERY_THROW);
@@ -240,7 +240,7 @@ void SwarmSolverTest::testTwoVariables()
     uno::Reference<table::XCell> xCell;
 
     uno::Reference<sheet::XSolver> xSolver;
-    OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
+    const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
     
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
                 uno::UNO_QUERY_THROW);
@@ -305,7 +305,7 @@ void SwarmSolverTest::testMultipleVariables()
     uno::Reference<table::XCell> xCell;
 
     uno::Reference<sheet::XSolver> xSolver;
-    OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
+    const OUString sSolverName("com.sun.star.comp.Calc.SwarmSolver");
 
     
xSolver.set(m_xContext->getServiceManager()->createInstanceWithContext(sSolverName,
 m_xContext),
                 uno::UNO_QUERY_THROW);
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 9dc6226b36d5..803df20d5311 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1837,8 +1837,8 @@ bool checkPatternValues(std::vector<sal_uInt8>& 
rExpected, Bitmap& rBitmap)
 {
     bool bResult = true;
 
-    Color aFGColor(0xFF0000);
-    Color aBGColor(0xFFFFFF);
+    const Color aFGColor(0xFF0000);
+    const Color aBGColor(0xFFFFFF);
 
     Bitmap::ScopedReadAccess pAccess(rBitmap);
     for (long y = 0; y < pAccess->Height(); ++y)
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 083c2f16302b..da45f2e9198e 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2430,11 +2430,12 @@ void SwLayoutWriter::testTdf118672()
         }))
         return;
 
-    OUString aLine1("He heard quiet steps behind him. That didn't bode well. 
Who could be fol*1 2 "
-                    "3 4 5 6 7 8 9 10con-");
+    const OUString aLine1(
+        "He heard quiet steps behind him. That didn't bode well. Who could be 
fol*1 2 "
+        "3 4 5 6 7 8 9 10con-");
     // This ended as "fol*1 2 3 4 5 6 7 8 9", i.e. "10con-" was moved to the 
next line.
     assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[1]", "Line", 
aLine1);
-    OUString aLine2("setetur");
+    const OUString aLine2("setetur");
     assertXPath(pXmlDoc, "/root/page/body/txt[1]/LineBreak[2]", "Line", 
aLine2);
 }
 
diff --git a/sw/qa/extras/odfexport/odfexport.cxx 
b/sw/qa/extras/odfexport/odfexport.cxx
index e130d754b9d2..a2620feaf55a 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2020,9 +2020,9 @@ DECLARE_ODFEXPORT_TEST(testChapterNumberingNewLine, 
"chapter-number-new-line.odt
 DECLARE_ODFEXPORT_TEST(testSpellOutNumberingTypes, 
"spellout-numberingtypes.odt")
 {
     // ordinal indicator, ordinal and cardinal number numbering styles (from 
LibreOffice 6.1)
-    const char* aFieldTexts[] = { "1st", "Erste", "Eins",  "1.", "Premier", 
"Un", "1ᵉʳ", "First", "One" };
+    static const char* const aFieldTexts[] = { "1st", "Erste", "Eins",  "1.", 
"Premier", "Un", "1ᵉʳ", "First", "One" };
     // fallback for old platforms without std::codecvt and std::regex supports
-    const char* aFieldTextFallbacks[] = { "Ordinal-number 1", "Ordinal 1", "1" 
};
+    static const char* const aFieldTextFallbacks[] = { "Ordinal-number 1", 
"Ordinal 1", "1" };
     uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
     // update text field content
     uno::Reference<util::XRefreshable>(xTextFieldsSupplier->getTextFields(), 
uno::UNO_QUERY)->refresh();
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 76cc659805dd..6d0ba0277d11 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -3561,8 +3561,7 @@ void SwUiWriterTest::testTableBackgroundColor()
     pWrtShell->SelTableRow(); //Selecting First Row
     pWrtShell->ClearMark();
     //Modifying the color of Table Box
-    Color colour = sal_Int32(0xFF00FF);
-    pWrtShell->SetBoxBackground(SvxBrushItem(colour, 
sal_Int16(RES_BACKGROUND)));
+    pWrtShell->SetBoxBackground(SvxBrushItem(Color(sal_Int32(0xFF00FF)), 
sal_Int16(RES_BACKGROUND)));
     //Checking cells for background color only A1 should be modified
     uno::Reference<table::XCell> xCell;
     xCell = xTable->getCellByName("A1");
diff --git a/tools/qa/cppunit/test_color.cxx b/tools/qa/cppunit/test_color.cxx
index 15d90e388e60..10da454b9497 100644
--- a/tools/qa/cppunit/test_color.cxx
+++ b/tools/qa/cppunit/test_color.cxx
@@ -62,10 +62,9 @@ void Test::test_asRGBColor()
 void Test::test_readAndWriteStream()
 {
     SvMemoryStream aStream;
-    Color aWriteColor(0x12, 0x34, 0x56);
     Color aReadColor;
 
-    WriteColor(aStream, aWriteColor);
+    WriteColor(aStream, Color(0x12, 0x34, 0x56));
 
     aStream.Seek(STREAM_SEEK_TO_BEGIN);
 
diff --git a/tools/qa/cppunit/test_config.cxx b/tools/qa/cppunit/test_config.cxx
index aaf599b8fa5e..4f392a3c7b50 100644
--- a/tools/qa/cppunit/test_config.cxx
+++ b/tools/qa/cppunit/test_config.cxx
@@ -76,9 +76,8 @@ public:
             CPPUNIT_ASSERT(!aConfig.HasGroup("TestGroup"));
             CPPUNIT_ASSERT_EQUAL(OString("TestGroup2"), 
aConfig.GetGroupName(0));
 
-            sal_uInt16 nExpected = 1;
             sal_uInt16 nActual = aConfig.GetGroupCount();
-            CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
+            CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), nActual);
         }
 
         osl::File::copy(maOriginalConfigFile, maConfigFile);
@@ -90,9 +89,8 @@ public:
             aConfig.DeleteGroup(OString("NonExistentTestGroup"));
             CPPUNIT_ASSERT_EQUAL(OString("TestGroup"), 
aConfig.GetGroupName(0));
 
-            sal_uInt16 nExpected = 2;
             sal_uInt16 nActual = aConfig.GetGroupCount();
-            CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
+            CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), nActual);
         }
 
         osl::File::copy(maOriginalConfigFile, maConfigFile);
@@ -101,9 +99,8 @@ public:
     void testGetGroupCount()
     {
         Config aConfig(maConfigFile);
-        sal_uInt16 nExpected = 2;
         sal_uInt16 nActual = aConfig.GetGroupCount();
-        CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(2), nActual);
     }
 
     void testReadKey()
diff --git a/tools/qa/cppunit/test_date.cxx b/tools/qa/cppunit/test_date.cxx
index 7e1119e93b68..ca6c39d84109 100644
--- a/tools/qa/cppunit/test_date.cxx
+++ b/tools/qa/cppunit/test_date.cxx
@@ -192,32 +192,27 @@ void DateTest::testGetDaysInYear()
 {
     {
         Date aDate(1, 1, 2000);
-        sal_uInt16 nExpectedDays = 366;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInYear());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(366), aDate.GetDaysInYear());
     }
 
     {
         Date aDate(1, 1, 1900);
-        sal_uInt16 nExpectedDays = 365;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInYear());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(365), aDate.GetDaysInYear());
     }
 
     {
         Date aDate(1, 1, 1999);
-        sal_uInt16 nExpectedDays = 365;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInYear());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(365), aDate.GetDaysInYear());
     }
 
     {
         Date aDate(1, 1, 2004);
-        sal_uInt16 nExpectedDays = 366;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInYear());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(366), aDate.GetDaysInYear());
     }
 
     {
         Date aDate(1, 1, 400);
-        sal_uInt16 nExpectedDays = 366;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInYear());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(366), aDate.GetDaysInYear());
     }
 }
 
@@ -469,80 +464,67 @@ void DateTest::testGetDaysInMonth()
 {
     {
         Date aDate(1, 1, 2000);
-        sal_uInt16 nExpectedDays = 31;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(31), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 2, 2000);
-        sal_uInt16 nExpectedDays = 29;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(29), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 2, 1999);
-        sal_uInt16 nExpectedDays = 28;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(28), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 3, 2000);
-        sal_uInt16 nExpectedDays = 31;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(31), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 4, 2000);
-        sal_uInt16 nExpectedDays = 30;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(30), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 5, 2000);
-        sal_uInt16 nExpectedDays = 31;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(31), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 6, 2000);
-        sal_uInt16 nExpectedDays = 30;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(30), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 7, 2000);
-        sal_uInt16 nExpectedDays = 31;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(31), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 8, 2000);
-        sal_uInt16 nExpectedDays = 31;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(31), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 9, 2000);
-        sal_uInt16 nExpectedDays = 30;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(30), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 10, 2000);
-        sal_uInt16 nExpectedDays = 31;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(31), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 11, 2000);
-        sal_uInt16 nExpectedDays = 30;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(30), aDate.GetDaysInMonth());
     }
 
     {
         Date aDate(1, 12, 2000);
-        sal_uInt16 nExpectedDays = 31;
-        CPPUNIT_ASSERT_EQUAL(nExpectedDays, aDate.GetDaysInMonth());
+        CPPUNIT_ASSERT_EQUAL(sal_uInt16(31), aDate.GetDaysInMonth());
     }
 }
 
diff --git a/vcl/qa/cppunit/FontFeatureTest.cxx 
b/vcl/qa/cppunit/FontFeatureTest.cxx
index 7476162b976e..fca68240f0da 100644
--- a/vcl/qa/cppunit/FontFeatureTest.cxx
+++ b/vcl/qa/cppunit/FontFeatureTest.cxx
@@ -48,7 +48,7 @@ void FontFeatureTest::testGetFontFeatures()
         return; // Can't test this because the font is not available, so exit
 
     vcl::Font aFont = aVDev->GetFont();
-    aFont.SetFamilyName("Linux Libertine G");
+    aFont.SetFamilyName(aFontName);
     aFont.SetWeight(FontWeight::WEIGHT_NORMAL);
     aFont.SetItalic(FontItalic::ITALIC_NORMAL);
     aFont.SetWidthType(FontWidth::WIDTH_NORMAL);
diff --git a/vcl/qa/cppunit/bitmapcolor.cxx b/vcl/qa/cppunit/bitmapcolor.cxx
index 0544a0c53e41..879bc78d7d1d 100644
--- a/vcl/qa/cppunit/bitmapcolor.cxx
+++ b/vcl/qa/cppunit/bitmapcolor.cxx
@@ -102,8 +102,7 @@ void BitmapColorTest::colorValueConstructor()
 void BitmapColorTest::colorClassConstructor()
 {
     {
-        Color aColor(0, 0, 0);
-        BitmapColor aBmpColor(aColor);
+        BitmapColor aBmpColor(Color(0, 0, 0));
 
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Red wrong", static_cast<sal_uInt8>(0), 
aBmpColor.GetRed());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", static_cast<sal_uInt8>(0),
@@ -114,8 +113,7 @@ void BitmapColorTest::colorClassConstructor()
     }
 
     {
-        Color aColor(127, 127, 127);
-        BitmapColor aBmpColor(aColor);
+        BitmapColor aBmpColor(Color(127, 127, 127));
 
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Red wrong", static_cast<sal_uInt8>(127), 
aBmpColor.GetRed());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", 
static_cast<sal_uInt8>(127),
@@ -127,8 +125,7 @@ void BitmapColorTest::colorClassConstructor()
     }
 
     {
-        Color aColor(255, 255, 255);
-        BitmapColor aBmpColor(aColor);
+        BitmapColor aBmpColor(Color(255, 255, 255));
 
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Red wrong", static_cast<sal_uInt8>(255), 
aBmpColor.GetRed());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", 
static_cast<sal_uInt8>(255),
@@ -141,8 +138,7 @@ void BitmapColorTest::colorClassConstructor()
 
     // Transparency / Alpha
     {
-        Color aColor(255, 128, 64, 0);
-        BitmapColor aBmpColor(aColor);
+        BitmapColor aBmpColor(Color(255, 128, 64, 0));
 
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Red wrong", static_cast<sal_uInt8>(128), 
aBmpColor.GetRed());
         CPPUNIT_ASSERT_EQUAL_MESSAGE("Green wrong", static_cast<sal_uInt8>(64),
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index e736934d739c..5abb8998032f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -7373,8 +7373,7 @@ void PDFWriterImpl::drawStraightTextLine( OStringBuffer& 
aLine, long nWidth, Fon
     {
         appendStrokingColor(aColor, aLine); // stroke with text color
         aLine.append( " " );
-        Color aNonStrokeColor(COL_WHITE);   // fill with white
-        appendNonStrokingColor(aNonStrokeColor, aLine);
+        appendNonStrokingColor(COL_WHITE, aLine); // fill with white
         aLine.append( "\n" );
         aLine.append( "0.25 w \n" ); // same line thickness as in drawLayout
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to