sw: replace boost::shared_array with std::shared_ptr

Change-Id: I99eec60db7f6d586b3b424661e03a7891422ab2e
This commit is contained in:
Michael Stahl
2016-05-25 23:19:05 +02:00
parent 66e798dda7
commit 1029b6cb06
4 changed files with 8 additions and 9 deletions

View File

@@ -50,7 +50,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <boost/intrusive_ptr.hpp> #include <boost/intrusive_ptr.hpp>
#include <boost/shared_array.hpp>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <osl/doublecheckedlocking.h> #include <osl/doublecheckedlocking.h>
#include <osl/endian.h> #include <osl/endian.h>

View File

@@ -54,7 +54,6 @@
#include <vector> #include <vector>
#include <boost/intrusive_ptr.hpp> #include <boost/intrusive_ptr.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/shared_array.hpp>
#include <osl/conditn.h> #include <osl/conditn.h>
#include <osl/conditn.hxx> #include <osl/conditn.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>

View File

@@ -24,6 +24,7 @@
#include <cstdio> #include <cstdio>
#include <osl/endian.h> #include <osl/endian.h>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <o3tl/make_shared.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
namespace ww8 namespace ww8
@@ -35,14 +36,14 @@ namespace ww8
{ {
sal_Size nRemainingSize = rSt.remainingSize(); sal_Size nRemainingSize = rSt.remainingSize();
nSize = std::min<sal_uInt32>(nRemainingSize, nSize); nSize = std::min<sal_uInt32>(nRemainingSize, nSize);
mp_data.reset(new sal_uInt8[nSize]); m_pData = o3tl::make_shared_array<sal_uInt8>(nSize);
mn_size = rSt.Read(mp_data.get(), nSize); mn_size = rSt.Read(m_pData.get(), nSize);
} }
OSL_ENSURE(mn_size == nSize, "short read in WW8Struct::WW8Struct"); OSL_ENSURE(mn_size == nSize, "short read in WW8Struct::WW8Struct");
} }
WW8Struct::WW8Struct(WW8Struct * pStruct, sal_uInt32 nPos, sal_uInt32 nSize) WW8Struct::WW8Struct(WW8Struct * pStruct, sal_uInt32 nPos, sal_uInt32 nSize)
: mp_data(pStruct->mp_data), mn_offset(pStruct->mn_offset + nPos) : m_pData(pStruct->m_pData), mn_offset(pStruct->mn_offset + nPos)
, mn_size(nSize) , mn_size(nSize)
{ {
} }
@@ -57,7 +58,7 @@ namespace ww8
if (nOffset < mn_size) if (nOffset < mn_size)
{ {
nResult = mp_data[mn_offset + nOffset]; nResult = m_pData.get()[mn_offset + nOffset];
} }
return nResult; return nResult;
@@ -79,7 +80,7 @@ namespace ww8
nCount = nAvailable; nCount = nAvailable;
#if defined OSL_LITENDIAN #if defined OSL_LITENDIAN
aResult = OUString(reinterpret_cast<const sal_Unicode *>( aResult = OUString(reinterpret_cast<const sal_Unicode *>(
mp_data.get() + nStartOff), nCount); m_pData.get() + nStartOff), nCount);
#else #else
OUStringBuffer aBuf; OUStringBuffer aBuf;
for (sal_uInt32 i = 0; i < nCount; ++i) for (sal_uInt32 i = 0; i < nCount; ++i)

View File

@@ -22,7 +22,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <boost/shared_array.hpp>
#include <tools/solar.h> #include <tools/solar.h>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <IDocumentExternalData.hxx> #include <IDocumentExternalData.hxx>
@@ -34,7 +34,7 @@ namespace ww8
class WW8Struct : public ::sw::ExternalData class WW8Struct : public ::sw::ExternalData
{ {
boost::shared_array<sal_uInt8> mp_data; std::shared_ptr<sal_uInt8> m_pData;
sal_uInt32 mn_offset; sal_uInt32 mn_offset;
sal_uInt32 mn_size; sal_uInt32 mn_size;