loplugin:useuniqueptr in hwpfilter
Change-Id: Id276015425ea7de3cf55b9ef21b4e7ce54c2ce47
This commit is contained in:
parent
61bfcf16dc
commit
96c85e7d10
5 changed files with 19 additions and 25 deletions
|
@ -21,6 +21,7 @@
|
|||
#define INCLUDED_HWPFILTER_SOURCE_DRAWDEF_H
|
||||
|
||||
#include "hwplib.h"
|
||||
#include <memory>
|
||||
|
||||
class HWPPara;
|
||||
|
||||
|
@ -228,11 +229,11 @@ struct HWPDrawingObject
|
|||
HWPDOArc arc;
|
||||
}
|
||||
u;
|
||||
struct HWPDrawingObject *next;
|
||||
std::unique_ptr<struct HWPDrawingObject> next;
|
||||
/**
|
||||
* This exists for container object
|
||||
*/
|
||||
struct HWPDrawingObject *child;
|
||||
std::unique_ptr<struct HWPDrawingObject> child;
|
||||
int index;
|
||||
HWPDrawingObject();
|
||||
~HWPDrawingObject();
|
||||
|
|
|
@ -355,7 +355,7 @@ static HWPDrawingObject *LoadDrawingObject(void)
|
|||
}
|
||||
if (link_info & HDOFILE_HAS_CHILD)
|
||||
{
|
||||
hdo->child = LoadDrawingObject();
|
||||
hdo->child.reset( LoadDrawingObject() );
|
||||
if (hdo->child == nullptr)
|
||||
{
|
||||
goto error;
|
||||
|
@ -364,7 +364,7 @@ static HWPDrawingObject *LoadDrawingObject(void)
|
|||
if (prev == nullptr)
|
||||
head = hdo;
|
||||
else
|
||||
prev->next = hdo;
|
||||
prev->next.reset( hdo );
|
||||
prev = hdo;
|
||||
}
|
||||
while (link_info & HDOFILE_HAS_NEXT);
|
||||
|
@ -682,12 +682,6 @@ HWPDrawingObject::HWPDrawingObject()
|
|||
|
||||
HWPDrawingObject::~HWPDrawingObject()
|
||||
{
|
||||
if (child)
|
||||
delete child;
|
||||
|
||||
if (next)
|
||||
delete next;
|
||||
|
||||
if (property.pPara)
|
||||
FreeParaList(property.pPara);
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ HWPFile::HWPFile()
|
|||
|
||||
HWPFile::~HWPFile()
|
||||
{
|
||||
delete oledata;
|
||||
delete hiodev;
|
||||
oledata.reset();
|
||||
hiodev.reset();
|
||||
}
|
||||
|
||||
int HWPFile::ReadHwpFile(HStream * stream)
|
||||
|
@ -185,9 +185,9 @@ void HWPFile::SetCompressed(bool flag)
|
|||
|
||||
HIODev *HWPFile::SetIODevice(HIODev * new_hiodev)
|
||||
{
|
||||
HIODev *old_hiodev = hiodev;
|
||||
HIODev *old_hiodev = hiodev.release();
|
||||
|
||||
hiodev = new_hiodev;
|
||||
hiodev.reset( new_hiodev );
|
||||
|
||||
return old_hiodev;
|
||||
}
|
||||
|
@ -316,8 +316,7 @@ void HWPFile::TagsRead()
|
|||
}
|
||||
break;
|
||||
case FILETAG_OLE_OBJECT:
|
||||
delete oledata;
|
||||
oledata = new OlePicture(size);
|
||||
oledata.reset( new OlePicture(size) );
|
||||
oledata->Read(*this);
|
||||
break;
|
||||
case FILETAG_HYPERTEXT:
|
||||
|
|
|
@ -273,7 +273,7 @@ class DLLEXPORT HWPFile
|
|||
unsigned char linenumber;
|
||||
int info_block_len;
|
||||
int error_code;
|
||||
OlePicture *oledata;
|
||||
std::unique_ptr<OlePicture> oledata;
|
||||
unsigned char scratch[SAL_MAX_UINT16];
|
||||
int readdepth;
|
||||
|
||||
|
@ -281,7 +281,7 @@ class DLLEXPORT HWPFile
|
|||
/* hwp 파일 이름 */
|
||||
int m_nCurrentPage;
|
||||
int m_nMaxSettedPage;
|
||||
HIODev *hiodev;
|
||||
std::unique_ptr<HIODev> hiodev;
|
||||
// read hwp contents
|
||||
HWPInfo _hwpInfo;
|
||||
HWPFont _hwpFont;
|
||||
|
|
|
@ -427,12 +427,12 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
|
|||
while( hdo )
|
||||
{
|
||||
if( hdo->child )
|
||||
makeDrawMiscStyle( hdo->child );
|
||||
makeDrawMiscStyle( hdo->child.get() );
|
||||
|
||||
HWPDOProperty *prop = &hdo->property;
|
||||
if( hdo->type == HWPDO_CONTAINER )
|
||||
{
|
||||
hdo = hdo->next;
|
||||
hdo = hdo->next.get();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -694,7 +694,7 @@ void HwpReader::makeDrawMiscStyle( HWPDrawingObject *hdo )
|
|||
rendEl( "draw:hatch");
|
||||
}
|
||||
}
|
||||
hdo = hdo->next;
|
||||
hdo = hdo->next.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2205,9 +2205,9 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle)
|
|||
|
||||
if( hdo->type == 0 )
|
||||
{
|
||||
makeDrawStyle( hdo->child, fstyle );
|
||||
makeDrawStyle( hdo->child.get(), fstyle );
|
||||
}
|
||||
hdo = hdo->next;
|
||||
hdo = hdo->next.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4016,7 +4016,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
|
|||
{
|
||||
rstartEl("draw:g", mxList.get());
|
||||
mxList->clear();
|
||||
makePictureDRAW(drawobj->child, hbox);
|
||||
makePictureDRAW(drawobj->child.get(), hbox);
|
||||
rendEl("draw:g");
|
||||
}
|
||||
else
|
||||
|
@ -4574,7 +4574,7 @@ void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
|
|||
}
|
||||
}
|
||||
mxList->clear();
|
||||
drawobj = drawobj->next;
|
||||
drawobj = drawobj->next.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue