summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-30 10:17:20 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-30 13:35:43 +0100
commit66343a8aeb4328a61766e4df41515130290e8a93 (patch)
tree2a2dc7d5ca9bdbc01886e3d027b26009f9c40368
parent78c83032b266fbb6fc20ddca86df80affaff7c24 (diff)
shared_array->unique_ptr<[]>
where we don't need to share the data Change-Id: I0edc9d62186d96095ee67e3c93f5cf186dffcb71
-rw-r--r--filter/source/svg/svgwriter.cxx3
-rw-r--r--include/oox/helper/binaryoutputstream.hxx13
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx30
3 files changed, 20 insertions, 26 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 37b84fd518bd..db8d1ce508f4 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -30,7 +30,6 @@
#include <sax/tools/converter.hxx>
#include <memory>
-#include <boost/shared_array.hpp>
static const char aXMLElemG[] = "g";
@@ -2422,7 +2421,7 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const OUString& rText,
else
aPos = rPos;
- boost::shared_array<long> xTmpArray(new long[nLen]);
+ std::unique_ptr<long[]> xTmpArray(new long[nLen]);
// get text sizes
if( pDXArray )
{
diff --git a/include/oox/helper/binaryoutputstream.hxx b/include/oox/helper/binaryoutputstream.hxx
index 49eb7e7e1cc1..bcceec379ffa 100644
--- a/include/oox/helper/binaryoutputstream.hxx
+++ b/include/oox/helper/binaryoutputstream.hxx
@@ -20,10 +20,8 @@
#ifndef INCLUDED_OOX_HELPER_BINARYOUTPUTSTREAM_HXX
#define INCLUDED_OOX_HELPER_BINARYOUTPUTSTREAM_HXX
-#include <memory>
-#include <boost/shared_array.hpp>
-
#include <oox/helper/binarystreambase.hxx>
+#include <memory>
namespace com { namespace sun { namespace star {
namespace io { class XOutputStream; }
@@ -103,14 +101,11 @@ void BinaryOutputStream::writeArray( Type* opnArray, sal_Int32 nElemCount )
template< typename Type >
void BinaryOutputStream::writeArray( const Type* opnArray, sal_Int32 nElemCount )
{
- boost::shared_array<Type> pArray(new Type[nElemCount]);
- std::uninitialized_copy(opnArray, opnArray + nElemCount, pArray.get());
- writeArray(pArray.get(), nElemCount);
+ std::unique_ptr<Type[]> xArray(new Type[nElemCount]);
+ std::uninitialized_copy(opnArray, opnArray + nElemCount, xArray.get());
+ writeArray(xArray.get(), nElemCount);
}
-
-
-
template< typename Type >
void BinaryOutputStream::writeValue( Type nValue )
{
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 0911269ad135..dfdbae345636 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3465,8 +3465,8 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
}
else
{
- boost::shared_array<unsigned char> pWriteBuffer( new unsigned char[ nLength2 ] );
- memset( pWriteBuffer.get(), 0, nLength2 );
+ std::unique_ptr<unsigned char[]> xWriteBuffer(new unsigned char[nLength2]);
+ memset(xWriteBuffer.get(), 0, nLength2);
int nWriteIndex = 0;
int nNextSectionIndex = 0;
@@ -3493,11 +3493,11 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const Physical
{
if( !(nWriteIndex & 1 ) )
cNibble <<= 4;
- pWriteBuffer.get()[ nWriteIndex/2 ] |= cNibble;
+ xWriteBuffer.get()[ nWriteIndex/2 ] |= cNibble;
nWriteIndex++;
}
}
- if( ! writeBuffer( pWriteBuffer.get(), nLength2 ) )
+ if (!writeBuffer(xWriteBuffer.get(), nLength2))
throw FontException();
if( aSections.empty() )
{
@@ -4039,15 +4039,15 @@ bool PDFWriterImpl::emitFonts()
}
else if( (aSubsetInfo.m_nFontType & FontSubsetInfo::TYPE1_PFB) != 0 ) // TODO: also support PFA?
{
- boost::shared_array<unsigned char> pBuffer( new unsigned char[ nLength1 ] );
+ std::unique_ptr<unsigned char[]> xBuffer(new unsigned char[nLength1]);
sal_uInt64 nBytesRead = 0;
- if ( osl::File::E_None != aFontFile.read(pBuffer.get(), nLength1, nBytesRead) ) return false;
+ if ( osl::File::E_None != aFontFile.read(xBuffer.get(), nLength1, nBytesRead) ) return false;
DBG_ASSERT( nBytesRead==nLength1, "PDF-FontSubset read incomplete!" );
if ( osl::File::E_None != aFontFile.setPos(osl_Pos_Absolut, 0) ) return false;
// get the PFB-segment lengths
ThreeInts aSegmentLengths = {0,0,0};
- getPfbSegmentLengths( pBuffer.get(), (int)nBytesRead, aSegmentLengths );
+ getPfbSegmentLengths(xBuffer.get(), (int)nBytesRead, aSegmentLengths);
// the lengths below are mandatory for PDF-exported Type1 fonts
// because the PFB segment headers get stripped! WhyOhWhy.
aLine.append( (sal_Int32)aSegmentLengths[0] );
@@ -4064,9 +4064,9 @@ bool PDFWriterImpl::emitFonts()
// emit PFB-sections without section headers
beginCompression();
checkAndEnableStreamEncryption( nFontStream );
- if ( !writeBuffer( &pBuffer[6], aSegmentLengths[0] ) ) return false;
- if ( !writeBuffer( &pBuffer[12] + aSegmentLengths[0], aSegmentLengths[1] ) ) return false;
- if ( !writeBuffer( &pBuffer[18] + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) ) return false;
+ if ( !writeBuffer( &xBuffer[6], aSegmentLengths[0] ) ) return false;
+ if ( !writeBuffer( &xBuffer[12] + aSegmentLengths[0], aSegmentLengths[1] ) ) return false;
+ if ( !writeBuffer( &xBuffer[18] + aSegmentLengths[0] + aSegmentLengths[1], aSegmentLengths[2] ) ) return false;
}
else
{
@@ -11440,17 +11440,17 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask )
else
{
const int nScanLineBytes = pAccess->Width()*3;
- boost::shared_array<sal_uInt8> pCol( new sal_uInt8[ nScanLineBytes ] );
+ std::unique_ptr<sal_uInt8[]> xCol(new sal_uInt8[nScanLineBytes]);
for( long y = 0; y < pAccess->Height(); y++ )
{
for( long x = 0; x < pAccess->Width(); x++ )
{
BitmapColor aColor = pAccess->GetColor( y, x );
- pCol[3*x+0] = aColor.GetRed();
- pCol[3*x+1] = aColor.GetGreen();
- pCol[3*x+2] = aColor.GetBlue();
+ xCol[3*x+0] = aColor.GetRed();
+ xCol[3*x+1] = aColor.GetGreen();
+ xCol[3*x+2] = aColor.GetBlue();
}
- CHECK_RETURN( writeBuffer( pCol.get(), nScanLineBytes ) );
+ CHECK_RETURN(writeBuffer(xCol.get(), nScanLineBytes));
}
}
endCompression();