summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2015-06-15 17:58:15 +0900
committerCaolán McNamara <caolanm@redhat.com>2015-06-17 15:50:45 +0000
commit09800956191c90035872cbc18cd304fee043c710 (patch)
tree9d255ad7629fedc181e8b5cf965a3075a328caaf /sal
parent9cc52266bd1a4d01552675f151ce2da8c5210f84 (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 'sal')
-rw-r--r--sal/cppunittester/cppunittester.cxx4
-rw-r--r--sal/inc/pch/precompiled_sal.hxx2
-rw-r--r--sal/qa/rtl/digest/rtl_digest.cxx16
-rw-r--r--sal/textenc/tencinfo.cxx6
4 files changed, 14 insertions, 14 deletions
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
index b637fb62cb2d..07c9a2b43e97 100644
--- a/sal/cppunittester/cppunittester.cxx
+++ b/sal/cppunittester/cppunittester.cxx
@@ -48,7 +48,7 @@
#include "cppunit/portability/Stream.h"
#include "boost/noncopyable.hpp"
-#include <boost/scoped_array.hpp>
+#include <memory>
#include <boost/algorithm/string.hpp>
#include <algorithm>
@@ -112,7 +112,7 @@ class EyecatcherListener
public:
void startTest( CppUnit::Test* test) SAL_OVERRIDE
{
- boost::scoped_array<char> tn(new char [ test->getName().length() + 2 ]);
+ std::unique_ptr<char[]> tn(new char [ test->getName().length() + 2 ]);
strcpy(tn.get(), test->getName().c_str());
int len = strlen(tn.get());
for(int i = 0; i < len; i++)
diff --git a/sal/inc/pch/precompiled_sal.hxx b/sal/inc/pch/precompiled_sal.hxx
index 4e93245df8d7..2454f4b573f5 100644
--- a/sal/inc/pch/precompiled_sal.hxx
+++ b/sal/inc/pch/precompiled_sal.hxx
@@ -54,7 +54,7 @@
#include <algorithm>
#include <assert.h>
#include <boost/noncopyable.hpp>
-#include <boost/scoped_array.hpp>
+#include <memory>
#include <cassert>
#include <config_features.h>
#include <config_folders.h>
diff --git a/sal/qa/rtl/digest/rtl_digest.cxx b/sal/qa/rtl/digest/rtl_digest.cxx
index 9e84e0630166..52ebb81ffb12 100644
--- a/sal/qa/rtl/digest/rtl_digest.cxx
+++ b/sal/qa/rtl/digest/rtl_digest.cxx
@@ -23,7 +23,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
-#include <boost/scoped_array.hpp>
+#include <memory>
#include <rtl/digest.h>
#include <rtl/ustring.hxx>
@@ -95,7 +95,7 @@ OString getDigest(const OString& aMessage, rtlDigestAlgorithm aAlgorithm)
rtl_digest_update(handle, pData, nSize);
sal_uInt32 nKeyLen = rtl_digest_queryLength(handle);
- boost::scoped_array<sal_uInt8> pKeyBuffer(new sal_uInt8[nKeyLen]);
+ std::unique_ptr<sal_uInt8[]> pKeyBuffer(new sal_uInt8[nKeyLen]);
rtl_digest_get(handle, pKeyBuffer.get(), nKeyLen);
OString aSum = createHex(pKeyBuffer.get(), nKeyLen);
@@ -187,7 +187,7 @@ public:
rtl_digest_update(handle, pData, nSize);
sal_uInt32 nKeyLen = rtl_digest_queryLength( handle );
- boost::scoped_array<sal_uInt8> pKeyBuffer(new sal_uInt8[nKeyLen]);
+ std::unique_ptr<sal_uInt8[]> pKeyBuffer(new sal_uInt8[nKeyLen]);
rtl_digest_get( handle, pKeyBuffer.get(), nKeyLen );
createHex(pKeyBuffer.get(), nKeyLen);
@@ -235,7 +235,7 @@ public:
OString runCheckPBKDF2(OString& sPassword, bool bClearSalt, sal_uInt32 nCount)
{
sal_uInt32 nKeyLen = RTL_DIGEST_LENGTH_HMAC_SHA1;
- boost::scoped_array<sal_uInt8> pKeyBuffer(new sal_uInt8[nKeyLen]);
+ std::unique_ptr<sal_uInt8[]> pKeyBuffer(new sal_uInt8[nKeyLen]);
memset(pKeyBuffer.get(), 0, nKeyLen);
@@ -243,7 +243,7 @@ public:
sal_Int32 nPasswordLen = sPassword.getLength();
sal_uInt32 nSaltDataLen = RTL_DIGEST_LENGTH_HMAC_SHA1;
- boost::scoped_array<sal_uInt8> pSaltData(new sal_uInt8[nSaltDataLen]);
+ std::unique_ptr<sal_uInt8[]> pSaltData(new sal_uInt8[nSaltDataLen]);
memset(pSaltData.get(), 0, nSaltDataLen);
if (!bClearSalt)
@@ -349,7 +349,7 @@ public:
CPPUNIT_ASSERT_MESSAGE("create with rtl_Digest_AlgorithmMD2", aHandle != 0);
sal_uInt32 nKeyLen = rtl_digest_queryLength(aHandle);
- boost::scoped_array<sal_uInt8> pKeyBuffer(new sal_uInt8[nKeyLen]);
+ std::unique_ptr<sal_uInt8[]> pKeyBuffer(new sal_uInt8[nKeyLen]);
aError = rtl_digest_getMD5(aHandle, NULL, 0);
CPPUNIT_ASSERT_MESSAGE("handle 2. parameter wrong", aError == rtl_Digest_E_Argument);
@@ -385,7 +385,7 @@ public:
0x37, 0x00
};
- boost::scoped_array<sal_uInt8> pResult(new sal_uInt8[RTL_DIGEST_LENGTH_SHA1]);
+ std::unique_ptr<sal_uInt8[]> pResult(new sal_uInt8[RTL_DIGEST_LENGTH_SHA1]);
OString sExpected = "06f460d693aecdd3b5cbe8365408eccfc570f32a";
@@ -411,7 +411,7 @@ public:
0x37, 0x00, 0x38, 0x00
};
- boost::scoped_array<sal_uInt8> pResult(new sal_uInt8[RTL_DIGEST_LENGTH_SHA1]);
+ std::unique_ptr<sal_uInt8[]> pResult(new sal_uInt8[RTL_DIGEST_LENGTH_SHA1]);
OString sExpected = "0bfe41eb7fb3edf5f5a6de57192de4ba1b925758";
diff --git a/sal/textenc/tencinfo.cxx b/sal/textenc/tencinfo.cxx
index 192619dbab41..af3898335943 100644
--- a/sal/textenc/tencinfo.cxx
+++ b/sal/textenc/tencinfo.cxx
@@ -26,7 +26,7 @@
#include "gettextencodingdata.hxx"
#include "tenchelp.hxx"
-#include <boost/scoped_array.hpp>
+#include <memory>
sal_Bool SAL_CALL rtl_isOctetTextEncoding(rtl_TextEncoding nEncoding)
{
@@ -414,7 +414,7 @@ rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromUnixCharset( const char* pUnixC
const char* pSecondPart;
/* Alloc Buffer and map to lower case */
- boost::scoped_array<char> pBuf(new char[nBufLen]);
+ std::unique_ptr<char[]> pBuf(new char[nBufLen]);
Impl_toAsciiLower( pUnixCharset, pBuf.get() );
/* Search FirstPart */
@@ -742,7 +742,7 @@ rtl_TextEncoding SAL_CALL rtl_getTextEncodingFromMimeCharset( const char* pMimeC
sal_uInt32 nBufLen = strlen( pMimeCharset )+1;
/* Alloc Buffer and map to lower case and remove non alphanumeric chars */
- boost::scoped_array<char> pBuf(new char[nBufLen]);
+ std::unique_ptr<char[]> pBuf(new char[nBufLen]);
Impl_toAsciiLowerAndRemoveNonAlphanumeric( pMimeCharset, pBuf.get() );
/* Search for equal in the VIP table */