diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-02 15:17:52 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-02 15:17:52 +0100 |
commit | 5595ee701eab0fef0683c93e3c99788ab1b08520 (patch) | |
tree | f65921d6b5b0c8c988fa37eb4dc57e2879d25bf2 /vcl/win/gdi | |
parent | 19c0eff34a5e1de4f3aff723b7750d4e01d4ba6d (diff) |
loplugin:useuniqueptr
Change-Id: I3a246a22baaac8195dc1b94c42994de7d80e8336
Diffstat (limited to 'vcl/win/gdi')
-rw-r--r-- | vcl/win/gdi/salprn.cxx | 10 |
1 files changed, 6 insertions, 4 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; |