summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-04-26 17:32:57 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-04-26 17:32:57 +0200
commit3995bf74a6ad711d6f7b63cbe8eeca83d5b0355f (patch)
treedcb78dad03856332a61f45684e354e90769d3236 /fpicker
parent36a9091ee88ecc0a03235ee144e6babf2f8ef92a (diff)
loplugin:useuniqueptr (clang-cl)
Change-Id: I5ed7a980da0d8f6d320db306fcfca969ae700c4f
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/win32/filepicker/FilterContainer.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/fpicker/source/win32/filepicker/FilterContainer.cxx b/fpicker/source/win32/filepicker/FilterContainer.cxx
index f428e45e390b..0601affcf320 100644
--- a/fpicker/source/win32/filepicker/FilterContainer.cxx
+++ b/fpicker/source/win32/filepicker/FilterContainer.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
#include <stdexcept>
#include <osl/diagnose.h>
#include "FilterContainer.hxx"
@@ -238,10 +241,10 @@ OUString SAL_CALL makeWinFilterBuffer( CFilterContainer& aFilterContainer )
if ( !reqBuffSize )
return OUString( );
- sal_Unicode* pBuff = new sal_Unicode[reqBuffSize];
+ auto pBuff = std::unique_ptr<sal_Unicode[]>(new sal_Unicode[reqBuffSize]);
// initialize the buffer with 0
- ZeroMemory( pBuff, sizeof( sal_Unicode ) * reqBuffSize );
+ ZeroMemory( pBuff.get(), sizeof( sal_Unicode ) * reqBuffSize );
OUString winFilterBuff;
CFilterContainer::FILTER_ENTRY_T nextFilter;
@@ -252,24 +255,21 @@ OUString SAL_CALL makeWinFilterBuffer( CFilterContainer& aFilterContainer )
while( aFilterContainer.getNextFilter( nextFilter ) )
{
wcsmemcpy(
- pBuff + memPos,
+ pBuff.get() + memPos,
nextFilter.first.getStr( ),
nextFilter.first.getLength( ) );
memPos += nextFilter.first.getLength( ) + 1;
wcsmemcpy(
- pBuff + memPos,
+ pBuff.get() + memPos,
nextFilter.second.getStr( ),
nextFilter.second.getLength( ) );
memPos += nextFilter.second.getLength( ) + 1 ;
}
- winFilterBuff = OUString( pBuff, reqBuffSize );
-
- // remove the allocated buffer
- delete [] pBuff;
+ winFilterBuff = OUString( pBuff.get(), reqBuffSize );
return winFilterBuff;
}