summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-05-22 13:49:30 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-05-22 16:35:20 +0200
commitc18e2ea2a52fc171c50fcb22d431e94c6aececc5 (patch)
treea63721b18626947e5278a51feb7fd64604e80eee /sc
parent7cf4bcef41448218f76fa1e974f541e13dc03023 (diff)
New loplugin:data
...following up on 1453c2c8f13bac64ecd1981af7cebf1c421808ac "prefer vector::data to &vector[0]" Change-Id: I7c113747d92d144a521d49b89384dd8bf1215c01 Reviewed-on: https://gerrit.libreoffice.org/72765 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx10
-rw-r--r--sc/qa/unit/ucalc.cxx8
-rw-r--r--sc/qa/unit/ucalc_sharedformula.cxx2
-rw-r--r--sc/source/core/data/column2.cxx6
-rw-r--r--sc/source/core/data/dptabres.cxx12
-rw-r--r--sc/source/core/data/markarr.cxx2
-rw-r--r--sc/source/core/data/tabprotection.cxx2
-rw-r--r--sc/source/core/opencl/formulagroupcl.cxx4
-rw-r--r--sc/source/filter/excel/xeescher.cxx2
-rw-r--r--sc/source/filter/excel/xestream.cxx10
-rw-r--r--sc/source/filter/excel/xestring.cxx2
-rw-r--r--sc/source/filter/lotus/op.cxx2
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/printfun.cxx4
-rw-r--r--sc/source/ui/view/tabvwshf.cxx4
16 files changed, 37 insertions, 37 deletions
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 1879924d705a..ef7346967397 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -1484,7 +1484,7 @@ void ScExportTest::testRichTextExportODS()
return false;
// Check the first bold section.
- const editeng::Section* pAttr = &aSecAttrs[0];
+ const editeng::Section* pAttr = aSecAttrs.data();
if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 4)
return false;
@@ -1576,7 +1576,7 @@ void ScExportTest::testRichTextExportODS()
return false;
// Check the first strike-out section.
- const editeng::Section* pAttr = &aSecAttrs[0];
+ const editeng::Section* pAttr = aSecAttrs.data();
if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 6)
return false;
@@ -1605,7 +1605,7 @@ void ScExportTest::testRichTextExportODS()
return false;
// First section should have "Courier" font applied.
- const editeng::Section* pAttr = &aSecAttrs[0];
+ const editeng::Section* pAttr = aSecAttrs.data();
if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 5)
return false;
@@ -1640,7 +1640,7 @@ void ScExportTest::testRichTextExportODS()
return false;
// First section shoul have overline applied.
- const editeng::Section* pAttr = &aSecAttrs[0];
+ const editeng::Section* pAttr = aSecAttrs.data();
if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 4)
return false;
@@ -1675,7 +1675,7 @@ void ScExportTest::testRichTextExportODS()
return false;
// superscript
- const editeng::Section* pAttr = &aSecAttrs[0];
+ const editeng::Section* pAttr = aSecAttrs.data();
if (pAttr->mnParagraph != 0 ||pAttr->mnStart != 0 || pAttr->mnEnd != 3)
return false;
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a445d2df2eb7..06881c84b5bb 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4227,7 +4227,7 @@ void Test::testCopyPasteRepeatOneFormula()
CPPUNIT_ASSERT(pBASM);
std::vector<sc::AreaListener> aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size());
- const sc::AreaListener* pListener = &aListeners[0];
+ const sc::AreaListener* pListener = aListeners.data();
CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,0,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener shouldn't be a group listener.", !pListener->mbGroupListening);
#endif
@@ -4260,7 +4260,7 @@ void Test::testCopyPasteRepeatOneFormula()
// a group listener listening on A1:B10.
aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size());
- pListener = &aListeners[0];
+ pListener = aListeners.data();
CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening);
#endif
@@ -4278,7 +4278,7 @@ void Test::testCopyPasteRepeatOneFormula()
// Make there we only have one group area listener listening on A2:B11.
aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size());
- pListener = &aListeners[0];
+ pListener = aListeners.data();
CPPUNIT_ASSERT_EQUAL(ScRange(0,1,0,1,10,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening);
#endif
@@ -4305,7 +4305,7 @@ void Test::testCopyPasteRepeatOneFormula()
// Check the group area listener again to make sure it's listening on A1:B10 once again.
aListeners = pBASM->GetAllListeners(aWholeSheet, sc::AreaInside);
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aListeners.size());
- pListener = &aListeners[0];
+ pListener = aListeners.data();
CPPUNIT_ASSERT_EQUAL(ScRange(0,0,0,1,9,0), pListener->maArea);
CPPUNIT_ASSERT_MESSAGE("This listener should be a group listener.", pListener->mbGroupListening);
#endif
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index c478e4c0b3f4..ea22e3651d4d 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -1406,7 +1406,7 @@ void Test::testSharedFormulaMoveBlock()
aRows.push_back(0);
aRows.push_back(1);
aRows.push_back(2);
- bool bRes = checkFormulaPositions(*m_pDoc, 0, 1, &aRows[0], aRows.size());
+ bool bRes = checkFormulaPositions(*m_pDoc, 0, 1, aRows.data(), aRows.size());
CPPUNIT_ASSERT(bRes);
SfxUndoManager* pUndoMgr = m_pDoc->GetUndoManager();
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index d8e2646d99f5..a4b52eef7061 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2224,13 +2224,13 @@ struct CellBucket
}
else if (!maNumVals.empty())
{
- const double* p = &maNumVals[0];
+ const double* p = maNumVals.data();
rMat.PutDouble(p, maNumVals.size(), nCol, mnNumValStart);
reset();
}
else if (!maStrVals.empty())
{
- const svl::SharedString* p = &maStrVals[0];
+ const svl::SharedString* p = maStrVals.data();
rMat.PutString(p, maStrVals.size(), nCol, mnStrValStart);
reset();
}
@@ -2309,7 +2309,7 @@ public:
aSSs.push_back(mpPool->intern(aStr));
}
- const svl::SharedString* p = &aSSs[0];
+ const svl::SharedString* p = aSSs.data();
mrMat.PutString(p, nDataSize, mnMatCol, nMatRow);
}
break;
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 8be7e52a27c4..d78885dc8d31 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -2446,8 +2446,8 @@ void ScDPDataMember::UpdateRunningTotals(
nColPos, rRunning );
else
{
- const long* pRowSorted = &rRowSorted[0];
- const long* pColSorted = &rColSorted[0];
+ const long* pRowSorted = rRowSorted.data();
+ const long* pColSorted = rColSorted.data();
pRowSorted += nRowPos + 1; // including the reference dimension
pSelectMember = pSelectDim->GetRowReferenceMember(
nullptr, nullptr, pRowSorted, pColSorted);
@@ -2505,8 +2505,8 @@ void ScDPDataMember::UpdateRunningTotals(
else
{
aRefItemPos.nBasePos = rRowVisible[nRowPos]; // without sort order applied
- const long* pRowSorted = &rRowSorted[0];
- const long* pColSorted = &rColSorted[0];
+ const long* pRowSorted = rRowSorted.data();
+ const long* pColSorted = rColSorted.data();
pRowSorted += nRowPos + 1; // including the reference dimension
pSelectMember = pSelectDim->GetRowReferenceMember(
pRefPos, pRefName, pRowSorted, pColSorted);
@@ -3336,8 +3336,8 @@ ScDPDataMember* ScDPResultDimension::GetColReferenceMember(
{
OSL_ENSURE( pRelativePos == nullptr || pName == nullptr, "can't use position and name" );
- const long* pColIndexes = &rRunning.GetColSorted()[0];
- const long* pRowIndexes = &rRunning.GetRowSorted()[0];
+ const long* pColIndexes = rRunning.GetColSorted().data();
+ const long* pRowIndexes = rRunning.GetRowSorted().data();
// get own row member using all indexes
diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index 9f25769c288c..eeeda2aeab8b 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -504,7 +504,7 @@ void ScMarkArray::Intersect(const ScMarkArray& rOther)
OSL_ENSURE(nSize > 0, "Unexpected case.");
pData.reset(new ScMarkEntry[nSize]);
- memcpy(pData.get(), &(aEntryArray[0]), nSize * sizeof(ScMarkEntry));
+ memcpy(pData.get(), aEntryArray.data(), nSize * sizeof(ScMarkEntry));
nCount = nLimit = nSize;
}
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index a3a4b777c33f..63bcbb3553e0 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -193,7 +193,7 @@ Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(
aChars.push_back(static_cast<sal_Char>(rPassHash[i]));
Sequence<sal_Int8> aNewHash;
- SvPasswordHelper::GetHashPassword(aNewHash, &aChars[0], aChars.size());
+ SvPasswordHelper::GetHashPassword(aNewHash, aChars.data(), aChars.size());
return aNewHash;
}
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 8c55b0f2f790..9c00e4d42490 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -4009,7 +4009,7 @@ void DynamicKernel::CreateKernel()
std::vector<char> log(n);
e = clGetProgramBuildInfo(
mpProgram, openclwrapper::gpuEnv.mpDevID,
- CL_PROGRAM_BUILD_LOG, n, &log[0], nullptr);
+ CL_PROGRAM_BUILD_LOG, n, log.data(), nullptr);
SAL_WARN_IF(
e != CL_SUCCESS || n == 0, "sc.opencl",
"after CL_BUILD_PROGRAM_FAILURE,"
@@ -4019,7 +4019,7 @@ void DynamicKernel::CreateKernel()
SAL_WARN(
"sc.opencl",
"CL_BUILD_PROGRAM_FAILURE, status " << stat
- << ", log \"" << &log[0] << "\"");
+ << ", log \"" << log.data() << "\"");
}
}
}
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 2500d75048fa..40cd9764ed6a 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -983,7 +983,7 @@ void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm )
for( const auto& rItem : maMultiSel )
if( rItem < nEntryCount )
aSelEx[ rItem ] = 1;
- rStrm.Write( &aSelEx[ 0 ], aSelEx.size() );
+ rStrm.Write( aSelEx.data(), aSelEx.size() );
}
}
else if( mnObjType == EXC_OBJTYPE_DROPDOWN )
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 417d35c3f0f9..e2bfc38cc26a 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -229,7 +229,7 @@ std::size_t XclExpStream::Write( const void* pData, std::size_t nBytes )
{
OSL_ENSURE(nWriteLen > 0, "XclExpStream::Write: write length is 0!");
vector<sal_uInt8> aBytes(nWriteLen);
- memcpy(&aBytes[0], pBuffer, nWriteLen);
+ memcpy(aBytes.data(), pBuffer, nWriteLen);
mxEncrypter->EncryptBytes(mrStrm, aBytes);
// TODO: How do I check if all the bytes have been successfully written ?
}
@@ -340,7 +340,7 @@ void XclExpStream::WriteByteString( const OString& rString )
void XclExpStream::WriteCharBuffer( const ScfUInt8Vec& rBuffer )
{
SetSliceSize( 0 );
- Write( &rBuffer[ 0 ], rBuffer.size() );
+ Write( rBuffer.data(), rBuffer.size() );
}
void XclExpStream::SetEncrypter( XclExpEncrypterRef const & xEncrypter )
@@ -513,14 +513,14 @@ void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData )
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, float fValue )
{
::std::vector<sal_uInt8> pnBytes(4);
- memcpy(&pnBytes[0], &fValue, 4);
+ memcpy(pnBytes.data(), &fValue, 4);
EncryptBytes(rStrm, pnBytes);
}
void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, double fValue )
{
::std::vector<sal_uInt8> pnBytes(8);
- memcpy(&pnBytes[0], &fValue, 8);
+ memcpy(pnBytes.data(), &fValue, 8);
EncryptBytes(rStrm, pnBytes);
}
@@ -712,7 +712,7 @@ OString XclXmlUtils::ToOString( const ScfUInt16Vec& rBuffer )
if(rBuffer.empty())
return OString();
- const sal_uInt16* pBuffer = &rBuffer [0];
+ const sal_uInt16* pBuffer = rBuffer.data();
return OString(
reinterpret_cast<sal_Unicode const *>(pBuffer), rBuffer.size(),
RTL_TEXTENCODING_UTF8);
diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx
index 22dfd5646394..70df7cde57ca 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -381,7 +381,7 @@ void XclExpString::WriteBufferToMem( sal_uInt8* pnMem ) const
}
}
else
- memcpy( pnMem, &maCharBuffer[ 0 ], mnLen );
+ memcpy( pnMem, maCharBuffer.data(), mnLen );
}
}
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index ae7f2d0e9050..7033f6da0550 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -594,7 +594,7 @@ void OP_SheetName123(LotusContext& rContext, SvStream& rStream, sal_uInt16 nLeng
if (!sSheetName.empty())
{
- OUString aName(&sSheetName[0], strlen(&sSheetName[0]), rContext.eCharVon);
+ OUString aName(sSheetName.data(), strlen(sSheetName.data()), rContext.eCharVon);
rContext.pDoc->RenameTab(nSheetNum, aName);
}
}
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 24f176b78dc3..bd4870bbde22 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -407,7 +407,7 @@ XclExpXmlChTrHeader::XclExpXmlChTrHeader(
if (rBuf.GetBufferCount())
{
maTabBuffer.resize(rBuf.GetBufferCount());
- rBuf.GetBufferCopy(&maTabBuffer[0]);
+ rBuf.GetBufferCopy(maTabBuffer.data());
}
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index fd24bc39fbf6..ea51223772ec 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4172,7 +4172,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos
}
}
- pView->ImportTables( pSrcShell,static_cast<SCTAB>(nTabs.size()), &nTabs[0], bIsLink, nThisTab );
+ pView->ImportTables( pSrcShell,static_cast<SCTAB>(nTabs.size()), nTabs.data(), bIsLink, nThisTab );
bDone = true;
}
}
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index ff9e75fdc909..86a823fa78d8 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -386,7 +386,7 @@ void ScPrintFunc::FillPageData()
}
else
{
- rData.SetPagesX( m_aRanges.m_nPagesX, &m_aRanges.m_aPageEndX[0]);
+ rData.SetPagesX( m_aRanges.m_nPagesX, m_aRanges.m_aPageEndX.data());
}
// #i123672#
@@ -396,7 +396,7 @@ void ScPrintFunc::FillPageData()
}
else
{
- rData.SetPagesY( m_aRanges.m_nTotalY, &m_aRanges.m_aPageEndY[0]);
+ rData.SetPagesY( m_aRanges.m_nTotalY, m_aRanges.m_aPageEndY.data());
}
// Settings
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index fadba4acd6b6..95796fc0930b 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -235,7 +235,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
{
if(pDlg->IsTableBefore())
{
- ImportTables( pDlg->GetDocShellTables(), nTabs.size(), &nTabs[0],
+ ImportTables( pDlg->GetDocShellTables(), nTabs.size(), nTabs.data(),
bLink,nTabNr );
}
else
@@ -251,7 +251,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
}
}
- ImportTables( pDlg->GetDocShellTables(), nTabs.size(), &nTabs[0],
+ ImportTables( pDlg->GetDocShellTables(), nTabs.size(), nTabs.data(),
bLink,nTabAfter );
}
}