[Libreoffice-commits] core.git: 2 commits - lotuswordpro/inc lotuswordpro/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Mar 5 06:32:20 UTC 2018
lotuswordpro/inc/lwpglobalmgr.hxx | 20 ++++++-------
lotuswordpro/source/filter/lwpglobalmgr.cxx | 42 ++++++----------------------
lotuswordpro/source/filter/lwplaypiece.cxx | 8 -----
lotuswordpro/source/filter/lwplaypiece.hxx | 2 -
4 files changed, 22 insertions(+), 50 deletions(-)
New commits:
commit e21d9c89409159254966e9acb1ac98626549e301
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Mar 1 10:41:16 2018 +0200
loplugin:useuniqueptr in LwpLayoutColumns
Change-Id: Ic31823fc539f26ef9ba543375d115d84623043a6
Reviewed-on: https://gerrit.libreoffice.org/50726
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/lotuswordpro/source/filter/lwplaypiece.cxx b/lotuswordpro/source/filter/lwplaypiece.cxx
index 27be301fa3e9..31b05f894c40 100644
--- a/lotuswordpro/source/filter/lwplaypiece.cxx
+++ b/lotuswordpro/source/filter/lwplaypiece.cxx
@@ -269,12 +269,6 @@ LwpLayoutColumns::LwpLayoutColumns(LwpObjectHeader const & objHdr, LwpSvStream*
LwpLayoutColumns::~LwpLayoutColumns()
{
- if(m_pColumns)
- {
- delete[] m_pColumns;
- m_pColumns = nullptr;
- }
-
}
void LwpLayoutColumns::Read()
@@ -284,7 +278,7 @@ void LwpLayoutColumns::Read()
if( LwpFileHeader::m_nFileRevision >= 0x000B )
{
m_nNumCols = m_pObjStrm->QuickReaduInt16();
- m_pColumns = new LwpColumnInfo[m_nNumCols];
+ m_pColumns.reset( new LwpColumnInfo[m_nNumCols] );
for(int i=0; i<m_nNumCols; i++)
{
m_pColumns[i].Read(m_pObjStrm.get());
diff --git a/lotuswordpro/source/filter/lwplaypiece.hxx b/lotuswordpro/source/filter/lwplaypiece.hxx
index 43f528fe5941..3f1e25d40454 100644
--- a/lotuswordpro/source/filter/lwplaypiece.hxx
+++ b/lotuswordpro/source/filter/lwplaypiece.hxx
@@ -223,7 +223,7 @@ private:
virtual ~LwpLayoutColumns() override;
sal_uInt16 m_nNumCols;
- LwpColumnInfo* m_pColumns;
+ std::unique_ptr<LwpColumnInfo[]> m_pColumns;
};
class LwpLayoutGutters final : public LwpVirtualPiece
commit 73668f8e009534ec38460ccea1065e1c1f52c8f7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Thu Mar 1 10:37:53 2018 +0200
loplugin:useuniqueptr in LwpGlobalMgr
Change-Id: I04651e32dd036bc12ed12097e4ee3bf6e5bf3dcf
Reviewed-on: https://gerrit.libreoffice.org/50725
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/lotuswordpro/inc/lwpglobalmgr.hxx b/lotuswordpro/inc/lwpglobalmgr.hxx
index 32a290f0d4a1..d0e2eee3ca7a 100644
--- a/lotuswordpro/inc/lwpglobalmgr.hxx
+++ b/lotuswordpro/inc/lwpglobalmgr.hxx
@@ -79,11 +79,11 @@ public:
~LwpGlobalMgr();
static LwpGlobalMgr* GetInstance(LwpSvStream* pSvStream=nullptr);
static void DeleteInstance();
- LwpObjectFactory* GetLwpObjFactory(){return m_pObjFactory;}
- LwpBookmarkMgr* GetLwpBookmarkMgr(){return m_pBookmarkMgr;}
- LwpChangeMgr* GetLwpChangeMgr(){return m_pChangeMgr;}
- XFFontFactory* GetXFFontFactory(){return m_pXFFontFactory;}
- XFStyleManager* GetXFStyleManager(){return m_pXFStyleManager;}
+ LwpObjectFactory* GetLwpObjFactory(){return m_pObjFactory.get();}
+ LwpBookmarkMgr* GetLwpBookmarkMgr(){return m_pBookmarkMgr.get();}
+ LwpChangeMgr* GetLwpChangeMgr(){return m_pChangeMgr.get();}
+ XFFontFactory* GetXFFontFactory(){return m_pXFFontFactory.get();}
+ XFStyleManager* GetXFStyleManager(){return m_pXFStyleManager.get();}
void SetEditorAttrMap(sal_uInt16 nID, LwpEditorAttr* pAttr);
OUString GetEditorName(sal_uInt8 nID);
XFColor GetHighlightColor(sal_uInt8 nID);
@@ -91,11 +91,11 @@ private:
explicit LwpGlobalMgr(LwpSvStream* pSvStream);
private:
static std::map< sal_uInt32,LwpGlobalMgr* > m_ThreadMap;
- LwpObjectFactory* m_pObjFactory;
- LwpBookmarkMgr* m_pBookmarkMgr;
- LwpChangeMgr* m_pChangeMgr;
- XFFontFactory* m_pXFFontFactory;
- XFStyleManager* m_pXFStyleManager;
+ std::unique_ptr<LwpObjectFactory> m_pObjFactory;
+ std::unique_ptr<LwpBookmarkMgr> m_pBookmarkMgr;
+ std::unique_ptr<LwpChangeMgr> m_pChangeMgr;
+ std::unique_ptr<XFFontFactory> m_pXFFontFactory;
+ std::unique_ptr<XFStyleManager> m_pXFStyleManager;
std::map<sal_uInt16, std::unique_ptr<LwpEditorAttr>> m_EditorAttrMap;
};
diff --git a/lotuswordpro/source/filter/lwpglobalmgr.cxx b/lotuswordpro/source/filter/lwpglobalmgr.cxx
index 94eec192a7c0..7ccbb71f74db 100644
--- a/lotuswordpro/source/filter/lwpglobalmgr.cxx
+++ b/lotuswordpro/source/filter/lwpglobalmgr.cxx
@@ -59,42 +59,20 @@ std::map< sal_uInt32,LwpGlobalMgr* > LwpGlobalMgr::m_ThreadMap;
LwpGlobalMgr::LwpGlobalMgr(LwpSvStream* pSvStream)
{
if (pSvStream)
- m_pObjFactory = new LwpObjectFactory(pSvStream);
- else
- m_pObjFactory = nullptr;
- m_pBookmarkMgr = new LwpBookmarkMgr;
- m_pChangeMgr = new LwpChangeMgr;
- m_pXFFontFactory = new XFFontFactory;
- m_pXFStyleManager = new XFStyleManager;
+ m_pObjFactory.reset( new LwpObjectFactory(pSvStream) );
+ m_pBookmarkMgr.reset( new LwpBookmarkMgr );
+ m_pChangeMgr.reset( new LwpChangeMgr );
+ m_pXFFontFactory.reset( new XFFontFactory );
+ m_pXFStyleManager.reset( new XFStyleManager );
}
LwpGlobalMgr::~LwpGlobalMgr()
{
- if (m_pObjFactory)
- {
- delete m_pObjFactory;
- m_pObjFactory = nullptr;
- }
- if (m_pBookmarkMgr)
- {
- delete m_pBookmarkMgr;
- m_pBookmarkMgr = nullptr;
- }
- if (m_pChangeMgr)
- {
- delete m_pChangeMgr;
- m_pChangeMgr = nullptr;
- }
- if (m_pXFFontFactory)
- {
- delete m_pXFFontFactory;
- m_pXFFontFactory = nullptr;
- }
- if (m_pXFStyleManager)
- {
- delete m_pXFStyleManager;
- m_pXFStyleManager = nullptr;
- }
+ m_pObjFactory.reset();
+ m_pBookmarkMgr.reset();
+ m_pChangeMgr.reset();
+ m_pXFFontFactory.reset();
+ m_pXFStyleManager.reset();
m_EditorAttrMap.clear();
}
More information about the Libreoffice-commits
mailing list