summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-04-28 12:49:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-04-28 12:55:02 +0100
commit6394fd4a1d56af4afab4f9683d5a2087a32588e6 (patch)
tree50f5f3719e583b130a97939a233e9b870d6477ab /hwpfilter
parentf30fb61c650e8b844501dcbbccbd441528b75997 (diff)
convert to std::vector
Change-Id: I315755d49df5d29c6c7075237b7401f16c89b449
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hbox.cxx12
-rw-r--r--hwpfilter/source/hbox.h5
-rw-r--r--hwpfilter/source/hwpread.cxx5
3 files changed, 8 insertions, 14 deletions
diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index 88e76c7ca7f8..479279f2bc49 100644
--- a/hwpfilter/source/hbox.cxx
+++ b/hwpfilter/source/hbox.cxx
@@ -356,19 +356,18 @@ TxtBox::TxtBox()
, protect(0)
, cell(nullptr)
, m_pTable(nullptr)
- , plists(nullptr)
{
reserved[0] = reserved[1] = 0;
}
TxtBox::~TxtBox()
{
- delete[]cell;
+ delete[] cell;
- for (int ii = 0; ii < nCell; ++ii)
+ for (auto& entry : plists)
{
- std::list < HWPPara* >::iterator it = plists[ii].begin();
- for (; it != plists[ii].end(); ++it)
+ std::list < HWPPara* >::iterator it = entry.begin();
+ for (; it != entry.end(); ++it)
{
HWPPara* pPara = *it;
delete pPara;
@@ -381,11 +380,8 @@ TxtBox::~TxtBox()
HWPPara* pPara = *it;
delete pPara;
}
-
- delete[]plists;
}
-
// picture(11)
Picture::Picture()
diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h
index 15c97c6363f4..5ed353364c0f 100644
--- a/hwpfilter/source/hbox.h
+++ b/hwpfilter/source/hbox.h
@@ -360,11 +360,12 @@ struct TxtBox: public FBox
short protect; //1=size lock
Cell *cell;
- Table *m_pTable;
+ Table *m_pTable;
/**
* Paragraph list
*/
- std::list<HWPPara*> *plists;
+ std::vector<std::list<HWPPara*>> plists;
+
/**
* Caption
*/
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index ca2a90905e50..1a96eaa29046 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -295,10 +295,7 @@ bool TxtBox::Read(HWPFile & hwpf)
}
if (ncell == 1)
style.cell = &cell[0];
- plists = ::comphelper::newArray_null< std::list< HWPPara* > >(ncell);
- if (!plists) {
- return hwpf.SetState(HWP_InvalidFileFormat);
- }
+ plists.resize(ncell);
for (ii = 0; ii < ncell; ii++)
hwpf.ReadParaList(plists[ii]);
// caption