summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-02 15:17:52 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-02 15:17:52 +0100
commit5595ee701eab0fef0683c93e3c99788ab1b08520 (patch)
treef65921d6b5b0c8c988fa37eb4dc57e2879d25bf2 /vcl/win
parent19c0eff34a5e1de4f3aff723b7750d4e01d4ba6d (diff)
loplugin:useuniqueptr
Change-Id: I3a246a22baaac8195dc1b94c42994de7d80e8336
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/gdi/salprn.cxx10
-rw-r--r--vcl/win/window/salframe.cxx8
2 files changed, 10 insertions, 8 deletions
diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx
index db54dd0069f0..60b5320f7c8b 100644
--- a/vcl/win/gdi/salprn.cxx
+++ b/vcl/win/gdi/salprn.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <memory>
#include <string.h>
#include <svsys.h>
@@ -1220,11 +1223,10 @@ OUString WinSalInfoPrinter::GetPaperBinName( const ImplJobSetup* pSetupData, sal
DWORD nBins = ImplDeviceCaps( this, DC_BINNAMES, nullptr, pSetupData );
if ( (nPaperBin < nBins) && (nBins != GDI_ERROR) )
{
- sal_Unicode* pBuffer = new sal_Unicode[nBins*24];
- DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, reinterpret_cast<BYTE*>(pBuffer), pSetupData );
+ auto pBuffer = std::unique_ptr<sal_Unicode[]>(new sal_Unicode[nBins*24]);
+ DWORD nRet = ImplDeviceCaps( this, DC_BINNAMES, reinterpret_cast<BYTE*>(pBuffer.get()), pSetupData );
if ( nRet && (nRet != GDI_ERROR) )
- aPaperBinName = OUString( pBuffer + (nPaperBin*24) );
- delete [] pBuffer;
+ aPaperBinName = OUString( pBuffer.get() + (nPaperBin*24) );
}
return aPaperBinName;
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 689a69c0699c..d908dbc7f854 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -26,6 +26,7 @@
#include <officecfg/Office/Common.hxx>
+#include <memory>
#include <string.h>
#include <limits.h>
@@ -5010,10 +5011,9 @@ static bool ImplHandleIMECompositionInput( WinSalFrame* pFrame,
LONG nTextLen = ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, nullptr, 0 ) / sizeof( WCHAR );
if ( nTextLen >= 0 )
{
- WCHAR* pTextBuf = new WCHAR[nTextLen];
- ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf, nTextLen*sizeof( WCHAR ) );
- aEvt.maText = OUString( reinterpret_cast<const sal_Unicode*>(pTextBuf), (sal_Int32)nTextLen );
- delete [] pTextBuf;
+ auto pTextBuf = std::unique_ptr<WCHAR[]>(new WCHAR[nTextLen]);
+ ImmGetCompositionStringW( hIMC, GCS_RESULTSTR, pTextBuf.get(), nTextLen*sizeof( WCHAR ) );
+ aEvt.maText = OUString( reinterpret_cast<const sal_Unicode*>(pTextBuf.get()), (sal_Int32)nTextLen );
}
aEvt.mnCursorPos = aEvt.maText.getLength();