[Libreoffice-commits] core.git: 10 commits - compilerplugins/clang extensions/source framework/inc framework/source idl/inc idl/source linguistic/source svx/source
Noel Grandin
noel at peralex.com
Wed Nov 11 01:36:10 PST 2015
compilerplugins/clang/memoryvar.cxx | 2 -
extensions/source/bibliography/bibconfig.cxx | 12 +++----
extensions/source/bibliography/bibconfig.hxx | 5 +--
extensions/source/bibliography/framectr.cxx | 13 ++++---
extensions/source/bibliography/framectr.hxx | 5 +--
framework/inc/xml/imagesconfiguration.hxx | 8 ++--
framework/source/uiconfiguration/imagemanagerimpl.cxx | 11 +++---
framework/source/xml/imagesdocumenthandler.cxx | 30 +++++++-----------
idl/inc/lex.hxx | 28 ++++++++--------
idl/source/cmptools/lex.cxx | 10 +++---
linguistic/source/lngsvcmgr.cxx | 11 +++---
linguistic/source/lngsvcmgr.hxx | 5 +--
svx/source/form/fmshimp.cxx | 4 +-
svx/source/inc/fmshimp.hxx | 4 +-
svx/source/inc/svdobjuserdatalist.hxx | 5 +--
svx/source/svdraw/svdobjuserdatalist.cxx | 4 +-
16 files changed, 78 insertions(+), 79 deletions(-)
New commits:
commit 2ff2fafff8fe455a2493d04e7da709588a691ddd
Author: Noel Grandin <noel at peralex.com>
Date: Wed Nov 11 11:35:11 2015 +0200
svx: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I6f3fee6b95e8675e04f867bf59447fa569a61d8e
diff --git a/svx/source/inc/svdobjuserdatalist.hxx b/svx/source/inc/svdobjuserdatalist.hxx
index e40e4b9..09b792c 100644
--- a/svx/source/inc/svdobjuserdatalist.hxx
+++ b/svx/source/inc/svdobjuserdatalist.hxx
@@ -12,13 +12,14 @@
#include <svx/svdobj.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
class SdrObjUserData;
class SdrObjUserDataList
{
- typedef boost::ptr_vector<SdrObjUserData> ListType;
+ typedef std::vector<std::unique_ptr<SdrObjUserData> > ListType;
ListType maList;
public:
diff --git a/svx/source/svdraw/svdobjuserdatalist.cxx b/svx/source/svdraw/svdobjuserdatalist.cxx
index e2abe16..aa59da1 100644
--- a/svx/source/svdraw/svdobjuserdatalist.cxx
+++ b/svx/source/svdraw/svdobjuserdatalist.cxx
@@ -20,12 +20,12 @@ size_t SdrObjUserDataList::GetUserDataCount() const
SdrObjUserData& SdrObjUserDataList::GetUserData(size_t nNum)
{
- return maList.at(nNum);
+ return *maList.at(nNum).get();
}
void SdrObjUserDataList::AppendUserData(SdrObjUserData* pData)
{
- maList.push_back(pData);
+ maList.push_back(std::unique_ptr<SdrObjUserData>(pData));
}
void SdrObjUserDataList::DeleteUserData(size_t nNum)
commit 0521461eee932eefbd69fcd39407f181bc2213dd
Author: Noel Grandin <noel at peralex.com>
Date: Wed Nov 11 11:25:24 2015 +0200
disable loplugin memoryvar for now
seems to be crashing with latest(trunk) clang sometimes
Change-Id: Ice92b35deb6cb4610dbd53f570d0b43e9d2a2834
diff --git a/compilerplugins/clang/memoryvar.cxx b/compilerplugins/clang/memoryvar.cxx
index 2e776901..9cacdee 100644
--- a/compilerplugins/clang/memoryvar.cxx
+++ b/compilerplugins/clang/memoryvar.cxx
@@ -232,7 +232,7 @@ bool MemoryVar::VisitReturnStmt(const ReturnStmt *returnStmt)
return true;
}
-loplugin::Plugin::Registration< MemoryVar > X("memoryvar");
+loplugin::Plugin::Registration< MemoryVar > X("memoryvar", false);
}
commit 8978ce53e16de9a597015b0704f813dffa7da920
Author: Noel Grandin <noel at peralex.com>
Date: Wed Nov 11 11:22:58 2015 +0200
svx: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ib4ebadcdecc0f673c585c820b4aa4a3e1e123f0c
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 0c6e7c2..b1d59bf 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -95,6 +95,7 @@
#include <vcl/layout.hxx>
#include <vcl/waitobj.hxx>
#include <vcl/settings.hxx>
+#include <o3tl/make_unique.hxx>
#include <algorithm>
#include <functional>
@@ -4036,8 +4037,7 @@ ControlConversionMenuController::ControlConversionMenuController( sal_uInt16 _nI
for (sal_Int16 i=0; i<m_pConversionMenu->GetItemCount(); ++i)
{
_rBindings.Invalidate(m_pConversionMenu->GetItemId(i));
- SfxStatusForwarder* pForwarder = new SfxStatusForwarder(m_pConversionMenu->GetItemId(i), *this);
- m_aStatusForwarders.push_back(pForwarder);
+ m_aStatusForwarders.push_back(o3tl::make_unique<SfxStatusForwarder>(m_pConversionMenu->GetItemId(i), *this));
}
}
}
diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx
index ccacff4..e15235c 100644
--- a/svx/source/inc/fmshimp.hxx
+++ b/svx/source/inc/fmshimp.hxx
@@ -61,7 +61,7 @@
#include <queue>
#include <set>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
typedef std::vector< css::uno::Reference< css::form::XForm > > FmFormArray;
@@ -571,7 +571,7 @@ public:
class SVX_DLLPUBLIC ControlConversionMenuController : public SfxMenuControl
{
protected:
- boost::ptr_vector<SfxStatusForwarder> m_aStatusForwarders;
+ std::vector<std::unique_ptr<SfxStatusForwarder> > m_aStatusForwarders;
Menu* m_pMainMenu;
PopupMenu* m_pConversionMenu;
commit 44d3577f4b5ec181219268826d2ec504e61541f3
Author: Noel Grandin <noel at peralex.com>
Date: Wed Nov 11 09:17:24 2015 +0200
linguistic: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I4343b77dde4353db6294d597cdd5da6131e30afe
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index ceebcc9..22249cb 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -37,6 +37,7 @@
#include <cppuhelper/supportsservice.hxx>
#include <boost/checked_delete.hpp>
#include <boost/noncopyable.hpp>
+#include <o3tl/make_unique.hxx>
#include "lngsvcmgr.hxx"
#include "lngopt.hxx"
@@ -1090,7 +1091,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
}
- pAvailSpellSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
+ pAvailSpellSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );
}
}
}
@@ -1153,7 +1154,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
}
- pAvailGrammarSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
+ pAvailGrammarSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );
}
}
}
@@ -1213,7 +1214,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
}
- pAvailHyphSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
+ pAvailHyphSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );
}
}
}
@@ -1275,7 +1276,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
}
- pAvailThesSvcs->push_back( new SvcInfo( aImplName, aLanguages ) );
+ pAvailThesSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );
}
}
}
@@ -1584,7 +1585,7 @@ uno::Sequence< OUString > SAL_CALL
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
for (size_t i = 0; i < nMaxCnt; ++i)
{
- const SvcInfo &rInfo = (*pInfoArray)[i];
+ const SvcInfo &rInfo = *(*pInfoArray)[i].get();
if (LinguIsUnspecified( nLanguage )
|| rInfo.HasLanguage( nLanguage ))
{
diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx
index d28216c..0eee060 100644
--- a/linguistic/source/lngsvcmgr.hxx
+++ b/linguistic/source/lngsvcmgr.hxx
@@ -32,7 +32,8 @@
#include <unotools/configitem.hxx>
#include <vcl/timer.hxx>
#include <vcl/idle.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
#include "linguistic/misc.hxx"
#include "defs.hxx"
@@ -101,7 +102,7 @@ class LngSvcMgr :
LngSvcMgrListenerHelper * pListenerHelper;
- typedef boost::ptr_vector< SvcInfo > SvcInfoArray;
+ typedef std::vector< std::unique_ptr<SvcInfo> > SvcInfoArray;
SvcInfoArray * pAvailSpellSvcs;
SvcInfoArray * pAvailGrammarSvcs;
SvcInfoArray * pAvailHyphSvcs;
commit 5d892a3378dfd5c452ba106b002c7cef9a77a861
Author: Noel Grandin <noel at peralex.com>
Date: Wed Nov 11 09:14:03 2015 +0200
idl: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I19fb53e162f3af282cd8cf46b965bce9506731ec
diff --git a/idl/inc/lex.hxx b/idl/inc/lex.hxx
index ffcb0c9..d9a0918 100644
--- a/idl/inc/lex.hxx
+++ b/idl/inc/lex.hxx
@@ -20,11 +20,11 @@
#ifndef INCLUDED_IDL_INC_LEX_HXX
#define INCLUDED_IDL_INC_LEX_HXX
-#include <boost/ptr_container/ptr_vector.hpp>
-
#include <sal/types.h>
#include <hash.hxx>
#include <tools/stream.hxx>
+#include <vector>
+#include <memory>
enum SVTOKEN_ENUM { SVTOKEN_EMPTY, SVTOKEN_COMMENT,
SVTOKEN_INTEGER, SVTOKEN_STRING,
@@ -132,8 +132,8 @@ class SvTokenStream
SvFileStream * pInStream;
SvStream & rInStream;
OUString aFileName;
- boost::ptr_vector<SvToken> aTokList;
- boost::ptr_vector<SvToken>::iterator pCurToken;
+ std::vector<std::unique_ptr<SvToken> > aTokList;
+ std::vector<std::unique_ptr<SvToken> >::iterator pCurToken;
OString aBufStr;
@@ -178,25 +178,25 @@ public:
SvToken* GetToken_PrevAll()
{
- boost::ptr_vector<SvToken>::iterator pRetToken = pCurToken;
+ std::vector<std::unique_ptr<SvToken> >::iterator pRetToken = pCurToken;
// current iterator always valid
if(pCurToken != aTokList.begin())
--pCurToken;
- return &(*pRetToken);
+ return (*pRetToken).get();
}
SvToken* GetToken_NextAll()
{
- boost::ptr_vector<SvToken>::iterator pRetToken = pCurToken++;
+ std::vector<std::unique_ptr<SvToken> >::iterator pRetToken = pCurToken++;
if (pCurToken == aTokList.end())
pCurToken = pRetToken;
SetMax();
- return &(*pRetToken);
+ return (*pRetToken).get();
}
SvToken* GetToken_Next()
@@ -205,12 +205,12 @@ public:
return GetToken_NextAll();
}
- SvToken& GetToken() const { return *pCurToken; }
+ SvToken& GetToken() const { return *(*pCurToken).get(); }
bool Read( char cChar )
{
- if( pCurToken->IsChar()
- && cChar == pCurToken->GetChar() )
+ if( (*pCurToken)->IsChar()
+ && cChar == (*pCurToken)->GetChar() )
{
GetToken_Next();
return true;
@@ -221,9 +221,9 @@ public:
void ReadDelemiter()
{
- if( pCurToken->IsChar()
- && (';' == pCurToken->GetChar()
- || ',' == pCurToken->GetChar()) )
+ if( (*pCurToken)->IsChar()
+ && (';' == (*pCurToken)->GetChar()
+ || ',' == (*pCurToken)->GetChar()) )
{
GetToken_Next();
}
diff --git a/idl/source/cmptools/lex.cxx b/idl/source/cmptools/lex.cxx
index 84737e2..85575113 100644
--- a/idl/source/cmptools/lex.cxx
+++ b/idl/source/cmptools/lex.cxx
@@ -119,7 +119,7 @@ SvTokenStream::~SvTokenStream()
void SvTokenStream::FillTokenList()
{
SvToken * pToken = new SvToken();
- aTokList.push_back(pToken);
+ aTokList.push_back(std::unique_ptr<SvToken>(pToken));
do
{
if( !MakeToken( *pToken ) )
@@ -127,10 +127,10 @@ void SvTokenStream::FillTokenList()
if (!aTokList.empty())
{
*pToken = SvToken();
- boost::ptr_vector<SvToken>::const_iterator it = aTokList.begin();
+ std::vector<std::unique_ptr<SvToken> >::const_iterator it = aTokList.begin();
- pToken->SetLine(it->GetLine());
- pToken->SetColumn(it->GetColumn());
+ pToken->SetLine((*it)->GetLine());
+ pToken->SetColumn((*it)->GetColumn());
}
break;
}
@@ -141,7 +141,7 @@ void SvTokenStream::FillTokenList()
else
{
pToken = new SvToken();
- aTokList.push_back(pToken);
+ aTokList.push_back(std::unique_ptr<SvToken>(pToken));
}
}
while( !pToken->IsEof() );
commit 1459f127711ba11e0ce044d9fb70d1941b5c3209
Author: Noel Grandin <noel at peralex.com>
Date: Wed Nov 11 09:07:48 2015 +0200
framework: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I10801343e65646b92eb0a6256cd7bfbf5c84c854
diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx
index 0931e82..61778f0 100644
--- a/framework/inc/xml/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -30,7 +30,6 @@
#include <vector>
#include <memory>
-#include <boost/ptr_container/ptr_vector.hpp>
namespace framework
{
@@ -75,7 +74,7 @@ struct ImageListItemDescriptor
OUString aHighContrastMaskURL; // an URL to an optional high contrast bitmap as a mask
};
-typedef boost::ptr_vector<ImageListItemDescriptor> ImageListDescriptor;
+typedef std::vector<std::unique_ptr<ImageListItemDescriptor> > ImageListDescriptor;
struct ImageListsDescriptor
{
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 9738194..b7f271a 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -440,7 +440,7 @@ bool ImageManagerImpl::implts_loadUserImages(
if (( aUserImageListInfo.pImageList != nullptr ) &&
( !aUserImageListInfo.pImageList->empty() ))
{
- ImageListItemDescriptor* pList = &aUserImageListInfo.pImageList->front();
+ ImageListItemDescriptor* pList = aUserImageListInfo.pImageList->front().get();
sal_Int32 nCount = pList->pImageItemList->size();
std::vector< OUString > aUserImagesVector;
aUserImagesVector.reserve(nCount);
@@ -512,7 +512,7 @@ bool ImageManagerImpl::implts_storeUserImages(
aUserImageListInfo.pImageList = new ImageListDescriptor;
ImageListItemDescriptor* pList = new ImageListItemDescriptor;
- aUserImageListInfo.pImageList->push_back( pList );
+ aUserImageListInfo.pImageList->push_back( std::unique_ptr<ImageListItemDescriptor>(pList) );
pList->pImageItemList = new ImageItemListDescriptor;
for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index 89c3513..0ba98b3 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -510,7 +510,7 @@ void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName)
if ( m_pImages )
{
if ( m_aImageList.pImageList )
- m_aImageList.pImageList->push_back( m_pImages );
+ m_aImageList.pImageList->push_back( std::unique_ptr<ImageListItemDescriptor>(m_pImages) );
m_pImages = nullptr;
}
m_bImagesStartFound = false;
@@ -642,7 +642,7 @@ void OWriteImagesDocumentHandler::WriteImagesDocument() throw
for ( size_t i = 0; i < m_aImageListsItems.pImageList->size(); i++ )
{
- const ImageListItemDescriptor* pImageItems = &(*pImageList)[i];
+ const ImageListItemDescriptor* pImageItems = (*pImageList)[i].get();
WriteImageList( pImageItems );
}
}
commit aef8a59d51954f1858296ef23f70c8bd65c77c1c
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 16:37:55 2015 +0200
framework: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ia75bf59de4eb5e0be18f81b6ab897f9f9cb28855
diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx
index 9c672f3..0931e82 100644
--- a/framework/inc/xml/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -57,7 +57,7 @@ struct ExternalImageItemDescriptor
typedef std::vector<std::unique_ptr<ImageItemDescriptor> > ImageItemListDescriptor;
-typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor;
+typedef std::vector<std::unique_ptr<ExternalImageItemDescriptor> > ExternalImageItemListDescriptor;
struct ImageListItemDescriptor
{
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index 667ab85..89c3513 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -422,7 +422,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
m_bExternalImageStartFound = true;
- ExternalImageItemDescriptor* pItem = new ExternalImageItemDescriptor;
+ std::unique_ptr<ExternalImageItemDescriptor> pItem(new ExternalImageItemDescriptor);
// Read attributes for this external image definition
for ( sal_Int16 n = 0; n < xAttribs->getLength(); n++ )
@@ -444,8 +444,8 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
}
break;
- default:
- break;
+ default:
+ break;
}
}
}
@@ -453,7 +453,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "command"
if ( pItem->aCommandURL.isEmpty() )
{
- delete pItem;
delete m_pImages;
delete m_pExternalImages;
m_pImages = nullptr;
@@ -467,7 +466,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "href"
if ( pItem->aURL.isEmpty() )
{
- delete pItem;
delete m_pImages;
delete m_pExternalImages;
m_pImages = nullptr;
@@ -479,14 +477,12 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
}
if ( m_pExternalImages )
- m_pExternalImages->push_back( pItem );
- else
- delete pItem;
+ m_pExternalImages->push_back( std::move(pItem) );
}
break;
- default:
- break;
+ default:
+ break;
}
}
}
@@ -763,7 +759,7 @@ void OWriteImagesDocumentHandler::WriteExternalImageList( const ExternalImageIte
for ( size_t i = 0; i < pExternalImageList->size(); i++ )
{
- const ExternalImageItemDescriptor* pItem = &(*pExternalImageList)[i];
+ const ExternalImageItemDescriptor* pItem = (*pExternalImageList)[i].get();
WriteExternalImage( pItem );
}
commit ea2ae023cf0ca44b445aead93a47b8154f0cc818
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 16:35:45 2015 +0200
framework: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: If9981b141a591f23e03479c90694e6ffa78f2cb8
diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx
index a79d9c9..9c672f3 100644
--- a/framework/inc/xml/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <vector>
+#include <memory>
#include <boost/ptr_container/ptr_vector.hpp>
namespace framework
@@ -54,7 +55,7 @@ struct ExternalImageItemDescriptor
OUString aURL; // a URL to an external bitmap
};
-typedef boost::ptr_vector<ImageItemDescriptor> ImageItemListDescriptor;
+typedef std::vector<std::unique_ptr<ImageItemDescriptor> > ImageItemListDescriptor;
typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 94fb2ed7..9738194 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -446,7 +446,7 @@ bool ImageManagerImpl::implts_loadUserImages(
aUserImagesVector.reserve(nCount);
for ( sal_Int32 i=0; i < nCount; i++ )
{
- const ImageItemDescriptor* pItem = &(*pList->pImageItemList)[i];
+ const ImageItemDescriptor* pItem = (*pList->pImageItemList)[i].get();
aUserImagesVector.push_back( pItem->aCommandURL );
}
@@ -517,11 +517,10 @@ bool ImageManagerImpl::implts_storeUserImages(
pList->pImageItemList = new ImageItemListDescriptor;
for ( sal_uInt16 i=0; i < pImageList->GetImageCount(); i++ )
{
- ImageItemDescriptor* pItem = new ::framework::ImageItemDescriptor;
-
+ ImageItemDescriptor* pItem = new ImageItemDescriptor;
pItem->nIndex = i;
pItem->aCommandURL = pImageList->GetImageName( i );
- pList->pImageItemList->push_back( pItem );
+ pList->pImageItemList->push_back( std::unique_ptr<ImageItemDescriptor>(pItem) );
}
pList->aURL = "Bitmaps/" + OUString::createFromAscii(BITMAP_FILE_NAMES[nImageType]);
diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx
index d05bf2b..667ab85 100644
--- a/framework/source/xml/imagesdocumenthandler.cxx
+++ b/framework/source/xml/imagesdocumenthandler.cxx
@@ -309,7 +309,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
m_bImageStartFound = true;
// Create new image item descriptor
- ImageItemDescriptor* pItem = new ImageItemDescriptor;
+ std::unique_ptr<ImageItemDescriptor> pItem(new ImageItemDescriptor);
pItem->nIndex = -1;
// Read attributes for this image definition
@@ -341,7 +341,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "bitmap-index"
if ( pItem->nIndex < 0 )
{
- delete pItem;
delete m_pImages;
m_pImages = nullptr;
@@ -353,7 +352,6 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
// Check required attribute "command"
if ( pItem->aCommandURL.isEmpty() )
{
- delete pItem;
delete m_pImages;
m_pImages = nullptr;
@@ -362,7 +360,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
}
- m_pImages->pImageItemList->push_back( pItem );
+ m_pImages->pImageItemList->push_back( std::move(pItem) );
}
break;
@@ -729,7 +727,7 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor*
if ( pImageItemList )
{
for ( size_t i = 0; i < pImageItemList->size(); i++ )
- WriteImage( &(*pImageItemList)[i] );
+ WriteImage( (*pImageItemList)[i].get() );
}
m_xWriteDocumentHandler->endElement( ELEMENT_NS_IMAGES );
commit 2a2b9920c1ccd9cfb2ec474ceffed7c5d78ecb00
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 16:24:35 2015 +0200
extensions: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ia6987c9566af0b79bf44c4793d4ca325ea921cb7
diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx
index b280405..586b9b6 100644
--- a/extensions/source/bibliography/framectr.cxx
+++ b/extensions/source/bibliography/framectr.cxx
@@ -51,6 +51,7 @@
#include <sot/formats.hxx>
#include <vcl/edit.hxx>
#include <osl/mutex.hxx>
+#include <o3tl/make_unique.hxx>
#include <unordered_map>
@@ -447,7 +448,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen
sal_uInt16 nCount = aStatusListeners.size();
for ( sal_uInt16 n=0; n<nCount; n++ )
{
- BibStatusDispatch *pObj = &aStatusListeners[n];
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
if ( pObj->aURL.Path == "Bib/removeFilter" )
{
FeatureStateEvent aEvent;
@@ -498,7 +499,7 @@ void BibFrameController_Impl::dispatch(const util::URL& _rURL, const uno::Sequen
sal_uInt16 nCount = aStatusListeners.size();
for ( sal_uInt16 n=0; n<nCount; n++ )
{
- BibStatusDispatch *pObj = &aStatusListeners[n];
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
if ( pObj->aURL.Path == "Bib/removeFilter" && pDatMan->getParser().is())
{
FeatureStateEvent aEvent;
@@ -643,7 +644,7 @@ void BibFrameController_Impl::addStatusListener(
{
BibConfig* pConfig = BibModul::GetConfig();
// create a new Reference and insert into listener array
- aStatusListeners.push_back( new BibStatusDispatch( aURL, aListener ) );
+ aStatusListeners.push_back( o3tl::make_unique<BibStatusDispatch>( aURL, aListener ) );
// send first status synchronously
FeatureStateEvent aEvent;
@@ -780,7 +781,7 @@ void BibFrameController_Impl::removeStatusListener(
sal_uInt16 nCount = aStatusListeners.size();
for ( sal_uInt16 n=0; n<nCount; n++ )
{
- BibStatusDispatch *pObj = &aStatusListeners[n];
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
bool bFlag=pObj->xListener.is();
if (!bFlag || (pObj->xListener == aObject &&
( aURL.Complete.isEmpty() || pObj->aURL.Path == aURL.Path )))
@@ -804,7 +805,7 @@ void BibFrameController_Impl::RemoveFilter()
for ( sal_uInt16 n=0; n<nCount; n++ )
{
- BibStatusDispatch *pObj = &aStatusListeners[n];
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
if ( pObj->aURL.Path == "Bib/removeFilter" )
{
FeatureStateEvent aEvent;
@@ -864,7 +865,7 @@ void BibFrameController_Impl::ChangeDataSource(const uno::Sequence< beans::Prope
bool bQueryText=false;
for ( sal_uInt16 n=0; n<nCount; n++ )
{
- BibStatusDispatch *pObj = &aStatusListeners[n];
+ BibStatusDispatch *pObj = aStatusListeners[n].get();
if (pObj->aURL.Path == "Bib/MenuFilter")
{
FeatureStateEvent aEvent;
diff --git a/extensions/source/bibliography/framectr.hxx b/extensions/source/bibliography/framectr.hxx
index d6fe8e6..feb94c37 100644
--- a/extensions/source/bibliography/framectr.hxx
+++ b/extensions/source/bibliography/framectr.hxx
@@ -27,7 +27,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/frame/XDispatchInformationProvider.hpp>
#include <cppuhelper/implbase.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
#include "bibmod.hxx"
class BibDataManager;
@@ -48,7 +49,7 @@ public:
{}
};
-typedef boost::ptr_vector<BibStatusDispatch> BibStatusDispatchArr;
+typedef std::vector<std::unique_ptr<BibStatusDispatch> > BibStatusDispatchArr;
class BibFrameController_Impl : public cppu::WeakImplHelper <
css::lang::XServiceInfo,
commit d1bda375a077d0de31cc4f5e602b3e33fdde0d55
Author: Noel Grandin <noel at peralex.com>
Date: Tue Nov 10 16:21:02 2015 +0200
extensions: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: Ie19e898e3a5e558906cfad841c01d6d9b380b18b
diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx
index 4060671..fd62c91 100644
--- a/extensions/source/bibliography/bibconfig.cxx
+++ b/extensions/source/bibliography/bibconfig.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <comphelper/processfactory.hxx>
+#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
@@ -185,7 +186,7 @@ BibConfig::BibConfig()
pMapping->aColumnPairs[nSetMapping++].sRealColumnName = sTempReal;
}
}
- pMappingsArr->push_back(pMapping);
+ pMappingsArr->push_back(std::unique_ptr<Mapping>(pMapping));
}
}
}
@@ -250,7 +251,7 @@ void BibConfig::ImplCommit()
OUString sCommandType("CommandType");
for(sal_Int32 i = 0; i < (sal_Int32)pMappingsArr->size(); i++)
{
- const Mapping* pMapping = &(*pMappingsArr)[i];
+ const Mapping* pMapping = (*pMappingsArr)[i].get();
OUString sPrefix(cDataSourceHistory);
sPrefix += "/_";
sPrefix += OUString::number(i);
@@ -296,7 +297,7 @@ const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const
{
for(size_t i = 0; i < pMappingsArr->size(); i++)
{
- Mapping& rMapping = (*pMappingsArr)[i];
+ Mapping& rMapping = *(*pMappingsArr)[i].get();
bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL);
if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual)
return &rMapping;
@@ -308,7 +309,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp
{
for(size_t i = 0; i < pMappingsArr->size(); i++)
{
- Mapping& rMapping = (*pMappingsArr)[i];
+ Mapping& rMapping = *(*pMappingsArr)[i].get();
bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL);
if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual)
{
@@ -316,8 +317,7 @@ void BibConfig::SetMapping(const BibDBDescriptor& rDesc, const Mapping* pSetMapp
break;
}
}
- Mapping* pNew = new Mapping(*pSetMapping);
- pMappingsArr->push_back(pNew);
+ pMappingsArr->push_back(o3tl::make_unique<Mapping>(*pSetMapping));
SetModified();
}
diff --git a/extensions/source/bibliography/bibconfig.hxx b/extensions/source/bibliography/bibconfig.hxx
index 4bd0d98..590e907 100644
--- a/extensions/source/bibliography/bibconfig.hxx
+++ b/extensions/source/bibliography/bibconfig.hxx
@@ -21,10 +21,11 @@
#define INCLUDED_EXTENSIONS_SOURCE_BIBLIOGRAPHY_BIBCONFIG_HXX
#include <unotools/configitem.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <vector>
+#include <memory>
struct Mapping;
-typedef boost::ptr_vector<Mapping> MappingArray;
+typedef std::vector<std::unique_ptr<Mapping> > MappingArray;
More information about the Libreoffice-commits
mailing list