summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-18 08:08:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-18 10:46:58 +0200
commitdfd5385d97d4c359185450f5d0acc5aac4a7527b (patch)
tree6d616aa5bf06a4c53c60b3639e32b1bbda6bbb7f /sc/qa
parente060b66fc4568f58562d85191aacd9fd9b6d86bf (diff)
loplugin:staticvar in sc
Change-Id: I9f1d66e9af454a27a341e56bbe50a558898b65a1 Reviewed-on: https://gerrit.libreoffice.org/61900 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/helper/qahelper.hxx8
-rw-r--r--sc/qa/unit/helper/shared_test_impl.hxx10
-rw-r--r--sc/qa/unit/pivottable_filters_test.cxx2
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx12
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx6
-rw-r--r--sc/qa/unit/ucalc.cxx30
-rw-r--r--sc/qa/unit/ucalc_column.cxx4
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx18
-rw-r--r--sc/qa/unit/ucalc_formula.cxx40
-rw-r--r--sc/qa/unit/ucalc_pivottable.cxx50
-rw-r--r--sc/qa/unit/ucalc_sort.cxx14
11 files changed, 97 insertions, 97 deletions
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index aac73cf8238a..37bbdc35ff50 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -90,10 +90,10 @@ struct TestParam
bool const bOptimal;
};
const char* sTestDoc;
- int const nImportType;
- int const nExportType; // -1 for import test, otherwise this is an export test
- int const nRowData;
- RowData* const pData;
+ int nImportType;
+ int nExportType; // -1 for import test, otherwise this is an export test
+ int nRowData;
+ RowData const * pData;
};
struct FileFormat {
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx
index 114f2571f610..88548cca3699 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -43,7 +43,7 @@ struct DataBarData
databar::ScAxisPosition eAxisPosition;
};
-DataBarData aData[] = {
+DataBarData const aData[] = {
{ ScRange(1,2,0,1,5,0), COLORSCALE_AUTO, COLORSCALE_AUTO, databar::AUTOMATIC },
{ ScRange(3,2,0,3,5,0), COLORSCALE_MIN, COLORSCALE_MAX, databar::AUTOMATIC },
{ ScRange(5,2,0,5,5,0), COLORSCALE_PERCENTILE, COLORSCALE_PERCENT, databar::AUTOMATIC },
@@ -82,7 +82,7 @@ struct ColorScale2EntryData
ScColorScaleEntryType eUpperType;
};
-ColorScale2EntryData aData2Entry[] = {
+ColorScale2EntryData const aData2Entry[] = {
{ ScRange(1,2,0,1,5,0), COLORSCALE_MIN, COLORSCALE_MAX },
{ ScRange(3,2,0,3,5,0), COLORSCALE_PERCENTILE, COLORSCALE_PERCENT },
{ ScRange(5,2,0,5,5,0), COLORSCALE_VALUE, COLORSCALE_FORMULA }
@@ -121,7 +121,7 @@ struct ColorScale3EntryData
ScColorScaleEntryType eUpperType;
};
-ColorScale3EntryData aData3Entry[] = {
+ColorScale3EntryData const aData3Entry[] = {
{ ScRange(1,1,1,1,6,1), COLORSCALE_MIN, COLORSCALE_PERCENTILE, COLORSCALE_MAX },
{ ScRange(3,1,1,3,6,1), COLORSCALE_PERCENTILE, COLORSCALE_VALUE, COLORSCALE_PERCENT },
{ ScRange(5,1,1,5,6,1), COLORSCALE_VALUE, COLORSCALE_VALUE, COLORSCALE_FORMULA }
@@ -159,11 +159,11 @@ void testFunctionsExcel2010_Impl( ScDocument& rDoc )
{
// Original test case document is functions-excel-2010.xlsx
// Which test rows to evaluate, 1-based as in UI to ease maintenance.
- struct
+ static struct
{
SCROW nRow;
bool bEvaluate;
- } aTests[] = {
+ } const aTests[] = {
{ 2, false }, // name=[ AGGREGATE ], result=0, expected=1
{ 3, true },
{ 4, true },
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx
index 609ee98e0a63..ceb43d6ce664 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -153,7 +153,7 @@ void ScPivotTableFiltersTest::tearDown()
void ScPivotTableFiltersTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
{
- struct
+ static const struct
{
xmlChar* pPrefix;
xmlChar* pURI;
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index ef0b5c96eec2..2472b3f9d55f 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -341,7 +341,7 @@ private:
void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
{
- struct { xmlChar* pPrefix; xmlChar* pURI; } aNamespaces[] =
+ static const struct { xmlChar* pPrefix; xmlChar* pURI; } aNamespaces[] =
{
{ BAD_CAST("w"), BAD_CAST("http://schemas.openxmlformats.org/wordprocessingml/2006/main") },
{ BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main") },
@@ -1192,7 +1192,7 @@ void ScExportTest::testDataBarExportXLSX()
void ScExportTest::testMiscRowHeightExport()
{
- TestParam::RowData DfltRowData[] =
+ static const TestParam::RowData DfltRowData[] =
{
{ 0, 4, 0, 529, 0, false },
{ 5, 10, 0, 1058, 0, false },
@@ -1202,7 +1202,7 @@ void ScExportTest::testMiscRowHeightExport()
{ 1048573, 1048575, 0, 529, 0, false },
};
- TestParam::RowData EmptyRepeatRowData[] =
+ static const TestParam::RowData EmptyRepeatRowData[] =
{
// rows 0-4, 5-10, 17-20 are all set at various
// heights, there is no content in the rows, there
@@ -2308,7 +2308,7 @@ const char* toBorderName( SvxBorderLineStyle eStyle )
void ScExportTest::testExcelCellBorders( sal_uLong nFormatType )
{
- struct
+ static const struct
{
SCROW mnRow;
SvxBorderLineStyle mnStyle;
@@ -2521,7 +2521,7 @@ void ScExportTest::testTrackChangesSimpleXLSX()
bool check( const ScDocument& rDoc )
{
- CheckItem aChecks[] =
+ static const CheckItem aChecks[] =
{
{ 1, SC_CAT_CONTENT , 1, 1, 0, 1, 1, 0, false },
{ 2, SC_CAT_INSERT_ROWS , 0, 2, 0, 0, 2, 0, true },
@@ -2732,7 +2732,7 @@ void ScExportTest::testSheetTabColorsXLSX()
}
}
- const Color aXclColors[] =
+ static const Color aXclColors[] =
{
0x0000B050, // green
0x00FF0000, // red
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index d10794a197d7..eca265feeb9d 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -2763,7 +2763,7 @@ void ScFiltersTest::testFormulaDependency()
void ScFiltersTest::testMiscRowHeights()
{
- TestParam::RowData DfltRowData[] =
+ static const TestParam::RowData DfltRowData[] =
{
// check rows at the beginning and end of document
// and make sure they are reported as the default row
@@ -2772,7 +2772,7 @@ void ScFiltersTest::testMiscRowHeights()
{ 1048573, 1048575, 0, -1, 0, false },
};
- TestParam::RowData MultiLineOptData[] =
+ static const TestParam::RowData MultiLineOptData[] =
{
// Row 0 is 12.63 mm, but optimal flag is set
{ 0, 0, 0, 1236, CHECK_OPTIMAL, true },
@@ -2908,7 +2908,7 @@ void ScFiltersTest::testOutlineODS()
size_t nIndex;
};
- OutlineData aRow[] =
+ static const OutlineData aRow[] =
{
{ 1, 29, false, true, 0, 0 },
{ 2, 26, false, true, 1, 0 },
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a5af0c3e0db0..5645600c2a45 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -612,7 +612,7 @@ void Test::testSelectionFunction()
};
{
- Check aChecks[] =
+ static const Check aChecks[] =
{
{ SUBTOTAL_FUNC_AVE, 3.5 },
{ SUBTOTAL_FUNC_CNT2, 12.0 },
@@ -640,7 +640,7 @@ void Test::testSelectionFunction()
CPPUNIT_ASSERT_MESSAGE("This row should be hidden.", m_pDoc->RowHidden(5, 0));
{
- Check aChecks[] =
+ static const Check aChecks[] =
{
{ SUBTOTAL_FUNC_AVE, 3.0 },
{ SUBTOTAL_FUNC_CNT2, 8.0 },
@@ -667,7 +667,7 @@ void Test::testSelectionFunction()
// D3 (numeric cell containing 5.)
ScAddress aPos(3, 2, 0);
- Check aChecks[] =
+ static const Check aChecks[] =
{
{ SUBTOTAL_FUNC_AVE, 5.0 },
{ SUBTOTAL_FUNC_CNT2, 1.0 },
@@ -691,7 +691,7 @@ void Test::testSelectionFunction()
// B7 (string formula cell containing ="C".)
ScAddress aPos(1, 6, 0);
- Check aChecks[] =
+ static const Check aChecks[] =
{
{ SUBTOTAL_FUNC_CNT2, 1.0 },
{ SUBTOTAL_FUNC_SELECTION_COUNT, 1.0 }
@@ -905,7 +905,7 @@ void Test::testHorizontalIterator()
{ "E", "3" }
};
- HoriIterCheck aChecks[] = {
+ static const HoriIterCheck aChecks[] = {
{ 0, 0, "A" },
{ 1, 0, "B" },
{ 0, 1, "C" },
@@ -931,7 +931,7 @@ void Test::testHorizontalIterator()
{ "D", "E" },
};
- HoriIterCheck aChecks[] = {
+ static const HoriIterCheck aChecks[] = {
{ 0, 0, "A" },
{ 1, 0, "B" },
{ 0, 1, "C" },
@@ -960,7 +960,7 @@ void Test::testHorizontalIterator()
{ nullptr, nullptr },
};
- HoriIterCheck aChecks[] = {
+ static const HoriIterCheck aChecks[] = {
{ 1, 0, "A" },
{ 1, 2, "1" },
{ 0, 3, "B" },
@@ -1002,7 +1002,7 @@ void Test::testHorizontalIterator()
{ nullptr, "A" },
};
- HoriIterCheck aChecks[] = {
+ static const HoriIterCheck aChecks[] = {
{ 1, 2, "A" },
};
@@ -1023,7 +1023,7 @@ void Test::testHorizontalIterator()
{ nullptr, nullptr },
};
- HoriIterCheck aChecks[] = {
+ static const HoriIterCheck aChecks[] = {
{ 1, 2, "A" },
{ 1, 3, "1" },
};
@@ -1518,7 +1518,7 @@ void Test::testFuncParam()
void Test::testNamedRange()
{
- RangeNameDef aNames[] = {
+ static const RangeNameDef aNames[] = {
{ "Divisor", "$Sheet1.$A$1:$A$1048576", 1 },
{ "MyRange1", "$Sheet1.$A$1:$A$100", 2 },
{ "MyRange2", "$Sheet1.$B$1:$B$100", 3 },
@@ -1600,7 +1600,7 @@ void Test::testInsertNameList()
{
m_pDoc->InsertTab(0, "Test");
- RangeNameDef aNames[] = {
+ static const RangeNameDef aNames[] = {
{ "MyRange1", "$Test.$A$1:$A$100", 1 },
{ "MyRange2", "$Test.$B$1:$B$100", 2 },
{ "MyRange3", "$Test.$C$1:$C$100", 3 }
@@ -3722,7 +3722,7 @@ void Test::testCopyPasteSkipEmpty()
// Check the initial condition.
{
- Check aChecks[] = {
+ static const Check aChecks[] = {
{ "A", COL_BLUE, true },
{ "B", COL_BLUE, true },
{ "C", COL_BLUE, true },
@@ -3753,7 +3753,7 @@ void Test::testCopyPasteSkipEmpty()
// Check the content after the paste.
{
- Check aChecks[] = {
+ static const Check aChecks[] = {
{ "Clip1", COL_YELLOW, false },
{ "B", COL_BLUE, true },
{ "Clip2", COL_YELLOW, false },
@@ -3768,7 +3768,7 @@ void Test::testCopyPasteSkipEmpty()
// Undo, and check the content.
aUndo.Undo();
{
- Check aChecks[] = {
+ static const Check aChecks[] = {
{ "A", COL_BLUE, true },
{ "B", COL_BLUE, true },
{ "C", COL_BLUE, true },
@@ -3783,7 +3783,7 @@ void Test::testCopyPasteSkipEmpty()
// Redo, and check the content again.
aUndo.Redo();
{
- Check aChecks[] = {
+ static const Check aChecks[] = {
{ "Clip1", COL_YELLOW, false },
{ "B", COL_BLUE, true },
{ "Clip2", COL_YELLOW, false },
diff --git a/sc/qa/unit/ucalc_column.cxx b/sc/qa/unit/ucalc_column.cxx
index a650b628b20f..35ffc0151a77 100644
--- a/sc/qa/unit/ucalc_column.cxx
+++ b/sc/qa/unit/ucalc_column.cxx
@@ -99,7 +99,7 @@ void Test::testSetFormula()
{
m_pDoc->InsertTab(0, "Test");
- struct aInputs
+ static struct aInputs
{
const char* aName;
SCROW const nRow;
@@ -108,7 +108,7 @@ void Test::testSetFormula()
const char* aFormula2; // Represents the formula that is actually stored in the cell.
formula::FormulaGrammar::Grammar const eGram;
- } aTest[] = {
+ } const aTest[] = {
{ "Rock and Roll" ,5 , 4 , "=SUM($D$2:$F$3)" ,"=SUM($D$2:$F$3)" , formula::FormulaGrammar::Grammar::GRAM_ENGLISH },
{ "Blues" ,5 , 5 , "=A1-$C2+B$3-$F$4" ,"=A1-$C2+B$3-$F$4", formula::FormulaGrammar::Grammar::GRAM_NATIVE },
{ "Acoustic" ,6 , 6 , "=A1-$C2+B$3-$F$4" ,"=A1-$C2+B$3-$F$4", formula::FormulaGrammar::Grammar::GRAM_NATIVE_XL_A1},
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index ad64e51e4853..633bfd86fbcc 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -562,9 +562,9 @@ void Test::testIconSet()
m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1);
pList->InsertNew(pFormat);
- struct {
+ static struct {
double nVal; sal_Int32 nIndex;
- } aTests[] = {
+ } const aTests[] = {
{ -1.0, 0 },
{ 0.0, 0 },
{ 1.0, 1 },
@@ -590,7 +590,7 @@ struct ScDataBarLengthData
double const nLength;
};
-void testDataBarLengthImpl(ScDocument* pDoc, ScDataBarLengthData* pData, const ScRange& rRange,
+void testDataBarLengthImpl(ScDocument* pDoc, const ScDataBarLengthData* pData, const ScRange& rRange,
double nMinVal, ScColorScaleEntryType eMinType,
double nMaxVal, ScColorScaleEntryType eMaxType,
double nZeroPos, databar::ScAxisPosition eAxisPos)
@@ -635,7 +635,7 @@ void Test::testDataBarLengthAutomaticAxis()
{
m_pDoc->InsertTab(0, "Test");
- ScDataBarLengthData aValues[] = {
+ static const ScDataBarLengthData aValues[] = {
{ 2, 0 },
{ 3, 0 },
{ 4, 25.0 },
@@ -650,7 +650,7 @@ void Test::testDataBarLengthAutomaticAxis()
testDataBarLengthImpl(m_pDoc, aValues, ScRange(0,0,0,0,7,0),
3, COLORSCALE_VALUE, 7, COLORSCALE_VALUE, 0.0, databar::AUTOMATIC);
- ScDataBarLengthData aValues2[] = {
+ static const ScDataBarLengthData aValues2[] = {
{ -6, -100 },
{ -5, -100 },
{ -4, -100 },
@@ -672,7 +672,7 @@ void Test::testDataBarLengthAutomaticAxis()
testDataBarLengthImpl(m_pDoc, aValues2, ScRange(1,0,0,1,15,0),
-4, COLORSCALE_VALUE, 8, COLORSCALE_VALUE, 1.0/3.0 * 100, databar::AUTOMATIC);
- ScDataBarLengthData aValues3[] = {
+ static const ScDataBarLengthData aValues3[] = {
{ 2, 0.0 },
{ 3, 25.0 },
{ 4, 50.0 },
@@ -682,7 +682,7 @@ void Test::testDataBarLengthAutomaticAxis()
testDataBarLengthImpl(m_pDoc, aValues3, ScRange(2,0,0,2,3,0),
0, COLORSCALE_MIN, 0, COLORSCALE_MAX, 0, databar::AUTOMATIC);
- ScDataBarLengthData aValues4[] = {
+ static const ScDataBarLengthData aValues4[] = {
{ 2, 40.0 },
{ 3, 60.0 },
{ 4, 80.0 },
@@ -699,7 +699,7 @@ void Test::testDataBarLengthMiddleAxis()
{
m_pDoc->InsertTab(0, "Test");
- ScDataBarLengthData aValues[] = {
+ static const ScDataBarLengthData aValues[] = {
{ 1, 25.0 },
{ 2, 25.0 },
{ 3, 37.5 },
@@ -715,7 +715,7 @@ void Test::testDataBarLengthMiddleAxis()
testDataBarLengthImpl(m_pDoc, aValues, ScRange(0,0,0,0,8,0),
2, COLORSCALE_VALUE, 8, COLORSCALE_VALUE, 50.0, databar::MIDDLE);
- ScDataBarLengthData aValues2[] = {
+ static const ScDataBarLengthData aValues2[] = {
{ -6, -50 },
{ -5, -50 },
{ -4, -50 },
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index 6bfccbc97bdc..cc55a350f9db 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -103,8 +103,8 @@ void Test::testFormulaCreateStringFromTokens()
m_pDoc->InsertTab(3, aTabName4);
// Insert named ranges.
- struct {
- bool const bGlobal;
+ static const struct {
+ bool bGlobal;
const char* pName;
const char* pExpr;
} aNames[] = {
@@ -139,7 +139,7 @@ void Test::testFormulaCreateStringFromTokens()
}
// Insert DB ranges.
- struct {
+ static const struct {
const char* pName;
SCTAB const nTab;
SCCOL const nCol1;
@@ -809,7 +809,7 @@ void Test::testFormulaHashAndTag()
// Test formula hashing.
- struct {
+ static const struct {
const char* pFormula1; const char* pFormula2; bool bEqual;
} aHashTests[] = {
{ "=1", "=2", false }, // different constants
@@ -864,7 +864,7 @@ void Test::testFormulaHashAndTag()
// Test formula vectorization state.
- struct {
+ static const struct {
const char* pFormula;
ScFormulaVectorState const eState;
} aVectorTests[] = {
@@ -903,7 +903,7 @@ void Test::testFormulaTokenEquality()
bool const mbEqual;
};
- FormulaTokenEqualityTest aTests[] = {
+ static const FormulaTokenEqualityTest aTests[] = {
{ "R1C2", "R1C2", true },
{ "R1C2", "R1C3", false },
{ "R1C2", "R2C2", false },
@@ -990,7 +990,7 @@ void Test::testFormulaRefData()
void Test::testFormulaCompiler()
{
- struct {
+ static const struct {
const char* pInput; FormulaGrammar::Grammar eInputGram;
const char* pOutput; FormulaGrammar::Grammar eOutputGram;
} aTests[] = {
@@ -1040,7 +1040,7 @@ void Test::testFormulaCompilerJumpReordering()
aCompRPN.CompileTokenArray();
// RPN tokens should be ordered: B1, ocIf, C1, ocSep, D1, ocClose.
- TokenCheck aCheckRPN[] =
+ static const TokenCheck aCheckRPN[] =
{
{ ocPush, svSingleRef },
{ ocIf, svUnknown }, // type is context dependent, don't test it
@@ -1068,7 +1068,7 @@ void Test::testFormulaCompilerJumpReordering()
aCompRPN2.EnableJumpCommandReorder(false);
aCompRPN2.CompileTokenArray();
- TokenCheck aCheckRPN2[] =
+ static const TokenCheck aCheckRPN2[] =
{
{ ocPush, svSingleRef },
{ ocPush, svDouble },
@@ -4646,7 +4646,7 @@ void Test::testFuncCOUNTIF()
printRange(m_pDoc, ScRange(0, 0, 0, 0, 8, 0), "data range for COUNTIF");
// formulas and results
- struct {
+ static const struct {
const char* pFormula; double fResult;
} aChecks[] = {
{ "=COUNTIF(A1:A12;1999)", 1 },
@@ -4838,7 +4838,7 @@ void Test::testFuncIFERROR()
printRange(m_pDoc, ScRange(0, 0, 0, 0, nRows-1, 0), "data range for IFERROR/IFNA");
// formulas and results
- struct {
+ static const struct {
const char* pFormula; const char* pResult;
} aChecks[] = {
{ "=IFERROR(A1;9)", "1" },
@@ -5007,7 +5007,7 @@ void Test::testFuncNUMBERVALUE()
printRange(m_pDoc, ScRange(0, 0, 0, 0, nRows - 1, 0), "data range for NUMBERVALUE");
// formulas and results
- struct {
+ static const struct {
const char* pFormula; const char* pResult;
} aChecks[] = {
{ "=NUMBERVALUE(A1;\"b\";\"ag\")", "199.9" },
@@ -5189,7 +5189,7 @@ void Test::testFuncVLOOKUP()
printRange(m_pDoc, ScRange(0, 0, 0, 1, 13, 0), "raw data for VLOOKUP");
// Formula data
- struct {
+ static const struct {
const char* pLookup; const char* pFormula; const char* pRes;
} aChecks[] = {
{ "Lookup", "Formula", nullptr },
@@ -5321,7 +5321,7 @@ struct StrStrCheck {
};
template<size_t DataSize, size_t FormulaSize, int Type>
-static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], StrStrCheck aChecks[FormulaSize])
+static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], const StrStrCheck aChecks[FormulaSize])
{
size_t nDataSize = DataSize;
for (size_t i = 0; i < nDataSize; ++i)
@@ -5360,7 +5360,7 @@ static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], StrStrCh
}
template<size_t DataSize, size_t FormulaSize, int Type>
-static void runTestHorizontalMATCH(ScDocument* pDoc, const char* aData[DataSize], StrStrCheck aChecks[FormulaSize])
+static void runTestHorizontalMATCH(ScDocument* pDoc, const char* aData[DataSize], const StrStrCheck aChecks[FormulaSize])
{
size_t nDataSize = DataSize;
for (size_t i = 0; i < nDataSize; ++i)
@@ -5425,7 +5425,7 @@ void Test::testFuncMATCH()
};
// formula (B1:C12)
- StrStrCheck aChecks[] = {
+ static const StrStrCheck aChecks[] = {
{ "0.8", "#N/A" },
{ "1.2", "1" },
{ "2.3", "2" },
@@ -5469,7 +5469,7 @@ void Test::testFuncMATCH()
};
// formula (B1:C12)
- StrStrCheck aChecks[] = {
+ static const StrStrCheck aChecks[] = {
{ "10", "#N/A" },
{ "8.9", "4" },
{ "7.8", "5" },
@@ -6481,7 +6481,7 @@ void Test::testExternalRefFunctions()
m_pDoc->InsertTab(0, "Test");
- struct {
+ static const struct {
const char* pFormula; double fResult;
} aChecks[] = {
{ "=SUM('file:///extdata.fake'#Data.A1:A4)", 10 },
@@ -6816,7 +6816,7 @@ void Test::testFuncTableRef()
/* TODO: should the item/header separator really be equal to the parameter
* separator, thus be locale dependent and ';' semicolon here, or should it
* be a fixed ',' comma instead? */
- struct {
+ static const struct {
const char* pName;
const char* pExpr;
const char* pCounta; // expected result when used in row 2 (first data row) as argument to COUNTA()
@@ -6990,7 +6990,7 @@ void Test::testFuncTableRef()
}
// Named expressions that use header-less Table structured references.
- struct {
+ static const struct {
const char* pName;
const char* pExpr;
const char* pCounta; // expected result when used in row 10 (first data row) as argument to COUNTA()
diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx
index f8a1da6235ef..d62a6cb3b9d0 100644
--- a/sc/qa/unit/ucalc_pivottable.cxx
+++ b/sc/qa/unit/ucalc_pivottable.cxx
@@ -46,7 +46,7 @@ struct DPFieldDef
};
template<size_t Size>
-ScRange insertDPSourceData(ScDocument* pDoc, DPFieldDef aFields[], size_t nFieldCount, const char* aData[][Size], size_t nDataCount)
+ScRange insertDPSourceData(ScDocument* pDoc, DPFieldDef const aFields[], size_t nFieldCount, const char* aData[][Size], size_t nDataCount)
{
// Insert field names in row 0.
for (size_t i = 0; i < nFieldCount; ++i)
@@ -84,7 +84,7 @@ bool checkDPTableOutput(
}
ScDPObject* createDPFromSourceDesc(
- ScDocument* pDoc, const ScSheetSourceDesc& rDesc, DPFieldDef aFields[], size_t nFieldCount,
+ ScDocument* pDoc, const ScSheetSourceDesc& rDesc, const DPFieldDef aFields[], size_t nFieldCount,
bool bFilterButton)
{
ScDPObject* pDPObj = new ScDPObject(pDoc);
@@ -155,7 +155,7 @@ ScDPObject* createDPFromSourceDesc(
}
ScDPObject* createDPFromRange(
- ScDocument* pDoc, const ScRange& rRange, DPFieldDef aFields[], size_t nFieldCount,
+ ScDocument* pDoc, const ScRange& rRange, const DPFieldDef aFields[], size_t nFieldCount,
bool bFilterButton)
{
ScSheetSourceDesc aSheetDesc(pDoc);
@@ -195,7 +195,7 @@ void Test::testPivotTable()
m_pDoc->InsertTab(1, "Table");
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Group", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
{ "Score", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -377,7 +377,7 @@ void Test::testPivotTableLabels()
m_pDoc->InsertTab(1, "Table");
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Software", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Version", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
{ "1.2.3", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -432,7 +432,7 @@ void Test::testPivotTableDateLabels()
m_pDoc->InsertTab(1, "Table");
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Date", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -507,7 +507,7 @@ void Test::testPivotTableFilters()
m_pDoc->InsertTab(1, "Table");
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_HIDDEN, ScGeneralFunction::NONE, false },
{ "Group1", sheet::DataPilotFieldOrientation_HIDDEN, ScGeneralFunction::NONE, false },
{ "Group2", sheet::DataPilotFieldOrientation_PAGE, ScGeneralFunction::NONE, false },
@@ -659,7 +659,7 @@ void Test::testPivotTableNamedSource()
m_pDoc->InsertTab(1, "Table");
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Group", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
{ "Score", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -958,7 +958,7 @@ void Test::testPivotTableDuplicateDataFields()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::COUNT, false }
@@ -1050,7 +1050,7 @@ void Test::testPivotTableNormalGrouping()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1210,7 +1210,7 @@ void Test::testPivotTableNumberGrouping()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Order", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Score", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1293,7 +1293,7 @@ void Test::testPivotTableDateGrouping()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Date", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1461,7 +1461,7 @@ void Test::testPivotTableEmptyRows()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1572,7 +1572,7 @@ void Test::testPivotTableTextNumber()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1671,7 +1671,7 @@ void Test::testPivotTableCaseInsensitiveStrings()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1745,7 +1745,7 @@ void Test::testPivotTableNumStability()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Total", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1830,7 +1830,7 @@ void Test::testPivotTableFieldReference()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -1998,7 +1998,7 @@ void Test::testPivotTableDocFunc()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -2073,7 +2073,7 @@ void Test::testFuncGETPIVOTDATA()
{
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
};
@@ -2134,7 +2134,7 @@ void Test::testFuncGETPIVOTDATA()
{
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::COUNT, false },
@@ -2228,7 +2228,7 @@ void Test::testFuncGETPIVOTDATALeafAccess()
ScDPObject* pDPObj = nullptr;
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Type", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Member", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Value", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::SUM, false },
@@ -2267,7 +2267,7 @@ void Test::testFuncGETPIVOTDATALeafAccess()
double const mfResult;
};
- Check aChecks[] = {
+ static const Check aChecks[] = {
{ "=GETPIVOTDATA($A$1;\"Member[Anna]\")", 1.0 },
{ "=GETPIVOTDATA($A$1;\"Member[Brittany]\")", 2.0 },
{ "=GETPIVOTDATA($A$1;\"Member[Cecilia]\")", 3.0 },
@@ -2303,7 +2303,7 @@ void Test::testPivotTableRepeatItemLabels()
m_pDoc->InsertTab(1, "Table");
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Name", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, true },
{ "Country", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Year", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
@@ -2380,7 +2380,7 @@ void Test::testPivotTableDPCollection()
m_pDoc->InsertTab(1, "Table");
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Software", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Version", sheet::DataPilotFieldOrientation_COLUMN, ScGeneralFunction::NONE, false },
{ "1.2.3", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::NONE, false }
@@ -2489,7 +2489,7 @@ void Test::testPivotTableMedianFunc()
};
// Dimension definition
- DPFieldDef aFields[] = {
+ static const DPFieldDef aFields[] = {
{ "Condition", sheet::DataPilotFieldOrientation_ROW, ScGeneralFunction::NONE, false },
{ "Day1Hit", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::MEDIAN, false },
{ "Day1Miss", sheet::DataPilotFieldOrientation_DATA, ScGeneralFunction::MEDIAN, false },
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index 9a2c759b0aab..bf817873a341 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -472,9 +472,9 @@ void Test::testSortInFormulaGroup()
{
SortRefUpdateSetter aUpdateSet;
- static struct {
- SCCOL const nCol;
- SCROW const nRow;
+ static const struct {
+ SCCOL nCol;
+ SCROW nRow;
const char *pData;
} aEntries[] = {
{ 0, 0, "3" }, { 1, 0, "=A1" },
@@ -506,10 +506,10 @@ void Test::testSortInFormulaGroup()
m_pDoc->Sort(0, aSortData, false, true, nullptr, nullptr);
- static struct {
- SCCOL const nCol;
- SCROW const nRow;
- double const fValue;
+ static const struct {
+ SCCOL nCol;
+ SCROW nRow;
+ double fValue;
} aResults[] = {
{ 0, 0, 1.0 }, { 1, 0, 1.0 },
{ 0, 1, 2.0 }, { 1, 1, 3.0 },