summaryrefslogtreecommitdiff
path: root/svl/source/items/itemset.cxx
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2016-11-03 09:31:30 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-04 08:19:47 +0000
commitbb3e19624bf4a400e9012b9b4451dc9542261fd8 (patch)
treebfe25a925fa12a7e2eaf8745f1a614e993d92f46 /svl/source/items/itemset.cxx
parentf4637c07c9ac87c2ad4b687263dfea50b5d4e0ef (diff)
use aggregate initialisation instead of memset for arrays
Change-Id: I084dee370e5c1096e51b8ff4073443c719688469 Reviewed-on: https://gerrit.libreoffice.org/30517 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl/source/items/itemset.cxx')
-rw-r--r--svl/source/items/itemset.cxx20
1 files changed, 6 insertions, 14 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx
index d2388c3d40d9..524752ccb9a1 100644
--- a/svl/source/items/itemset.cxx
+++ b/svl/source/items/itemset.cxx
@@ -141,8 +141,7 @@ SfxItemSet::SfxItemSet(SfxItemPool& rPool)
m_pPool->FillItemIdRanges_Impl( m_pWhichRanges );
const sal_uInt16 nSize = TotalCount();
- m_pItems = new const SfxPoolItem* [ nSize ];
- memset(static_cast<void*>(m_pItems), 0, nSize * sizeof(SfxPoolItem*));
+ m_pItems = new const SfxPoolItem*[nSize]{};
}
SfxItemSet::SfxItemSet(SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhich2)
@@ -157,20 +156,15 @@ SfxItemSet::SfxItemSet(SfxItemPool& rPool, sal_uInt16 nWhich1, sal_uInt16 nWhich
void SfxItemSet::InitRanges_Impl(sal_uInt16 nWh1, sal_uInt16 nWh2)
{
- m_pWhichRanges = new sal_uInt16[ 3 ];
- *(m_pWhichRanges+0) = nWh1;
- *(m_pWhichRanges+1) = nWh2;
- *(m_pWhichRanges+2) = 0;
+ m_pWhichRanges = new sal_uInt16[3]{nWh1, nWh2, 0};
const sal_uInt16 nRg = nWh2 - nWh1 + 1;
- m_pItems = new const SfxPoolItem* [ nRg ];
- memset(static_cast<void*>(m_pItems), 0, nRg * sizeof(SfxPoolItem*));
+ m_pItems = new const SfxPoolItem*[nRg]{};
}
void SfxItemSet::InitRanges_Impl(va_list pArgs, sal_uInt16 nWh1, sal_uInt16 nWh2, sal_uInt16 nNull)
{
sal_uInt16 nSize = InitializeRanges_Impl(m_pWhichRanges, pArgs, nWh1, nWh2, nNull);
- m_pItems = new const SfxPoolItem* [ nSize ];
- memset(static_cast<void*>(m_pItems), 0, sizeof(SfxPoolItem*) * nSize);
+ m_pItems = new const SfxPoolItem*[nSize]{};
}
SfxItemSet::SfxItemSet(SfxItemPool& rPool, int nWh1, int nWh2, int nNull, ...)
@@ -206,8 +200,7 @@ void SfxItemSet::InitRanges_Impl(const sal_uInt16 *pWhichPairTable)
pPtr += 2;
}
- m_pItems = new const SfxPoolItem* [ nCnt ];
- memset(static_cast<void*>(m_pItems), 0, sizeof(SfxPoolItem*) * nCnt);
+ m_pItems = new const SfxPoolItem*[nCnt]{};
std::ptrdiff_t cnt = pPtr - pWhichPairTable +1;
m_pWhichRanges = new sal_uInt16[ cnt ];
@@ -1659,8 +1652,7 @@ SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool )
m_pItems = nullptr;
// Allocate nInitCount pairs at USHORTs for Ranges
- m_pWhichRanges = new sal_uInt16[ nInitCount + 1 ];
- memset( m_pWhichRanges, 0, (nInitCount + 1) * sizeof(sal_uInt16) );
+ m_pWhichRanges = new sal_uInt16[nInitCount + 1]{};
}
SfxAllItemSet::SfxAllItemSet(const SfxItemSet &rCopy)