diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2015-06-15 17:58:15 +0900 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-17 15:50:45 +0000 |
commit | 09800956191c90035872cbc18cd304fee043c710 (patch) | |
tree | 9d255ad7629fedc181e8b5cf965a3075a328caaf /extensions | |
parent | 9cc52266bd1a4d01552675f151ce2da8c5210f84 (diff) |
Replace boost::scoped_array<T> with std::unique_ptr<T[]>
This may reduce some degree of dependency on boost.
Done by running a script like:
git grep -l '#include *.boost/scoped_array.hpp.' \
| xargs sed -i -e 's@#include *.boost/scoped_array.hpp.@#include <memory>@'
git grep -l '\(boost::\)\?scoped_array<\([^<>]*\)>' \
| xargs sed -i -e 's/\(boost::\)\?scoped_array<\([^<>]*\)>/std::unique_ptr<\2[]>/'
... and then killing duplicate or unnecessary includes,
while changing manually
m_xOutlineStylesCandidates in xmloff/source/text/txtimp.cxx,
extensions/source/ole/unoconversionutilities.hxx, and
extensions/source/ole/oleobjw.cxx.
Change-Id: I3955ed3ad99b94499a7bd0e6e3a09078771f9bfd
Reviewed-on: https://gerrit.libreoffice.org/16289
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/ole/oleobjw.cxx | 23 | ||||
-rw-r--r-- | extensions/source/ole/unoconversionutilities.hxx | 9 | ||||
-rw-r--r-- | extensions/source/plugin/base/nfuncs.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/base/xplugin.cxx | 4 | ||||
-rw-r--r-- | extensions/source/plugin/unx/mediator.cxx | 6 | ||||
-rw-r--r-- | extensions/source/propctrlr/formcomponenthandler.cxx | 4 | ||||
-rw-r--r-- | extensions/source/scanner/grid.cxx | 6 | ||||
-rw-r--r-- | extensions/source/scanner/sane.cxx | 12 | ||||
-rw-r--r-- | extensions/source/scanner/sanedlg.cxx | 6 |
9 files changed, 36 insertions, 38 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx index 01f8aa368596..364e25670017 100644 --- a/extensions/source/ole/oleobjw.cxx +++ b/extensions/source/ole/oleobjw.cxx @@ -25,7 +25,7 @@ #include "osl/doublecheckedlocking.h" #include "osl/thread.h" -#include "boost/scoped_array.hpp" +#include <memory> #include <com/sun/star/script/FailReason.hpp> #include <com/sun/star/beans/XMaterialHolder.hpp> #include <com/sun/star/script/XTypeConverter.hpp> @@ -54,7 +54,6 @@ #include "unoobjw.hxx" #include <stdio.h> using namespace std; -using namespace boost; using namespace osl; using namespace cppu; using namespace com::sun::star::script; @@ -761,8 +760,8 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName, // Then out and in/out parameters have to be treated differently than // with common COM objects. sal_Bool bJScriptObject= isJScriptObject(); - scoped_array<CComVariant> sarParams; - scoped_array<CComVariant> sarParamsRef; + std::unique_ptr<CComVariant[]> sarParams; + std::unique_ptr<CComVariant[]> sarParamsRef; CComVariant *pVarParams= NULL; CComVariant *pVarParamsRef= NULL; sal_Bool bConvRet= sal_True; @@ -1298,9 +1297,9 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con { DISPPARAMS dispparams = {NULL, NULL, 0, 0}; - scoped_array<DISPID> arDispidNamedArgs; - scoped_array<CComVariant> ptrArgs; - scoped_array<CComVariant> ptrRefArgs; // referenced arguments + std::unique_ptr<DISPID[]> arDispidNamedArgs; + std::unique_ptr<CComVariant[]> ptrArgs; + std::unique_ptr<CComVariant[]> ptrRefArgs; // referenced arguments CComVariant * arArgs = NULL; CComVariant * arRefArgs = NULL; @@ -1319,7 +1318,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con if ( pInvkinds[nStep] == INVOKE_PROPERTYPUT ) nSizeAr = dispparams.cNamedArgs; - scoped_array<OLECHAR*> saNames(new OLECHAR*[nSizeAr]); + std::unique_ptr<OLECHAR*[]> saNames(new OLECHAR*[nSizeAr]); OLECHAR ** pNames = saNames.get(); pNames[0] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(aName.getStr())); @@ -1687,9 +1686,9 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, sal_Int32 i = 0; sal_Int32 nUnoArgs = Params.getLength(); DISPID idPropertyPut = DISPID_PROPERTYPUT; - scoped_array<DISPID> arDispidNamedArgs; - scoped_array<CComVariant> ptrArgs; - scoped_array<CComVariant> ptrRefArgs; // referenced arguments + std::unique_ptr<DISPID[]> arDispidNamedArgs; + std::unique_ptr<CComVariant[]> ptrArgs; + std::unique_ptr<CComVariant[]> ptrRefArgs; // referenced arguments CComVariant * arArgs = NULL; CComVariant * arRefArgs = NULL; sal_Int32 revIndex = 0; @@ -1762,7 +1761,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdComTlb(FuncDesc& aFuncDesc, nSizeAr = dispparams.cNamedArgs; //counts the DISID_PROPERTYPUT } - scoped_array<OLECHAR*> saNames(new OLECHAR*[nSizeAr]); + std::unique_ptr<OLECHAR*[]> saNames(new OLECHAR*[nSizeAr]); OLECHAR ** arNames = saNames.get(); arNames[0] = const_cast<OLECHAR*>(reinterpret_cast<LPCOLESTR>(sFuncName.getStr())); diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx index 1984d1003e0a..122acc5137a7 100644 --- a/extensions/source/ole/unoconversionutilities.hxx +++ b/extensions/source/ole/unoconversionutilities.hxx @@ -19,7 +19,7 @@ #ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_UNOCONVERSIONUTILITIES_HXX #define INCLUDED_EXTENSIONS_SOURCE_OLE_UNOCONVERSIONUTILITIES_HXX -#include "boost/scoped_array.hpp" +#include <memory> #include "com/sun/star/script/XInvocationAdapterFactory.hpp" #include "com/sun/star/script/XInvocationAdapterFactory2.hpp" #include "com/sun/star/script/XTypeConverter.hpp" @@ -60,7 +60,6 @@ using namespace com::sun::star::bridge; using namespace com::sun::star::bridge::ModelDependent; #endif using namespace com::sun::star::bridge::oleautomation; -using namespace boost; namespace ole_adapter { extern std::unordered_map<sal_uInt32, sal_uInt32> AdapterToWrapperMap; @@ -1038,7 +1037,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, if( elementTypeDesc.is() ) { // set up the SAFEARRAY - scoped_array<SAFEARRAYBOUND> sarSafeArrayBound(new SAFEARRAYBOUND[dims]); + std::unique_ptr<SAFEARRAYBOUND[]> sarSafeArrayBound(new SAFEARRAYBOUND[dims]); SAFEARRAYBOUND* prgsabound= sarSafeArrayBound.get(); for( sal_Int32 i=0; i < dims; i++) { @@ -1069,7 +1068,7 @@ SAFEARRAY* UnoConversionUtilities<T>::createUnoSequenceWrapper(const Any& rSeq, // In this case arDimSeqIndices would have the size 1. That is the elements are not counted // but the Sequences that contain those elements. // The indices ar 0 based - scoped_array<sal_Int32> sarDimsSeqIndices; + std::unique_ptr<sal_Int32[]> sarDimsSeqIndices; sal_Int32* arDimsSeqIndices= NULL; if( dimsSeq > 0) { @@ -2238,7 +2237,7 @@ Sequence<Any> UnoConversionUtilities<T>::createOleArrayWrapper(SAFEARRAY* pArray if (dim > 0) { - scoped_array<long> sarIndex(new long[dim]); + std::unique_ptr<long[]> sarIndex(new long[dim]); long * index = sarIndex.get(); for (unsigned int i = 0; i < dim; i++) diff --git a/extensions/source/plugin/base/nfuncs.cxx b/extensions/source/plugin/base/nfuncs.cxx index dfeff975ff07..f36e89b24079 100644 --- a/extensions/source/plugin/base/nfuncs.cxx +++ b/extensions/source/plugin/base/nfuncs.cxx @@ -43,7 +43,7 @@ #include <plugin/impl.hxx> #include <vcl/svapp.hxx> -#include <boost/scoped_array.hpp> +#include <memory> #if OSL_DEBUG_LEVEL > 1 #include <osl/thread.h> @@ -425,7 +425,7 @@ extern "C" { return NPERR_FILE_NOT_FOUND; PluginInputStream* pInputStream = static_cast<PluginInputStream*>(pStream); - boost::scoped_array<sal_Int8> pBytes; + std::unique_ptr<sal_Int8[]> pBytes; int nBytes = 0; pPlugin->enterPluginCallback(); while( rangeList ) diff --git a/extensions/source/plugin/base/xplugin.cxx b/extensions/source/plugin/base/xplugin.cxx index f5f54fe4c4be..506f776dca0e 100644 --- a/extensions/source/plugin/base/xplugin.cxx +++ b/extensions/source/plugin/base/xplugin.cxx @@ -61,7 +61,7 @@ #include <stdio.h> #endif -#include <boost/scoped_array.hpp> +#include <memory> using namespace com::sun::star; using namespace com::sun::star::io; @@ -1116,7 +1116,7 @@ void PluginInputStream::writeBytes( const Sequence<sal_Int8>& Buffer ) throw(std { nBytes = (nBytes > nPos - m_nWritePos) ? nPos - m_nWritePos : nBytes; - boost::scoped_array<char> pBuffer(new char[ nBytes ]); + std::unique_ptr<char[]> pBuffer(new char[ nBytes ]); m_aFileStream.Seek( m_nWritePos ); nBytes = m_aFileStream.Read( pBuffer.get(), nBytes ); diff --git a/extensions/source/plugin/unx/mediator.cxx b/extensions/source/plugin/unx/mediator.cxx index 76045f3724a3..4aecda071328 100644 --- a/extensions/source/plugin/unx/mediator.cxx +++ b/extensions/source/plugin/unx/mediator.cxx @@ -32,7 +32,7 @@ #include <plugin/unx/mediator.hxx> #include <sal/log.hxx> #include <vcl/svapp.hxx> -#include <boost/scoped_array.hpp> +#include <memory> #define MEDIATOR_MAGIC 0xf7a8d2f4 @@ -94,7 +94,7 @@ sal_uLong Mediator::SendMessage( sal_uLong nBytes, const char* pBytes, sal_uLong if( ! m_bValid ) return nMessageID; - boost::scoped_array<sal_uLong> pBuffer(new sal_uLong[ (nBytes/sizeof(sal_uLong)) + 4 ]); + std::unique_ptr<sal_uLong[]> pBuffer(new sal_uLong[ (nBytes/sizeof(sal_uLong)) + 4 ]); pBuffer[ 0 ] = nMessageID; pBuffer[ 1 ] = nBytes; pBuffer[ 2 ] = MEDIATOR_MAGIC; @@ -208,7 +208,7 @@ void MediatorListener::run() { if( nHeader[ 0 ] == 0 && nHeader[ 1 ] == 0 ) return; - boost::scoped_array<char> pBuffer(new char[ nHeader[ 1 ] ]); + std::unique_ptr<char[]> pBuffer(new char[ nHeader[ 1 ] ]); if( m_pMediator && (sal_uLong)read( m_pMediator->m_nSocket, pBuffer.get(), nHeader[ 1 ] ) == nHeader[ 1 ] ) { ::osl::MutexGuard aMyGuard( m_aMutex ); diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index b3e544abfe97..78f2551b55ec 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -102,7 +102,7 @@ #include <sal/macros.h> #include <limits> -#include <boost/scoped_array.hpp> +#include <memory> #define GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:" @@ -385,7 +385,7 @@ namespace pcr sal_Int32 nNewCount = aNewStrings.getLength(); // Create new Ids - boost::scoped_array<OUString> pNewPureIds(new OUString[nNewCount]); + std::unique_ptr<OUString[]> pNewPureIds(new OUString[nNewCount]); OUString aIdStrBase = aDot; Any aNameAny = m_xComponent->getPropertyValue(PROPERTY_NAME); OUString sControlName; diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 496542f42fad..67a47a6e9394 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -29,7 +29,7 @@ #include <vcl/builderfactory.hxx> #include <algorithm> -#include <boost/scoped_array.hpp> +#include <memory> class GridWindow : public vcl::Window { @@ -392,8 +392,8 @@ void GridWindow::computeNew() int i; // get node arrays - boost::scoped_array<double> nodex(new double[ nSorted ]); - boost::scoped_array<double> nodey(new double[ nSorted ]); + std::unique_ptr<double[]> nodex(new double[ nSorted ]); + std::unique_ptr<double[]> nodey(new double[ nSorted ]); for( i = 0L; i < nSorted; i++ ) transform( m_aHandles[i].maPos, nodex[ i ], nodey[ i ] ); diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index 1a7a1060963f..cde72244d725 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -31,7 +31,7 @@ #include <sys/types.h> #include <sal/config.h> #include <sal/macros.h> -#include <boost/scoped_array.hpp> +#include <memory> #if (OSL_DEBUG_LEVEL > 1) || defined DBG_UTIL #include <stdarg.h> @@ -359,7 +359,7 @@ bool Sane::GetOptionValue( int n, OString& rRet ) bool bSuccess = false; if( ! maHandle || mppOptions[n]->type != SANE_TYPE_STRING ) return false; - boost::scoped_array<char> pRet(new char[mppOptions[n]->size+1]); + std::unique_ptr<char[]> pRet(new char[mppOptions[n]->size+1]); SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet.get() ); if( nStatus == SANE_STATUS_GOOD ) { @@ -377,7 +377,7 @@ bool Sane::GetOptionValue( int n, double& rRet, int nElement ) mppOptions[n]->type != SANE_TYPE_FIXED ) ) return false; - boost::scoped_array<SANE_Word> pRet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); + std::unique_ptr<SANE_Word[]> pRet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pRet.get() ); if( nStatus == SANE_STATUS_GOOD ) { @@ -396,7 +396,7 @@ bool Sane::GetOptionValue( int n, double* pSet ) mppOptions[n]->type == SANE_TYPE_INT ) ) return false; - boost::scoped_array<SANE_Word> pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); + std::unique_ptr<SANE_Word[]> pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); SANE_Status nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pFixedSet.get() ); if( nStatus != SANE_STATUS_GOOD ) return false; @@ -443,7 +443,7 @@ bool Sane::SetOptionValue( int n, double fSet, int nElement ) SANE_Status nStatus; if( mppOptions[n]->size/sizeof(SANE_Word) > 1 ) { - boost::scoped_array<SANE_Word> pSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); + std::unique_ptr<SANE_Word[]> pSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); nStatus = ControlOption( n, SANE_ACTION_GET_VALUE, pSet.get() ); if( nStatus == SANE_STATUS_GOOD ) { @@ -470,7 +470,7 @@ bool Sane::SetOptionValue( int n, double* pSet ) if( ! maHandle || ( mppOptions[n]->type != SANE_TYPE_INT && mppOptions[n]->type != SANE_TYPE_FIXED ) ) return false; - boost::scoped_array<SANE_Word> pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); + std::unique_ptr<SANE_Word[]> pFixedSet(new SANE_Word[mppOptions[n]->size/sizeof(SANE_Word)]); for( size_t i = 0; i < mppOptions[n]->size/sizeof(SANE_Word); i++ ) { if( mppOptions[n]->type == SANE_TYPE_FIXED ) diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index 57e80bbc829d..9078823b2b94 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -28,7 +28,7 @@ #include <math.h> #include <sal/macros.h> #include <rtl/strbuf.hxx> -#include <boost/scoped_array.hpp> +#include <memory> #include "strings.hrc" #define PREVIEW_WIDTH 113 @@ -641,8 +641,8 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton ) case SANE_TYPE_INT: { int nElements = mrSane.GetOptionElements( mnCurrentOption ); - boost::scoped_array<double> x(new double[ nElements ]); - boost::scoped_array<double> y(new double[ nElements ]); + std::unique_ptr<double[]> x(new double[ nElements ]); + std::unique_ptr<double[]> y(new double[ nElements ]); for( int i = 0; i < nElements; i++ ) x[ i ] = (double)i; mrSane.GetOptionValue( mnCurrentOption, y.get() ); |