summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml/XMLStylesExportHelper.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-16 11:03:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-17 08:22:51 +0200
commit1b95eb30f6358a9ebdedee2888be8273120669c8 (patch)
tree45ddd96753d0fac4311529da5af61994dfd56181 /sc/source/filter/xml/XMLStylesExportHelper.cxx
parent7125c6798f94a8b7345372ba36dbabd89bab8820 (diff)
loplugin:useuniqueptr in ScColumnRowStylesBase
Change-Id: I44e9cb38f57684930a94bd1f185e87a9605b65c2 Reviewed-on: https://gerrit.libreoffice.org/59225 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/filter/xml/XMLStylesExportHelper.cxx')
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx24
1 files changed, 5 insertions, 19 deletions
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 57accced6e18..dba0fee848f6 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -982,18 +982,11 @@ ScColumnRowStylesBase::ScColumnRowStylesBase()
ScColumnRowStylesBase::~ScColumnRowStylesBase()
{
- auto i(aStyleNames.begin());
- auto endi(aStyleNames.end());
- while (i != endi)
- {
- delete *i;
- ++i;
- }
}
-sal_Int32 ScColumnRowStylesBase::AddStyleName(OUString* pString)
+sal_Int32 ScColumnRowStylesBase::AddStyleName(const OUString & rString)
{
- aStyleNames.push_back(pString);
+ aStyleNames.push_back(rString);
return aStyleNames.size() - 1;
}
@@ -1002,7 +995,7 @@ sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(const OUString& rString, co
sal_Int32 nPrefixLength(rPrefix.getLength());
OUString sTemp(rString.copy(nPrefixLength));
sal_Int32 nIndex(sTemp.toInt32());
- if (nIndex > 0 && static_cast<size_t>(nIndex-1) < aStyleNames.size() && *aStyleNames.at(nIndex - 1) == rString)
+ if (nIndex > 0 && static_cast<size_t>(nIndex-1) < aStyleNames.size() && aStyleNames.at(nIndex - 1) == rString)
return nIndex - 1;
else
{
@@ -1010,7 +1003,7 @@ sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(const OUString& rString, co
bool bFound(false);
while (!bFound && static_cast<size_t>(i) < aStyleNames.size())
{
- if (*aStyleNames.at(i) == rString)
+ if (aStyleNames.at(i) == rString)
bFound = true;
else
++i;
@@ -1022,15 +1015,8 @@ sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(const OUString& rString, co
}
}
-OUString* ScColumnRowStylesBase::GetStyleNameByIndex(const sal_Int32 nIndex)
+OUString& ScColumnRowStylesBase::GetStyleNameByIndex(const sal_Int32 nIndex)
{
- if ( nIndex < 0 || nIndex >= sal::static_int_cast<sal_Int32>( aStyleNames.size() ) )
- {
- // should no longer happen, use first style then
- OSL_FAIL("GetStyleNameByIndex: invalid index");
- return aStyleNames[0];
- }
-
return aStyleNames[nIndex];
}